H5中0元支付弹窗修改
This commit is contained in:
parent
8e7d038dba
commit
a0e49f9830
3
App.vue
3
App.vue
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
if (e.id) {
|
||||
console.log(e)
|
||||
if (e.id) {
|
||||
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,7 +595,17 @@
|
|||
|
||||
},
|
||||
appear(e, index) {
|
||||
this.courseDetailsId = e
|
||||
// 清除已经设置的定时器
|
||||
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
|
||||
|
|
@ -603,36 +617,38 @@
|
|||
//插入历史记录
|
||||
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;
|
||||
}
|
||||
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;
|
||||
// }
|
||||
// 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('走更新了')
|
||||
|
||||
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'
|
||||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
//没找到直接拿前三条数据即可
|
||||
|
|
@ -1619,7 +1650,12 @@
|
|||
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)
|
||||
// 根据courseDetailsId在meunList中找到这个数据的下标
|
||||
|
|
@ -1875,6 +1912,7 @@
|
|||
},
|
||||
//监听视频播放完成
|
||||
ended() {
|
||||
console.log(this.current)
|
||||
if (this.current == 2) {
|
||||
this.current = 0
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -293,7 +293,6 @@
|
|||
|
||||
// #endif
|
||||
|
||||
console.log(options, '22222222222222222')
|
||||
if (uni.getStorageSync('qdCode')) {
|
||||
this.qdCode = uni.getStorageSync('qdCode')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue