From 362567735732b99686f73aeb116a5f56d2e06c5b Mon Sep 17 00:00:00 2001 From: daihh Date: Wed, 19 Oct 2022 21:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE=E7=AC=94?= =?UTF-8?q?=E8=AE=B0=E8=AE=B0=E5=BD=95=E6=97=B6=E9=97=B4=E7=9A=84=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/myNote.vue | 28 ++-- src/components/VideoPlayer/index.vue | 24 ++- src/components/VideoPlayer/progress-bar.vue | 2 +- src/views/study/coursenew.vue | 158 ++++++++++++-------- 4 files changed, 125 insertions(+), 87 deletions(-) diff --git a/src/components/Course/myNote.vue b/src/components/Course/myNote.vue index 3fde660a..b54e606d 100644 --- a/src/components/Course/myNote.vue +++ b/src/components/Course/myNote.vue @@ -14,8 +14,7 @@
+ v-model="content_new" maxlength="200" :autosize="{ minRows: inputRows, maxRows: 20}" show-word-limit>
@@ -23,8 +22,7 @@
-
+
{{note.sysUpdateTime}} {{note.openType == 9?'公开':'私密'}} @@ -32,20 +30,16 @@ - + - 删除 + 删除 - 编辑 + 编辑 -
+
{{formatSeconds(note.playTime)}}
@@ -73,17 +67,15 @@
- +
- 视频位置 + 视频位置 公开 私密 取消 @@ -184,7 +176,7 @@ export default { }, data(val){ if(val.id) { - console.log(val,'val'); + //console.log(val,'val'); this.mynoteData.courseId = this.courseId; this.mynoteData.courseName = this.data.name; // this.mynoteData.contentId = this.data.id; diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index 83f96fe5..7b44d328 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -524,6 +524,16 @@ export default { document.msFullScreen ); }, + //开始播放 + startPlay:function(newTime){ + if(newTime){ + this.videoDom.currentTime = newTime; + this.barrageTimelineStart = newTime; + this.updateProgressBySetTime(newTime); + } + this.isPlaying = true; + this.videoDom.play(); + }, }, watch: { currentVolume: function () { @@ -539,13 +549,13 @@ export default { this.$emit('onPlayerEnded', {}) } }, - notePlay: function(val) { - if(val) { - this.updateProgressBySetTime(val); - this.isPlaying = true; - this.videoDom.play(); - } - }, + // notePlay: function(val) { + // if(val) { + // this.updateProgressBySetTime(val); + // this.isPlaying = true; + // this.videoDom.play(); + // } + // }, src: function () { // 当视频地址变更时,重载视频 this.videoDom.load(); diff --git a/src/components/VideoPlayer/progress-bar.vue b/src/components/VideoPlayer/progress-bar.vue index 325215a2..0a2e72ec 100644 --- a/src/components/VideoPlayer/progress-bar.vue +++ b/src/components/VideoPlayer/progress-bar.vue @@ -49,7 +49,7 @@ export default { }; }, mounted() { - console.log(this.isDrag,'isDrag'); + //console.log(this.isDrag,'isDrag'); //初始化一些固定数据 let dom_full = this.$el.getElementsByClassName("progress-full")[0]; this.dom_full = dom_full; diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index a7f91c61..00d00376 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -25,7 +25,7 @@
- @@ -65,8 +65,7 @@
{{ contentData.contentName }}
-
@@ -124,7 +123,7 @@
{{item.section.name}}
{{i+1}}. - {{ ele.contentName }} + {{ ele.contentName }}
@@ -141,7 +140,7 @@
-
@@ -383,7 +382,7 @@ } }, methods: { - Fn1(){ + noteChange(){ //视频点定位,直接到播放的视频位置 this.timer = new Date().getTime() @@ -455,17 +454,51 @@ onPlayVideo(contentId,time){ //这里需要根据contentId,是否切换到对应的内容的视频的时间 //如果 contentId已经不存在,需要提示 - this.playerBoxShow = false; - this.notePlay = null; + console.log(contentId,this.contentData.id,'两个内容id'); let $this=this; - setTimeout(() => { - $this.notePlay = time; - }, 500) + if(this.contentData.id==contentId){ + this.onPlayerPause() + //this.audioPause(); + this.contentData.lastStudyTime=time; + //this.onPlayerPlay(); + setTimeout(() => { + $this.$refs.myVideoPlayer.startPlay(time); + }, 10) + console.log('开始播放1'); + }else{ + //通过contentId + let toResContent=null; + this.contentList.forEach(c => { + if(c.id==contentId){ + c.lastStudyTime=time; + toResContent=c; + } + }); + if(toResContent!=null){ + this.changePlayRes(toResContent); + //this.onPlayerPlay(); + setTimeout(() => { + $this.$refs.myVideoPlayer.startPlay(time); + }, 10) + + console.log('开始播放2'); + }else{ + this.$message.error('资源已不存在或更换过,已无法定位'); + } + } + this.playerBoxShow = false; + //this.changePlayRes(r); + // this.playerBoxShow = false; + // this.notePlay = null; + // let $this=this; + // setTimeout(() => { + // $this.notePlay = time; + // }, 500) }, //笔记组件触发,记录当前播放时间 videoLocation() { //this.$store.dispatch("SetIntTimeNote", this.intTimeNote); - console.log(this.contentData.id+'='+this.intTimeNote,'设置视频播放时间') + //console.log(this.contentData.id+'='+this.intTimeNote,'设置视频播放时间') this.$refs.mynote.setVideoTime(this.contentData.id,this.intTimeNote); }, coutab(n) { @@ -490,51 +523,8 @@ widthOpen(url) { window.open(url, '_blank'); }, - showRes(r, i, index) { //i:子节下标,index:章下标 - if (i != undefined && index != undefined && r.status < 9) { - if (this.courseInfo.orderStudy) { - //判断上个是否学完 - if (i == 0) { - if (index > 0) { //第一章 第一节 - let preCatalog = this.catalogTree[index - 1]; - let last = preCatalog.children[preCatalog.children.length - 1]; - if (last.status != 9) { - this.$message.warning('请按顺序学习!'); - return; - } - } - } else { - let pre = this.catalogTree[index].children[i - 1]; - if (pre.status != 9) { - this.$message.warning('请按顺序学习!'); - return; - } - } - //判断是否是第一个未学完的 - let isAllow = false; - let has = this.catalogTree.some(treeNode => { - let hasNo = treeNode.children.some(child => { - if (child.status < 9) { - if (child.id == r.id) { - isAllow = true; - } - return true; - } else { - return false; - } - - }); - return hasNo; - }); - if (has) { - if (!isAllow) { - this.$message.warning('请按顺序学习!'); - return; - } - } - } - } - + //替换播放区域 + changePlayRes(r){ if(this.appendStudyOtherHandle!=null){ window.clearTimeout(this.appendStudyOtherHandle); } @@ -629,11 +619,53 @@ $this.controlHeight=h-95; //console.log(h,$this.controlHeight,'$this.controlHeight'); }) - }, - // handleChange(val) { - // console.log(val); - // }, + showRes(r, i, index) { //i:子节下标,index:章下标 + if (i != undefined && index != undefined && r.status < 9) { + if (this.courseInfo.orderStudy) { + //判断上个是否学完 + if (i == 0) { + if (index > 0) { //第一章 第一节 + let preCatalog = this.catalogTree[index - 1]; + let last = preCatalog.children[preCatalog.children.length - 1]; + if (last.status != 9) { + this.$message.warning('请按顺序学习!'); + return; + } + } + } else { + let pre = this.catalogTree[index].children[i - 1]; + if (pre.status != 9) { + this.$message.warning('请按顺序学习!'); + return; + } + } + //判断是否是第一个未学完的 + let isAllow = false; + let has = this.catalogTree.some(treeNode => { + let hasNo = treeNode.children.some(child => { + if (child.status < 9) { + if (child.id == r.id) { + isAllow = true; + } + return true; + } else { + return false; + } + + }); + return hasNo; + }); + if (has) { + if (!isAllow) { + this.$message.warning('请按顺序学习!'); + return; + } + } + } + } + this.changePlayRes(r); + }, loadScorePraiseAndTrample() { //加载是否请过分 apiCourseGrade.has(this.courseId).then(rs => { @@ -1900,6 +1932,10 @@ line-height: 60px; font-size: 16px; cursor: pointer; + overflow: hidden; + white-space:nowrap; + word-break:break-all; + text-overflow:ellipsis; } .units-active {