mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 11:26:43 +08:00
案例和文章代码优化
This commit is contained in:
@@ -161,7 +161,6 @@ export default {
|
|||||||
setTime: null,
|
setTime: null,
|
||||||
defaultMaxTime: 1800,//最大时长
|
defaultMaxTime: 1800,//最大时长
|
||||||
cumulativeDuration:0,//累计时长
|
cumulativeDuration:0,//累计时长
|
||||||
judgmentTime:true,//是否发送
|
|
||||||
secondTime:15,//默认时长
|
secondTime:15,//默认时长
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -184,7 +183,6 @@ export default {
|
|||||||
window.removeEventListener("scroll",this.handleScroll);
|
window.removeEventListener("scroll",this.handleScroll);
|
||||||
clearTimeout(this.setTime);
|
clearTimeout(this.setTime);
|
||||||
this.cumulativeDuration = 0;
|
this.cumulativeDuration = 0;
|
||||||
this.judgmentTime = true;
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
banJump() {
|
banJump() {
|
||||||
@@ -297,27 +295,18 @@ export default {
|
|||||||
aname: this.userInfo.name,//当前人的姓名
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
status: 1 //状态,直接写1
|
status: 1 //状态,直接写1
|
||||||
}
|
}
|
||||||
// 十五秒的时候发一次,只记录一次
|
this.setTime = setTimeout(()=>{
|
||||||
if(this.judgmentTime){
|
this.cumulativeDuration += this.secondTime
|
||||||
this.judgmentTime = false
|
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||||
setTimeout(() => {
|
|
||||||
this.$store.dispatch("userTrigger", event);
|
this.$store.dispatch("userTrigger", event);
|
||||||
this.secondTime = 60
|
this.secondTime = 60
|
||||||
this.sendEventData()
|
this.sendEventData()
|
||||||
},15000)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setTime = setTimeout(()=>{
|
|
||||||
this.cumulativeDuration += 60
|
|
||||||
if(this.cumulativeDuration<=this.defaultMaxTime){
|
|
||||||
this.$store.dispatch("userTrigger", event);
|
|
||||||
this.sendEventData()
|
|
||||||
}else{
|
}else{
|
||||||
this.cumulativeDuration = 0
|
this.cumulativeDuration = 0
|
||||||
clearTimeout(this.setTime);
|
clearTimeout(this.setTime);
|
||||||
this.setTime = null
|
this.setTime = null
|
||||||
}
|
}
|
||||||
},60000);//1分钟后记录
|
},this.secondTime * 1000);//15秒记录一次之后1分钟后记录
|
||||||
},
|
},
|
||||||
//获取文章发布人的人物信息
|
//获取文章发布人的人物信息
|
||||||
getAuthorInfo(data){
|
getAuthorInfo(data){
|
||||||
|
|||||||
@@ -227,7 +227,6 @@ export default {
|
|||||||
defaultMaxTime: 1800,//最大时长
|
defaultMaxTime: 1800,//最大时长
|
||||||
cumulativeDuration:0,//累计时长
|
cumulativeDuration:0,//累计时长
|
||||||
secondTime:15, //秒数
|
secondTime:15, //秒数
|
||||||
judgmentTime:true //判断是否开始计时
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -269,7 +268,6 @@ export default {
|
|||||||
window.removeEventListener("scroll", this.handleScroll);
|
window.removeEventListener("scroll", this.handleScroll);
|
||||||
clearTimeout(this.setTimeCase);
|
clearTimeout(this.setTimeCase);
|
||||||
this.cumulativeDuration = 0;
|
this.cumulativeDuration = 0;
|
||||||
this.judgmentTime = true
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
endTimeRequst(caseId, recordEndTime) {
|
endTimeRequst(caseId, recordEndTime) {
|
||||||
@@ -555,27 +553,18 @@ export default {
|
|||||||
aname: this.userInfo.name,//当前人的姓名
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
status: 1 //状态,直接写1
|
status: 1 //状态,直接写1
|
||||||
}
|
}
|
||||||
// 十五秒的时候发一次,只记录一次
|
this.setTimeCase = setTimeout(() => {
|
||||||
if(this.judgmentTime){
|
this.cumulativeDuration += this.secondTime
|
||||||
this.judgmentTime = false
|
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||||
setTimeout(() => {
|
|
||||||
this.$store.dispatch("userTrigger", event);
|
this.$store.dispatch("userTrigger", event);
|
||||||
this.secondTime = 60
|
this.secondTime = 60
|
||||||
this.sendEventData()
|
this.sendEventData()
|
||||||
},15000)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setTimeCase = setTimeout(() => {
|
|
||||||
this.cumulativeDuration += 60
|
|
||||||
if(this.cumulativeDuration<=this.defaultMaxTime){
|
|
||||||
this.$store.dispatch("userTrigger", event);
|
|
||||||
this.sendEventData()
|
|
||||||
}else{
|
}else{
|
||||||
this.cumulativeDuration = 0
|
this.cumulativeDuration = 0
|
||||||
clearTimeout(this.setTimeCase);
|
clearTimeout(this.setTimeCase);
|
||||||
this.setTimeCase = null
|
this.setTimeCase = null
|
||||||
}
|
}
|
||||||
}, 60000);//1分钟之后发送阅读案例事件
|
}, this.secondTime * 1000);//15秒记录一次之后1分钟之后发送阅读案例事件
|
||||||
},
|
},
|
||||||
getCaseData() {
|
getCaseData() {
|
||||||
let $this = this;
|
let $this = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user