From 30d147c4c92dbfd5ca1b2f8c24a617dc82d2d25b Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期一, 28 四月 2025 18:34:51 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/books/civilAviation/view/components/index.vue |  231 +++++++++++++++++++++++++++------------------------------
 1 files changed, 109 insertions(+), 122 deletions(-)

diff --git a/src/books/civilAviation/view/components/index.vue b/src/books/civilAviation/view/components/index.vue
index 9a16a8e..07d47d8 100644
--- a/src/books/civilAviation/view/components/index.vue
+++ b/src/books/civilAviation/view/components/index.vue
@@ -1,10 +1,13 @@
 <template>
   <div class="page-main" @scroll="throttledScrollHandler">
+    <div id="searchDomBox" style="display: none">
+      <div id="searchContent"></div>
+    </div>
     <div
       class="page-content"
       :style="{
-        fontSize: fontSize ? fontSize + 'px' : '16px',
-        transform: `scale(${pageZoom ? pageZoom : 1})`,
+        fontSize: fontSize + 'px',
+        transform: `scale(${pageZoom})`,
         transformOrigin: 'center top',
       }"
     >
@@ -13,68 +16,37 @@
         :showPageList="loadPageList"
       ></pageHeader>
       <chapterOne
-        @initViewer="initViewer"
         v-if="showCatalogList.indexOf(2) > -1"
         :showPageList="loadPageList"
       ></chapterOne>
-      <!-- <chapterTwo
-        @initViewer="initViewer"
+      <chapterTwo
         v-if="showCatalogList.indexOf(3) > -1"
         :showPageList="loadPageList"
       ></chapterTwo>
       <chapterThree
-        @initViewer="initViewer"
         v-if="showCatalogList.indexOf(4) > -1"
         :showPageList="loadPageList"
       ></chapterThree>
-      <chapterFour
-        @initViewer="initViewer"
+      <chapterfour
         v-if="showCatalogList.indexOf(5) > -1"
         :showPageList="loadPageList"
-      ></chapterFour>
-      <chapterFive
-        @initViewer="initViewer"
+      ></chapterfour>
+      <chapterfive
         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> -->
-      
+      ></chapterfive>
     </div>
-    <!-- <miniAudio
-      :path="audioPath"
-      :currentTime="currentTime"
-      @closeMiniAudio="closeMiniAudio"
-      ref="audioPlayer"
-    >
-    </miniAudio> -->
   </div>
 </template>
 
 <script>
+import Vue from "vue";
 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 chapterTwo from "./chapter002.vue";
+import chapterThree from "./chapter003.vue";
+import chapterfour from "./chapter004.vue";
+import chapterfive from "./chapter005.vue";
 import NoteIcon from "@/assets/images/biji.png";
 import _ from "lodash";
 import Swiper from "swiper/bundle";
@@ -82,9 +54,10 @@
 import Viewer from "viewerjs";
 import "viewerjs/dist/viewer.css";
 export default {
+  name: "pageContent",
   data() {
     return {
-      catalogLength: 2, // 鎬荤珷鑺傛暟
+      catalogLength: 6, // 鎬荤珷鑺傛暟
       showCatalogList: [], // 鏄剧ず鐨勭珷鑺�
       loadThreshold: 300, // 瑙﹀彂鍔犺浇闃堝��
       throttleThreshold: 100, // 鑺傛祦闃堝��
@@ -103,10 +76,15 @@
   },
   computed: {
     fontSize() {
-      return this.$store.state.qiankun.fontSize;
+      this.transformDom(this.$store.state.qiankun.fontSize);
+      return this.$store.state.qiankun.fontSize
+        ? this.$store.state.qiankun.fontSize
+        : 18;
     },
     pageZoom() {
-      return this.$store.state.qiankun.scale / 100;
+      return this.$store.state.qiankun.scale
+        ? this.$store.state.qiankun.scale / 100
+        : 1;
     },
   },
   watch: {
@@ -131,10 +109,11 @@
     loadPageList: {
       handler(newVal, oldVal) {
         setTimeout(() => {
+          this.transformDom(this.$store.state.qiankun.fontSize);
           this.initSwiper();
           this.initViewer();
           this.closeAudio();
-           this.saveWord()
+          this.closeVideo();
         }, 200);
       },
     },
@@ -144,14 +123,13 @@
           this.container ? this.container : document
         ).querySelector(".page-main");
         scrollBox.scrollTop = (scrollBox.scrollTop / oldVal) * newVal;
-      },
+      }, 
     },
   },
   mounted() {
     // 榛樿鍔犺浇绔犺妭
     this.showCatalogList = [1];
     // 婊氬姩鐩戝惉鑺傛祦
-    debugger
     this.throttledScrollHandler = _.throttle(
       this.scrollFun,
       this.throttleThreshold,
@@ -206,22 +184,22 @@
     }, 500);
 
     // 娴嬭瘯椤甸潰璺宠浆
-    //  setTimeout(() => {
-    //   this.gotoPage(5,69);
-    //   setTimeout(() => {
-    //     this.renderSign("Highlight", {
-    //       id: "2ACA9359",
-    //       txt: "棰樹竴瀛︿範涓婚涓� 杩愬姩",
-    //       page: "10",
-    //       type: "Highlight",
-    //       color: "#F5E12A"
-    //     });
     // setTimeout(() => {
-    //   this.delSign({
-    //     ids: ["2ACA9359"]
-    //   });
-    // }, 2000);
-    //   }, 5000);
+    //   this.gotoPage(3, 130);
+      //   setTimeout(() => {
+      //     this.renderSign("Highlight", {
+      //       id: "2ACA9359",
+      //       txt: "棰樹竴瀛︿範涓婚涓� 杩愬姩",
+      //       page: "10",
+      //       type: "Highlight",
+      //       color: "#F5E12A"
+      //     });
+      // setTimeout(() => {
+      //   this.delSign({
+      //     ids: ["2ACA9359"]
+      //   });
+      // }, 2000);
+    // }, 500);
 
     // const pageDom = (this.container ? this.container : document)
     //   .querySelector("#app")
@@ -235,7 +213,7 @@
     //   txt: " 杩愬姩绯荤粺鏄敱楠ㄣ�侀杩炵粨鍜岄楠艰倢涓夐儴鍒嗙粍鎴愮殑銆傚叏韬殑楠ㄩ�氳繃楠ㄨ繛缁撶粍鎴愪汉浣撻楠硷紙瑙佸浘1-1锛夈�傞楠兼槸浜轰綋鐨勬敮鏋讹紝鍏锋湁淇濇姢鍐呰剰鍣ㄥ畼銆佷緵鑲岃倝闄勭潃鍜屼綔涓鸿倢鑲夎繍鍔ㄧ殑鏉犳潌绛変綔鐢ㄣ�傚湪绁炵粡绯荤粺鐨勬敮閰嶄笅锛岃倢鑲夋敹缂╃壍鍔ㄦ墍闄勭潃鐨勯缁曠潃鍏宠妭杞姩锛屼娇韬綋浜х敓鍚勭鍔ㄤ綔銆傛墍浠ワ紝杩愬姩绯荤粺鍏锋湁杩愬姩銆佹敮鎸佸拰淇濇姢绛夊姛鑳斤紝骞煎勾鏃舵湡鐨勯楠艰繕鍏锋湁閫犺鍔熻兘銆� ",
     //   txtIndex: 57
     // });
-    //  }, 50);
+    // }, 500);
   },
   methods: {
     // setZoom1() {
@@ -254,9 +232,8 @@
     // },
     // 婊氬姩鐩戝惉
     scrollFun(event) {
+      this.handleVideoPicture();
       // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩
-      console.log(11);
-      
       if (event.target.scrollTop > this.previousScrollTop) {
         this.getAduio();
         // 鍚戜笅
@@ -267,8 +244,7 @@
           event.target.scrollHeight - this.loadThreshold
         ) {
           console.log(1);
-          
-          debugger
+
           // 鍒拌揪闃堝��
           if (
             this.showCatalogList[this.showCatalogList.length - 1] <
@@ -543,7 +519,6 @@
       });
     },
     getParentWithClass(element, className) {
-      console.log(element, className, "element, className");
       while (element.parentElement) {
         element = element.parentElement;
         if (element.classList.contains(className)) {
@@ -690,8 +665,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(
@@ -761,15 +736,12 @@
       let catalogIndex = 0;
       // 鎵�鏈夌珷鑺傜粍浠讹紙姣忔湰涔﹀埗浣滄椂鍗曠嫭閰嶇疆锛�
       const pageData = {
-        pageHeader,
+        pageHeader, 
         chapterOne,
-        // chapterTwo,
-        // chapterThree,
-        // chapterFour,
-        // chapterFive,
-        // chapterSix,
-        // chapterSeven,
-        // chapterEight,
+        chapterTwo,
+        chapterThree,
+        chapterfour,
+        chapterfive,
       };
       // 閬嶅巻鎵�鏈夌珷鑺傛枃浠�
       for (const key in pageData) {
@@ -871,38 +843,6 @@
       // 璺宠浆
       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,
-            });
-          }
-        })
-      }
-    },
     // 椤甸潰鍚戜笅婊氬姩锛岄煶棰戝皬绐楁挱鏀惧姛鑳�
     getAduio() {
       let allVideo = (
@@ -971,26 +911,73 @@
         });
       }
     },
+    // 鐐瑰嚮瑙嗛鍏抽棴鍏朵粬
+    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) {
+          try {
+            if (playVudio.readyState) playVudio.requestPictureInPicture();
+          } catch (error) {
+            console.log(error, "灏忕獥閿欒error");
+          }
+        }
+      }
+    },
+    //鍏朵粬绫诲悕涓嬪瓧浣撳ぇ灏忓彉鍖�
+    transformDom(fs) {
+      if (!fs) return;
+      let doms = (this.container ? this.container : document).querySelectorAll(
+        ".block"
+      );
+      if (!doms.length) return;
+      for (let index = 0; index < doms.length; index++) {
+        const dom = doms[index];
+        dom.style.fontSize = fs + "px";
+      }
+    },
   },
   components: {
     pageHeader,
     chapterOne,
-    // chapterTwo,
-    // chapterThree,
-    // chapterFour,
-    // chapterFive,
-    // chapterSix,
-    // chapterSeven,
-    // chapterEight,
-    // miniAudio,
+    chapterTwo,
+    chapterThree,
+    chapterfour,
+    chapterfive,
   },
 };
 </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