案例和文章代码优化

This commit is contained in:
nisen
2023-11-09 15:38:52 +08:00
parent e0377d8abc
commit 05217f78ab
2 changed files with 8 additions and 30 deletions

View File

@@ -227,7 +227,6 @@ export default {
defaultMaxTime: 1800,//最大时长
cumulativeDuration:0,//累计时长
secondTime:15, //秒数
judgmentTime:true //判断是否开始计时
};
},
mounted() {
@@ -269,7 +268,6 @@ export default {
window.removeEventListener("scroll", this.handleScroll);
clearTimeout(this.setTimeCase);
this.cumulativeDuration = 0;
this.judgmentTime = true
},
methods: {
endTimeRequst(caseId, recordEndTime) {
@@ -555,27 +553,18 @@ export default {
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
// 十五秒的时候发一次,只记录一次
if(this.judgmentTime){
this.judgmentTime = false
setTimeout(() => {
this.setTimeCase = setTimeout(() => {
this.cumulativeDuration += this.secondTime
if(this.cumulativeDuration <= this.defaultMaxTime){
this.$store.dispatch("userTrigger", event);
this.secondTime = 60
this.sendEventData()
},15000)
return
}
this.setTimeCase = setTimeout(() => {
this.cumulativeDuration += 60
if(this.cumulativeDuration<=this.defaultMaxTime){
this.$store.dispatch("userTrigger", event);
this.sendEventData()
}else{
this.cumulativeDuration = 0
clearTimeout(this.setTimeCase);
this.setTimeCase = null
}
}, 60000);//1分钟之后发送阅读案例事件
}, this.secondTime * 1000);//15秒记录一次之后1分钟之后发送阅读案例事件
},
getCaseData() {
let $this = this;