From f3b576a06ab598d73da1895c5de954ee409291f8 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Fri, 21 Jun 2024 09:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=BE=E7=BD=AE=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 14 +- .../commonComponents/video/index.vue | 52 +- pages/course/courseSet.vue | 664 +++++++++- pages/course/illustrate.vue | 1142 ----------------- pages/course/index.vue | 2 +- 5 files changed, 644 insertions(+), 1230 deletions(-) delete mode 100644 pages/course/illustrate.vue diff --git a/pages.json b/pages.json index 3394d43..0ec6d10 100644 --- a/pages.json +++ b/pages.json @@ -371,13 +371,13 @@ "navigationBarTitleText": "总课程说明" } }, - { - "path": "pages/course/illustrate", - "style": { - "navigationBarTitleText": "课程说明", - "enablePullDownRefresh": true - } - }, + // { + // "path": "pages/course/illustrate", + // "style": { + // "navigationBarTitleText": "课程说明", + // "enablePullDownRefresh": true + // } + // }, { "path": "pages/course/outline", "style": { diff --git a/pages/component/commonComponents/video/index.vue b/pages/component/commonComponents/video/index.vue index fe98850..f551d17 100644 --- a/pages/component/commonComponents/video/index.vue +++ b/pages/component/commonComponents/video/index.vue @@ -16,7 +16,16 @@ ref="videoContent" @tap="renderScript.handleClick" id="url-player-test" - :videoData="videoData" + :videoData="videoData" + :winWidth="winWidth" + :winHeight="winHeight" + :currentVideoList="currentVideoList" + :firstTime="firstTime" + :change:videoData="renderScript.receiveMsg" + :change:winWidth="renderScript.receiveWinWidth" + :change:winHeight="renderScript.receiveWinHeight" + :change:firstTime="renderScript.receiveFirstTime" + :change:currentVideoList="renderScript.receiveVideoList" >
直接调用renderjs中的emitData的方法,传递当前播放时长 @@ -143,7 +152,7 @@ export default { this.options = JSON.parse(options.data); - this.videoId = this.options.id; + this.videoId = this.options.video; this.timer = setInterval(() => { var that = this; @@ -203,7 +212,7 @@ export default { } this.options = data.currentVideo; console.log("this.options at line 64:", this.options); - this.videoId = this.options.id; + this.videoId = this.options.video; this.timer = setInterval(async () => { var that = this; if (this.currentTime) { @@ -288,14 +297,13 @@ export default { }, // 获取数据 getLive() { - console.log(this.options,'----------------11111111111111--------') var data = { ...this.options, }; - console.log(data,'------------------------') + $http .request({ - url: "medical/course/checkVideoByMD", + url: `sociology/course/checkVideo`, method: "Post", // POST、GET、PUT、DELETE,具体说明查看官方文档 data, header: { @@ -305,23 +313,22 @@ export default { }) .then((res) => { console.log("res at line 252111111111111111111111111111:", res); - if (this.currentVideo.type == 1) { - var playAuth = res.playAuth.replace(/=/g, ""); + var playAuth = res.video.playAuth.replace(/=/g, ""); this.videoData = { - ...res, - video: res.id, + ...res.video, + videoId: res.video.video, playAuth: playAuth, }; this.playAuth = playAuth; } else { - // this.videoData = res.video; - // this.videoUrl = - // // "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" + - // res.video.videoUrl; - // this.$nextTick(async () => { - // await this.getData(); - // }); + this.videoData = res.video; + this.videoUrl = + // "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" + + res.video.videoUrl; + this.$nextTick(async () => { + await this.getData(); + }); } this.$forceUpdate(); @@ -498,9 +505,6 @@ this.player.fullscreenService.requestFullScreen(); ownerInstance.callMethod('handleEnd', ) }, getLive() { - - - console.log(this.videoData,'走没走。。。。。。。。。。') if(this.videoData.type==1){ var fullScreenButtonComponent = Aliplayer.Component({ /** @@ -728,15 +732,15 @@ this.player.on('ended', function() { // console.log('vm', vm) }, checkValue() { - console.log(this.videoId, this.videoData, "1111888888") - if (!this.videoData.playAuth) { + console.log(this.videoId, this.authId, "1111888888") + if (!this.videoData.playAuth||!this.currentVideoList) { setTimeout(() => { this.checkValue(); }, 1000); } else { - - this.getLive();console.log('this.videoList at line 这是这只只是594:',this.videoData) +console.log('this.videoList at line 这是这只只是594:', this.currentVideoList) + this.getLive(); } }, loadWebPlayerSDK() { diff --git a/pages/course/courseSet.vue b/pages/course/courseSet.vue index fd7cb72..fb55f09 100644 --- a/pages/course/courseSet.vue +++ b/pages/course/courseSet.vue @@ -21,7 +21,10 @@ {{item.title}} - + + + + @@ -29,18 +32,18 @@ author="吴门医述" :action="audioAction" controls> - - - - - - + +
+
+
+
+
@@ -65,10 +68,15 @@ export default { data() { return { + isFullScreen: false, playData: {}, Leve1:[], Leve2:[], Leve3:[], + options: {}, //上个页面获取的视频参数(视频id) + playAuth: "", //播放凭证 + videoId: "", //阿里云视频id + videoData: {}, //阿里云视频其他参数 accordionVal: '', // extraIcon:{ // color: '#4cd964', @@ -104,10 +112,10 @@ poster:'../../static/videoF.jpg', //封面图 audioPoster:'../../static/logo.png', current: { - poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png', - name: '致爱丽丝', - author: '暂无', - src: 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3', + // poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png', + // name: '致爱丽丝', + // author: '暂无', + // src: 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3', }, audioAction: { method: 'pause' @@ -156,6 +164,20 @@ }, //方法 methods: { + getLive(playAuthsss) { + //playAuth 是播放凭证 通过后端自己根据api去获取,返回时不知道为什么结束会带有 = 有时候甚至是2个 所以要截取等号 不然不能播放 + var playAuth = this.playAuth.replace(/=/g, ""); + // var playAuth = playAuthsss + this.videoData = { + // ...res.video,//视频其他信息 + type: 1, + videoId: this.videoId, //阿里云视频id + playAuth: playAuth, //阿里云播放凭证 + }; + console.log('得到播放凭证') + this.playAuth = playAuth; + this.$forceUpdate(); + }, tabChange(e){ console.log(e,'e'); let _index = e.index @@ -166,18 +188,21 @@ this.leve3Index = null if(this.treeList[_index].isLast == 0 && this.treeList[_index].children.length > 0){ this.Leve1 = this.treeList[_index].children - if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){ - this.Leve2 = this.Leve1[0].children - // console.log(this.Leve2,'Leve2'); - if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){ - this.Leve3 = this.Leve2[0].children - }else{ - this.Leve3 = [] - } - }else{ - this.Leve2 = [] - this.Leve3 = [] - } + this.Leve2 = [] + this.Leve3 = [] + // if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){ + // this.Leve2 = this.Leve1[0].children + // this.Leve3 = [] + // // console.log(this.Leve2,'Leve2'); + // if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){ + // this.Leve3 = this.Leve2[0].children + // }else{ + // this.Leve3 = [] + // } + // }else{ + // this.Leve2 = [] + // this.Leve3 = [] + // } }else{ this.Leve1 = [] @@ -193,7 +218,8 @@ this.clickCourseInfo(val) if(this.Leve1[index].isLast == 0 && this.Leve1[index].children.length > 0){ this.Leve2 = this.Leve1[index].children - console.log(this.Leve2,'Leve2'); + // console.log(this.Leve2,'Leve2'); + this.Leve3 = [] }else{ this.Leve2 = [] this.Leve3 = [] @@ -250,23 +276,51 @@ .post('medical/home/getCourseMedicalTree') .then(res => { if (res.code == 0 && res.labels.length > 0) { - this.tabList = [] + this.tabList = [] this.treeList = res.labels - if(this.treeList[0].isLast == 0 && this.treeList[0].children.length > 0){ - this.Leve1 = this.treeList[0].children - if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){ - this.Leve2 = this.Leve1[0].children - // console.log(this.Leve2,'Leve2'); - if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){ - this.Leve3 = this.Leve2[0].children + if(this.tagId && this.pid){ + res.labels.forEach((item, index) => { + this.tabList.push({ + id: item.id, + name: item.title + }) + if (item.id == this.pid) { + this.curTagIndex = index + console.log(this.curTagIndex) + } + }) + this.getCourseInfo(this.tagId) + }else{ + this.curTagIndex = 0 + this.leve1Index = null + this.getCourseInfo(this.treeList[0].id) + } + // this.treeList = res.labels + if(this.treeList[this.curTagIndex].isLast == 0 && this.treeList[this.curTagIndex].children.length > 0){ + this.Leve1 = this.treeList[this.curTagIndex].children + if(this.tagId){ + this.Leve1.forEach((item, index) => { + if (item.id == this.tagId) { + this.leve1Index = index + } + }) + if(this.Leve1[this.leve1Index].isLast == 0 && this.Leve1[this.leve1Index].children.length > 0){ + this.Leve2 = this.Leve1[this.leve1Index].children + // console.log(this.Leve2,'Leve2'); + // if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){ + // this.Leve3 = this.Leve2[0].children + // }else{ + // this.Leve3 = [] + // } }else{ + this.Leve2 = [] this.Leve3 = [] } }else{ + this.leve1Index = null this.Leve2 = [] this.Leve3 = [] - } - + } }else{ this.Leve1 = [] this.Leve2 = [] @@ -275,12 +329,13 @@ res.labels.forEach( item => { this.tabList.push({id:item.id, name: item.title}) }) - this.getCourseInfo(this.treeList[0].id) + // /this.getCourseInfo(this.treeList[0].id) // console.log(this.treeList[0].id,'+++++') // this.showDrawer('showRight') } else { this.treeList = [] } + }).catch(e => { console.log(e, '报错') }); @@ -297,16 +352,15 @@ 'Content-Type': 'application/json' }, }) - .then(res => { + .then(async res => { if (res.code == 0 && res.course.id) { this.courseInfo = res.course this.courseTitle = this.courseInfo.title + '课程说明' this.curId = id - if(this.courseInfo.mediaType == 1 && this.courseInfo.media != ''){ - this.videoUrl = this.courseInfo.media - // this.poster = this.videoUrl + - // "?x-oss-process=video/snapshot,t_0,f_jpg" - // this.getVideoPath(this.courseInfo.media) + if (this.courseInfo.mediaType == 1 && this.courseInfo.media != '') { + this.videoId = this.courseInfo.media + this.playAuth = await this.getVideoPath(this.courseInfo.media) + this.getLive(this.playAuth) }else{ // this.videoUrl = '' this.poster = '' @@ -328,10 +382,11 @@ }); }, // 获得播放地址 - getVideoPath(str){ - console.log(str,'str'); - $http.request({ - url: "sociology/course/checkVideo", + async getVideoPath(str) { + // console.log(str, 'str'); + let path = '' + await $http.request({ + url: "medical/course/checkVideoByMD", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { id: str @@ -340,15 +395,15 @@ 'Content-Type': 'application/json' }, }) - // this.$http - // .post('sociology/course/checkVideo',{ - // id: str - // }) .then(res => { - console.log(res,'res'); + if (res.code == 0) { + // console.log(res, 'res'); + path = res.playAuth + } }).catch(e => { - console.log(e,'获取视频播放地址错误'); + console.log(e, '获取视频播放地址错误'); }) + return path }, clickCourseInfo(item) { this.getCourseInfo(item.id) @@ -364,6 +419,503 @@ }, }; + + + \ No newline at end of file diff --git a/pages/course/index.vue b/pages/course/index.vue index 9f0b7a5..84a670f 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -2,7 +2,7 @@ - 课程说明 + 课程说明