diff --git a/hybrid/html/web/viewer.html b/hybrid/html/web/viewer.html index d208332..ad2579b 100644 --- a/hybrid/html/web/viewer.html +++ b/hybrid/html/web/viewer.html @@ -494,6 +494,7 @@ See https://github.com/adobe-type-tools/cmap-resources console.log('params:',params) if (params > 0) { let minute = Math.floor(params / 60); + minute = String(minute).padStart(2, '0') let second = params % 60; let time = minute + ':' + second; let interval = setInterval(() => { diff --git a/pages/YNEduApp/learnProj/imageStudy.vue b/pages/YNEduApp/learnProj/imageStudy.vue index 39f81c2..fffc8db 100644 --- a/pages/YNEduApp/learnProj/imageStudy.vue +++ b/pages/YNEduApp/learnProj/imageStudy.vue @@ -1,5 +1,9 @@ + + 剩余学习时间:{{ time }} + 已完成学习 + @@ -15,7 +19,8 @@ export default { params: {}, timer: null, isEnd: false, - isShowImg: false + isShowImg: false, + time: '' } }, onLoad(opt) { @@ -75,6 +80,10 @@ export default { countDown() { let allStudyDuration = Number(this.params.allStudyDuration) - Number(this.params.studyDuration) // let studyDuration = Number(this.params.studyDuration) + let minute = Math.floor(allStudyDuration / 60) + minute = String(minute).padStart(2, '0') + let second = allStudyDuration % 60 + this.time = minute + ':' + second this.timer = setInterval(() => { allStudyDuration-- this.params.studyDuration++ @@ -92,6 +101,25 @@ export default { this.updStudyDuration() }, 1000) } + let arr = this.time.split(':') + let minute = parseInt(arr[0]) + let second = parseInt(arr[1]) + if (second == 0) { + minute -= 1 + second = 59 + if (minute < 10) { + minute = String(minute).padStart(2, '0') + } + } else { + second -= 1 + if (minute < 10) { + minute = String(minute).padStart(2, '0') + } + if (second < 10) { + second = String(second).padStart(2, '0') + } + } + this.time = minute + ':' + second console.log('🚀 ~ countDown ~ 剩余时间-->:', allStudyDuration) console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) }, 1000) @@ -148,6 +176,7 @@ export default {