闫增涛
2024-05-17 9b6190fd6a601942e41399cb3106ff2c4d9014e3
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>