From 7715ae3606bb01c0e9f08f40e83bfed0d983c6a3 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 22 十月 2024 15:20:42 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/books/civilAviation/view/components/index.vue |  199 ++++++++++++++++---------------------------------
 1 files changed, 66 insertions(+), 133 deletions(-)

diff --git a/src/books/civilAviation/view/components/index.vue b/src/books/civilAviation/view/components/index.vue
index 9a16a8e..b7efa64 100644
--- a/src/books/civilAviation/view/components/index.vue
+++ b/src/books/civilAviation/view/components/index.vue
@@ -1,80 +1,22 @@
 <template>
-  <div class="page-main" @scroll="throttledScrollHandler">
-    <div
-      class="page-content"
-      :style="{
-        fontSize: fontSize ? fontSize + 'px' : '16px',
-        transform: `scale(${pageZoom ? pageZoom : 1})`,
-        transformOrigin: 'center top',
-      }"
-    >
-      <pageHeader
-        v-if="showCatalogList.indexOf(1) > -1"
-        :showPageList="loadPageList"
-      ></pageHeader>
-      <chapterOne
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(2) > -1"
-        :showPageList="loadPageList"
-      ></chapterOne>
-      <!-- <chapterTwo
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(3) > -1"
-        :showPageList="loadPageList"
-      ></chapterTwo>
-      <chapterThree
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(4) > -1"
-        :showPageList="loadPageList"
-      ></chapterThree>
-      <chapterFour
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(5) > -1"
-        :showPageList="loadPageList"
-      ></chapterFour>
-      <chapterFive
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(6) > -1"
-        :showPageList="loadPageList"
-      ></chapterFive>
-      <chapterSix
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(7) > -1"
-        :showPageList="loadPageList"
-      ></chapterSix>
-      <chapterSeven
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(8) > -1"
-        :showPageList="loadPageList"
-      ></chapterSeven>
-      <chapterEight
-        @initViewer="initViewer"
-        v-if="showCatalogList.indexOf(9) > -1"
-        :showPageList="loadPageList"
-      ></chapterEight> -->
-      
+  <div class="page-main"  @scroll="throttledScrollHandler">
+    <div id="searchDomBox" style="display: none">
+      <div id="searchContent"></div>
     </div>
-    <!-- <miniAudio
-      :path="audioPath"
-      :currentTime="currentTime"
-      @closeMiniAudio="closeMiniAudio"
-      ref="audioPlayer"
-    >
-    </miniAudio> -->
+    <div class="page-content" :style="{
+      fontSize: fontSize ? fontSize + 'px' : '16px',
+      transform: `scale(${pageZoom ? pageZoom : 1})`,
+      transformOrigin: 'center top',
+    }">
+      <pageHeader v-if="showCatalogList.indexOf(1) > -1" :showPageList="loadPageList"></pageHeader>
+      <chapterOne v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList"></chapterOne>
+    </div>
   </div>
 </template>
 
 <script>
 import pageHeader from "./header.vue";
 import chapterOne from "./chapter001.vue";
-// import chapterTwo from "./chapter002.vue";
-// import chapterThree from "./chapter003.vue";
-// import chapterFour from "./chapter004.vue";
-// import chapterFive from "./chapter005.vue";
-// import chapterSix from "./chapter006.vue";
-// import chapterSeven from "./chapter007.vue";
-// import chapterEight from "./chapter008.vue";
-import miniAudio from "@/components/miniAudio/index.vue";
 import NoteIcon from "@/assets/images/biji.png";
 import _ from "lodash";
 import Swiper from "swiper/bundle";
@@ -82,6 +24,7 @@
 import Viewer from "viewerjs";
 import "viewerjs/dist/viewer.css";
 export default {
+  name: "pageContent",
   data() {
     return {
       catalogLength: 2, // 鎬荤珷鑺傛暟
@@ -134,7 +77,7 @@
           this.initSwiper();
           this.initViewer();
           this.closeAudio();
-           this.saveWord()
+          this.closeVideo();
         }, 200);
       },
     },
@@ -206,8 +149,8 @@
     }, 500);
 
     // 娴嬭瘯椤甸潰璺宠浆
-    //  setTimeout(() => {
-    //   this.gotoPage(5,69);
+    // setTimeout(() => {
+    //   this.gotoPage(6, 30);
     //   setTimeout(() => {
     //     this.renderSign("Highlight", {
     //       id: "2ACA9359",
@@ -221,7 +164,7 @@
     //     ids: ["2ACA9359"]
     //   });
     // }, 2000);
-    //   }, 5000);
+    // }, 500);
 
     // const pageDom = (this.container ? this.container : document)
     //   .querySelector("#app")
@@ -235,7 +178,7 @@
     //   txt: " 杩愬姩绯荤粺鏄敱楠ㄣ�侀杩炵粨鍜岄楠艰倢涓夐儴鍒嗙粍鎴愮殑銆傚叏韬殑楠ㄩ�氳繃楠ㄨ繛缁撶粍鎴愪汉浣撻楠硷紙瑙佸浘1-1锛夈�傞楠兼槸浜轰綋鐨勬敮鏋讹紝鍏锋湁淇濇姢鍐呰剰鍣ㄥ畼銆佷緵鑲岃倝闄勭潃鍜屼綔涓鸿倢鑲夎繍鍔ㄧ殑鏉犳潌绛変綔鐢ㄣ�傚湪绁炵粡绯荤粺鐨勬敮閰嶄笅锛岃倢鑲夋敹缂╃壍鍔ㄦ墍闄勭潃鐨勯缁曠潃鍏宠妭杞姩锛屼娇韬綋浜х敓鍚勭鍔ㄤ綔銆傛墍浠ワ紝杩愬姩绯荤粺鍏锋湁杩愬姩銆佹敮鎸佸拰淇濇姢绛夊姛鑳斤紝骞煎勾鏃舵湡鐨勯楠艰繕鍏锋湁閫犺鍔熻兘銆� ",
     //   txtIndex: 57
     // });
-    //  }, 50);
+    // }, 500);
   },
   methods: {
     // setZoom1() {
@@ -254,6 +197,7 @@
     // },
     // 婊氬姩鐩戝惉
     scrollFun(event) {
+      this.handleVideoPicture()
       // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩
       console.log(11);
       
@@ -499,8 +443,8 @@
           page && pageThemeColor && pageThemeColor[page]
             ? pageThemeColor[page]
             : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum]
-            ? chapterThemeColor[chapterNum]
-            : bookThemeColor;
+              ? chapterThemeColor[chapterNum]
+              : bookThemeColor;
         if (themeColor) {
           domItem.style.color = themeColor;
         }
@@ -517,8 +461,8 @@
           page && pageThemeColor && pageThemeColor[page]
             ? pageThemeColor[page]
             : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum]
-            ? chapterThemeColor[chapterNum]
-            : bookThemeColor;
+              ? chapterThemeColor[chapterNum]
+              : bookThemeColor;
         if (themeColor) {
           domItem.style.backgroundColor = themeColor;
         }
@@ -535,15 +479,14 @@
           page && pageThemeColor && pageThemeColor[page]
             ? pageThemeColor[page]
             : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum]
-            ? chapterThemeColor[chapterNum]
-            : bookThemeColor;
+              ? chapterThemeColor[chapterNum]
+              : bookThemeColor;
         if (themeColor) {
           domItem.style.borderColor = themeColor;
         }
       });
     },
     getParentWithClass(element, className) {
-      console.log(element, className, "element, className");
       while (element.parentElement) {
         element = element.parentElement;
         if (element.classList.contains(className)) {
@@ -690,8 +633,8 @@
             prevEl: dom.querySelector(".swiper-button-prev"),
           },
           // 绐楀彛鍙樺寲,閲嶆柊init,閽堝F11鍏ㄥ睆鍜屾斁澶х缉灏�,蹇呴』鍔�
-          observer: true,
-          observeParents: true,
+          // observer: true,
+          // observeParents: true
           // // 濡傛灉闇�瑕佸垎椤靛櫒
           // pagination: {
           //   el: (this.container ? this.container : document).querySelector(
@@ -763,13 +706,6 @@
       const pageData = {
         pageHeader,
         chapterOne,
-        // chapterTwo,
-        // chapterThree,
-        // chapterFour,
-        // chapterFive,
-        // chapterSix,
-        // chapterSeven,
-        // chapterEight,
       };
       // 閬嶅巻鎵�鏈夌珷鑺傛枃浠�
       for (const key in pageData) {
@@ -869,39 +805,7 @@
       // 璁板綍楂樹寒淇℃伅
       this.highlightData = data;
       // 璺宠浆
-      this.gotoPage(data.catalog, data.page, () => {});
-    },
-    // 鐐瑰嚮浜嬩欢锛氬皢鐢熷兓鍗曡瘝浼犵粰 涓诲簲鐢� 浠庤�岃皟鐢ㄨ瘝鍏稿姛鑳�
-    // saveCharacters(event, word) {
-    //   if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) {
-    //     this.$store.state.qiankun.chooseWords({
-    //       type: "word",
-    //       word,
-    //       x: event.pageX,
-    //       y: event.pageY,
-    //     });
-    //   }
-    // },
-    saveWord() {
-      const doms = (
-        this.container ? this.container : document
-      ).querySelectorAll(".word-bc");
-      for (let index = 0; index < doms.length; index++) {
-        const dom = doms[index];
-        dom.addEventListener('click',(e) => {
-          let word = null
-          dom.getAttribute('word') ? word = dom.getAttribute('word') : word = e.srcElement.innerText
-          console.log('鍗曡瘝',word)
-          if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) {
-            this.$store.state.qiankun.chooseWords({
-              type: "word",
-              word,
-              x: e.pageX,
-              y: e.pageY,
-            });
-          }
-        })
-      }
+      this.gotoPage(data.catalog, data.page, () => { });
     },
     // 椤甸潰鍚戜笅婊氬姩锛岄煶棰戝皬绐楁挱鏀惧姛鑳�
     getAduio() {
@@ -971,26 +875,55 @@
         });
       }
     },
+    // 鐐瑰嚮瑙嗛鍏抽棴鍏朵粬
+    closeVideo() {
+      let allVideo = (
+        this.container ? this.container : document
+      ).querySelectorAll(".video");
+      for (let index = 0; index < allVideo.length; index++) {
+        const item = allVideo[index];
+        item.addEventListener("playing", (item) => {
+          const path = item.srcElement.src;
+          const videoList = Array.from(allVideo);
+          for (let cindex = 0; cindex < videoList.length; cindex++) {
+            const citem = videoList[cindex];
+            if (citem.currentSrc != path && path) {
+              citem.pause();
+            }
+          }
+        });
+      }
+    },
+    // 瑙嗛灏忕獥
+    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();
+        }
+      }
+    }
   },
   components: {
     pageHeader,
     chapterOne,
-    // chapterTwo,
-    // chapterThree,
-    // chapterFour,
-    // chapterFive,
-    // chapterSix,
-    // chapterSeven,
-    // chapterEight,
-    // miniAudio,
   },
 };
 </script>
 
 <style lang="less" scoped>
 .page-main {
-  width: 100%;
-  height: 100%;
+  width: 100% !important;
+  height: 100% !important;
   overflow: auto;
 
   .page-content {

--
Gitblit v1.9.1