设置最大时长30分钟

This commit is contained in:
nisen
2023-11-08 10:06:38 +08:00
parent cd0c243c1e
commit 56c4d3f9a9
2 changed files with 37 additions and 21 deletions

View File

@@ -159,7 +159,7 @@ export default {
isPraise:false,
isFavorite: false,
setTime: null,
defaultMaxTime: 180,//最大时长
defaultMaxTime: 1800,//最大时长
cumulativeDuration:0,//累计时长
};
},
@@ -255,7 +255,21 @@ export default {
this.articleDetailData=res.result;
//if(this.articleDetailData.toString()!='{}'){
this.getAuthorInfo(this.articleDetailData)
//记录时长
//记录查看文章
this.$store.dispatch("userTrigger", {
key: "ViewArticle",//后台的事件key 发布文章且审核通过
title: "查看文章",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "查看了文章",//事件的内容
source:'page',
objId: this.articleId,//关联的id
objType: "2",//关联的类型
objInfo: this.articleDetailData.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
});
//记录阅读时长
this.sendEventData()
//}
}else{
@@ -268,10 +282,10 @@ export default {
},
sendEventData(){
let event = {
key: "ViewArticle",//后台的事件key 发布文章且审核通过
title: "查看文章",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "查看了文章",//事件的内容
key: "ReadArticle",//后台的事件key 发布文章且审核通过
title: "阅读文章",//事件的标题
parameters:"second:60",//用户自定义参数 name:value,name:value
content: "阅读了文章",//事件的内容
source:'page',
objId: this.articleId,//关联的id
objType: "2",//关联的类型
@@ -280,12 +294,7 @@ export default {
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
this.$store.dispatch("userTrigger", event);
this.setTime = setTimeout(()=>{
event.key = 'ReadArticle';
event.title = "阅读文章";
event.parameters='second:60';//增加60秒的学习时长
event.content = "阅读了文章"
$this.$store.dispatch("userTrigger", event);
if(this.cumulativeDuration<=this.defaultMaxTime){
this.sendEventData()

View File

@@ -224,7 +224,7 @@ export default {
orgData: [],
setTimeCase: null,
dataTime: sessionStorage.getItem('startTime') || 0,
defaultMaxTime: 180,//最大时长
defaultMaxTime: 1800,//最大时长
cumulativeDuration:0,//累计时长
};
},
@@ -333,6 +333,18 @@ export default {
if (xmlhttp.status == 200) {
clearTimeout(timer);
$this.Internet = 1;
this.$store.dispatch("userTrigger", {
key: "ViewCase",//后台的事件key 发布文章且审核通过
title: '查看案例',//事件的标题
parameters: "",//用户自定义参数 name:value,name:value
content: '查看了案例',//事件的内容
objId: this.resolveId,//关联的id
objType: "3",//关联的类型
objInfo: this.caseDetail.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
});
$this.sendEventData();
} else {
clearTimeout(timer);
@@ -529,10 +541,10 @@ export default {
},
sendEventData() {
let event = {
key: "ViewCase",//后台的事件key 发布文章且审核通过
title: '查看案例',//事件的标题
parameters: "",//用户自定义参数 name:value,name:value
content: '查看了案例',//事件的内容
key: "ReadCase",//后台的事件key 发布文章且审核通过
title: '阅读案例',//事件的标题
parameters: "second:60",//用户自定义参数 name:value,name:value
content: '阅读了案例',//事件的内容
objId: this.resolveId,//关联的id
objType: "3",//关联的类型
objInfo: this.caseDetail.title,
@@ -540,13 +552,8 @@ export default {
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
this.$store.dispatch("userTrigger", event);
let $this = this;
this.setTimeCase = setTimeout(() => {
event.key = 'ReadCase';
event.title = '阅读案例';
event.parameters = "second:60";
event.content = '阅读了案例';
$this.$store.dispatch("userTrigger", event);
this.cumulativeDuration += 60
if(this.cumulativeDuration<=this.defaultMaxTime){