mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
修改课程案例和文章时长
This commit is contained in:
@@ -282,23 +282,13 @@ export default {
|
||||
})
|
||||
},
|
||||
sendEventData(){
|
||||
let event = {
|
||||
key: "ReadArticle",//后台的事件key 发布文章且审核通过
|
||||
title: "阅读文章",//事件的标题
|
||||
parameters:"second:" + this.secondTime,//用户自定义参数 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
|
||||
}
|
||||
let startTime = new Date().getTime();
|
||||
this.setTime = setTimeout(()=>{
|
||||
this.cumulativeDuration += this.secondTime
|
||||
let endTime = new Date().getTime();
|
||||
let totalTime = parseInt((endTime - startTime) / 1000);
|
||||
this.cumulativeDuration += totalTime;
|
||||
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||
this.$store.dispatch("userTrigger", event);
|
||||
this.sendStudyTime(totalTime);
|
||||
this.secondTime = 60
|
||||
this.sendEventData()
|
||||
}else{
|
||||
@@ -308,6 +298,22 @@ export default {
|
||||
}
|
||||
},this.secondTime * 1000);//15秒记录一次之后1分钟后记录
|
||||
},
|
||||
// 发送学习时间
|
||||
sendStudyTime(totalTime){
|
||||
this.$store.dispatch("userTrigger", {
|
||||
key: "ReadArticle",//后台的事件key 发布文章且审核通过
|
||||
title: "阅读文章",//事件的标题
|
||||
parameters:"second:" + totalTime,//用户自定义参数 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
|
||||
});
|
||||
},
|
||||
//获取文章发布人的人物信息
|
||||
getAuthorInfo(data){
|
||||
let ids=[data.sysCreateAid]
|
||||
|
||||
@@ -541,10 +541,16 @@ export default {
|
||||
})
|
||||
},
|
||||
sendEventData() {
|
||||
let event = {
|
||||
let startTime = new Date().getTime();
|
||||
this.setTimeCase = setTimeout(() => {
|
||||
let endTime = new Date().getTime();
|
||||
let totalTime = parseInt((endTime - startTime) / 1000);
|
||||
this.cumulativeDuration += totalTime
|
||||
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||
this.$store.dispatch("userTrigger", {
|
||||
key: "ReadCase",//后台的事件key 发布文章且审核通过
|
||||
title: '阅读案例',//事件的标题
|
||||
parameters: "second:" + this.secondTime,//用户自定义参数 name:value,name:value
|
||||
parameters: "second:" + totalTime,//用户自定义参数 name:value,name:value
|
||||
content: '阅读了案例',//事件的内容
|
||||
objId: this.resolveId,//关联的id
|
||||
objType: "3",//关联的类型
|
||||
@@ -552,11 +558,7 @@ export default {
|
||||
aid: this.userInfo.aid, //当前登录人的id
|
||||
aname: this.userInfo.name,//当前人的姓名
|
||||
status: 1 //状态,直接写1
|
||||
}
|
||||
this.setTimeCase = setTimeout(() => {
|
||||
this.cumulativeDuration += this.secondTime
|
||||
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||
this.$store.dispatch("userTrigger", event);
|
||||
});
|
||||
this.secondTime = 60
|
||||
this.sendEventData()
|
||||
}else{
|
||||
|
||||
@@ -474,31 +474,18 @@
|
||||
if (!this.contentData.id) {
|
||||
return;
|
||||
}
|
||||
let postData={
|
||||
"key": "StudyCourseOther",//课程学习的key
|
||||
"title": "非音视频课内容",//事件的标题
|
||||
"parameters":"second:60",//second:value 本次的学习时长
|
||||
"content": "学习课程",//事件的内容
|
||||
"objId": this.courseInfo.id,//课程的id
|
||||
"objType": "1",//类型
|
||||
"source":"page",
|
||||
"objInfo": ""+this.courseInfo.name,
|
||||
"aid":this.userInfo.aid, //当前登录人的id
|
||||
"aname":this.userInfo.name,//当前人的姓名
|
||||
"status": 1 //状态
|
||||
}
|
||||
//每一分钟保存一次
|
||||
// 取消阅读的每分钟六十秒的计时,最多是设置的时间或默认时间
|
||||
let $this=this;
|
||||
let startTime = new Date().getTime();
|
||||
this.appendStudyOtherHandle = setTimeout(function() {
|
||||
$this.cumulativeDuration += 60;
|
||||
let endTime = new Date().getTime();
|
||||
let totalTime = parseInt((endTime - startTime) / 1000);
|
||||
$this.cumulativeDuration += totalTime;
|
||||
if($this.cumulativeDuration <= $this.maxDuration){
|
||||
//静默处理
|
||||
apiStat.sendEvent(postData).then(rs=>{
|
||||
if(rs.status != 200) {
|
||||
console.log(rs.message);
|
||||
}
|
||||
});
|
||||
//发送时长
|
||||
$this.sendStudyOtherTime(totalTime);
|
||||
//递归调用
|
||||
$this.appendStudyOtherTime();
|
||||
}else{
|
||||
clearTimeout(this.appendStudyOtherHandle);
|
||||
@@ -508,6 +495,26 @@
|
||||
}, 1000*60);
|
||||
|
||||
},
|
||||
sendStudyOtherTime(totalTime){
|
||||
//静默处理
|
||||
apiStat.sendEvent({
|
||||
"key": "StudyCourseOther",//课程学习的key
|
||||
"title": "非音视频课内容",//事件的标题
|
||||
"parameters":"second:" + totalTime,//second:value 本次的学习时长
|
||||
"content": "学习课程",//事件的内容
|
||||
"objId": this.courseInfo.id,//课程的id
|
||||
"objType": "1",//类型
|
||||
"source":"page",
|
||||
"objInfo": ""+this.courseInfo.name,
|
||||
"aid":this.userInfo.aid, //当前登录人的id
|
||||
"aname":this.userInfo.name,//当前人的姓名
|
||||
"status": 1 //状态
|
||||
}).then(rs=>{
|
||||
if(rs.status != 200) {
|
||||
console.log(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
//笔记组件触发,播放指定时间
|
||||
onPlayVideo(contentId,time){
|
||||
//这里需要根据contentId,是否切换到对应的内容的视频的时间
|
||||
|
||||
Reference in New Issue
Block a user