gemercheung vor 2 Jahren
Ursprung
Commit
cd6057d826

+ 2 - 1
src/components/hotspot/index.vue

@@ -151,6 +151,7 @@
   };
 
   const focusTag = (tag: tagType) => {
+    console.log('focusTag');
     nextTick(async () => {
       const app = await useApp();
       let t = setTimeout(() => {
@@ -174,7 +175,7 @@
             },
           };
 
-          let position = getApp().config.mobile ? 'center' : 'left';
+          let position = isMobile.value ? 'center' : 'left';
           app.TagManager.focus(params, 'board', position);
         } catch (err) {}
       }, 300);

+ 23 - 3
src/components/hotspot/metas/metas-video.vue

@@ -3,6 +3,10 @@
   <!-- <div class="video-box" :style="metasHeight ? `height:${metasHeight}px;` : ''"> -->
   <div class="video-box">
     <!-- <ui-icon v-show="loading" class="loading-icon" type="_loading_"></ui-icon> -->
+    <i
+      v-show="loading"
+      class="iconfont ui-kankan-icon icon tip-h-center tip-v-bottom icon-_loading_ loading-icon"
+    ></i>
     <video
       @error="filesError"
       v-show="!loading"
@@ -27,6 +31,7 @@
   import { onMounted, nextTick, ref, computed, defineProps } from 'vue';
   import { changeUrl } from '../common';
   import { tagType } from '/@/store/modules/scene';
+  import { watchEffect } from 'vue';
 
   // const videoNum = ref(0);
   // const type = ref('video');
@@ -45,6 +50,10 @@
       type: Number,
       default: null,
     },
+    show: {
+      type: Boolean,
+      default: false,
+    },
   });
   const loading = ref(true);
 
@@ -61,11 +70,22 @@
   };
 
   onMounted(() => {
+    watchEffect(() => {
+      if (props.show) {
+        let myVideo = document.getElementById('video');
+        if (myVideo) {
+          //@ts-ignore
+          myVideo.play();
+        }
+      }
+    });
     nextTick(() => {
       let myVideo = document.getElementById('video');
-      myVideo.oncanplay = function () {
-        loading.value = false;
-      };
+      if (myVideo) {
+        myVideo.oncanplay = function () {
+          loading.value = false;
+        };
+      }
     });
   });
 </script>

+ 4 - 2
src/components/hotspot/show-tag.vue

@@ -29,7 +29,7 @@
     >
       <metasImage :data="tag" v-if="tag.type == 'image'" />
       <metasWeb :data="tag" v-if="tag.type == 'link'" />
-      <metasVideo :data="tag" v-if="tag.type == 'video'" />
+      <metasVideo :show="show" :data="tag" v-if="tag.type == 'video'" />
       <!-- <metasImage v-if="tag.type == 'image'" />
       <metasVideo v-if="tag.type == 'video'" />
       <metasWeb v-if="tag.type == 'link'" /> -->
@@ -64,7 +64,9 @@
   });
   const emits = defineEmits(['open']);
   const open = () => {
-    emits('open');
+    if (props.tag.type !== 'video') {
+      emits('open');
+    }
   };
   onMounted(() => {
     watchEffect(() => {