From 0de743f6fd8cb64b67c9f0c3279769d60c53b09d Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期三, 22 一月 2025 16:37:39 +0800
Subject: [PATCH] tuoyujigou

---
 src/books/childHealth/view/content/index.vue |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/books/childHealth/view/content/index.vue b/src/books/childHealth/view/content/index.vue
index 6b0600d..3f1280e 100644
--- a/src/books/childHealth/view/content/index.vue
+++ b/src/books/childHealth/view/content/index.vue
@@ -229,7 +229,7 @@
 
     // 娴嬭瘯椤甸潰璺宠浆
     // setTimeout(() => {
-    // this.gotoPage(8,175);
+    // this.gotoPage(4,87);
     //   setTimeout(() => {
     //     this.renderSign("Highlight", {
     //       id: "2ACA9359",
@@ -276,6 +276,8 @@
     // },
     // 婊氬姩鐩戝惉
     scrollFun(event) {
+      // 瑙嗛灏忕獥鏂规硶
+      this.handleVideoPicture()
       // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩
       if (event.target.scrollTop > this.previousScrollTop) {
         // 鍚戜笅
@@ -614,11 +616,12 @@
               if (testData && testData[catalog]) {
                 if (testData[catalog][page]) {
                   if (Array.isArray(testData[catalog][page])) {
-                    this.questionDataMap[page] = await getQuestionList(
+                    const datas = await getQuestionList(
                       page,
                       testData[catalog][page],
                       this.config.activeBook
                     );
+                    this.$set(this.questionDataMap,page,datas)
                   } else {
                     const obj = {};
                     for (let key in testData[catalog][page]) {
@@ -628,7 +631,8 @@
                         this.config.activeBook
                       );
                     }
-                    this.questionDataMap[page] = obj;
+                    this.$set(this.questionDataMap,page,obj)
+                    // this.questionDataMap[page] = obj;
                   }
                 }
               }
@@ -898,6 +902,7 @@
       // 璺宠浆
       this.gotoPage(data.catalog, data.page, () => {});
     },
+    // 鐐瑰嚮瑙嗛鍏抽棴鍏朵粬
     closeVideo() {
       let allVideo = (
         this.container ? this.container : document
@@ -907,7 +912,6 @@
         item.addEventListener('playing',(item) => {
           const path  = item.srcElement.src
           const videoList = Array.from(allVideo);
-          console.log('鎾斁',item);
           for (let cindex = 0; cindex < videoList.length; cindex++) {
             const citem = videoList[cindex];
             if(citem.currentSrc != path && path) {
@@ -916,16 +920,25 @@
           }
         })
       }
+    },
+    // 瑙嗛灏忕獥
+    handleVideoPicture() {
+      let doms = (
+        this.container ? this.container : document
+      ).querySelectorAll(".video");
+      doms = Array.from(doms)
+      if(!doms.length) return false
+      const playVudio = doms
+        .reverse()
+        .find((item) => item.paused == false);
+      if(playVudio) {
+        const bottomGap = playVudio.getBoundingClientRect().bottom;
+        const topGap = playVudio.getBoundingClientRect().top;
+        if (bottomGap < 0 || topGap > window.innerHeight) {
+          playVudio.requestPictureInPicture();
+        } 
+      }
     }
-    //   allVideo = Array.from(allVideo);
-    //   if(allVideo.length) {
-    //     for (let index = 0; index < allVideo.length; index++) {
-    //       const item = allVideo[index];
-    //       if(item.currentSrc != path) {
-    //         item.pause()
-    //       }
-    //     }
-    //   }
   },
   components: {
     pageHeader,

--
Gitblit v1.9.1