Browse Source

Merge branch 'louise' into HTEX_render

Louise Lin 2 years ago
parent
commit
00d6575bee

+ 21 - 1
HiTeachCC/ClientApp/src/components/Tools/ButtonTimer.vue

@@ -171,6 +171,20 @@ export default {
     },
     countDown() {
       let that = this
+
+      console.log('先重置')
+      this.timeStartCount=0
+      let timer = this.timer
+      // 清除当前定时任务
+      clearInterval(timer)
+      // 清除原来的值, 还原计时器的初始值. 恢复默认的null
+      this.timer = null
+     
+      this.$store.state.timerIsStart = false
+      this.timeleft = 0
+      this.stopAudio('audio1')
+      this.stopAudio('audio2')
+
       // 获取剩余时间
       this.getTimeLeft()
       this.$store.state.timerIsStart = true
@@ -178,7 +192,6 @@ export default {
       this.timer = setInterval(function() {
         that.timeleft--
         that.timeStartCount++
-
         // 如果剩余时间, 小于0, 执行暂停按钮的逻辑, 停止定时任务
         if ((that.timeleft >= 1 && that.timeleft < 6) || that.timeStartCount < 6) {
             //確保顯示不是零才播
@@ -205,12 +218,15 @@ export default {
       }, 1000)
     },
     onhandlePause() {
+      console.log('暫停')
       let that = this
       this.getTimeLeft()
       this.$store.state.timerIsStart = false
       clearInterval(that.timer)
     },
     handleReset() {
+      console.log('重置')
+      this.timeStartCount=0
       let timer = this.timer
       // 清除当前定时任务
       clearInterval(timer)
@@ -237,6 +253,10 @@ export default {
         let isPlaying = audio.currentTime > 0 && !audio.paused && !audio.ended && audio.readyState > audio.HAVE_CURRENT_DATA
         if (!isPlaying) {
           audio.play()
+        }else{
+          this.stopAudio('audio1')
+          this.stopAudio('audio2')
+          audio.play()
         }
       }
     },

+ 1 - 1
HiTeachCC/ClientApp/src/store/index.js

@@ -200,7 +200,7 @@ export default new Vuex.Store({
     startTime: 0,
     elapsedTime: 0,
     timeLineEvents: [],
-    version: 'v5.0.230308.1'
+    version: 'v5.0.230313.1'
   },
   mutations: {},
   actions:{