mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 10:56:44 +08:00
案例和文章记录时长
This commit is contained in:
@@ -158,7 +158,9 @@ export default {
|
||||
diagSync:false,//控制弹窗
|
||||
isPraise:false,
|
||||
isFavorite: false,
|
||||
setTime: null
|
||||
setTime: null,
|
||||
defaultMaxTime: 180,//最大时长
|
||||
cumulativeDuration:0,//累计时长
|
||||
};
|
||||
},
|
||||
created(){
|
||||
@@ -252,27 +254,8 @@ export default {
|
||||
this.articleDetailData=res.result;
|
||||
//if(this.articleDetailData.toString()!='{}'){
|
||||
this.getAuthorInfo(this.articleDetailData)
|
||||
let event = {
|
||||
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.$store.dispatch("userTrigger", event);
|
||||
this.setTime = setTimeout(()=>{
|
||||
event.key = 'ReadArticle';
|
||||
event.title = "阅读文章";
|
||||
event.parameters='second:60';//增加60秒的学习时长
|
||||
event.content = "阅读了文章"
|
||||
$this.$store.dispatch("userTrigger", event);
|
||||
},61000);//1分钟后记录
|
||||
//记录时长
|
||||
this.sendEventData()
|
||||
//}
|
||||
}else{
|
||||
this.noData = false;
|
||||
@@ -282,6 +265,36 @@ export default {
|
||||
this.$message.error("获取数据失败")
|
||||
})
|
||||
},
|
||||
sendEventData(){
|
||||
let event = {
|
||||
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.$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){
|
||||
sendEventData()
|
||||
}else{
|
||||
this.cumulativeDuration = 0
|
||||
clearInterval(this.setTime);
|
||||
this.setTime = null
|
||||
}
|
||||
},61000);//1分钟后记录
|
||||
},
|
||||
//获取文章发布人的人物信息
|
||||
getAuthorInfo(data){
|
||||
let ids=[data.sysCreateAid]
|
||||
|
||||
@@ -223,7 +223,9 @@ export default {
|
||||
Profess: [],
|
||||
orgData: [],
|
||||
setTimeCase: null,
|
||||
dataTime: sessionStorage.getItem('startTime') || 0
|
||||
dataTime: sessionStorage.getItem('startTime') || 0,
|
||||
defaultMaxTime: 180,//最大时长
|
||||
cumulativeDuration:0,//累计时长
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -545,6 +547,14 @@ export default {
|
||||
event.parameters = "second:60";
|
||||
event.content = '阅读了案例';
|
||||
$this.$store.dispatch("userTrigger", event);
|
||||
this.cumulativeDuration += 60
|
||||
if(this.cumulativeDuration<=this.defaultMaxTime){
|
||||
sendEventData()
|
||||
}else{
|
||||
this.cumulativeDuration = 0
|
||||
clearInterval(this.setTimeCase);
|
||||
this.setTimeCase = null
|
||||
}
|
||||
}, 61000);//1分钟之后发送阅读案例事件
|
||||
},
|
||||
getCaseData() {
|
||||
|
||||
Reference in New Issue
Block a user