修复金币解锁未自动播放问题
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="detail">
|
||||
<list :bounce="false" :loadmoreoffset="wHeight*3" :show-scrollbar="false" ref="listBox" :pagingEnabled="true"
|
||||
:scrollable="true">
|
||||
:scrollable="true">
|
||||
<cell v-for="(item,i) in videoList" :key="i" :ref="'list'+item.courseDetailsId">
|
||||
<view class="swipers-items" @longpress="openBs()" @disappear="disappear(item.courseDetailsId,i)"
|
||||
@appear="appear(item.courseDetailsId,i)" :style="boxStyle">
|
||||
@@ -149,14 +149,14 @@
|
||||
style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;">
|
||||
{{getRedEnvelopeTips}}
|
||||
</text>
|
||||
<view class="pay-content" >
|
||||
<view class="pay-content">
|
||||
<view class="pay-content-item" v-if="info&&info.price" @click="payVideo(2,'all')">
|
||||
<image class="pay-content-item-icon" src="../../static/images/me/rmIcon.png" mode=""></image>
|
||||
<text class="pay-content-items">
|
||||
{{info.price}}元解锁全剧
|
||||
</text>
|
||||
</view>
|
||||
<view class="pay-content-item" v-if="info&&info.wholesalePrice" @click="payVideo(2,10)">
|
||||
<view class="pay-content-item" v-if="info&&info.wholesalePrice" @click="payVideo(2,10)">
|
||||
<image class="pay-content-item-icon" src="../../static/images/me/rmIcon.png" mode=""></image>
|
||||
<text class="pay-content-items">
|
||||
{{info.wholesalePrice}}元解锁10集视频
|
||||
@@ -542,7 +542,7 @@
|
||||
this.getMoneyList()
|
||||
this.getMyMoney()
|
||||
} else {
|
||||
console.log("allId====="+e.allId)
|
||||
console.log("allId=====" + e.allId)
|
||||
if (e.allId) {
|
||||
const arr = e.allId.split('-')
|
||||
this.courseId = arr[0];
|
||||
@@ -578,7 +578,7 @@
|
||||
console.log(this.playFlag)
|
||||
// this.courseDetailsId = courseDetailsId
|
||||
if (!this.playFlag) {
|
||||
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,true);
|
||||
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, true);
|
||||
this.playFlag = true
|
||||
httpsRequest.getT('app/course/viewCourse', {
|
||||
courseId: this.courseId,
|
||||
@@ -612,14 +612,14 @@
|
||||
this.courseDetailsId = e;
|
||||
// 清除已经设置的定时器
|
||||
clearTimeout(this.appearTimeout);
|
||||
|
||||
|
||||
// 设置一个新的延迟执行的定时器
|
||||
this.appearTimeout = setTimeout(() => {
|
||||
// 实际要执行的操作
|
||||
console.log('页面出现在视图中');
|
||||
// 这里可以加入你需要执行的代码
|
||||
console.log("appear==="+e)
|
||||
console.log("appear==="+index)
|
||||
console.log("appear===" + e)
|
||||
console.log("appear===" + index)
|
||||
// this.courseDetailsId = e
|
||||
this.current = index
|
||||
this.showControls = true
|
||||
@@ -628,15 +628,15 @@
|
||||
this.scrollIntoView = 'video' + index
|
||||
console.log(this.scrollIntoViews, '当前位置')
|
||||
//播放并更新video的上下文
|
||||
this.startPlay(index)
|
||||
this.startPlay(index)
|
||||
//插入历史记录
|
||||
this.setHistor(this.videoList[index].courseId, this.videoList[index].courseDetailsId);
|
||||
this.$forceUpdate()
|
||||
}, 500); // 延迟500毫秒执行
|
||||
|
||||
|
||||
},
|
||||
disappear(e, index) {
|
||||
|
||||
|
||||
// if (this.videoContext) { //判断之前是否有视频的上下文
|
||||
// this.videoContext.stop();
|
||||
// this.videoContext = null;
|
||||
@@ -1040,9 +1040,9 @@
|
||||
* 1:购买整部视频
|
||||
* 2:购买单集视频
|
||||
*/
|
||||
payVideo(type,num) {
|
||||
payVideo(type, num) {
|
||||
if (uni.getStorageSync('token')) {
|
||||
this.submitPay(type,num)
|
||||
this.submitPay(type, num)
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
@@ -1050,16 +1050,17 @@
|
||||
}
|
||||
},
|
||||
//使用金币购买
|
||||
submitPay(type,num) {
|
||||
submitPay(type, num) {
|
||||
let data = {
|
||||
courseId: this.courseId
|
||||
}
|
||||
if(!num){
|
||||
if (!num) {
|
||||
console.log('进入num');
|
||||
//单集解锁
|
||||
data.courseDetailsId = this.videoList[this.current].courseDetailsId
|
||||
}
|
||||
httpsRequest.getT((num && num == 10)?'/app/order/insertCourseOrders/limit10': '/app/order/insertCourseOrders', data).then(res => {
|
||||
httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' :
|
||||
'/app/order/insertCourseOrders', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.ordersId = res.data.orders.ordersId //记录订单id
|
||||
this.payMoney = res.data.orders.payMoney //记录订单价格
|
||||
@@ -1074,7 +1075,7 @@
|
||||
|
||||
// this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
|
||||
} else {
|
||||
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);
|
||||
@@ -1136,8 +1137,8 @@
|
||||
this.$refs.popupPya.close()
|
||||
},
|
||||
//选择播放
|
||||
selectPlay(item,type) {
|
||||
if ( this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type ) {
|
||||
selectPlay(item, type) {
|
||||
if (this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type) {
|
||||
this.getDataList(this.courseId, this.courseDetailsId, true, 'select')
|
||||
return;
|
||||
}
|
||||
@@ -1266,7 +1267,7 @@
|
||||
animated: false
|
||||
})
|
||||
_this.$forceUpdate()
|
||||
console.log('移动结束', el)
|
||||
console.log('移动结束', el)
|
||||
// },1000)
|
||||
})
|
||||
},
|
||||
@@ -1348,6 +1349,17 @@
|
||||
this.videoContext.play();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('播放')
|
||||
this.$nextTick(()=>{
|
||||
this.videoContextId = 'myVideo' + courseDetailsIds;
|
||||
this.videoContext = uni.createVideoContext(this
|
||||
.videoContextId,
|
||||
this);
|
||||
console.log(this.videoContext);
|
||||
this.videoContext.play();
|
||||
})
|
||||
|
||||
}
|
||||
// console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
|
||||
|
||||
@@ -1393,8 +1405,8 @@
|
||||
this.$forceUpdate();
|
||||
})
|
||||
}
|
||||
if ( t == 'select') {
|
||||
this.selectPlay(this.videoList[this.current],true)
|
||||
if (t == 'select') {
|
||||
this.selectPlay(this.videoList[this.current], true)
|
||||
}
|
||||
this.$forceUpdate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user