From 6b6e8a4096328d0db7567e9bf6f8325c320a62a8 Mon Sep 17 00:00:00 2001 From: joshen <445497689@qq.com> Date: Thu, 10 Oct 2024 23:07:46 +0800 Subject: [PATCH 1/6] =?UTF-8?q?pc=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=99=A8=E7=A6=81=E6=AD=A2=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/VideoPlayer/index.vue | 25 +++++++++-- src/components/VideoPlayer/progress-bar.vue | 44 +++++++++++++++----- src/views/study/coursenew.vue | 46 ++++++++++++++++++++- 3 files changed, 101 insertions(+), 14 deletions(-) diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index bf7b6f2f..3869ae06 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -40,12 +40,12 @@ :isPlaying="isPlaying" :biBarrageXml="biBarrageXml" /> - -
+ +
loading
-
+
当前音量:{{volumePercent}}%
@@ -71,6 +71,7 @@
{ + console.log('this.currentProgress::',this.currentProgress,this.isDrag) + // 视频播放时本地记录视频实时播放时长,视频设置了禁止拖动时执行 + if(!this.isDrag){ + var time = localStorage.getItem('videoProgressData') + var arr = time&&JSON.parse(time) || {} + if(arr[this.blobId] < this.currentProgress || !arr[this.blobId]){ + arr[this.blobId] = parseFloat((this.currentProgress).toFixed(8)) + if(arr[this.blobId]) localStorage.setItem('videoProgressData',JSON.stringify(arr)) + } + } + // 定时更新进度条 if (this.isPlaying && !this.isMousedownProgress) { this.currentProgress = @@ -365,11 +382,13 @@ export default { //当视频由于需要缓冲下一帧而停止,解决一直计时的问题 onWaiting(){ console.log('触发了onWairing'); + this.isShowLoading = true this.$emit('onPlayerPause', {}) }, //当音频/视频在已因缓冲而暂停或停止后已就绪时 onPlaying(){ console.log('触发缓存结束onPlaying'); + this.isShowLoading = false if(this.videoDom.paused){ this.$emit('onPlayerPause', {}) }else{ diff --git a/src/components/VideoPlayer/progress-bar.vue b/src/components/VideoPlayer/progress-bar.vue index 0a2e72ec..f9a3c7ca 100644 --- a/src/components/VideoPlayer/progress-bar.vue +++ b/src/components/VideoPlayer/progress-bar.vue @@ -38,6 +38,9 @@ export default { isDrag:{ type: Boolean, default: true, + }, + blobId:{ + type: String, } }, data() { @@ -57,10 +60,12 @@ export default { window.addEventListener("mousemove", (e) => { if (this.is_mousedown_progress) { this.move(e); + e.preventDefault(); } }); window.addEventListener("mouseup", (e) => { this.up(e); + e.preventDefault(); }); }, beforeDestroy() { @@ -68,7 +73,7 @@ export default { }, methods: { down(e) { - if(this.isDrag) { + // if(this.isDrag) { this.$emit("getMouseDownStatus", true); this.is_mousedown_progress = true; // 获取完整进度条的clientX(dom左上角) @@ -76,28 +81,47 @@ export default { // 计算调整后的当前进度条的长度 this.current_width_px = e.clientX - init_clientX; // 设置当前的播放进度(同时作用于当前进度条的样式) - let current = - (e.clientX - init_clientX) / this.dom_full.clientWidth; + let current = (e.clientX - init_clientX) / this.dom_full.clientWidth; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + console.log('down arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) + // 禁止拖动 + if(!this.isDrag && time && arr[this.blobId] < current) return; + this.$emit("updateProgress", current); - } + // } }, move(e) { - if (this.is_mousedown_progress && this.isDrag) { + if (this.is_mousedown_progress) { let init_clientX = this.dom_full.getBoundingClientRect().left; this.current_width_px = e.clientX - init_clientX; - let current = - (e.clientX - init_clientX) / this.dom_full.clientWidth; + let current = (e.clientX - init_clientX) / this.dom_full.clientWidth; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + console.log('move arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) + // 禁止拖动 + if(!this.isDrag && time && arr[this.blobId] < current) return; this.$emit("updateProgress", current); } }, up() { - if (this.is_mousedown_progress && this.isDrag) { + if (this.is_mousedown_progress) { // 标记鼠标不处于按下的状态了 this.is_mousedown_progress = false; // 松开鼠标后,即调整进度条后,此时的进度(0-1) - let current = - this.current_width_px / this.dom_full.clientWidth; + let current = this.current_width_px / this.dom_full.clientWidth; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + console.log('up arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) + // 禁止拖动 + if(!this.isDrag && time && arr[this.blobId] < current) return; this.$emit("updateProgress", current); this.$emit("getMouseDownStatus", false); } diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index a82814dd..9a3339b5 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -27,7 +27,7 @@
- @@ -652,6 +652,8 @@ } else { this.blobUrl = process.env.VUE_APP_BASE_API + '/xboe/m/course/cware/resource?sign=' + urlSign; } + console.log('this.contentData.id:',this.contentData.id) + this.blobId = this.contentData.id //console.log(this.blobUrl,'this.blobUrl'); }, widthOpen(url) { @@ -814,6 +816,28 @@ $this.controlHeight=h-95; //console.log(h,$this.controlHeight,'$this.controlHeight'); }) + + + console.log('this.contentData11:',this.contentData,this.curriculumData) + // 视频设置禁用处理逻辑,如果用户已全部观看完该视频,则设置为能全部拖动的逻辑,把isDrag设置为true即可,同时删除本地存储的数据 + if(this.contentData.progressVideo ===1){ + var obj = JSON.parse(this.contentData.content) + obj.isDrag = true + this.contentData.content = JSON.stringify(obj) + this.curriculumData.isDrag = true + var time = localStorage.getItem('videoProgressData') + var arr = time&&JSON.parse(time) || {} + //alert(con.progressVideo+'--'+con.id + '--'+JSON.stringify(arr)) + delete arr[this.contentData.id]; + localStorage.setItem('videoProgressData',JSON.stringify(arr)) + } + if(this.contentData.progressVideo>0 && this.contentData.progressVideo !==1){ + var time = localStorage.getItem('videoProgressData') + var arr = time&&JSON.parse(time) || {} + arr[this.contentData.id] = this.contentData.progressVideo + localStorage.setItem('videoProgressData',JSON.stringify(arr)) + } + }, isShowTime(){ if(this.isContentTypeTwo != this.contentData.contentType){ @@ -1205,6 +1229,16 @@ itemId: this.contentData.studyItemId, videoTime: intTime }; + console.log('this.courseInfo:',this.contentData) + if(!this.curriculumData.isDrag && this.contentData.progressVideo !=1){ + var time = localStorage.getItem('videoProgressData') + var arr = time&&JSON.parse(time) || {} + if(arr[this.blobId] && this.contentData.progressVideo { if (rs.status != 200) { @@ -1247,6 +1281,16 @@ itemId: this.contentData.studyItemId, videoTime: intTime }; + console.log('this.courseInfo:',this.contentData) + if(!this.curriculumData.isDrag && this.contentData.progressVideo !=1){ + var time = localStorage.getItem('videoProgressData') + var arr = time&&JSON.parse(time) || {} + if(arr[this.blobId] && this.contentData.progressVideo { if (rs.status != 200) { From f01283f5301dd07f9829e00bac604785bfb143db Mon Sep 17 00:00:00 2001 From: joshen Date: Thu, 9 Jan 2025 11:49:44 +0800 Subject: [PATCH 2/6] 10.251.132.75 --- .env.production | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.production b/.env.production index 195e48a9..351fe739 100644 --- a/.env.production +++ b/.env.production @@ -16,19 +16,19 @@ VUE_APP_CESOURCE_BASE_API = '/socialApi' VUE_APP_STAT_BASE_API = '/statApi' # BOE系统网址 -VUE_APP_BOE_WEB_URL = 'https://u.boe.com' +VUE_APP_BOE_WEB_URL = 'http://10.251.132.75' # BOE 移动端url -VUE_APP_BOE_MOBILE_URL = 'https://u.boe.com' +VUE_APP_BOE_MOBILE_URL = 'http://10.251.132.75' # File路径的基础url -VUE_APP_FILE_BASE_URL='https://u.boe.com/upload' +VUE_APP_FILE_BASE_URL='http://10.251.132.75/upload' # File路径的基础url的相对路径,加此项是为了不影响之前的路径配置 VUE_APP_FILE_RELATIVE_PATH = '/upload' # 受众批量导入人员信息URL -VUE_APP_AUDIENCE_IMPORT_URL = 'https://u.boe.com/userbasic/audience/import' +VUE_APP_AUDIENCE_IMPORT_URL = 'http://10.251.132.75/userbasic/audience/import' @@ -39,10 +39,10 @@ VUE_APP_STUDENT_PATH='/fe-student' VUE_APP_MANAGER_API_PATH='/manageApi' # 登录地址 -VUE_APP_LOGIN_URL='https://u.boe.com/web/' +VUE_APP_LOGIN_URL='http://10.251.132.75/web/' # scorm课件的播放url地址 -VUE_APP_SCORM_URL = 'https://u.boe.com/newscorm/scorm-player' +VUE_APP_SCORM_URL = 'http://10.251.132.75/newscorm/scorm-player' #案例组织领域类型 VUE_APP_CASE_TYPE = '155' From d0a6807d2c36c0c95d657839af7193df4c2d157e Mon Sep 17 00:00:00 2001 From: zhangsir Date: Thu, 9 Jan 2025 17:30:40 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/case/Index.vue | 6 +++--- src/views/study/Courses.vue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 7a3f91b5..0cedc298 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -1507,7 +1507,7 @@ export default { }; }); res.result.list.forEach(item=>{ - item.viewRankTags = item.viewRankTags.slice(0,2) + item.viewRankTags = item.viewRankTags?.slice(0,2)||[] }) this.caseList.list = res.result.list this.getCaseUserData(res.result.list); @@ -1562,7 +1562,7 @@ export default { }; }); res.result.list.forEach(item=>{ - item.viewRankTags = item.viewRankTags.slice(0,2) + item.viewRankTags = item.viewRankTags?.slice(0,2)||[] }) this.caseList.list = res.result.list this.getCaseUserData(res.result.list); @@ -1601,7 +1601,7 @@ export default { } // console.log(res?.result?.list ,'有没有数据'); res.result.list.forEach(item=>{ - item.viewRankTags = item.viewRankTags.slice(0,2) + item.viewRankTags = item.viewRankTags?.slice(0,2)||[] }) this.caseList.list = res.result.list this.getCaseUserData(res.result.list); diff --git a/src/views/study/Courses.vue b/src/views/study/Courses.vue index f83bb31a..16e767c1 100644 --- a/src/views/study/Courses.vue +++ b/src/views/study/Courses.vue @@ -253,8 +253,8 @@ export default { if(res.status==200){ let localCourseIds=[];//本地在线课程的id集合 res.result.list.forEach(item=>{ - if(item.courseImage.startsWith('/upload')){ - item.courseImage=$this.fileUrl+item.courseImage.substring(7) + if(item.courseImage?.startsWith('/upload')){ + item.courseImage=$this.fileUrl+item.courseImage?.substring(7) } if(item.source==2){ localCourseIds.push(item.id); From 398bbc675bb47f0fa5e98e7af84120e9a1a4954a Mon Sep 17 00:00:00 2001 From: zhangsir Date: Fri, 10 Jan 2025 09:49:25 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/case/ManageList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/case/ManageList.vue b/src/views/case/ManageList.vue index ed237e54..5e70ac72 100644 --- a/src/views/case/ManageList.vue +++ b/src/views/case/ManageList.vue @@ -52,7 +52,7 @@