diff --git a/me/detail/detail.nvue b/me/detail/detail.nvue index 2f944b1..ab1764e 100644 --- a/me/detail/detail.nvue +++ b/me/detail/detail.nvue @@ -409,6 +409,8 @@ appearTimeout: null, isOrder: true, isGetDataList: false, + dianzanTimer:null, + zhuijuTimer:null }; }, onUnload() { @@ -418,7 +420,6 @@ } }, onShow() { - // console.log('onSHow video'); //当应用从后台进入前台时自动播放 if (this.videoContext) { this.videoContext.play() @@ -513,6 +514,17 @@ }) this.getScale() }, + onBackPress() { + console.log('onBackPress') + const { + courseId, + courseDetailsId, + videoUrl + } = this.videoList[this.current] + if (videoUrl) { + this.setHistor(courseId, courseDetailsId, true) + } + }, onLoad(e) { //是开启整部购买 this.zhengbu = uni.getStorageSync('zhengbu') ? uni.getStorageSync('zhengbu') : '否' @@ -536,7 +548,7 @@ // 记录跳转过来的视频总id跟单集id if (e.id) { this.courseId = e.id; - + // this.getMyLoveStatus() this.getMoneyList() this.getMyMoney() @@ -545,7 +557,7 @@ if (e.allId) { const arr = e.allId.split('-') this.courseId = arr[0]; - + // this.getMyLoveStatus() this.getMoneyList() this.getMyMoney() @@ -573,8 +585,8 @@ videoPlay(videoId, courseDetailsId) { if (!this.playFlag) { this.playFlag = true - if ( this.isGetDataList) { - this.getDataList(this.courseId, courseDetailsId,true); + if (this.isGetDataList) { + this.getDataList(this.courseId, courseDetailsId, true); } this.isGetDataList = true; httpsRequest.getT('app/course/viewCourse', { @@ -595,7 +607,7 @@ this.playFlag = false httpsRequest.getT('app/course/viewCourse', { courseId: this.courseId, - courseDetailsId: this.courseDetailsId, + courseDetailsId: this.videoList[this.current].courseDetailsId, type: 'end' }).then(res => { console.log('播放结束') @@ -810,10 +822,11 @@ console.log('nvue payType=' + paytype); httpsRequest.getT("/app/wuyou/payOrder/" + this.ordersId + '?payType=' + paytype, {}).then(ret => { // plus.runtime.openURL(ret.data.h5Url) - if(ret.code == 0 ) { + if (ret.code == 0) { uni.hideLoading() uni.navigateTo({ - url: '/pages/pays/pays?ordersId=' + this.ordersId + '&url=' + ret.data.h5Url + url: '/pages/pays/pays?ordersId=' + this.ordersId + '&url=' + ret.data + .h5Url }); } else { uni.hideLoading() @@ -822,7 +835,7 @@ title: '支付失败!' }); } - + // uni.navigateTo({ // url: '/pages/index/webView?ordersId='+this.ordersId+'url=' + ret.data.h5Url @@ -1054,7 +1067,7 @@ */ payVideo(type, num) { console.log(this.isOrder) - if(!this.isOrder){ + if (!this.isOrder) { return; } uni.showLoading({ @@ -1081,11 +1094,12 @@ } console.log(this.current) console.log(data) + this.setHistor() httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' : '/app/order/insertCourseOrders', data).then(res => { console.log(res) if (res.code == 0) { - + if (res.status && res.status == 1) { uni.hideLoading() this.showPay = false //关闭购买选择弹窗 @@ -1093,7 +1107,7 @@ this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, true); return; - } else{ + } else { this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 if (type == 1) { //金币 @@ -1104,10 +1118,10 @@ this.payPrice = res.data.orders.payMoney //需要支付的价格 this.openPopusPay() //显示充值弹窗 } - + } console.log(this.isOrder) - + // this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) } else { this.isOrder = true @@ -1123,7 +1137,7 @@ console.log("orderId==" + orderId) httpsRequest.postT("/app/order/payOrders", { orderId: orderId, - }).then(res => { + }).then(res => { console.log("orderIds==", res) if (res.code == 0) { uni.hideLoading() @@ -1204,16 +1218,23 @@ //收藏 shoucang() { if (uni.getStorageSync('token')) { + this.isCollect=!this.isCollect let data = { courseId: this.courseId, classify: 1, type: this.isCollect == false ? 1 : 0 } - httpsRequest.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { - if (res.code == 0) { - this.getMyLoveStatus() - } - }) + clearTimeout(this.zhuijuTimer) + this.zhuijuTimer=setTimeout(()=>{ + clearTimeout(this.zhuijuTimer) + this.zhuijuTimer=null; + httpsRequest.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + if (res.code == 0) { + // this.getMyLoveStatus() + } + }) + },500) + } else { uni.navigateTo({ url: "/pages/login/login" @@ -1230,17 +1251,23 @@ classify: 2, type: item.isGood == 0 ? 1 : 0 }; - httpsRequest.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { - if (res.code == 0) { - if (data.type == 1) { - item.isGood = 1; - item.goodNum += 1; - } else { - item.isGood = 0; - item.goodNum -= 1; + if (data.type == 1) { + item.isGood = 1; + item.goodNum += 1; + } else { + item.isGood = 0; + item.goodNum -= 1; + } + clearTimeout(this.dianzanTimer) + this.dianzanTimer = null + this.dianzanTimer = setTimeout(() => { + httpsRequest.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + if (res.code == 0) { + } - } - }) + }) + }, 500) + } else { uni.navigateTo({ url: "/pages/login/login" @@ -1320,34 +1347,26 @@ */ getDataList(courseId, courseDetailsId, type, t) { let data = { - id: courseId, + courseId: courseId, token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '' }; - console.log("getDataList==="+courseDetailsId) - console.log("getDataList===",data) - httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => { - + httpsRequest.getT('/app/course/courseSets', data).then(res => { + console.log('getDataList') + console.log(res) if (res.code == 0) { - console.log(res) - if (res.data && res.data.isCollect && res.data.isCollect > 0) { - this.isCollect = true - } else { - this.isCollect = false - } - if( res.data && res.data.courseDetailsId && !this.courseDetailsId && !courseDetailsId) { + this.isCollect = res.data.collect ? true : false; + if (res.data && res.data.courseDetailsId && !this.courseDetailsId && !courseDetailsId) { courseDetailsId = res.data.courseDetailsId } this.courseDetailsId = courseDetailsId - console.log(courseDetailsId) - if (res.data.listsDetail) { + if (res.data.list) { this.info = res.data; this.title = this.info.title; - let arr = JSON.parse(JSON.stringify(res.data.listsDetail)); - const indexs = arr.findIndex(menu => menu.courseDetailsId == Number(courseDetailsId)); - //如果未找到将current值改为0,否则会导致选集无法弹窗,弹窗后点击相对应集数也无反应 - this.current = indexs===-1?0:indexs; - console.log(indexs) - console.log(this.current) + const arr = res.data.list + const indexs = arr.findIndex(v => v.courseDetailsId == (courseDetailsId ? + courseDetailsId : res.data.current.courseDetailsId)); + //如果未找到将current值改为0,否则会导致选集无法弹窗,弹窗后点击相对应集数也无反应 + this.current = indexs === -1 ? 0 : indexs; this.scrollIntoViews = 'video' + indexs this.scrollIntoView = 'video' + indexs // this.scrollIntoView = 'video' + indexs @@ -1398,7 +1417,7 @@ }) } else { console.log('播放') - this.$nextTick(()=>{ + this.$nextTick(() => { console.log('myVideo' + courseDetailsIds) this.videoContextId = 'myVideo' + courseDetailsIds; this.videoContext = uni.createVideoContext(this @@ -1406,12 +1425,12 @@ this); if (this.videoList[this.current].videoUrl) { this.videoContext.play(); - }else { + } else { console.log("播放失败") this.getDataList(this.courseId, courseDetailsIds, true); } }) - + } // console.log('this.noBuyVideoIndex', this.noBuyVideoIndex) @@ -1484,8 +1503,22 @@ }) }, //插入观看记录 - setHistor(courseId, courseDetailsId) { + setHistor(courseId, courseDetailsId, now) { + clearTimeout(this.timer) + if (uni.getStorageSync('token')) { + clearTimeout(this.timer) + if (now) { + let data = { + courseId: courseId, + courseDetailsId: courseDetailsId, + classify: 3, + type: 1 + }; + console.log(data, '记录了') + httpsRequest.postJson('/app/courseCollect/insertCourseCollect', data).then(res => {}) + return + } let data = { courseId: courseId, courseDetailsId: courseDetailsId, diff --git a/me/detail/detail.vue b/me/detail/detail.vue index 4a97dd4..14e5817 100644 --- a/me/detail/detail.vue +++ b/me/detail/detail.vue @@ -13,8 +13,8 @@ @waiting="waiting()" object-fit="cover" v-if="current === index && item.videoUrl" :play-strategy="2" :show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="false" @ended="ended" - @play="videoPlay('myVideo'+item.courseDetailsId)" :enable-progress-gesture="false" - :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId" + @play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" + :enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl" :autoplay="item.autoPlay" class="swipers-items-video"> @@ -23,7 +23,7 @@ @controlstoggle="controlstoggles" @timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" v-if="current === index && item.videoUrl" :play-strategy="2" :show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="false" - @ended="ended" @play="videoPlay('myVideo'+item.courseDetailsId)" + @ended="ended" @play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl" :autoplay="item.autoPlay" class="swipers-items-video" @contextmenu.prevent="disableContextMenu"> @@ -41,8 +41,8 @@ - + @@ -188,8 +188,8 @@ + close-icon-size="30" @close="popupPyaClose" close-icon-color="#333333" :mask-custom-style="maskCustomStyle" + v-model="showPay" border-radius="24" mode="bottom"> @@ -198,8 +198,8 @@ {{getRedEnvelopeTips}} - - + + {{info.price}}元解锁全剧 @@ -321,7 +321,9 @@ import { returnIsSafari } from '@/utils/app.js' - import {cacheClear} from '@/store/cashe.js' + import { + cacheClear + } from '@/store/cashe.js' export default { components: { tkiQrcode, @@ -329,6 +331,7 @@ }, data() { return { + timer: null, isSafari: returnIsSafari(), //记录未购买视频索引 noBuyVideoIndex: null, @@ -446,7 +449,9 @@ getRedEnvelopeTips: '', scale: 1, isOrder: true, - isGetDataList: false + isGetDataList: false, + dianzanTimer: null, + zhuijuTimer:null }; }, onShareAppMessage(res) { @@ -532,7 +537,6 @@ // #endif }, - onLoad(e) { //在苹果系统微信小程序是否开启支付 this.isWxIosPay = uni.getStorageSync('isWxIosPay') @@ -638,6 +642,9 @@ // }); }, onHide() { + + + //恢复录屏 // #ifdef MP-TOUTIAO tt.enableUserScreenRecord({ @@ -663,8 +670,7 @@ // #endif }, onShow() { - console.log('onSHow video'); - + //当应用从后台进入前台时自动播放 if (this.videoContext) { this.videoContext.play() @@ -673,11 +679,9 @@ if (noBuyVideoIndex !== null && noBuyVideoIndex !== undefined) { this.noBuyVideoIndex = noBuyVideoIndex } - try { this.playType = Number(uni.getStorageSync('playType')) } catch (e) { - //TODO handle the exception this.playType = 1 } let that = this @@ -730,7 +734,6 @@ // #endif this.isVips = uni.getStorageSync('isVips') ? uni.getStorageSync('isVips') : '否' if (this.courseId) { - console.log('has this.courseId getDataList()'); this.getDataList(this.courseId, this.courseDetailsId); } this.$Request.getT('app/course/getRedEnvelopeTips').then(res => { @@ -758,7 +761,7 @@ this.meunTop = 37 // #endif - + // const windowResizeCallback = (res) => { // console.log('变化后的窗口宽度=' + res.size.windowWidth) // console.log('变化后的窗口高度=' + res.size.windowHeight) @@ -773,6 +776,17 @@ // #endif }, + onBackPress() { + console.log('onBackPress') + const { + courseId, + courseDetailsId, + videoUrl + } = this.videoList[this.current] + if (videoUrl) { + this.setHistor(courseId, courseDetailsId, true) + } + }, watch: { //监听当前播放的集数 current() { @@ -854,7 +868,7 @@ event.preventDefault(); }, //点击封面打开弹窗 - openShowPay(val,inx,url) { + openShowPay(val, inx, url) { console.log(val) console.log(inx) console.log(url) @@ -1128,7 +1142,7 @@ this.playFlag = false this.$Request.getT('app/course/viewCourse', { courseId: this.courseId, - courseDetailsId: this.courseDetailsId, + courseDetailsId: this.videoList[this.current].courseDetailsId, type: 'end' }).then(res => { console.log('播放结束') @@ -1270,7 +1284,7 @@ * 2:购买单集视频 */ payVideo(type, num) { - if(!this.isOrder){ + if (!this.isOrder) { return; } this.isOrder = false @@ -1295,6 +1309,7 @@ //子组件支付成功的回调 paySuccess(data) { console.log(data) + this.setHistor(this.courseId, this.videoList[this.current].courseDetailsId, true) // data.h5Url 跳转地址 this.showMoney = false //显示充值弹窗 uni.setStorageSync('noBuyVideoIndex', this.current) @@ -1305,10 +1320,10 @@ }); // #endif // #ifdef H5 - + window.location.href = data.h5Url // #endif - cacheClear(['renwu','user']) + cacheClear(['renwu', 'user']) }, //自组件关闭的回调 @@ -1332,9 +1347,7 @@ this.$Request.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' : '/app/order/insertCourseOrders', data).then(res => { if (res.code == 0) { - - - if ( res.status && res.status == 1) { + if (res.status && res.status == 1) { this.showPay = false //关闭购买选择弹窗 this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, true); @@ -1353,11 +1366,11 @@ this.showMoney = true //显示充值弹窗 } } - + } else { this.isOrder = true - + uni.showToast({ title: res.msg, icon: 'none' @@ -1415,16 +1428,23 @@ //收藏 shoucang() { if (uni.getStorageSync('token')) { + this.isCollect=!this.isCollect let data = { courseId: this.courseId, classify: 1, type: this.isCollect == false ? 1 : 0 } - this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { - if (res.code == 0) { - this.getMyLoveStatus() - } - }) + clearTimeout(this.zhuijuTimer) + this.zhuijuTimer = setTimeout(() => { + clearTimeout(this.zhuijuTimer) + this.zhuijuTimer = null; + this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + if (res.code == 0) { + // this.getMyLoveStatus() + } + }) + }, 500) + } else { uni.navigateTo({ url: "/pages/login/login" @@ -1441,17 +1461,24 @@ classify: 2, type: item.isGood == 0 ? 1 : 0 } - this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { - if (res.code == 0) { - if (data.type == 1) { - item.isGood = 1 - item.goodNum += 1 - } else { - item.isGood = 0 - item.goodNum -= 1 + if (data.type == 1) { + item.isGood = 1 + item.goodNum += 1 + } else { + item.isGood = 0 + item.goodNum -= 1 + } + clearTimeout(this.dianzanTimer) + this.dianzanTimer = null + this.dianzanTimer = setTimeout(() => { + this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + if (res.code == 0) { + } - } - }) + }) + }, 500) + + } else { uni.navigateTo({ url: "/pages/login/login" @@ -1500,18 +1527,17 @@ this.$forceUpdate() }, //选择播放 - selectPlay(item,type) {//price //videoUrl + selectPlay(item, type) { //price //videoUrl // 根据选择的courseDetailsId拿到meunList列表中的相同数据的下标 const index = this.meunList.findIndex(menu => menu.courseDetailsId === item.courseDetailsId); this.videoList = [this.meunList[index]] this.current = 0 - if ( this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type ) { + if (this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type) { this.getDataList(this.courseId, this.courseDetailsId, true, 'select') return; } //重新计算一下当前观看的是哪个视频 this.comNumVideo() - this.setWxUrl() // 把选择的视频的自动播放设置为true this.videoList[this.current].autoPlay = true //让当前选择的视频播放 @@ -1541,33 +1567,24 @@ }, // 资源详情 getDataList(id, courseDetailsId, type, t) { - console.log('getDataList'); let data = { - id, - token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '' + courseId: id } - // // #ifdef MP-WEIXIN - // data.courseDetailsId = courseDetailsId - // // #endif this.$u.api.selectCourseDetailsById(data).then(res => { if (res.code == 0) { + this.isCollect = res.data.collect ? true : false; + console.log(this.isCollect); if (res.data && res.data.dyCourseId) { this.dyCourseId = "" + res.data.dyCourseId; - console.log("dyCourseId__" + this.dyCourseId) } - if( res.data && res.data.courseDetailsId && !this.courseDetailsId && !courseDetailsId) { + if (res.data && res.data.courseDetailsId && !this.courseDetailsId && !courseDetailsId) { this.courseDetailsId = res.data.courseDetailsId courseDetailsId = res.data.courseDetailsId } - if (res.data && res.data.isCollect && res.data.isCollect > 0) { - this.isCollect = true - } else { - this.isCollect = false - } - if (res.data.listsDetail) { + if (res.data.list) { this.info = res.data this.title = this.info.title - let arr = res.data.listsDetail + let arr = res.data.list arr.map((item, index) => { item.num = index + 1 // #ifdef MP-TOUTIAO @@ -1592,7 +1609,6 @@ this.videoList[this.current].videoUrl = item.videoUrl //自动播放 this.startPlay(this.current) - this.setWxUrl() return true } }) @@ -1647,7 +1663,7 @@ } } else if (Number(indexs) === Number(this.meunList.length - 1)) { //倒数第二条 - console.log("倒数第二条") + console.log("倒数第二条") if (this.meunList.length == 1) { //只有一条 this.videoList = this.meunList.slice(0, 3) @@ -1669,7 +1685,7 @@ } else { console.log("如果不是最后一条,也不是倒数第二条") //如果不是最后一条,也不是倒数第二条,则从找到的位置开始往后拿三条数据放入数组 - if ( indexs == 0 ) { + if (indexs == 0) { this.videoList = [ this.meunList[this.meunList .length - 2], @@ -1677,7 +1693,7 @@ .length - 1], this.meunList[0], ] - } else if ( indexs == 1) { + } else if (indexs == 1) { this.videoList = [ this.meunList[this.meunList .length - 1], @@ -1685,10 +1701,10 @@ this.meunList[1], ] } else { - this.videoList = this.meunList.slice(indexs-2, - indexs-2 + 3) + this.videoList = this.meunList.slice(indexs - 2, + indexs - 2 + 3) } - + } } else { //没找到直接拿前三条数据即可 @@ -1696,17 +1712,14 @@ } } else { //新的视频 // //视频数组//直接拿前三条 - + this.videoList = this.meunList.slice(0, 3) indexs = 0 } - console.log(this.videoList); - this.videoList.map((item, index) => { - if (item.courseDetailsId == courseDetailsId) { - this.current = index - } - }) + const currentIndex = this.videoList.findIndex(v => v.courseDetailsId == ( + courseDetailsId ? courseDetailsId : res.data.current.courseDetailsId)) + this.current = currentIndex == -1 ? 0 : currentIndex //重新计算当前在播放哪个视频 this.comNumVideo() if (indexs != -1 && this.meunList.length > 0) { @@ -1741,7 +1754,6 @@ this.setHistor(this.videoList[this.current].courseId, this.videoList[this.current] .courseDetailsId) this.$nextTick(() => { - this.setWxUrl() if (!this.videoList[this.current].videoUrl) { //不能播放的显示购买弹窗 this.zongPrice = this.info.price this.countPrice = this.videoList[this.current].price @@ -1751,8 +1763,8 @@ }) - if ( t == 'select') { - this.selectPlay(this.videoList[this.current],true) + if (t == 'select') { + this.selectPlay(this.videoList[this.current], true) } } } else { @@ -1765,32 +1777,27 @@ }) }, - setWxUrl() { - // // #ifdef MP-WEIXIN - // if (!this.videoList[this.current].wxUrl) { - // let data = { - // wxCourseDetailsIds: this.videoList[this.current].wxCourseDetailsId - // } - // this.$Request.postJson('/app/course/selectWxVideoUrl', data).then(res => { - // if (res.code == 0 && res.data) { - // this.videoList[this.current].wxUrl = res.data[0].mp4_url - // } - // }) - // } - // // #endif - - }, - setHistor(courseId, courseDetailsId) { - if (uni.getStorageSync('token')) { - let data = { - courseId: courseId, - courseDetailsId: courseDetailsId, - classify: 3, - type: 1 - } - this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => {}) + setHistor(courseId, courseDetailsId, now = false) { + let data = { + courseId: courseId, + courseDetailsId: courseDetailsId, + classify: 3, + type: 1 } + if (uni.getStorageSync('token')) { + clearTimeout(this.timer) + if (now) { + this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + }) + return + } + this.timer = setTimeout(() => { + this.$Request.postJson('/app/courseCollect/insertCourseCollect', data).then(res => { + + }) + }, 3000) + } }, //swiper上下切换事件 change(e) { @@ -1852,12 +1859,12 @@ } } //考虑向下滑动 - console.log(current+"---"+this.current) + console.log(current + "---" + this.current) if ((current == 0 && this.current == 2) || (current == 0 && this.current == 0)) { //是否滑动到第一条,虽然刚进入页面current为0,但是首次不触发 //拿出当前的courseDetailsId console.log(this.videoList) - let courseDetailsId =this.videoList[2].courseDetailsId + let courseDetailsId = this.videoList[2].courseDetailsId // if ( this.videoList.length > 1) { // courseDetailsId = this.videoList[2].courseDetailsId // } else { @@ -1914,27 +1921,30 @@ } this.$nextTick(() => { //插入历史记录 - this.setHistor(this.videoList[this.current].courseId, this.videoList[this.current] - .courseDetailsId) - this.setWxUrl() + clearTimeout(this.timer) + const { + courseId, + courseDetailsId, + videoUrl + } = this.videoList[this.current] + if (videoUrl) { + this.setHistor(courseId, courseDetailsId) + } // #ifndef MP-TOUTIAO // 把选择的视频的自动播放设置为true this.videoList[this.current].autoPlay = true //让当前选择的视频播放 this.startPlay(this.current) // #endif - //更新视图 this.$forceUpdate() }) }, startPlay(current) { - console.log(222222) if (this.videoContext) { //判断之前是否有视频的上下文 this.videoContext.stop() this.videoContext = null } - console.log(this.videoList[current]) let numIdCurr = this.videoList[current].courseDetailsId if (this.videoList[current].videoUrl) { //已经购买可直接播放 // 播放时记录当前播放的id @@ -1946,7 +1956,6 @@ //播放当前的 this.videoContext.play() this.$forceUpdate() - this.setWxUrl() }) } } else { //没有视频链接则表示没有权限,需要购买 弹出购买弹窗 @@ -1957,23 +1966,23 @@ } }, //播放时的回掉 - videoPlay(videoId) { + videoPlay(videoId, courseDetailsId) { // this.courseDetailsId = courseDetailsId if (!this.playFlag) { - if ( this.isGetDataList) { - this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,true); + if (this.isGetDataList) { + this.getDataList(this.courseId, courseDetailsId, true); } this.isGetDataList = true; this.playFlag = true this.$Request.getT('app/course/viewCourse', { courseId: this.courseId, - courseDetailsId: this.videoList[this.current].courseDetailsId, + courseDetailsId: courseDetailsId, type: 'start' }).then(res => { console.log('播放开始') }) } - + }, //监听视频播放完成 ended() {