From e661c793b5bf790a86f7817b0557bc728220bfb1 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 25 四月 2025 10:14:06 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/books/lifeCare/view/components/index.vue |  173 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 98 insertions(+), 75 deletions(-)

diff --git a/src/books/lifeCare/view/components/index.vue b/src/books/lifeCare/view/components/index.vue
index 9560d76..c104f9b 100644
--- a/src/books/lifeCare/view/components/index.vue
+++ b/src/books/lifeCare/view/components/index.vue
@@ -14,44 +14,37 @@
       <front001
         v-if="showCatalogList.indexOf(1) > -1"
         :showPageList="loadPageList"
-        :isSearch="isSearch"
       />
       <ChapterOne
         v-if="showCatalogList.indexOf(2) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <ChapterTwo
         v-if="showCatalogList.indexOf(3) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <ChapterThree
         v-if="showCatalogList.indexOf(4) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <ChapterFour
         v-if="showCatalogList.indexOf(5) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <ChapterFive
         v-if="showCatalogList.indexOf(6) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
         @Upload_initViewer="changeDomViewer"
-        :isSearch="isSearch"
       />
       <chapterSix
         v-if="showCatalogList.indexOf(7) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <chapterSeven
         v-if="showCatalogList.indexOf(8) > -1"
@@ -59,19 +52,16 @@
         :questionData="questionDataMap"
         @eventSwdt="swdtChange"
         @Upload_initViewer="changeDomViewer"
-        :isSearch="isSearch"
       />
       <chapterEight
         v-if="showCatalogList.indexOf(9) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <chapterNine
         v-if="showCatalogList.indexOf(10) > -1"
         :showPageList="loadPageList"
         :questionData="questionDataMap"
-        :isSearch="isSearch"
       />
       <chapter010
         v-if="showCatalogList.indexOf(11) > -1"
@@ -114,6 +104,7 @@
 </template>
 
 <script>
+import Vue from "vue";
 import front001 from "./front001";
 import ChapterOne from "./chapter001";
 import ChapterTwo from "./chapter002";
@@ -156,7 +147,6 @@
       questionDataMap: {},
       renderSignMap: {},
       highlightData: null,
-      isSearch: false,
     };
   },
   computed: {
@@ -166,11 +156,6 @@
     pageZoom() {
       return this.$store.state.qiankun.scale / 100;
     },
-  },
-  provide() {
-    return {
-      changeQuestionData: this.changeQuestionData,
-    };
   },
   watch: {
     showCatalogList: {
@@ -192,17 +177,25 @@
       },
     },
     loadPageList: {
-      handler() {
+      handler(newVal, oldVal) {
         setTimeout(() => {
           this.initSwiper();
           this.initViewer();
         }, 200);
       },
     },
+    pageZoom: {
+      handler(newVal, oldVal) {
+        const scrollBox = (
+          this.container ? this.container : document
+        ).querySelector(".page-main");
+        scrollBox.scrollTop = (scrollBox.scrollTop / oldVal) * newVal;
+      },
+    },
   },
   mounted() {
     // 榛樿鍔犺浇绔犺妭
-    this.showCatalogList = [7];
+    this.showCatalogList = [1];
     // 婊氬姩鐩戝惉鑺傛祦
     this.throttledScrollHandler = _.throttle(
       this.scrollFun,
@@ -259,30 +252,62 @@
 
     // 娴嬭瘯椤甸潰璺宠浆
     // setTimeout(() => {
-    // this.gotoPage(1, 15);
+    // this.gotoPage(1,10);
     //   setTimeout(() => {
-    //     this.renderSign("Note", {
+    //     this.renderSign("Highlight", {
     //       id: "2ACA9359",
-    //       txt: "钀ュ吇绱犲拰鐑噺锛屾墠鑳�",
-    //       page: "100",
+    //       txt: "棰樹竴瀛︿範涓婚涓� 杩愬姩",
+    //       page: "10",
     //       type: "Highlight",
     //       color: "#F5E12A"
     //     });
-    //     setTimeout(() => {
-    //       this.delSign({
-    //         ids: ["2ACA9359"]
-    //       });
-    //     }, 2000);
-    //   }, 1000);
-    // }, 1000);
+    // setTimeout(() => {
+    //   this.delSign({
+    //     ids: ["2ACA9359"]
+    //   });
+    // }, 2000);
+    //   }, 5000);
+
+    // const pageDom = (this.container ? this.container : document)
+    //   .querySelector("#app")
+    //   .querySelectorAll(".page-box");
+    // 妫�绱�
+    // console.log(this.searchTextByPage("淇濇姢鍐呰剰鍣ㄥ畼"), "searchTextByPage");
+    // 妫�绱㈣烦杞�
+    // this.searchItemLocation({
+    //   catalog: 2,
+    //   page: 10,
+    //   txt: " 杩愬姩绯荤粺鏄敱楠ㄣ�侀杩炵粨鍜岄楠艰倢涓夐儴鍒嗙粍鎴愮殑銆傚叏韬殑楠ㄩ�氳繃楠ㄨ繛缁撶粍鎴愪汉浣撻楠硷紙瑙佸浘1-1锛夈�傞楠兼槸浜轰綋鐨勬敮鏋讹紝鍏锋湁淇濇姢鍐呰剰鍣ㄥ畼銆佷緵鑲岃倝闄勭潃鍜屼綔涓鸿倢鑲夎繍鍔ㄧ殑鏉犳潌绛変綔鐢ㄣ�傚湪绁炵粡绯荤粺鐨勬敮閰嶄笅锛岃倢鑲夋敹缂╃壍鍔ㄦ墍闄勭潃鐨勯缁曠潃鍏宠妭杞姩锛屼娇韬綋浜х敓鍚勭鍔ㄤ綔銆傛墍浠ワ紝杩愬姩绯荤粺鍏锋湁杩愬姩銆佹敮鎸佸拰淇濇姢绛夊姛鑳斤紝骞煎勾鏃舵湡鐨勯楠艰繕鍏锋湁閫犺鍔熻兘銆� ",
+    //   txtIndex: 57
+    // });
+    // }, 500);
   },
   methods: {
-    changeDomViewer() {
-      setTimeout(() => {
-        this.initViewer();
-      }, 500);
+    swdtChange(data) {
+      if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) {
+        this.$store.state.qiankun.chooseWords({
+          type: data.type,
+          data: data.data,
+        });
+      }
     },
-
+    changeDomViewer() {
+      this.initViewer();
+    },
+    // setZoom1() {
+    //   let scale = this.$store.state.qiankun.scale + 10;
+    //   const scrollBox = (
+    //     this.container ? this.container : document
+    //   ).querySelector(".page-main");
+    //   this.$store.commit("setZoom", scale);
+    // },
+    // setZoom2() {
+    //   let scale = this.$store.state.qiankun.scale - 10;
+    //   const scrollBox = (
+    //     this.container ? this.container : document
+    //   ).querySelector(".page-main");
+    //   this.$store.commit("setZoom", scale);
+    // },
     // 婊氬姩鐩戝惉
     scrollFun(event) {
       // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩
@@ -432,7 +457,6 @@
         }
       }
     },
-
     // 鍒犻櫎鏍囪娓叉煋
     delSign({ ids, type }) {
       if (ids && ids.length) {
@@ -460,7 +484,6 @@
         }
       }
     },
-
     initObservation() {
       const sections = (
         this.container ? this.container : document
@@ -489,7 +512,6 @@
         }
       });
     },
-
     initThemeColor() {
       // 鑾峰彇鍚勭闇�瑕佷富棰樿壊鐨勮妭鐐�
       const colorDom = (
@@ -569,7 +591,15 @@
         }
       });
     },
-
+    getParentWithClass(element, className) {
+      console.log(element, className, "element, className");
+      while (element.parentElement) {
+        element = element.parentElement;
+        if (element.classList.contains(className)) {
+          return element;
+        }
+      }
+    },
     pageChangeCallback(entries, observer) {
       //entries锛氫唬琛ㄨ瀵熷埌鐨勭洰鏍囧厓绱犵殑闆嗗悎銆� observer锛氫唬琛ㄨ瀵熻�呭璞°��
       entries.forEach((entry) => {
@@ -601,7 +631,6 @@
         }
       });
     },
-
     loadPageCallback(entries, observer) {
       entries.forEach(async (entry) => {
         if (entry.isIntersecting) {
@@ -619,26 +648,27 @@
               if (testData && testData[catalog]) {
                 if (testData[catalog][page]) {
                   if (Array.isArray(testData[catalog][page])) {
-                      this.questionDataMap[page] = await getQuestionList(
-                        page,
-                        testData[catalog][page],
-                        this.config.activeBook
-                      );
+                    this.questionDataMap[page] = await getQuestionList(
+                      page,
+                      testData[catalog][page],
+                      this.config.activeBook
+                    );
                   } else {
                     const obj = {};
                     for (let key in testData[catalog][page]) {
-                          obj[key] = await getQuestionList(
-                          [],
-                          testData[catalog][page][key],
-                          this.config.activeBook
-                        );
+                      obj[key] = await getQuestionList(
+                        [],
+                        testData[catalog][page][key],
+                        this.config.activeBook
+                      );
                     }
                     this.questionDataMap[page] = obj;
                   }
+                  console.log('棰樼洰',this.questionDataMap);
+                  
                 }
               }
             }
-
             // 娓叉煋杩欎竴椤电殑鏍囪
             for (const key in this.renderSignMap) {
               if (this.renderSignMap[key][page]) {
@@ -652,7 +682,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();
@@ -685,7 +718,6 @@
         }
       });
     },
-
     initSwiper() {
       const doms = (
         this.container ? this.container : document
@@ -697,23 +729,23 @@
           autoplay: {
             //鑷姩寮�濮�
             delay: 3000, //鏃堕棿闂撮殧
-            disableOnInteraction: false, //*鎵嬪姩鎿嶄綔杞挱鍥惧悗涓嶄細鏆傚仠*
+            disableOnInteraction: false //*鎵嬪姩鎿嶄綔杞挱鍥惧悗涓嶄細鏆傚仠*
           },
           paginationClickable: true,
           slidesPerView: 1, // 涓�缁勪笁涓�
           spaceBetween: 30, // 闂撮殧
           // 濡傛灉闇�瑕佸墠杩涘悗閫�鎸夐挳
           navigation: {
-            nextEl: (this.container ? this.container : document).querySelector(
+            nextEl: dom.querySelector(
               ".swiper-button-next"
             ),
-            prevEl: (this.container ? this.container : document).querySelector(
+            prevEl: dom.querySelector(
               ".swiper-button-prev"
-            ),
+            )
           },
           // 绐楀彛鍙樺寲,閲嶆柊init,閽堝F11鍏ㄥ睆鍜屾斁澶х缉灏�,蹇呴』鍔�
           observer: true,
-          observeParents: true,
+          observeParents: true
           // // 濡傛灉闇�瑕佸垎椤靛櫒
           // pagination: {
           //   el: (this.container ? this.container : document).querySelector(
@@ -736,12 +768,12 @@
           spaceBetween: 30, // 闂撮殧
           // 濡傛灉闇�瑕佸墠杩涘悗閫�鎸夐挳
           navigation: {
-            nextEl: (this.container ? this.container : document).querySelector(
+            nextEl: dom.querySelector(
               ".swiper-button-next"
             ),
-            prevEl: (this.container ? this.container : document).querySelector(
+            prevEl: dom.querySelector(
               ".swiper-button-prev"
-            ),
+            )
           },
           // 绐楀彛鍙樺寲,閲嶆柊init,閽堝F11鍏ㄥ睆鍜屾斁澶х缉灏�,蹇呴』鍔�
           observer: true,
@@ -760,12 +792,11 @@
               var paginationInfoEl = dom.querySelector(".pageBox");
               if (paginationInfoEl)
                 paginationInfoEl.textContent = currentPage + "/" + totalPages;
-            },
-          },
+            }
+          }
         });
       }
     },
-
     initViewer() {
       const doms = (
         this.container ? this.container : document
@@ -782,16 +813,6 @@
         });
       }
     },
-
-    swdtChange(data) {
-      if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) {
-        this.$store.state.qiankun.chooseWords({
-          type: data.type,
-          data: data.data,
-        });
-      }
-    },
-
     // 鏍规嵁鍏抽敭瀛楀叏鏂囨绱�
     searchTextByPage(keyword) {
       const searchResult = [];
@@ -828,6 +849,7 @@
           propsData: {
             showPageList: [],
             questionData: {},
+            isSearch: true,
           },
         });
         pageExample.$mount(
@@ -840,6 +862,7 @@
           .querySelector("#searchDomBox")
           .querySelectorAll(".page-box");
         const pages = [];
+        
         for (let i = 0; i < pageDom.length; i++) {
           const pageDomItem = pageDom[i];
           pages.push(Number(pageDomItem.getAttribute("page")));
@@ -859,6 +882,7 @@
               propsData: {
                 showPageList: [pageNum],
                 questionData: {},
+                isSearch: true,
               },
             });
             pageExample.$mount(
@@ -906,10 +930,9 @@
         }
       }
       // 杈撳嚭鎼滅储缁撴灉
-      // console.log(searchResult);
+      console.log(searchResult);
       return searchResult;
     },
-
     // 鏍规嵁妫�绱㈢粨鏋滆烦杞搴斾綅缃苟楂樹寒
     searchItemLocation(data) {
       // 璁板綍楂樹寒淇℃伅

--
Gitblit v1.9.1