From 05217f78abece1b7db77a5ddb2315ef9eea357b5 Mon Sep 17 00:00:00 2001 From: nisen Date: Thu, 9 Nov 2023 15:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E5=92=8C=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/article/Detail.vue | 19 ++++--------------- src/views/portal/case/Detail.vue | 19 ++++--------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/views/portal/article/Detail.vue b/src/views/portal/article/Detail.vue index fc7ba986..83f5039b 100644 --- a/src/views/portal/article/Detail.vue +++ b/src/views/portal/article/Detail.vue @@ -161,7 +161,6 @@ export default { setTime: null, defaultMaxTime: 1800,//最大时长 cumulativeDuration:0,//累计时长 - judgmentTime:true,//是否发送 secondTime:15,//默认时长 }; }, @@ -184,7 +183,6 @@ export default { window.removeEventListener("scroll",this.handleScroll); clearTimeout(this.setTime); this.cumulativeDuration = 0; - this.judgmentTime = true; }, methods: { banJump() { @@ -297,27 +295,18 @@ export default { aname: this.userInfo.name,//当前人的姓名 status: 1 //状态,直接写1 } - // 十五秒的时候发一次,只记录一次 - if(this.judgmentTime){ - this.judgmentTime = false - setTimeout(() => { + this.setTime = setTimeout(()=>{ + this.cumulativeDuration += this.secondTime + if(this.cumulativeDuration <= this.defaultMaxTime){ this.$store.dispatch("userTrigger", event); this.secondTime = 60 this.sendEventData() - },15000) - return - } - this.setTime = setTimeout(()=>{ - this.cumulativeDuration += 60 - if(this.cumulativeDuration<=this.defaultMaxTime){ - this.$store.dispatch("userTrigger", event); - this.sendEventData() }else{ this.cumulativeDuration = 0 clearTimeout(this.setTime); this.setTime = null } - },60000);//1分钟后记录 + },this.secondTime * 1000);//15秒记录一次之后1分钟后记录 }, //获取文章发布人的人物信息 getAuthorInfo(data){ diff --git a/src/views/portal/case/Detail.vue b/src/views/portal/case/Detail.vue index 54fe8c0e..869bf454 100644 --- a/src/views/portal/case/Detail.vue +++ b/src/views/portal/case/Detail.vue @@ -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;