mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-11 03:46:47 +08:00
Merge branch 'zcwyMaster' into 'master'
Zcwy master See merge request !16
This commit is contained in:
@@ -19,7 +19,8 @@ if(process.env.NODE_ENV === 'development'){
|
|||||||
oldApiBaseUrl = '/uboeApi';
|
oldApiBaseUrl = '/uboeApi';
|
||||||
statApiBaseUrl='/statApi';
|
statApiBaseUrl='/statApi';
|
||||||
socialApiBaseUrl='/socialApi';
|
socialApiBaseUrl='/socialApi';
|
||||||
fileUrl = 'https://u-pre.boe.com/cdn/upload';
|
fileUrl = 'https://u-pre.boe.com/upload';
|
||||||
|
//fileUrl = 'https://u-pre.boe.com/cdn/upload';
|
||||||
loginPath='/mobile/pages/login/login';
|
loginPath='/mobile/pages/login/login';
|
||||||
scormPlayer='https://u-pre.boe.com/scorm-player';
|
scormPlayer='https://u-pre.boe.com/scorm-player';
|
||||||
}else if(process.env.ENV_TYPE === 'preview'){
|
}else if(process.env.ENV_TYPE === 'preview'){
|
||||||
|
|||||||
@@ -49,7 +49,11 @@
|
|||||||
// 字符串的形式
|
// 字符串的形式
|
||||||
p: 'word-break:break-all;font-size: 28upx;letter-spacing:1rpx; line-height: 1.6;margin-bottom:25px',
|
p: 'word-break:break-all;font-size: 28upx;letter-spacing:1rpx; line-height: 1.6;margin-bottom:25px',
|
||||||
span: 'word-break:break-all;font-size: 28upx;letter-spacing:1rpx; line-height: 1.6'
|
span: 'word-break:break-all;font-size: 28upx;letter-spacing:1rpx; line-height: 1.6'
|
||||||
}
|
},
|
||||||
|
secondTime: 15,//默认时长
|
||||||
|
cumulativeDuration: 0,
|
||||||
|
setTime: null,
|
||||||
|
defaultMaxTime: 1800,//最大时长
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -74,15 +78,20 @@
|
|||||||
source:"h5",
|
source:"h5",
|
||||||
}
|
}
|
||||||
apiStat.sendEvent(event);
|
apiStat.sendEvent(event);
|
||||||
|
this.sendEventData()
|
||||||
// this.$store.dispatch("userTrigger", event);
|
// this.$store.dispatch("userTrigger", event);
|
||||||
this.setTime = setTimeout(()=>{
|
// this.setTime = setTimeout(()=>{
|
||||||
event.key = 'ReadArticle';
|
// event.key = 'ReadArticle';
|
||||||
event.title = "阅读文章";
|
// event.title = "阅读文章";
|
||||||
event.parameters='second:60';//增加60秒的学习时长
|
// event.parameters='second:60';//增加60秒的学习时长
|
||||||
event.content = "阅读了文章"
|
// event.content = "阅读了文章"
|
||||||
apiStat.sendEvent(event);
|
// apiStat.sendEvent(event);
|
||||||
// $this.$store.dispatch("userTrigger", event);
|
// // $this.$store.dispatch("userTrigger", event);
|
||||||
},61000);//1分钟后记录
|
// },61000);//1分钟后记录
|
||||||
|
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
this.setTime && clearTimeout(this.setTime);
|
||||||
},
|
},
|
||||||
onReachBottom(){
|
onReachBottom(){
|
||||||
this.getDetail()
|
this.getDetail()
|
||||||
@@ -91,6 +100,43 @@
|
|||||||
...mapGetters(['userInfo'])
|
...mapGetters(['userInfo'])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 发送计时
|
||||||
|
sendEventData(){
|
||||||
|
this.setTime && clearTimeout(this.setTime);
|
||||||
|
let startTime = new Date().getTime();
|
||||||
|
this.setTime = setTimeout(()=>{
|
||||||
|
let endTime = new Date().getTime();
|
||||||
|
let totalTime = Math.round((endTime - startTime) / 1000);
|
||||||
|
this.cumulativeDuration += totalTime;
|
||||||
|
console.log(this.cumulativeDuration,'时间');
|
||||||
|
if(this.cumulativeDuration <= this.defaultMaxTime){
|
||||||
|
this.sendStudyTime(totalTime)
|
||||||
|
this.secondTime = 60
|
||||||
|
this.sendEventData()
|
||||||
|
}else{
|
||||||
|
this.cumulativeDuration = 0
|
||||||
|
clearTimeout(this.setTime);
|
||||||
|
this.setTime = null
|
||||||
|
}
|
||||||
|
},this.secondTime * 1000);//15秒记录一次之后1分钟后记录
|
||||||
|
},
|
||||||
|
//发送学习时间
|
||||||
|
sendStudyTime(totalTime){
|
||||||
|
apiStat.sendEvent({
|
||||||
|
key: "ReadArticle",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "阅读文章",//事件的标题
|
||||||
|
parameters:"second:" + totalTime,//用户自定义参数 name:value,name:value
|
||||||
|
content: "阅读了文章",//事件的内容
|
||||||
|
source:'page',
|
||||||
|
objId: this.id,//关联的id
|
||||||
|
objType: "2",//关联的类型
|
||||||
|
objInfo: this.detail.title,
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 ,//状态,直接写1
|
||||||
|
source:"h5",
|
||||||
|
});
|
||||||
|
},
|
||||||
getDetail(){
|
getDetail(){
|
||||||
uni.showLoading({title:'加载中...'});
|
uni.showLoading({title:'加载中...'});
|
||||||
let $this=this;
|
let $this=this;
|
||||||
|
|||||||
@@ -486,6 +486,9 @@
|
|||||||
appendStudyOtherHandle:null,
|
appendStudyOtherHandle:null,
|
||||||
articleMore:true,
|
articleMore:true,
|
||||||
scormUrl:'',
|
scormUrl:'',
|
||||||
|
maxDuration:0, //非音频最大时长
|
||||||
|
cumulativeDuration:0, //非音频累计时长
|
||||||
|
defaultMaxTime:1800, //非音频默认最大时间
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -555,8 +558,9 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onHide(){
|
onHide(){
|
||||||
//清除定时任务
|
//清除定时任务,隐藏的时候不清除,因为没有停止播放
|
||||||
this.clearTimeHandle();
|
// this.clearTimeHandle();
|
||||||
|
console.log('触发onHide');
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.clearTimeHandle();
|
this.clearTimeHandle();
|
||||||
@@ -568,6 +572,12 @@
|
|||||||
getSysTypeTree:'sysType/getSysTypeTree',
|
getSysTypeTree:'sysType/getSysTypeTree',
|
||||||
loadSysTypes:'sysType/loadSysTypes'
|
loadSysTypes:'sysType/loadSysTypes'
|
||||||
}),
|
}),
|
||||||
|
// 没有写播放时间
|
||||||
|
onPlayerPlay() {
|
||||||
|
this.playerBoxShow = false;
|
||||||
|
this.isAppendTime=true;
|
||||||
|
this.appendStudyTime();//启动追加学习时长
|
||||||
|
},
|
||||||
convertTypeName(code){
|
convertTypeName(code){
|
||||||
if(!code){return '';}
|
if(!code){return '';}
|
||||||
return this.sysTypeMap.get(code);
|
return this.sysTypeMap.get(code);
|
||||||
@@ -945,13 +955,37 @@
|
|||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
this.scrollInfo.scrollLeft=len*this.scrollItemWidth+len*6;
|
this.scrollInfo.scrollLeft=len*this.scrollItemWidth+len*6;
|
||||||
if(con.contentType>20){
|
//50事scorm项目单独计时
|
||||||
|
if(con.contentType>20 && con.contentType !== 50){
|
||||||
let $this=this;
|
let $this=this;
|
||||||
//用户的学习时长,音视频课程学习,单独的处理,不再追加学习时长
|
//用户的学习时长,音视频课程学习,单独的处理,不再追加学习时长
|
||||||
this.isAppendTime = false;
|
this.isAppendTime = false;
|
||||||
this.appendStudyOtherHandle = setTimeout(function() {
|
this.appendStudyOtherHandle = setTimeout(function() {
|
||||||
|
// 开始之前把响应式清空
|
||||||
|
$this.maxDuration = 0;
|
||||||
|
$this.cumulativeDuration = 0;
|
||||||
|
// 没有设置默认时长三十分钟,
|
||||||
|
$this.maxDuration = con.duration !== 0 ? con.duration * 2 : $this.defaultMaxTime;
|
||||||
|
//静默处理
|
||||||
|
apiStat.sendEvent({
|
||||||
|
"key": "StudyCourse",//课程学习的key
|
||||||
|
"title": "学习课程",//事件的标题
|
||||||
|
"parameters":"second:15",//second:value,total:value 本次的学习时长
|
||||||
|
"content": "学习课程【"+$this.courseInfo.name+"】",//事件的内容
|
||||||
|
"objId": $this.courseInfo.id,//课程的id
|
||||||
|
"objType": "1",//类型
|
||||||
|
"source":"h5",
|
||||||
|
"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);
|
||||||
|
}
|
||||||
|
});
|
||||||
$this.appendStudyOtherTime();
|
$this.appendStudyOtherTime();
|
||||||
}, 1000*60*2); //非音视频课程学习,2分钟后记录,因为一次记录是60秒
|
}, 1000 * 15); //非音视频课程学习,15秒后记录,因为一次记录是60秒
|
||||||
//this.appendStudyTime();
|
//this.appendStudyTime();
|
||||||
//非视频,音频的5秒后学习完成
|
//非视频,音频的5秒后学习完成
|
||||||
if(con.contentType!=50){
|
if(con.contentType!=50){
|
||||||
@@ -1280,7 +1314,7 @@
|
|||||||
//静默处理
|
//静默处理
|
||||||
apiStat.sendEvent(postData).then(rs=>{
|
apiStat.sendEvent(postData).then(rs=>{
|
||||||
if(rs.status == 200) {
|
if(rs.status == 200) {
|
||||||
this.appendStartTime = new Date();//重新计时
|
//this.appendStartTime = new Date();//重新计时
|
||||||
studyUtil.clearStudyDuration(); //清除本地存储
|
studyUtil.clearStudyDuration(); //清除本地存储
|
||||||
} else {
|
} else {
|
||||||
console.log(rs.message);
|
console.log(rs.message);
|
||||||
@@ -1292,6 +1326,8 @@
|
|||||||
stopStudyTime(){
|
stopStudyTime(){
|
||||||
//console.log('停止追加学习时长');
|
//console.log('停止追加学习时长');
|
||||||
this.isAppendTime=false;
|
this.isAppendTime=false;
|
||||||
|
//暂停让他为空 从新计时
|
||||||
|
this.appendStartTime = null
|
||||||
if (this.appendHandle != null) {
|
if (this.appendHandle != null) {
|
||||||
window.clearTimeout(this.appendHandle);
|
window.clearTimeout(this.appendHandle);
|
||||||
}
|
}
|
||||||
@@ -1324,7 +1360,7 @@
|
|||||||
$this.appendStudyTime();
|
$this.appendStudyTime();
|
||||||
}, $this.appentInterval); //设置定时追加学习时长
|
}, $this.appentInterval); //设置定时追加学习时长
|
||||||
//保存之前的
|
//保存之前的
|
||||||
if (duration >0 ) {
|
if (duration >= 60 ) {
|
||||||
this.saveStudyDuration(duration);
|
this.saveStudyDuration(duration);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1332,13 +1368,16 @@
|
|||||||
//如果当前追加开始时间不为空
|
//如果当前追加开始时间不为空
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数
|
let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数
|
||||||
let sen = parseInt(m / 1000); //计算秒数
|
let sen = Math.round(m / 1000); //计算秒数
|
||||||
duration = duration + $this.appentInterval/1000;//追加的是秒
|
// 每次添加的是定时器计时的时间
|
||||||
if (sen>=60) { //一分钟保存一次
|
duration = duration + sen;//追加的是秒
|
||||||
|
if (duration >= 60) { //一分钟保存一次
|
||||||
this.saveStudyDuration(duration);
|
this.saveStudyDuration(duration);
|
||||||
} else {
|
} else {
|
||||||
studyUtil.setStudyDuration(duration); //添加到本地存储中
|
studyUtil.setStudyDuration(duration); //添加到本地存储中
|
||||||
}
|
}
|
||||||
|
//重新覆盖时间
|
||||||
|
this.appendStartTime = new Date();
|
||||||
//启动下次追加学习时长
|
//启动下次追加学习时长
|
||||||
this.appendHandle = setTimeout(function() {
|
this.appendHandle = setTimeout(function() {
|
||||||
$this.appendStudyTime();
|
$this.appendStudyTime();
|
||||||
@@ -1353,31 +1392,44 @@
|
|||||||
if (!this.curContent.id) {
|
if (!this.curContent.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let postData={
|
|
||||||
"key": "StudyCourseOther",//课程学习的key
|
|
||||||
"title": "非音视频课内容",//事件的标题
|
|
||||||
"parameters":"second:60",//second:value 本次的学习时长
|
|
||||||
"content": "学习课程",//事件的内容
|
|
||||||
"objId": this.courseInfo.id,//课程的id
|
|
||||||
"objType": "1",//类型
|
|
||||||
"source":"h5",
|
|
||||||
"objInfo": ""+this.courseInfo.name,
|
|
||||||
"aid":this.userInfo.aid, //当前登录人的id
|
|
||||||
"aname":this.userInfo.name,//当前人的姓名
|
|
||||||
"status": 1 //状态
|
|
||||||
}
|
|
||||||
//静默处理
|
|
||||||
apiStat.sendEvent(postData).then(rs=>{
|
|
||||||
if(rs.status != 200) {
|
|
||||||
console.log(rs.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//每一分钟保存一次
|
//每一分钟保存一次
|
||||||
let $this=this;
|
// 取消阅读的每分钟六十秒的计时,最多是设置的时间或默认时间
|
||||||
this.appendStudyOtherHandle = setTimeout(function() {
|
let $this=this;
|
||||||
$this.appendStudyOtherTime();
|
let startTime = new Date().getTime();
|
||||||
}, 1000*60);
|
this.appendStudyOtherHandle = setTimeout(function() {
|
||||||
|
let endTime = new Date().getTime();
|
||||||
|
let totalTime = Math.round((endTime - startTime) / 1000);
|
||||||
|
$this.cumulativeDuration += totalTime;
|
||||||
|
if($this.cumulativeDuration <= $this.maxDuration){
|
||||||
|
//静默处理
|
||||||
|
$this.sendOtherTime(totalTime)
|
||||||
|
$this.appendStudyOtherTime();
|
||||||
|
}else{
|
||||||
|
clearTimeout(this.appendStudyOtherHandle);
|
||||||
|
$this.cumulativeDuration = 0;
|
||||||
|
$this.maxDuration = 0;
|
||||||
|
}
|
||||||
|
}, 1000*60);
|
||||||
|
|
||||||
|
},
|
||||||
|
sendOtherTime(totalTime){
|
||||||
|
apiStat.sendEvent({
|
||||||
|
"key": "StudyCourseOther",//课程学习的key
|
||||||
|
"title": "非音视频课内容",//事件的标题
|
||||||
|
"parameters":"second:" + totalTime,//second:value 本次的学习时长
|
||||||
|
"content": "学习课程",//事件的内容
|
||||||
|
"objId": this.courseInfo.id,//课程的id
|
||||||
|
"objType": "1",//类型
|
||||||
|
"source":"h5",
|
||||||
|
"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);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
//先保存学习的内容,针对于音视频的内容
|
//先保存学习的内容,针对于音视频的内容
|
||||||
saveStudyItem(){
|
saveStudyItem(){
|
||||||
|
|||||||
Reference in New Issue
Block a user