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

View File

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

View File

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

View File

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