From fe52c75b42ef2815dc5c66e964c2b388ed09d097 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 25 四月 2025 11:28:21 +0800
Subject: [PATCH] 环境变量修改

---
 src/books/English/view/components/index.vue |  184 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 143 insertions(+), 41 deletions(-)

diff --git a/src/books/English/view/components/index.vue b/src/books/English/view/components/index.vue
index a62ae6a..ee551a8 100644
--- a/src/books/English/view/components/index.vue
+++ b/src/books/English/view/components/index.vue
@@ -13,24 +13,68 @@
         :showPageList="loadPageList"
       ></pageHeader>
       <chapterOne
-        @saveCharacters="saveCharacters"
-        @closeMiniAudio="closeMiniAudio"
+        @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>
     <miniAudio
       :path="audioPath"
       :currentTime="currentTime"
       @closeMiniAudio="closeMiniAudio"
       ref="audioPlayer"
-    ></miniAudio>
+    >
+    </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 NoteIcon from "@/assets/images/biji.png";
 import _ from "lodash";
@@ -41,7 +85,7 @@
 export default {
   data() {
     return {
-      catalogLength: 14, // 鎬荤珷鑺傛暟
+      catalogLength: 9, // 鎬荤珷鑺傛暟
       showCatalogList: [], // 鏄剧ず鐨勭珷鑺�
       loadThreshold: 300, // 瑙﹀彂鍔犺浇闃堝��
       throttleThreshold: 100, // 鑺傛祦闃堝��
@@ -90,6 +134,8 @@
         setTimeout(() => {
           this.initSwiper();
           this.initViewer();
+          this.closeAudio();
+           this.saveWord()
         }, 200);
       },
     },
@@ -160,8 +206,8 @@
     }, 500);
 
     // 娴嬭瘯椤甸潰璺宠浆
-    // setTimeout(() => {
-    //   this.gotoPage(1, 10);
+    //  setTimeout(() => {
+    //   this.gotoPage(5,69);
     //   setTimeout(() => {
     //     this.renderSign("Highlight", {
     //       id: "2ACA9359",
@@ -189,7 +235,7 @@
     //   txt: " 杩愬姩绯荤粺鏄敱楠ㄣ�侀杩炵粨鍜岄楠艰倢涓夐儴鍒嗙粍鎴愮殑銆傚叏韬殑楠ㄩ�氳繃楠ㄨ繛缁撶粍鎴愪汉浣撻楠硷紙瑙佸浘1-1锛夈�傞楠兼槸浜轰綋鐨勬敮鏋讹紝鍏锋湁淇濇姢鍐呰剰鍣ㄥ畼銆佷緵鑲岃倝闄勭潃鍜屼綔涓鸿倢鑲夎繍鍔ㄧ殑鏉犳潌绛変綔鐢ㄣ�傚湪绁炵粡绯荤粺鐨勬敮閰嶄笅锛岃倢鑲夋敹缂╃壍鍔ㄦ墍闄勭潃鐨勯缁曠潃鍏宠妭杞姩锛屼娇韬綋浜х敓鍚勭鍔ㄤ綔銆傛墍浠ワ紝杩愬姩绯荤粺鍏锋湁杩愬姩銆佹敮鎸佸拰淇濇姢绛夊姛鑳斤紝骞煎勾鏃舵湡鐨勯楠艰繕鍏锋湁閫犺鍔熻兘銆� ",
     //   txtIndex: 57
     // });
-    // }, 5000);
+    //  }, 50);
   },
   methods: {
     // setZoom1() {
@@ -210,7 +256,7 @@
     scrollFun(event) {
       // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩
       if (event.target.scrollTop > this.previousScrollTop) {
-        this.getAduio()
+        this.getAduio();
         // 鍚戜笅
         const currentScrollTop =
           event.target.scrollTop + event.target.offsetHeight;
@@ -234,7 +280,7 @@
           }
         }
       } else if (event.target.scrollTop < this.previousScrollTop) {
-        this.handleAudio()
+        this.handleAudio();
         // 鍚戜笂
         const currentScrollTop = event.target.scrollTop;
         if (currentScrollTop <= this.loadThreshold) {
@@ -313,7 +359,10 @@
           this.container ? this.container : document
         ).querySelector(`[page="${data.page}"]`);
         // 鍒涘缓 createTreeWalker 杩唬鍣紝鐢ㄤ簬閬嶅巻鏂囨湰鑺傜偣锛屼繚瀛樺埌涓�涓暟缁�
-        const treeWalker = document.createTreeWalker(pageDom, NodeFilter.SHOW_TEXT);
+        const treeWalker = document.createTreeWalker(
+          pageDom,
+          NodeFilter.SHOW_TEXT
+        );
         const allTextNodes = [];
         let currentNode = treeWalker.nextNode();
         while (currentNode) {
@@ -512,7 +561,7 @@
           const catalog = catalogDom.getAttribute("num");
           let text = null;
           if (target.querySelector("p")) {
-            text = target.querySelector("p").textContent.substring(0, 20);
+            text = target.querySelector("p").textContent.substring(0, 50);
           }
           // 杩斿洖椤电爜鍜岀珷鑺備俊鎭�
           if (this.$store.state.qiankun && this.$store.state.qiankun.pageChange)
@@ -538,6 +587,8 @@
               target,
               "chapter"
             );
+            // 娣诲姞椤电爜
+            this.loadPageList.push(Number(page));
             const catalog = catalogDom.getAttribute("num");
             // if (!this.questionDataMap[page]) {
             //   if (testData && testData[catalog]) {
@@ -563,8 +614,6 @@
             //     }
             //   }
             // }
-            // 娣诲姞椤电爜
-            this.loadPageList.push(Number(page));
             // 娓叉煋杩欎竴椤电殑鏍囪
             for (const key in this.renderSignMap) {
               if (this.renderSignMap[key][page]) {
@@ -578,7 +627,10 @@
               // 楂樹寒琛�
               setTimeout(() => {
                 // 鑾峰彇椤甸潰鎵�鏈塼ext鑺傜偣
-                const pageTextList = document.createTreeWalker(target, NodeFilter.SHOW_TEXT);
+                const pageTextList = document.createTreeWalker(
+                  target,
+                  NodeFilter.SHOW_TEXT
+                );
                 // 鍖归厤鍏抽敭瀛�
                 const allPageTextNodes = [];
                 let currentNode = pageTextList.nextNode();
@@ -629,12 +681,8 @@
           spaceBetween: 30, // 闂撮殧
           // 濡傛灉闇�瑕佸墠杩涘悗閫�鎸夐挳
           navigation: {
-            nextEl: (this.container ? this.container : document).querySelector(
-              ".swiper-button-next"
-            ),
-            prevEl: (this.container ? this.container : document).querySelector(
-              ".swiper-button-prev"
-            ),
+            nextEl: dom.querySelector(".swiper-button-next"),
+            prevEl: dom.querySelector(".swiper-button-prev"),
           },
           // 绐楀彛鍙樺寲,閲嶆柊init,閽堝F11鍏ㄥ睆鍜屾斁澶х缉灏�,蹇呴』鍔�
           observer: true,
@@ -661,12 +709,8 @@
           spaceBetween: 30, // 闂撮殧
           // 濡傛灉闇�瑕佸墠杩涘悗閫�鎸夐挳
           navigation: {
-            nextEl: (this.container ? this.container : document).querySelector(
-              ".swiper-button-next"
-            ),
-            prevEl: (this.container ? this.container : document).querySelector(
-              ".swiper-button-prev"
-            ),
+            nextEl: dom.querySelector(".swiper-button-next"),
+            prevEl: dom.querySelector(".swiper-button-prev"),
           },
           // 绐楀彛鍙樺寲,閲嶆柊init,閽堝F11鍏ㄥ睆鍜屾斁澶х缉灏�,蹇呴』鍔�
           observer: true,
@@ -714,6 +758,13 @@
       const pageData = {
         pageHeader,
         chapterOne,
+        chapterTwo,
+        chapterThree,
+        chapterFour,
+        chapterFive,
+        chapterSix,
+        chapterSeven,
+        chapterEight,
       };
       // 閬嶅巻鎵�鏈夌珷鑺傛枃浠�
       for (const key in pageData) {
@@ -725,6 +776,7 @@
           propsData: {
             showPageList: [],
             questionData: {},
+            isSearch: true,
           },
         });
         pageExample.$mount(
@@ -756,6 +808,7 @@
               propsData: {
                 showPageList: [pageNum],
                 questionData: {},
+                isSearch: true,
               },
             });
             pageExample.$mount(
@@ -769,7 +822,10 @@
               .querySelector(`[page="${pageNum}"]`);
             if (thisPageDom) {
               // 鑾峰彇椤甸潰鎵�鏈塼ext鑺傜偣
-              const pageTextList = document.createTreeWalker(thisPageDom, NodeFilter.SHOW_TEXT);
+              const pageTextList = document.createTreeWalker(
+                thisPageDom,
+                NodeFilter.SHOW_TEXT
+              );
               // 鍖归厤鍏抽敭瀛�
               const allPageTextNodes = [];
               let currentNode = pageTextList.nextNode();
@@ -810,18 +866,37 @@
       // 璺宠浆
       this.gotoPage(data.catalog, data.page, () => {});
     },
-        // 鐐瑰嚮浜嬩欢锛氬皢鐢熷兓鍗曡瘝浼犵粰 涓诲簲鐢� 浠庤�岃皟鐢ㄨ瘝鍏稿姛鑳�
-    saveCharacters(event, word) {
-      console.log("鐢熷兓瀛�", 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,
-        });
+    // 鐐瑰嚮浜嬩欢锛氬皢鐢熷兓鍗曡瘝浼犵粰 涓诲簲鐢� 浠庤�岃皟鐢ㄨ瘝鍏稿姛鑳�
+    // 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,
+            });
+          }
+        })
       }
-      // chooseWords
     },
     // 椤甸潰鍚戜笅婊氬姩锛岄煶棰戝皬绐楁挱鏀惧姛鑳�
     getAduio() {
@@ -870,13 +945,39 @@
     },
     // 鍏抽棴mini video
     closeMiniAudio() {
-      this.audioPath = ''
-    }
+      this.audioPath = "";
+    },
+    // 鐐瑰嚮闊抽鎾斁锛屽叧闂叾浠栭煶棰�
+    closeAudio() {
+      let allAudio = (
+        this.container ? this.container : document
+      ).querySelectorAll(".audio");
+      for (let index = 0; index < allAudio.length; index++) {
+        const item = allAudio[index];
+        item.addEventListener("play", () => {
+          const audioList = Array.from(allAudio);
+          for (let cindex = 0; cindex < audioList.length; cindex++) {
+            const citem = audioList[cindex];
+            if (citem.currentSrc != item.src) {
+              citem.pause();
+            }
+          }
+          this.closeMiniAudio();
+        });
+      }
+    },
   },
   components: {
     pageHeader,
     chapterOne,
-    miniAudio
+    chapterTwo,
+    chapterThree,
+    chapterFour,
+    chapterFive,
+    chapterSix,
+    chapterSeven,
+    chapterEight,
+    miniAudio,
   },
 };
 </script>
@@ -886,6 +987,7 @@
   width: 100%;
   height: 100%;
   overflow: auto;
+
   .page-content {
     max-width: 816px;
     min-width: 375px;

--
Gitblit v1.9.1