From 9b6190fd6a601942e41399cb3106ff2c4d9014e3 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期五, 17 五月 2024 15:50:56 +0800
Subject: [PATCH] 标签替换

---
 src/books/childHealth/view/content/components/chapter002.vue |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/books/childHealth/view/content/components/chapter002.vue b/src/books/childHealth/view/content/components/chapter002.vue
index 1e8a046..38d18bc 100644
--- a/src/books/childHealth/view/content/components/chapter002.vue
+++ b/src/books/childHealth/view/content/components/chapter002.vue
@@ -345,7 +345,12 @@
         </h6>
         <p class="blockh6-c">
           <span class="img center dl-bl w100">涓撻浜� 瀛︿範涓婚涓�</span>
-          <examinations :cardList="questionData[46]" />
+          <examinations
+            v-if="questionData" 
+            :cardList="questionData[46]"
+            :chapter="2"
+            :page="46" 
+            />
         </p>
         <h2 class="module_block" id="b011">
           <div class="custom1">瀛︿範涓婚浜�</div>
@@ -718,7 +723,7 @@
         <p class="blockh6-c">
           <!-- <img class="img-g" alt="" src="image/0062-1.jpg" /><br /> -->
           <span class="img center dl-bl w100">涓撻浜� 瀛︿範涓婚浜�</span>
-          <examinations :cardList="questionData[49]" />
+          <examinations v-if="questionData"  :cardList="questionData[49]" />
         </p>
         <p class="custom_tag"><b>鈥㈣祫鏂欓摼鎺モ��</b></p>
         <div class="fieldset">
@@ -1053,7 +1058,7 @@
         <p class="blockh6-c center">
           <!-- <img class="img-g" alt="" src="image/0065-1.jpg" /><br /> -->
           <span class="img center dl-bl w100">涓撻浜� 瀛︿範涓婚涓�</span>
-          <examinations :cardList="questionData[52]" />
+          <examinations  v-if="questionData" :cardList="questionData[52]" />
         </p>
       </div>
     </div>
@@ -1222,10 +1227,10 @@
         <p class="blockh6-c">
           瀛︿範瀹屾湰涓撻锛屼綘鐨勫涔犳晥鏋滃浣曞憿锛熷挶浠竴璧锋潵鎵爜娴嬩竴娴嬪惂锛�<br />
           <span class="img">杩囧叧妫�娴嬶紙璧勬牸鑰冭瘯妯℃嫙棰橈級1</span><br />
-          <examinations :cardList="questionData[541]" />
+          <examinations v-if="questionData"  :cardList="questionData[541]" />
           <span class="span-border"></span>
           <span class="img mt-20 dl-bl">杩囧叧妫�娴嬶紙璧勬牸鑰冭瘯妯℃嫙棰橈級2</span>
-          <examinations :cardList="questionData[542]" />
+          <examinations v-if="questionData"  :cardList="questionData[542]" />
         </p>
         <h6 class="Conclusion-title4">鈥㈠涔犲弽鎬濃��</h6>
         <p class="blockh6 m0-t0 fl fl-di fl-cn">
@@ -1250,7 +1255,6 @@
 import getQuestionData from "@/assets/methods/examination";
 import testData from "../../../assets/examinationList";
 import getResourcePath from "@/assets/methods/resources";
-import { mapState } from "vuex";
 export default {
   name: "chapterTwo",
   components: { evenHeaderVue, oddHeaderVue, examinations },
@@ -1347,10 +1351,26 @@
     };
   },
   async mounted() {
-    this.$data.questionData = await getQuestionData(testData[2]);
+    const localData = localStorage.getItem('chapterTwoData')
+    if(localData) {
+      this.chapterTwoData = JSON.parse(localData)
+    }
+    window.timerOne = setInterval(() => {
+      this.saveTime--
+      if(this.saveTime == 0) {
+        this.saveChapterOneData()
+      }
+    },1000)
+    this.$data.questionData = await getQuestionData('2',testData[2]);
     this.$data.pathOne = getResourcePath("e2b2b610e8b77c82bad7cf94c7986646");
     this.$data.pathTwo = getResourcePath("b11b51863da2a4e7e21c73358fa96c1e");
     this.$data.pathThree = getResourcePath("67cf97bd8295dc3aeb46982c574df8d0");
+  },
+  unmounted() {
+    if(window.timerTwo) {
+      clearInterval(window.timerTwo)
+    }
+    localStorage.setItem('chapterTwoData',JSON.stringify(this.chapterTwoData))
   },
   methods: {
     changeResources(type) {
@@ -1364,6 +1384,11 @@
         this.$data.videoState = !this.$data.videoState;
       }
     },
+    saveChapterOneData() {
+      this.saveTime = 20
+      console.log(this.chapterTwoData);
+      localStorage.setItem('chapterTwoData',JSON.stringify(this.chapterTwoData))
+    }
   },
 };
 </script>

--
Gitblit v1.9.1