From 5718fa4302c6d4d1718ad002ee1a4e1d46879c08 Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期五, 17 五月 2024 16:15:29 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

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

diff --git a/src/books/childHealth/view/content/components/chapter002.vue b/src/books/childHealth/view/content/components/chapter002.vue
index 1908f45..38d18bc 100644
--- a/src/books/childHealth/view/content/components/chapter002.vue
+++ b/src/books/childHealth/view/content/components/chapter002.vue
@@ -1351,10 +1351,26 @@
     };
   },
   async mounted() {
+    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) {
@@ -1368,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