修改正常视频浏览器静默状态的上传时间

This commit is contained in:
nisen
2023-11-17 14:18:25 +08:00
parent 74ca554804
commit a3fb600f4d

View File

@@ -396,7 +396,7 @@
appendStudyOtherHandle:null, appendStudyOtherHandle:null,
cumulativeDuration:0, //非音频累计时长 cumulativeDuration:0, //非音频累计时长
maxDuration:0, //非音频最大时长 maxDuration:0, //非音频最大时长
defaultMaxTime:1800 //非音频默认最大时间 defaultMaxTime:1800, //非音频默认最大时间
} }
}, },
mounted() { mounted() {
@@ -1400,7 +1400,7 @@
//静默处理 //静默处理
apiStat.sendEvent(postData).then(rs=>{ apiStat.sendEvent(postData).then(rs=>{
if(rs.status == 200) { if(rs.status == 200) {
this.appendStartTime = new Date();//重新计时 // this.appendStartTime = new Date();//重新计时
studyUtil.clearStudyDuration(); //清除本地存储 studyUtil.clearStudyDuration(); //清除本地存储
} else { } else {
console.log(rs.message); console.log(rs.message);
@@ -1469,12 +1469,16 @@
let now = new Date(); let now = new Date();
let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数 let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数
let sen = parseInt(m / 1000); //计算秒数 let sen = parseInt(m / 1000); //计算秒数
duration = duration + $this.appentInterval/1000;//追加的是秒 console.log('定时器时间',sen);
if (sen>=60) { //一分钟保存一次 // 每次添加的是定时器计时的时间
duration = duration + sen;//追加的是秒
if (duration >= 60) { //一分钟保存一次
this.saveStudyDuration(duration); this.saveStudyDuration(duration);
} else { } else {
studyUtil.setStudyDuration(duration); //添加到本地存储中 studyUtil.setStudyDuration(duration); //添加到本地存储中
} }
//重新覆盖时间
this.appendStartTime = new Date();
//启动下次追加学习时长 //启动下次追加学习时长
this.appendHandle = setTimeout(function() { this.appendHandle = setTimeout(function() {
$this.appendStudyTime(); $this.appendStudyTime();