gemercheung 2 年 前
コミット
65d7996b9d

+ 11 - 8
packages/qjkankan-view/src/components/assembly/Opening.vue

@@ -38,7 +38,7 @@
       muted
     ></video>
     <img
-      v-show="videoPlaying"
+      v-show="videoNeedPlay"
       @click.stop="handleVideoPlay"
       class="videoPlay"
       :src="require('@/assets/images/default/bofang.png')"
@@ -125,7 +125,7 @@ const props = defineProps({
 });
 const store = useStore();
 const openvideo$ = ref(null);
-const videoPlaying = ref(true);
+const videoNeedPlay = ref(true);
 
 const isMixinMode = computed(
   () => props.coverData.coverSelect.toLowerCase().indexOf("and") > -1
@@ -186,6 +186,10 @@ const jumpVideo = () => {
     }
   }
 };
+const handleVideoPlay = () => {
+  let video = unref(openvideo$);
+  video && video.play();
+};
 
 const startImageCount = () => {
   imgTimer.value = setInterval(() => {
@@ -309,14 +313,14 @@ onMounted(() => {
     });
 
     openvideo$.value.addEventListener("playing", () => {
-      if (videoPlaying.value) {
-        videoPlaying.value = false;
+      if (videoNeedPlay.value) {
+        videoNeedPlay.value = false;
       }
     });
 
     openvideo$.value.addEventListener("pause", () => {
-      if (!videoPlaying.value) {
-        videoPlaying.value = true;
+      if (!videoNeedPlay.value) {
+        videoNeedPlay.value = true;
       }
     });
 
@@ -408,7 +412,7 @@ onMounted(() => {
     object-fit: cover;
   }
 
-  .bofang {
+  .videoPlay {
     position: absolute;
     top: 50%;
     transform: translate(-50%, -50%);
@@ -416,7 +420,6 @@ onMounted(() => {
     width: 80px;
     height: 80px;
     z-index: 99999;
-    pointer-events: none;
   }
 }
 

+ 13 - 8
packages/qjkankan-view/src/components/assembly/OpeningMobile.vue

@@ -38,7 +38,7 @@
       muted
     ></video>
     <img
-      v-show="videoPlaying"
+      v-show="videoNeedPlay"
       @click.stop="handleVideoPlay"
       class="videoPlay"
       :src="require('@/assets/images/default/bofang.png')"
@@ -125,7 +125,7 @@ const props = defineProps({
 });
 const store = useStore();
 const openvideo$ = ref(null);
-const videoPlaying = ref(true);
+const videoNeedPlay = ref(true);
 
 const isMixinMode = computed(
   () => props.coverData.coverSelect.toLowerCase().indexOf("and") > -1
@@ -161,6 +161,12 @@ const videoIndex = ref(1);
 
 const currentScene = computed(() => store.getters["scene/currentScene"]);
 
+const handleVideoPlay = () => {
+  window.alert("play");
+  let video = unref(openvideo$);
+  video && video.play();
+};
+
 //手动跳转
 const jumpImage = () => {
   if (unref(isMixinMode)) {
@@ -309,14 +315,14 @@ onMounted(() => {
     });
 
     openvideo$.value.addEventListener("playing", () => {
-      if (videoPlaying.value) {
-        videoPlaying.value = false;
+      if (videoNeedPlay.value) {
+        videoNeedPlay.value = false;
       }
     });
 
     openvideo$.value.addEventListener("pause", () => {
-      if (!videoPlaying.value) {
-        videoPlaying.value = true;
+      if (!videoNeedPlay.value) {
+        videoNeedPlay.value = true;
       }
     });
 
@@ -408,7 +414,7 @@ onMounted(() => {
     object-fit: cover;
   }
 
-  .bofang {
+  .videoPlay {
     position: absolute;
     top: 50%;
     transform: translate(-50%, -50%);
@@ -416,7 +422,6 @@ onMounted(() => {
     width: 80px;
     height: 80px;
     z-index: 99999;
-    pointer-events: none;
   }
 }