From 74ca5548041cd8f4f9000936dba8c9cf064bf474 Mon Sep 17 00:00:00 2001 From: zhangsir Date: Thu, 16 Nov 2023 14:15:03 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8F=97=E4=BC=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/course/Index.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/views/portal/course/Index.vue b/src/views/portal/course/Index.vue index bf8a9c1b..45aaf00c 100644 --- a/src/views/portal/course/Index.vue +++ b/src/views/portal/course/Index.vue @@ -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) { From a3fb600f4dbae4862b12da22ac7a0b7a6395d18f Mon Sep 17 00:00:00 2001 From: nisen Date: Fri, 17 Nov 2023 14:18:25 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=B5=8F=E8=A7=88=E5=99=A8=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E4=B8=8A=E4=BC=A0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/study/coursenew.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 05aed8cf..50bf1005 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -396,7 +396,7 @@ appendStudyOtherHandle:null, cumulativeDuration:0, //非音频累计时长 maxDuration:0, //非音频最大时长 - defaultMaxTime:1800 //非音频默认最大时间 + defaultMaxTime:1800, //非音频默认最大时间 } }, mounted() { @@ -1400,7 +1400,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); @@ -1469,12 +1469,16 @@ 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('定时器时间',sen); + // 每次添加的是定时器计时的时间 + duration = duration + sen;//追加的是秒 + if (duration >= 60) { //一分钟保存一次 this.saveStudyDuration(duration); } else { studyUtil.setStudyDuration(duration); //添加到本地存储中 } + //重新覆盖时间 + this.appendStartTime = new Date(); //启动下次追加学习时长 this.appendHandle = setTimeout(function() { $this.appendStudyTime(); From ed2fef1d4b4327811326151993fa54ae71ea7b10 Mon Sep 17 00:00:00 2001 From: nisen Date: Mon, 20 Nov 2023 13:40:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=A1=88=E4=BE=8B=E5=92=8C=E6=96=87=E7=AB=A0=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/article/Detail.vue | 36 +++++++++++++--------- src/views/portal/case/Detail.vue | 30 +++++++++--------- src/views/study/coursenew.vue | 47 +++++++++++++++++------------ 3 files changed, 64 insertions(+), 49 deletions(-) diff --git a/src/views/portal/article/Detail.vue b/src/views/portal/article/Detail.vue index 83f5039b..7ee41347 100644 --- a/src/views/portal/article/Detail.vue +++ b/src/views/portal/article/Detail.vue @@ -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] diff --git a/src/views/portal/case/Detail.vue b/src/views/portal/case/Detail.vue index 869bf454..a74997c5 100644 --- a/src/views/portal/case/Detail.vue +++ b/src/views/portal/case/Detail.vue @@ -541,22 +541,24 @@ 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 - } + let startTime = new Date().getTime(); this.setTimeCase = 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.$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 + }); this.secondTime = 60 this.sendEventData() }else{ diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 50bf1005..8bce3233 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -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,是否切换到对应的内容的视频的时间 From b4f42f8556bf6601aac283713f69454b8b2d6245 Mon Sep 17 00:00:00 2001 From: nisen Date: Mon, 20 Nov 2023 14:31:20 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=9A=82=E5=81=9C=E6=97=B6=E6=8A=8A?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=AF=B7=E7=A9=BA=E9=87=8D=E6=96=B0=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/study/coursenew.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 8bce3233..85fa59d7 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -1435,6 +1435,8 @@ stopStudyTime(){ //console.log('停止追加学习时长'); this.isAppendTime=false; + //暂停让他为空 从新计时 + this.appendStartTime = null if (this.appendHandle != null) { window.clearTimeout(this.appendHandle); } @@ -1467,7 +1469,7 @@ $this.appendStudyTime(); }, $this.appentInterval); //设置定时追加学习时长 //保存之前的 - if (duration >0 ) { + if (duration >= 60 ) { this.saveStudyDuration(duration); } return; From c702208b95c7467ffff73cbdbe53d96953b75e0c Mon Sep 17 00:00:00 2001 From: nisen Date: Mon, 20 Nov 2023 14:43:00 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E9=83=BD=E6=B8=85?= =?UTF-8?q?=E6=A5=9A=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/article/Detail.vue | 1 + src/views/portal/case/Detail.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/src/views/portal/article/Detail.vue b/src/views/portal/article/Detail.vue index 7ee41347..336ffc68 100644 --- a/src/views/portal/article/Detail.vue +++ b/src/views/portal/article/Detail.vue @@ -282,6 +282,7 @@ export default { }) }, sendEventData(){ + this.setTime && clearTimeout(this.setTime); let startTime = new Date().getTime(); this.setTime = setTimeout(()=>{ let endTime = new Date().getTime(); diff --git a/src/views/portal/case/Detail.vue b/src/views/portal/case/Detail.vue index a74997c5..4fc03bc3 100644 --- a/src/views/portal/case/Detail.vue +++ b/src/views/portal/case/Detail.vue @@ -541,6 +541,7 @@ export default { }) }, sendEventData() { + this.setTimeCase && clearTimeout(this.setTimeCase); let startTime = new Date().getTime(); this.setTimeCase = setTimeout(() => { let endTime = new Date().getTime(); From 6a811e42bc6c824bc70f8da2e34fc2cc094fc4b2 Mon Sep 17 00:00:00 2001 From: nisen Date: Mon, 20 Nov 2023 15:46:50 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E8=BD=AC=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/article/Detail.vue | 2 +- src/views/portal/case/Detail.vue | 2 +- src/views/study/coursenew.vue | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/portal/article/Detail.vue b/src/views/portal/article/Detail.vue index 336ffc68..bd6b2110 100644 --- a/src/views/portal/article/Detail.vue +++ b/src/views/portal/article/Detail.vue @@ -286,7 +286,7 @@ export default { let startTime = new Date().getTime(); this.setTime = setTimeout(()=>{ let endTime = new Date().getTime(); - let totalTime = parseInt((endTime - startTime) / 1000); + let totalTime = Math.round((endTime - startTime) / 1000); this.cumulativeDuration += totalTime; if(this.cumulativeDuration <= this.defaultMaxTime){ this.sendStudyTime(totalTime); diff --git a/src/views/portal/case/Detail.vue b/src/views/portal/case/Detail.vue index 4fc03bc3..180157ce 100644 --- a/src/views/portal/case/Detail.vue +++ b/src/views/portal/case/Detail.vue @@ -545,7 +545,7 @@ export default { let startTime = new Date().getTime(); this.setTimeCase = setTimeout(() => { let endTime = new Date().getTime(); - let totalTime = parseInt((endTime - startTime) / 1000); + let totalTime = Math.round((endTime - startTime) / 1000); this.cumulativeDuration += totalTime if(this.cumulativeDuration <= this.defaultMaxTime){ this.$store.dispatch("userTrigger", { diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 85fa59d7..06457d30 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -480,7 +480,7 @@ let startTime = new Date().getTime(); this.appendStudyOtherHandle = setTimeout(function() { let endTime = new Date().getTime(); - let totalTime = parseInt((endTime - startTime) / 1000); + let totalTime = Math.round((endTime - startTime) / 1000); $this.cumulativeDuration += totalTime; if($this.cumulativeDuration <= $this.maxDuration){ //发送时长 @@ -1477,7 +1477,9 @@ //如果当前追加开始时间不为空 let now = new Date(); let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数 - let sen = parseInt(m / 1000); //计算秒数 + console.log(m/1000,'时间'); + + let sen = Math.round(m / 1000); //计算秒数 console.log('定时器时间',sen); // 每次添加的是定时器计时的时间 duration = duration + sen;//追加的是秒 From 50de4fcb99176b73801604da499e9be304a21149 Mon Sep 17 00:00:00 2001 From: nisen Date: Mon, 20 Nov 2023 16:17:57 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/case/Detail.vue | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/views/portal/case/Detail.vue b/src/views/portal/case/Detail.vue index 180157ce..be0d17ce 100644 --- a/src/views/portal/case/Detail.vue +++ b/src/views/portal/case/Detail.vue @@ -548,18 +548,8 @@ export default { let totalTime = Math.round((endTime - startTime) / 1000); this.cumulativeDuration += totalTime if(this.cumulativeDuration <= this.defaultMaxTime){ - 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 - }); + console.log(totalTime,'时长'); + this.sendStudyTime(totalTime) this.secondTime = 60 this.sendEventData() }else{ @@ -569,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 => { From 18092b9a0b366f175822f6086840b2363c783e9d Mon Sep 17 00:00:00 2001 From: nisen Date: Tue, 21 Nov 2023 10:17:01 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=92=AD=E6=94=BE=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=A7=A3=E5=86=B3=E8=A7=86=E9=A2=91=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E4=B8=80=E7=9B=B4=E8=AE=A1=E6=97=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/VideoPlayer/index.vue | 17 +++++++++++++++++ src/views/study/coursenew.vue | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index 55f7f6c9..922e3ab9 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -22,6 +22,8 @@ tabindex="0" width="100%" height="100%" + @waiting="onWaiting" + @playing="onPlaying" > @@ -358,6 +360,20 @@ export default { }); }, methods: { + //当视频由于需要缓冲下一帧而停止,解决一直计时的问题 + onWaiting(){ + console.log('触发了onWairing'); + this.$emit('onPlayerEnded', {}) + }, + //当音频/视频在已因缓冲而暂停或停止后已就绪时 + onPlaying(){ + console.log('触发缓存结束onPlaying'); + if(this.videoDom.paused){ + this.$emit('onPlayerEnded', {}) + }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; diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 06457d30..a15c90df 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -1477,10 +1477,10 @@ //如果当前追加开始时间不为空 let now = new Date(); let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数 - console.log(m/1000,'时间'); + // console.log(m/1000,'时间'); let sen = Math.round(m / 1000); //计算秒数 - console.log('定时器时间',sen); + // console.log('定时器时间',sen); // 每次添加的是定时器计时的时间 duration = duration + sen;//追加的是秒 if (duration >= 60) { //一分钟保存一次 From ac948790052d990035c08ee305736187e6be9d69 Mon Sep 17 00:00:00 2001 From: nisen Date: Tue, 21 Nov 2023 13:20:15 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/VideoPlayer/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index 922e3ab9..95bd36d5 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -363,13 +363,13 @@ export default { //当视频由于需要缓冲下一帧而停止,解决一直计时的问题 onWaiting(){ console.log('触发了onWairing'); - this.$emit('onPlayerEnded', {}) + this.$emit('onPlayerPause', {}) }, //当音频/视频在已因缓冲而暂停或停止后已就绪时 onPlaying(){ console.log('触发缓存结束onPlaying'); if(this.videoDom.paused){ - this.$emit('onPlayerEnded', {}) + this.$emit('onPlayerPause', {}) }else{ this.$emit('onPlayerPlay', {}); }