diff --git a/pages/YNEduApp/learn/learn.vue b/pages/YNEduApp/learn/learn.vue index 8e72968..15cf40e 100644 --- a/pages/YNEduApp/learn/learn.vue +++ b/pages/YNEduApp/learn/learn.vue @@ -59,7 +59,9 @@ export default { isEnd: false, video: null, isHide: false, - oldTime: 0 + oldTime: 0, + random1: 0, + random2: 0 } }, onLoad(opt) { @@ -75,6 +77,8 @@ export default { console.log('🚀 ~ onLoad ~ this.path:', this.path) this.studyDuration = this.currentTime = Number(opt.studyDuration) this.allStudyDuration = Number(opt.allStudyDuration) + this.random1 = ((this.allStudyDuration / 3) * 2).toFixed(0) + this.random2 = (this.allStudyDuration / 3).toFixed(0) this.isEnd = opt.isEnd if (opt.isEnd) { this.studyDuration = 0 @@ -104,11 +108,10 @@ export default { this.currentTime = Math.ceil(e.detail.currentTime) console.log('🚀 ~ 视频播放时间: ~ this.currentTime:', this.currentTime) console.log('🚀 ~ 视频总时长: ~ this.allStudyDuration:', this.allStudyDuration) - const random1 = (this.allStudyDuration / 3) * 2 - const random2 = this.allStudyDuration / 3 + console.log('🚀 ~ videoTimeUpdate ~ random1-2:', this.random1, this.random2) if (this.currentTime != this.oldTime) { - if (this.currentTime == random1 || this.currentTime == random2) { + if (this.currentTime == this.random2 || this.currentTime == this.random1) { this.oldTime = this.currentTime // 记录当前时间, 防止重复执行, 如果下次时间等于当前时间, 则不执行 this.video.pause() this.openPhotograph()