From 66d96053e0283c081b95bed87afa42e837389a7e Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期三, 29 五月 2024 14:24:09 +0800
Subject: [PATCH] swiper

---
 src/books/childHealth/view/content/index.vue |   68 ++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/src/books/childHealth/view/content/index.vue b/src/books/childHealth/view/content/index.vue
index 63b78b9..125467f 100644
--- a/src/books/childHealth/view/content/index.vue
+++ b/src/books/childHealth/view/content/index.vue
@@ -1,71 +1,79 @@
 <template>
   <div class="page-main" @scroll="throttledScrollHandler">
-    <div class="page-content">
+    <div
+      class="page-content"
+      :style="{
+        fontSize: fontSize ? fontSize + 'px' : '16px',
+        transform: `scale(${pageZoom ? pageZoom : 1})`,
+        transformOrigin: 'center top'
+      }"
+    >
       <pageHeader
-        v-if="showCatalogList.indexOf(0) > -1"
+        v-if="showCatalogList.indexOf(1) > -1"
         :showPageList="loadPageList"
       ></pageHeader>
       <chapterOne
-        v-if="showCatalogList.indexOf(1) > -1"
+        v-if="showCatalogList.indexOf(2) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterOne>
       <chapterTwo
-        v-if="showCatalogList.indexOf(2) > -1"
+        v-if="showCatalogList.indexOf(3) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterTwo>
       <chapterThree
-        v-if="showCatalogList.indexOf(3) > -1"
+        v-if="showCatalogList.indexOf(4) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterThree>
       <chapterFour
-        v-if="showCatalogList.indexOf(4) > -1"
+        v-if="showCatalogList.indexOf(5) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterFour>
       <chapterFive
-        v-if="showCatalogList.indexOf(5) > -1"
+        v-if="showCatalogList.indexOf(6) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterFive>
       <chapterSix
-        v-if="showCatalogList.indexOf(6) > -1"
+        v-if="showCatalogList.indexOf(7) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterSix>
       <chapterSeven
-        v-if="showCatalogList.indexOf(7) > -1"
+        v-if="showCatalogList.indexOf(8) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterSeven>
       <chapterEight
-        v-if="showCatalogList.indexOf(8) > -1"
+        v-if="showCatalogList.indexOf(9) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterEight>
       <chapterNine
-        v-if="showCatalogList.indexOf(9) > -1"
+        v-if="showCatalogList.indexOf(10) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterNine>
       <chapterTen
-        v-if="showCatalogList.indexOf(10) > -1"
+        v-if="showCatalogList.indexOf(11) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterTen>
       <chapterEleven
-        v-if="showCatalogList.indexOf(11) > -1"
+        v-if="showCatalogList.indexOf(12) > -1"
         :showPageList="loadPageList"
         :questionData="questionData"
       ></chapterEleven>
       <chapterTwelve
-        v-if="showCatalogList.indexOf(12) > -1"
+        v-if="showCatalogList.indexOf(13) > -1"
         :showPageList="loadPageList"
       ></chapterTwelve>
       <chapterThirteen
-        v-if="showCatalogList.indexOf(13) > -1"
+        v-if="showCatalogList.indexOf(14) > -1"
+        :showPageList="loadPageList"
       ></chapterThirteen>
     </div>
   </div>
@@ -105,10 +113,13 @@
       questionData: {}
     };
   },
-  provide() {
-    return {
-      changeQuestionData: this.changeQuestionData
-    };
+  computed: {
+    fontSize() {
+      return this.$store.state.qiankun.fontSize;
+    },
+    pageZoom() {
+      return this.$store.state.qiankun.scale / 100;
+    }
   },
   watch: {
     showCatalogList: {
@@ -132,7 +143,7 @@
   },
   mounted() {
     // 榛樿鍔犺浇绔犺妭
-    this.showCatalogList = [0];
+    this.showCatalogList = [1];
     // 婊氬姩鐩戝惉鑺傛祦
     this.throttledScrollHandler = _.throttle(
       this.scrollFun,
@@ -303,7 +314,7 @@
             // 绗旇
             pageDom.innerHTML = pageDom.innerHTML.replace(
               reg,
-              `<span datatype="Note" dataid="${data.id}" style="border-bottom-color:${data.color}" class="notesline" onclick="signClick('Note','${data.id}','${data.chapterNum}')" onmouseover="noteHover('Note','${data.id}','${data.chapterNum}')" onmouseout="noteOut">${data.txt}<img src="${NoteIcon}"/></span>`
+              `<span datatype="Note" dataid="${data.id}" style="border-bottom-color:${data.color}" class="notesline" onclick="signClick('Note','${data.id}','${data.chapterNum}')" onmouseover="noteHover('Note','${data.id}','${data.chapterNum}')" onmouseout="noteOut('Note')">${data.txt}<img src="${NoteIcon}"/></span>`
             );
             break;
         }
@@ -464,12 +475,18 @@
             "chapter"
           );
           const catalog = catalogDom.getAttribute("num");
-          console.log(page,"page",catalog,"catalog");
+          console.log(page, "page", catalog, "catalog",);
+          let text = null
+          if(target.querySelector('p')) {
+            console.log(target.querySelector('p').textContent.substring(0, 20));
+            text = target.querySelector('p').textContent.substring(0, 20)
+          }
           // 杩斿洖椤电爜鍜岀珷鑺備俊鎭�
           if (this.$store.state.qiankun && this.$store.state.qiankun.pageChange)
             this.$store.state.qiankun.pageChange({
               page: page,
-              catalog: catalog
+              catalog: catalog,
+              text,
             });
           // const sections = Array.from(document.querySelectorAll(".section"));
           //sections锛氳幏鍙栨墍鏈夊叿鏈� .section 绫诲悕鐨勫厓绱狅紝骞惰浆鎹负鏁扮粍銆�
@@ -495,7 +512,7 @@
                 if (testData[catalog][page]) {
                   if (Array.isArray(testData[catalog][page])) {
                     this.questionData[page] = await getQuestionList(
-                      [],
+                      page,
                       testData[catalog][page],
                       this.config.activeBook
                     );
@@ -522,9 +539,6 @@
         }
       });
     },
-    changeQuestionData(page, data) {
-      this.$props.questionData[page] = data;
-    }
   },
   components: {
     pageHeader,

--
Gitblit v1.9.1