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();