From b560ba9bea88c9d44de64b8166da3e4f2fc71798 Mon Sep 17 00:00:00 2001 From: nisen Date: Tue, 7 Nov 2023 18:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E8=A7=86=E9=A2=91=E6=83=85=E5=86=B5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=88=90=E4=B8=89=E5=8D=81=E5=88=86=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/study/coursenew.vue | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 020b5dce..f263b55c 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -394,6 +394,9 @@ localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式 localTimeValue:0,//计算的时间 appendStudyOtherHandle:null, + cumulativeDuration:0, //非音频累计时长 + maxDuration:0, //非音频最大时长 + defaultMaxTime:1800 //非音频默认最大时间 } }, mounted() { @@ -493,11 +496,18 @@ } }); //每一分钟保存一次 - // 取消阅读的每分钟六十秒的计时 - // let $this=this; - // this.appendStudyOtherHandle = setTimeout(function() { - // $this.appendStudyOtherTime(); - // }, 1000*60); + // 取消阅读的每分钟六十秒的计时,最多是设置的时间或默认时间 + let $this=this; + this.appendStudyOtherHandle = setTimeout(function() { + $this.cumulativeDuration += 60; + if($this.cumulativeDuration <= $this.maxDuration){ + $this.appendStudyOtherTime(); + }else{ + clearTimeout(this.appendStudyOtherHandle); + $this.cumulativeDuration = 0; + $this.maxDuration = 0; + } + }, 1000*60); }, //笔记组件触发,播放指定时间 @@ -670,6 +680,11 @@ this.isAppendTime = false; this.appendStudyOtherHandle = setTimeout(function() { + // 开始之前把响应式清空 + this.maxDuration = 0; + this.cumulativeDuration = 0; + // 没有设置默认时长 + this.maxDuration = r.duration !== 0 ? r.duration : this.defaultMaxTime; $this.appendStudyOtherTime(); }, 1000*60*2); //非音视频课程学习,2分钟后记录,因为一次记录是60秒 //this.appendStudyTime();