From a3fb600f4dbae4862b12da22ac7a0b7a6395d18f Mon Sep 17 00:00:00 2001 From: nisen Date: Fri, 17 Nov 2023 14:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=B8=B8=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=B5=8F=E8=A7=88=E5=99=A8=E9=9D=99=E9=BB=98=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9A=84=E4=B8=8A=E4=BC=A0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/study/coursenew.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 05aed8cf..50bf1005 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -396,7 +396,7 @@ appendStudyOtherHandle:null, cumulativeDuration:0, //非音频累计时长 maxDuration:0, //非音频最大时长 - defaultMaxTime:1800 //非音频默认最大时间 + defaultMaxTime:1800, //非音频默认最大时间 } }, mounted() { @@ -1400,7 +1400,7 @@ //静默处理 apiStat.sendEvent(postData).then(rs=>{ if(rs.status == 200) { - this.appendStartTime = new Date();//重新计时 + // this.appendStartTime = new Date();//重新计时 studyUtil.clearStudyDuration(); //清除本地存储 } else { console.log(rs.message); @@ -1469,12 +1469,16 @@ let now = new Date(); let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数 let sen = parseInt(m / 1000); //计算秒数 - duration = duration + $this.appentInterval/1000;//追加的是秒 - if (sen>=60) { //一分钟保存一次 + console.log('定时器时间',sen); + // 每次添加的是定时器计时的时间 + duration = duration + sen;//追加的是秒 + if (duration >= 60) { //一分钟保存一次 this.saveStudyDuration(duration); } else { studyUtil.setStudyDuration(duration); //添加到本地存储中 } + //重新覆盖时间 + this.appendStartTime = new Date(); //启动下次追加学习时长 this.appendHandle = setTimeout(function() { $this.appendStudyTime();