mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 11:56:44 +08:00
Merge branch 'zcwyTeacher' into 'master'
Zcwy teacher See merge request !89
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
tabindex="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
@waiting="onWaiting"
|
||||
@playing="onPlaying"
|
||||
>
|
||||
<source :src="src" />
|
||||
</video>
|
||||
@@ -358,6 +360,20 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//当视频由于需要缓冲下一帧而停止,解决一直计时的问题
|
||||
onWaiting(){
|
||||
console.log('触发了onWairing');
|
||||
this.$emit('onPlayerPause', {})
|
||||
},
|
||||
//当音频/视频在已因缓冲而暂停或停止后已就绪时
|
||||
onPlaying(){
|
||||
console.log('触发缓存结束onPlaying');
|
||||
if(this.videoDom.paused){
|
||||
this.$emit('onPlayerPause', {})
|
||||
}else{
|
||||
this.$emit('onPlayerPlay', {});
|
||||
}
|
||||
},
|
||||
/* 切换播放状态
|
||||
*/
|
||||
togglePlayStatus() {
|
||||
@@ -372,6 +388,7 @@ export default {
|
||||
this.isPlaying = true;
|
||||
this.isInit = true;
|
||||
this.$emit('onPlayerPlay', {});//播放(播放时会调用)
|
||||
console.log('播放');
|
||||
} else {
|
||||
this.videoDom.pause();
|
||||
this.isPlaying = false;
|
||||
|
||||
@@ -282,23 +282,14 @@ 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
|
||||
}
|
||||
this.setTime && clearTimeout(this.setTime);
|
||||
let startTime = new Date().getTime();
|
||||
this.setTime = setTimeout(()=>{
|
||||
this.cumulativeDuration += this.secondTime
|
||||
let endTime = new Date().getTime();
|
||||
let totalTime = Math.round((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 +299,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,22 +541,15 @@ export default {
|
||||
})
|
||||
},
|
||||
sendEventData() {
|
||||
let event = {
|
||||
key: "ReadCase",//后台的事件key 发布文章且审核通过
|
||||
title: '阅读案例',//事件的标题
|
||||
parameters: "second:" + this.secondTime,//用户自定义参数 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.setTimeCase && clearTimeout(this.setTimeCase);
|
||||
let startTime = new Date().getTime();
|
||||
this.setTimeCase = setTimeout(() => {
|
||||
this.cumulativeDuration += this.secondTime
|
||||
let endTime = new Date().getTime();
|
||||
let totalTime = Math.round((endTime - startTime) / 1000);
|
||||
this.cumulativeDuration += totalTime
|
||||
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||
this.$store.dispatch("userTrigger", event);
|
||||
console.log(totalTime,'时长');
|
||||
this.sendStudyTime(totalTime)
|
||||
this.secondTime = 60
|
||||
this.sendEventData()
|
||||
}else{
|
||||
@@ -566,6 +559,20 @@ export default {
|
||||
}
|
||||
}, this.secondTime * 1000);//15秒记录一次之后1分钟之后发送阅读案例事件
|
||||
},
|
||||
sendStudyTime(totalTime){
|
||||
this.$store.dispatch("userTrigger", {
|
||||
key: "ReadCase",//后台的事件key 发布文章且审核通过
|
||||
title: '阅读案例',//事件的标题
|
||||
parameters: "second:" + totalTime,//用户自定义参数 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
|
||||
});
|
||||
},
|
||||
getCaseData() {
|
||||
let $this = this;
|
||||
apiCase.details(this.resolveId, true).then(res => {
|
||||
|
||||
@@ -669,17 +669,17 @@ export default {
|
||||
};
|
||||
},
|
||||
// 受众需要每次刷新
|
||||
// created() {
|
||||
// let localKey = "user_" + this.userInfo.sysId + "_gids";
|
||||
// apiUserbasic.getInAudienceIds().then(rs => {
|
||||
// if (rs.status == 200) {
|
||||
// this.audiences = rs.result;
|
||||
// sessionStorage.setItem(localKey, this.audiences);
|
||||
// } else {
|
||||
// console.log(rs.message);
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
created() {
|
||||
let localKey = "user_" + this.userInfo.sysId + "_gids";
|
||||
apiUserbasic.getInAudienceIds().then(rs => {
|
||||
if (rs.status == 200) {
|
||||
this.audiences = rs.result;
|
||||
sessionStorage.setItem(localKey, this.audiences);
|
||||
} else {
|
||||
console.log(rs.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
let screenWidth = window.screen.availWidth;
|
||||
// if (screenWidth < 1280) {
|
||||
|
||||
@@ -396,7 +396,7 @@
|
||||
appendStudyOtherHandle:null,
|
||||
cumulativeDuration:0, //非音频累计时长
|
||||
maxDuration:0, //非音频最大时长
|
||||
defaultMaxTime:1800 //非音频默认最大时间
|
||||
defaultMaxTime:1800, //非音频默认最大时间
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -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 = Math.round((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,是否切换到对应的内容的视频的时间
|
||||
@@ -1400,7 +1407,7 @@
|
||||
//静默处理
|
||||
apiStat.sendEvent(postData).then(rs=>{
|
||||
if(rs.status == 200) {
|
||||
this.appendStartTime = new Date();//重新计时
|
||||
// this.appendStartTime = new Date();//重新计时
|
||||
studyUtil.clearStudyDuration(); //清除本地存储
|
||||
} else {
|
||||
console.log(rs.message);
|
||||
@@ -1428,6 +1435,8 @@
|
||||
stopStudyTime(){
|
||||
//console.log('停止追加学习时长');
|
||||
this.isAppendTime=false;
|
||||
//暂停让他为空 从新计时
|
||||
this.appendStartTime = null
|
||||
if (this.appendHandle != null) {
|
||||
window.clearTimeout(this.appendHandle);
|
||||
}
|
||||
@@ -1460,7 +1469,7 @@
|
||||
$this.appendStudyTime();
|
||||
}, $this.appentInterval); //设置定时追加学习时长
|
||||
//保存之前的
|
||||
if (duration >0 ) {
|
||||
if (duration >= 60 ) {
|
||||
this.saveStudyDuration(duration);
|
||||
}
|
||||
return;
|
||||
@@ -1468,13 +1477,19 @@
|
||||
//如果当前追加开始时间不为空
|
||||
let now = new Date();
|
||||
let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数
|
||||
let sen = parseInt(m / 1000); //计算秒数
|
||||
duration = duration + $this.appentInterval/1000;//追加的是秒
|
||||
if (sen>=60) { //一分钟保存一次
|
||||
// console.log(m/1000,'时间');
|
||||
|
||||
let sen = Math.round(m / 1000); //计算秒数
|
||||
// console.log('定时器时间',sen);
|
||||
// 每次添加的是定时器计时的时间
|
||||
duration = duration + sen;//追加的是秒
|
||||
if (duration >= 60) { //一分钟保存一次
|
||||
this.saveStudyDuration(duration);
|
||||
} else {
|
||||
studyUtil.setStudyDuration(duration); //添加到本地存储中
|
||||
}
|
||||
//重新覆盖时间
|
||||
this.appendStartTime = new Date();
|
||||
//启动下次追加学习时长
|
||||
this.appendHandle = setTimeout(function() {
|
||||
$this.appendStudyTime();
|
||||
|
||||
Reference in New Issue
Block a user