H5中0元支付弹窗修改

This commit is contained in:
GaoHao
2024-12-19 14:52:19 +08:00
parent 8e7d038dba
commit a0e49f9830
4 changed files with 111 additions and 60 deletions

View File

@@ -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">
@@ -393,6 +393,8 @@
playFlag: false,
getRedEnvelopeTips: '',
scale: 1,
// 防抖使用的变量
appearTimeout: null
};
},
onUnload() {
@@ -402,7 +404,7 @@
}
},
onShow() {
console.log('onSHow video');
// console.log('onSHow video');
//当应用从后台进入前台时自动播放
if (this.videoContext) {
this.videoContext.play()
@@ -491,7 +493,6 @@
this.getDataList(this.courseId, this.courseDetailsId);
}
httpsRequest.getT('app/course/getRedEnvelopeTips').then(res => {
console.log(res)
if (res.code == 0) {
this.getRedEnvelopeTips = res.data
}
@@ -519,16 +520,18 @@
this.wHeight = sysInfo.screenHeight
this.boxStyle.height = this.wHeight + 5;
// 记录跳转过来的视频总id跟单集id
console.log(e)
if (e.id) {
console.log(e)
this.courseId = e.id;
if (e.courseDetailsId && e.courseDetailsId != 'null') {
this.courseDetailsId = e.courseDetailsId
}
console.log(this.courseDetailsId)
this.getMyLoveStatus()
this.getMoneyList()
this.getMyMoney()
} else {
console.log("allId====="+e.allId)
if (e.allId) {
const arr = e.allId.split('-')
this.courseId = arr[0];
@@ -560,9 +563,9 @@
},
//播放时的回掉
videoPlay(videoId, courseDetailsId) {
this.courseDetailsId = courseDetailsId
console.log(courseDetailsId)
// this.courseDetailsId = courseDetailsId
if (!this.playFlag) {
console.log(this.courseDetailsId)
this.playFlag = true
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
@@ -576,6 +579,7 @@
},
//播放进度变化回掉
timeupdate(e) {
// console.log(this.courseDetailsId)
if (e.detail.currentTime > e.detail.duration * 0.9) {
if (this.playFlag) {
this.playFlag = false
@@ -591,48 +595,60 @@
},
appear(e, index) {
this.courseDetailsId = e
this.current = index
this.showControls = true
this.isShowVideo = e
this.scrollIntoViews = 'video' + index
this.scrollIntoView = 'video' + index
console.log(this.scrollIntoViews, '当前位置')
//播放并更新video的上下文
this.startPlay(index)
//插入历史记录
this.setHistor(this.videoList[index].courseId, this.videoList[index].courseDetailsId);
this.$forceUpdate()
// 清除已经设置的定时器
clearTimeout(this.appearTimeout);
// 设置一个新的延迟执行的定时器
this.appearTimeout = setTimeout(() => {
// 实际要执行的操作
console.log('页面出现在视图中');
// 这里可以加入你需要执行的代码
console.log("appear==="+e)
console.log("appear==="+index)
// this.courseDetailsId = e
this.current = index
this.showControls = true
this.isShowVideo = e
this.scrollIntoViews = 'video' + index
this.scrollIntoView = 'video' + index
console.log(this.scrollIntoViews, '当前位置')
//播放并更新video的上下文
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;
// }
// console.log("disappear==="+index)
// if (this.current > index) {
// index = index + 1
// } else {
// index = index - 1
// }
// let numIdCurr = this.videoList[index].courseDetailsId;
// if (this.videoList[index].videoUrl) { //已经购买可直接播放
// // 播放时记录当前播放的id
// this.appear(numIdCurr, index)
// this.videoContextId = 'myVideo' + numIdCurr;
// this.videoContext = uni.createVideoContext(this.videoContextId, this);
// console.log('走更新了')
if (this.videoContext) { //判断之前是否有视频的上下文
this.videoContext.stop();
this.videoContext = null;
}
if (this.current > index) {
index = index + 1
} else {
index = index - 1
}
let numIdCurr = this.videoList[index].courseDetailsId;
if (this.videoList[index].videoUrl) { //已经购买可直接播放
// 播放时记录当前播放的id
this.appear(numIdCurr, index)
this.videoContextId = 'myVideo' + numIdCurr;
this.videoContext = uni.createVideoContext(this.videoContextId, this);
console.log('走更新了')
this.$nextTick(() => {
//播放当前的
this.videoContext.play();
})
}
// this.$nextTick(() => {
// //播放当前的
// this.videoContext.play();
// })
// }
// this.$forceUpdate();
},
//选集弹窗的回调
changeXj(e) {
console.log(e)
if (e.show == false) {
//关闭弹窗的时候重置scrollIntoViews防止关闭后第二次点就不能自动滑动到当前集的位置
this.scrollIntoViews = 'video0'
@@ -1226,8 +1242,8 @@
animated: false
})
_this.$forceUpdate()
console.log('移动结束', el)
// },1000)
console.log('移动结束', el)
// },1000)
})
},
async getCount() {
@@ -1273,8 +1289,6 @@
});
//菜单数组
this.meunList = arr;
console.log(type)
console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
if (type == true) { //购买视频后返回的
console.log('购买视频后返回的')
let courseDetailsIds = this.videoList[this.current].courseDetailsId;
@@ -1310,7 +1324,7 @@
}
})
}
console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
// console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
} else { //直接跳转进来的
this.videoList = this.meunList
@@ -1321,7 +1335,7 @@
console.log(indexs, '有记录吗?')
this.goListPosition(this.videoList[indexs].courseDetailsId)
}
console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
// console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
if (this.videoList[indexss].videoUrl) { //有播放权限
console.log('有播放权限进入是否抽取转盘判断')
@@ -1351,6 +1365,7 @@
} else { //没有播放权限打开购买弹窗
this.openPay()
}
this.$forceUpdate();
})
}
if ( t == 'select') {