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

@ -375,8 +375,7 @@
//
that.$Request.getT('/app/user/selectNewApp').then(res => {
res = res.data[0];
console.log("widgetInfo==",widgetInfo)
console.log("selectNewApp==",res)
if (widgetInfo.version < res.version) {
let downloadLink = '';
let androidLink = res.androidWgtUrl;

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') {

View File

@ -41,7 +41,7 @@
<!-- #endif -->
<!-- :autoplay="item.autoPlay" -->
<!-- 没有视频权限则显示封面图 -->
<image v-else @click="openShowPay();showControls = true" :src="item.titleImg"
<image v-else @click="openShowPay(current,index,item.videoUrl);showControls = true" :src="item.titleImg"
class="swipers-items-imgsbg" mode="aspectFill"></image>
<!-- 返回图标 -->
<!-- #ifndef MP-TOUTIAO -->
@ -84,7 +84,7 @@
<image src="../../static/images/me/share.png" mode=""></image>
</view>
<view class="swipers-items-right-item-txt">
分享
分享{{current}}
</view>
</view>
<!-- #endif -->
@ -103,7 +103,7 @@
<image src="../../static/images/me/shuqian.png" style="height: 60rpx;" mode=""></image>
</view>
<view class="swipers-items-right-item-txt">
追剧
追剧{{index}}
</view>
</view>
</view>
@ -654,6 +654,7 @@
},
onShow() {
console.log('onSHow video');
//
if (this.videoContext) {
this.videoContext.play()
@ -843,7 +844,11 @@
event.preventDefault();
},
//
openShowPay() {
openShowPay(val,inx,url) {
console.log(val)
console.log(inx)
console.log(url)
console.log(this.videoList[this.current])
this.zongPrice = this.info.price
this.countPrice = this.videoList[this.current].price
this.showPay = true
@ -1562,13 +1567,17 @@
let indexs = -1
if (courseDetailsId) { //
console.log(courseDetailsId)
console.log(this.meunList)
this.meunList.map((item, index) => {
if (item.courseDetailsId == courseDetailsId) {
indexs = index
}
})
console.log(indexs)
if (indexs != -1) { //
if (Number(indexs + 1) === this.meunList.length) { //
console.log("最后一条")
if (this.meunList.length == 1) { //
this.videoList = this.meunList.slice(0,
3)
@ -1577,14 +1586,17 @@
3)
} else {
this.videoList = [
this.meunList[this.meunList
.length - 3],
this.meunList[this.meunList
.length - 2],
this.meunList[this.meunList
.length - 1],
this.meunList[0],
this.meunList[1],
]
}
} else if (Number(indexs) === Number(this.meunList.length - 1)) { //
console.log("倒数第二条")
if (this.meunList.length == 1) { //
this.videoList = this.meunList.slice(0,
3)
@ -1604,9 +1616,28 @@
}
} else {
console.log("如果不是最后一条,也不是倒数第二条")
//
this.videoList = this.meunList.slice(indexs,
indexs + 3)
if ( indexs == 0 ) {
this.videoList = [
this.meunList[this.meunList
.length - 2],
this.meunList[this.meunList
.length - 1],
this.meunList[0],
]
} else if ( indexs == 1) {
this.videoList = [
this.meunList[this.meunList
.length - 1],
this.meunList[0],
this.meunList[1],
]
} else {
this.videoList = this.meunList.slice(indexs-2,
indexs-2 + 3)
}
}
} else {
//
@ -1614,12 +1645,17 @@
}
} else { //
// ////
this.videoList = this.meunList.slice(0, 3)
indexs = 0
}
console.log(this.videoList, '111111111111')
console.log(this.videoList);
this.videoList.map((item, index) => {
if (item.courseDetailsId == courseDetailsId) {
this.current = index
}
})
//
this.comNumVideo()
if (indexs != -1 && this.meunList.length > 0) {
@ -1707,6 +1743,7 @@
},
//swiper
change(e) {
console.log(e)
//swiper
let current = Number(e.detail.current)
// courseDetailsIdmeunList
@ -1875,6 +1912,7 @@
},
//
ended() {
console.log(this.current)
if (this.current == 2) {
this.current = 0
} else {

View File

@ -293,7 +293,6 @@
// #endif
console.log(options, '22222222222222222')
if (uni.getStorageSync('qdCode')) {
this.qdCode = uni.getStorageSync('qdCode')
}