mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
案例和文章代码优化
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user