This commit is contained in:
GaoHao
2024-12-09 16:40:16 +08:00
4 changed files with 85 additions and 28 deletions

View File

@@ -3,7 +3,7 @@
<list :bounce="false" :loadmoreoffset="wHeight*3" :show-scrollbar="false" ref="listBox" :pagingEnabled="true"
:scrollable="true">
<cell v-for="(item,i) in videoList" :key="i" :ref="'list'+item.courseDetailsId">
<view class="swipers-items" @longpress="openBs()" @appear="appear(item.courseDetailsId,i)"
<view class="swipers-items" @longpress="openBs()" @disappear="disappear(item.courseDetailsId,i)" @appear="appear(item.courseDetailsId,i)"
:style="boxStyle">
<!-- 视频 -->
<video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" object-fit="contain"
@@ -145,11 +145,14 @@
<image class="list-title-rs" src="../../static/images/me/closeIconss.png" mode=""></image>
</view>
</view>
<text class="" 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-item" @click="payVideo(1)">
<image class="pay-content-item-icon" src="../../static/images/me/rmIcon.png" mode=""></image>
<text class="pay-content-items">
{{countPrice*scale}}金币解锁整部视频
{{countPrice*scale}}金币解锁单集视频
</text>
</view>
<view class="pay-content-item" @click="payVideo(2)">
@@ -535,6 +538,7 @@
videoPlay(videoId,courseDetailsId) {
this.courseDetailsId = courseDetailsId
if ( !this.playFlag ) {
console.log(this.courseDetailsId)
this.playFlag = true
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
@@ -576,6 +580,27 @@
this.setHistor(this.videoList[index].courseId, this.videoList[index].courseDetailsId);
this.$forceUpdate()
},
disappear(e, index) {
if (this.videoContext) { //判断之前是否有视频的上下文
this.videoContext.stop();
this.videoContext = null;
}
let numIdCurr = this.videoList[index-1].courseDetailsId;
if (this.videoList[index-1].videoUrl) { //已经购买可直接播放
// 播放时记录当前播放的id
this.appear(numIdCurr,index-1)
this.videoContextId = 'myVideo' + numIdCurr;
this.videoContext = uni.createVideoContext(this.videoContextId, this);
console.log('走更新了')
this.$nextTick(() => {
//播放当前的
this.videoContext.play();
})
}
// this.$forceUpdate();
},
//选集弹窗的回调
changeXj(e) {
if (e.show == false) {
@@ -972,7 +997,7 @@
if (res.code == 0) {
uni.hideLoading()
uni.showToast({
title: '已解锁',
title: '已成功解锁',
icon: 'none'
})
this.closePopusPay()

View File

@@ -1249,7 +1249,7 @@
if (res.code == 0) {
uni.hideLoading()
uni.showToast({
title: '已解锁',
title: '已成功解锁',
icon: 'none'
})
that.showPay = false

View File

@@ -144,7 +144,7 @@
</view>
</view>
<text class="" style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;">
{{getRedEnvelopeTips}}
{{this.courseDetailsId}}
</text>
<view class="pay-content">
<view class="pay-content-item" @click="payVideo(1)">
@@ -961,7 +961,7 @@
if (res.code == 0) {
uni.hideLoading()
uni.showToast({
title: '已解锁',
title: '已成功解锁',
icon: 'none'
})
this.closePopusPay()