tag-view.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!-- -->
  2. <template>
  3. <teleport to="body">
  4. <div class="tag-layer" @click.stop="" :class="{ mobile: isMobile, full: tag.type == 'image' }">
  5. <div class="tag-info" @click.stop="" id="tag-info">
  6. <!-- <ui-icon class="close-btn" @click.stop="close" type="close" /> -->
  7. <div class="tag-metas" v-if="tag.media[tag.type].length > 0 && tag.type != 'audio'">
  8. <metasImage
  9. @close="close"
  10. :scale="true"
  11. :viewer="true"
  12. v-if="tag.type == 'image' && !isMobile"
  13. />
  14. <!-- <imageView v-if="tag.type == 'image' && isMobile" /> -->
  15. <!-- <metasWeb v-if="tag.type == 'link'" /> -->
  16. </div>
  17. </div>
  18. </div>
  19. </teleport>
  20. </template>
  21. <script setup lang="ts">
  22. import { defineEmits, onMounted, ref, watchEffect, computed, nextTick } from 'vue';
  23. import metasImage from './metas/metas-image.vue';
  24. import imageView from './metas/image-view.vue';
  25. import metasWeb from './metas/metas-web.vue';
  26. import { useApp } from '/@/hooks/userApp';
  27. import { tagType } from '/@/store/modules/scene';
  28. const isMobile = ref(false);
  29. const metasHeight = ref(0);
  30. const props = defineProps({
  31. data: {
  32. type: Object,
  33. default: {} as any as tagType,
  34. },
  35. });
  36. onMounted(async () => {
  37. const app = await useApp();
  38. isMobile.value = app.config.mobile;
  39. nextTick(() => {
  40. let Layer = document.getElementById('tag-info');
  41. let layerHeight = Layer ? Layer.getBoundingClientRect().height : 0;
  42. metasHeight.value = layerHeight * 0.85;
  43. });
  44. });
  45. const emit = defineEmits(['close']);
  46. const tag = computed(() => props.data);
  47. const audioInfo = computed(() => {
  48. return tag.value.media.audio;
  49. });
  50. const audio = ref(null);
  51. watchEffect(() => {
  52. if (audio.value) {
  53. audio.value.play();
  54. }
  55. });
  56. const close = () => {
  57. emit('close');
  58. };
  59. onMounted(() => {});
  60. </script>
  61. <style lang="scss">
  62. .tag-layer {
  63. width: 100vw;
  64. height: 100vh;
  65. z-index: 10000;
  66. top: 0;
  67. position: fixed;
  68. left: 0;
  69. // padding: calc(var(--editor-head-height) + 20px) calc(var(--editor-toolbox-width) + 20px) 60px calc(var(--editor-menu-width) + 20px);
  70. background-color: rgba(0, 0, 0, 0.7);
  71. .tag-info {
  72. color: #fff;
  73. width: 100%;
  74. height: 85%;
  75. position: absolute;
  76. top: 7.5%;
  77. left: 0;
  78. .close-btn {
  79. position: fixed;
  80. right: 36px;
  81. top: 36px;
  82. font-size: 18px;
  83. cursor: pointer;
  84. z-index: 100;
  85. }
  86. .tag-metas {
  87. width: 100%;
  88. height: 100%;
  89. position: relative;
  90. .pic-box {
  91. width: 100%;
  92. height: 100%;
  93. border: none;
  94. .image-list {
  95. .image-item {
  96. background-size: contain;
  97. }
  98. }
  99. }
  100. .video-box {
  101. height: auto;
  102. border: none;
  103. video {
  104. width: 100%;
  105. height: auto;
  106. object-fit: contain;
  107. }
  108. }
  109. .web-box {
  110. // height: 500px;
  111. width: 91%;
  112. height: 100%;
  113. border: none;
  114. left: 50%;
  115. transform: translateX(-50%);
  116. }
  117. }
  118. }
  119. }
  120. [is-mobile] {
  121. .tag-layer {
  122. .tag-info {
  123. .close-btn {
  124. position: absolute;
  125. right: 20px;
  126. top: -30px;
  127. font-size: 18px;
  128. cursor: pointer;
  129. }
  130. }
  131. &.full {
  132. background-color: #141414;
  133. .tag-info {
  134. height: 100%;
  135. top: 0;
  136. .close-btn {
  137. position: absolute;
  138. right: 20px;
  139. top: 20px;
  140. font-size: 18px;
  141. cursor: pointer;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>