增加:
抽奖次数不足时不跳转 增加配速播放
This commit is contained in:
@@ -3,14 +3,13 @@
|
||||
<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()" @disappear="disappear(item.courseDetailsId,i)" @appear="appear(item.courseDetailsId,i)"
|
||||
:style="boxStyle">
|
||||
<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"
|
||||
v-if="isShowVideo == item.courseDetailsId && item.videoUrl" :play-strategy="2"
|
||||
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="true"
|
||||
@timeupdate="timeupdate"
|
||||
@play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
|
||||
@timeupdate="timeupdate" @play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
|
||||
@ended="ended" :enable-progress-gesture="false" :poster="item.titleImg"
|
||||
:ref="'myVideo'+item.courseDetailsId" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"
|
||||
:autoplay="item.autoPlay" class="swipers-items-video"></video>
|
||||
@@ -18,7 +17,8 @@
|
||||
mode="aspectFill">
|
||||
</image>
|
||||
<!-- 返回图标 -->
|
||||
<image v-if="showBack" src="../static/nvueIcon/backs.png" @click="goBack()" class="swipers-items-back" mode="">
|
||||
<image v-if="showBack" src="../static/nvueIcon/backs.png" @click="goBack()"
|
||||
class="swipers-items-back" mode="">
|
||||
</image>
|
||||
<!-- 右边操作 -->
|
||||
<view class="swipers-items-right" :style="rightTop" v-if="showControls">
|
||||
@@ -145,7 +145,8 @@
|
||||
<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%;">
|
||||
<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">
|
||||
@@ -181,7 +182,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
|
||||
|
||||
<!-- 支付弹窗 -->
|
||||
<uni-popup ref="popuppay" :safe-area="false">
|
||||
@@ -298,7 +299,7 @@
|
||||
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
|
||||
<!-- 抽奖弹窗 -->
|
||||
<!-- <uni-popup ref="refPopupZhuanPan" :safe-area="true" background-color="#ffffff">
|
||||
<view case="">
|
||||
@@ -317,9 +318,9 @@
|
||||
data() {
|
||||
return {
|
||||
//可抽奖次数
|
||||
freeNum:0,
|
||||
showBack:false,
|
||||
noBuyVideoIndex:null,
|
||||
freeNum: 0,
|
||||
showBack: false,
|
||||
noBuyVideoIndex: null,
|
||||
// 奖品列表,
|
||||
showMoney: true,
|
||||
nowBs: 1, //当前倍速
|
||||
@@ -388,7 +389,7 @@
|
||||
'width': '750rpx',
|
||||
},
|
||||
isShowVideo: '',
|
||||
noBuyVideoIndex:null,
|
||||
noBuyVideoIndex: null,
|
||||
playFlag: false,
|
||||
getRedEnvelopeTips: '',
|
||||
scale: 1,
|
||||
@@ -406,6 +407,10 @@
|
||||
if (this.videoContext) {
|
||||
this.videoContext.play()
|
||||
}
|
||||
const noBuyVideoIndex= uni.getStorageSync('noBuyVideoIndex')
|
||||
if(noBuyVideoIndex!==null&&noBuyVideoIndex!==undefined){
|
||||
this.noBuyVideoIndex=noBuyVideoIndex
|
||||
}
|
||||
this.isVips = uni.getStorageSync('isVips') ? uni.getStorageSync('isVips') : '否'
|
||||
let that = this
|
||||
uni.$on('back', (data) => {
|
||||
@@ -478,17 +483,17 @@
|
||||
}
|
||||
|
||||
// #endif
|
||||
this.$nextTick(()=>{
|
||||
this.$nextTick(() => {
|
||||
this.closePopusPay()
|
||||
})
|
||||
if(this.courseId){
|
||||
|
||||
if (this.courseId) {
|
||||
|
||||
this.getDataList(this.courseId, this.courseDetailsId);
|
||||
}
|
||||
httpsRequest.getT('app/course/getRedEnvelopeTips').then(res => {
|
||||
console.log(res)
|
||||
if (res.code == 0) {
|
||||
this.getRedEnvelopeTips= res.data
|
||||
this.getRedEnvelopeTips = res.data
|
||||
}
|
||||
})
|
||||
this.getScale()
|
||||
@@ -524,23 +529,23 @@
|
||||
this.getMoneyList()
|
||||
this.getMyMoney()
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取金币比例
|
||||
*/
|
||||
getScale () {
|
||||
getScale() {
|
||||
httpsRequest.getT("app/common/type/914", {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.scale = Number(res.data.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//播放时的回掉
|
||||
videoPlay(videoId,courseDetailsId) {
|
||||
videoPlay(videoId, courseDetailsId) {
|
||||
this.courseDetailsId = courseDetailsId
|
||||
if ( !this.playFlag ) {
|
||||
if (!this.playFlag) {
|
||||
console.log(this.courseDetailsId)
|
||||
this.playFlag = true
|
||||
httpsRequest.getT('app/course/viewCourse', {
|
||||
@@ -551,12 +556,12 @@
|
||||
console.log('播放开始')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
//播放进度变化回掉
|
||||
timeupdate(e) {
|
||||
if (e.detail.currentTime > e.detail.duration*0.9) {
|
||||
if ( this.playFlag) {
|
||||
if (e.detail.currentTime > e.detail.duration * 0.9) {
|
||||
if (this.playFlag) {
|
||||
this.playFlag = false
|
||||
httpsRequest.getT('app/course/viewCourse', {
|
||||
courseId: this.courseId,
|
||||
@@ -567,7 +572,7 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
appear(e, index) {
|
||||
this.courseDetailsId = e
|
||||
@@ -584,24 +589,24 @@
|
||||
this.$forceUpdate()
|
||||
},
|
||||
disappear(e, index) {
|
||||
|
||||
|
||||
if (this.videoContext) { //判断之前是否有视频的上下文
|
||||
this.videoContext.stop();
|
||||
this.videoContext = null;
|
||||
}
|
||||
if ( this.current > index) {
|
||||
index = index+1
|
||||
if (this.current > index) {
|
||||
index = index + 1
|
||||
} else {
|
||||
index = index-1
|
||||
index = index - 1
|
||||
}
|
||||
let numIdCurr = this.videoList[index].courseDetailsId;
|
||||
if (this.videoList[index].videoUrl) { //已经购买可直接播放
|
||||
// 播放时记录当前播放的id
|
||||
this.appear(numIdCurr,index)
|
||||
this.appear(numIdCurr, index)
|
||||
this.videoContextId = 'myVideo' + numIdCurr;
|
||||
this.videoContext = uni.createVideoContext(this.videoContextId, this);
|
||||
console.log('走更新了')
|
||||
|
||||
|
||||
this.$nextTick(() => {
|
||||
//播放当前的
|
||||
this.videoContext.play();
|
||||
@@ -751,17 +756,17 @@
|
||||
})
|
||||
} else if (this.openWay == 1) {
|
||||
// APP支付宝支付
|
||||
httpsRequest.getT("/app/wuyou/payOrder/"+this.ordersId, {}).then(ret => {
|
||||
httpsRequest.getT("/app/wuyou/payOrder/" + this.ordersId, {}).then(ret => {
|
||||
// plus.runtime.openURL(ret.data.h5Url)
|
||||
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/pays/pays?ordersId='+this.ordersId+'&url=' + ret.data.h5Url
|
||||
url: '/pages/pays/pays?ordersId=' + this.ordersId + '&url=' + ret.data.h5Url
|
||||
});
|
||||
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/index/webView?ordersId='+this.ordersId+'url=' + ret.data.h5Url
|
||||
// });
|
||||
|
||||
|
||||
// this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data));
|
||||
});
|
||||
} else if (this.openWay == 3) {
|
||||
@@ -891,19 +896,19 @@
|
||||
this.$refs.popuppay.open('bottom')
|
||||
return
|
||||
// 通过 id 获取 nvue 子窗体
|
||||
const subNVue = uni.getSubNVueById('pay')
|
||||
subNVue.setStyle({
|
||||
height : '350rpx',
|
||||
const subNVue = uni.getSubNVueById('pay')
|
||||
subNVue.setStyle({
|
||||
height: '350rpx',
|
||||
})
|
||||
// 打开 nvue 子窗体
|
||||
subNVue.show('slide-in-bottom', 300, function(){
|
||||
// 打开后进行一些操作...
|
||||
//
|
||||
subNVue.show('slide-in-bottom', 300, function() {
|
||||
// 打开后进行一些操作...
|
||||
//
|
||||
console.log('subnvue open')
|
||||
});
|
||||
});
|
||||
// 关闭 nvue 子窗体
|
||||
// subNVue.hide('fade-out', 300)
|
||||
|
||||
|
||||
// this.$refs.refPopupZhuanPan.open('bottom')
|
||||
},
|
||||
// 获取收藏状态
|
||||
@@ -925,7 +930,7 @@
|
||||
//显示/隐藏适配控制器的回调
|
||||
controlstoggles(e) {
|
||||
this.showControls = e.detail.show
|
||||
this.showBack=!this.showBack
|
||||
this.showBack = !this.showBack
|
||||
// console.log(e.detail.show, '显示/隐藏控制栏')
|
||||
},
|
||||
//打开倍速弹框
|
||||
@@ -996,7 +1001,7 @@
|
||||
let data = {
|
||||
courseId: this.courseId
|
||||
}
|
||||
|
||||
|
||||
data.courseDetailsId = this.videoList[this.current].courseDetailsId
|
||||
httpsRequest.getT('/app/order/insertCourseOrders', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
@@ -1005,12 +1010,12 @@
|
||||
|
||||
if (type == 1) { //金币
|
||||
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
|
||||
} else if(type == 2){ //支付宝
|
||||
} else if (type == 2) { //支付宝
|
||||
this.closePay() //关闭购买选择弹窗
|
||||
this.payPrice = res.data.orders.payMoney //需要支付的价格
|
||||
this.openPopusPay() //显示充值弹窗
|
||||
}
|
||||
|
||||
|
||||
// this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
|
||||
} else {
|
||||
uni.showToast({
|
||||
@@ -1022,7 +1027,7 @@
|
||||
},
|
||||
payOrder(orderId, payMoney) {
|
||||
let that = this
|
||||
console.log("orderId=="+orderId)
|
||||
console.log("orderId==" + orderId)
|
||||
httpsRequest.postT("/app/order/payOrders", {
|
||||
orderId: orderId,
|
||||
}).then(res => {
|
||||
@@ -1057,11 +1062,12 @@
|
||||
},
|
||||
//打开购买弹窗
|
||||
openPay() {
|
||||
|
||||
|
||||
this.zongPrice = this.info.price
|
||||
this.countPrice = this.videoList[this.current].price
|
||||
this.$refs.popupPya.open('bottom')
|
||||
this.noBuyVideoIndex=this.current
|
||||
this.noBuyVideoIndex = this.current
|
||||
uni.setStorageSync('noBuyVideoIndex',this.current)
|
||||
},
|
||||
//关闭购买弹窗
|
||||
closePay() {
|
||||
@@ -1171,6 +1177,7 @@
|
||||
this.$nextTick(() => {
|
||||
//播放当前的
|
||||
this.videoContext.play();
|
||||
this.videoContext.playbackRate(this.subList[this.nowBs].num)
|
||||
})
|
||||
} else { //没有视频链接则表示没有权限,需要购买 弹出购买弹窗
|
||||
this.openPay()
|
||||
@@ -1186,21 +1193,23 @@
|
||||
let _this = this;
|
||||
this.$nextTick(() => {
|
||||
// setTimeout(()=>{
|
||||
console.log(courseDetailsId, '开始移动了')
|
||||
const el = _this.$refs['list' + courseDetailsId][0]
|
||||
listDom.scrollToElement(el, {
|
||||
animated: false
|
||||
})
|
||||
_this.$forceUpdate()
|
||||
console.log('移动结束',el)
|
||||
console.log(courseDetailsId, '开始移动了')
|
||||
const el = _this.$refs['list' + courseDetailsId][0]
|
||||
listDom.scrollToElement(el, {
|
||||
animated: false
|
||||
})
|
||||
_this.$forceUpdate()
|
||||
console.log('移动结束', el)
|
||||
// },1000)
|
||||
})
|
||||
},
|
||||
async getCount(){
|
||||
const res=await this.$Request.getT('app/discSpinning/drawCount')
|
||||
if(res.code==0){
|
||||
this.freeNum=res.count||0
|
||||
async getCount() {
|
||||
console.log('getCount')
|
||||
const res = await this.$Request.getT('app/discSpinning/drawCount')
|
||||
if (res.code == 0) {
|
||||
this.freeNum = res.count || 0
|
||||
}
|
||||
console.log(res);
|
||||
return res
|
||||
},
|
||||
/**
|
||||
@@ -1236,7 +1245,7 @@
|
||||
//菜单数组
|
||||
this.meunList = arr;
|
||||
console.log(type)
|
||||
console.log('this.noBuyVideoIndex',this.noBuyVideoIndex)
|
||||
console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
|
||||
if (type == true) { //购买视频后返回的
|
||||
console.log('购买视频后返回的')
|
||||
let courseDetailsIds = this.videoList[this.current].courseDetailsId;
|
||||
@@ -1254,16 +1263,26 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
getCount
|
||||
if(this.noBuyVideoIndex!==null){
|
||||
this.noBuyVideoIndex=null
|
||||
|
||||
if (this.noBuyVideoIndex !== null&& this.videoList[this
|
||||
.noBuyVideoIndex].videoUrl) {
|
||||
this.noBuyVideoIndex = null
|
||||
uni.removeStorageSync('noBuyVideoIndex')
|
||||
this.videoContext.stop()
|
||||
uni.navigateTo({
|
||||
url:'/me/choujiang/choujiang'
|
||||
httpsRequest.getT('app/discSpinning/drawCount').then(res => {
|
||||
console.log('转盘抽奖次数')
|
||||
console.log(res)
|
||||
if (res.count >= 1) {
|
||||
uni.navigateTo({
|
||||
url: '/me/choujiang/choujiang'
|
||||
})
|
||||
}else{
|
||||
this.videoContext.play();
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log('this.noBuyVideoIndex',this.noBuyVideoIndex)
|
||||
|
||||
console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
|
||||
|
||||
} else { //直接跳转进来的
|
||||
this.videoList = this.meunList
|
||||
this.$nextTick(() => {
|
||||
@@ -1273,28 +1292,33 @@
|
||||
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('有播放权限进入是否抽取转盘判断')
|
||||
let numIdCurr = this.videoList[indexss].courseDetailsId;
|
||||
this.videoContextId = 'myVideo' + numIdCurr;
|
||||
this.videoContext = uni.createVideoContext(this
|
||||
.videoContextId,
|
||||
this);
|
||||
if(this.noBuyVideoIndex!=null&&this.videoList[this.noBuyVideoIndex].videoUrl){
|
||||
this.videoContext.stop();
|
||||
this.getCount(res).then(res=>{
|
||||
if(res.count>=1){
|
||||
uni.navigateTo({
|
||||
url:'/me/choujiang/choujiang'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.noBuyVideoIndex=null
|
||||
}else{
|
||||
this.videoContext.play();
|
||||
}
|
||||
if (this.noBuyVideoIndex != null && this.videoList[this
|
||||
.noBuyVideoIndex].videoUrl) {
|
||||
this.videoContext.stop();
|
||||
httpsRequest.getT('app/discSpinning/drawCount').then(res => {
|
||||
console.log('转盘抽奖次数')
|
||||
if (res.count >= 1) {
|
||||
uni.navigateTo({
|
||||
url: '/me/choujiang/choujiang'
|
||||
})
|
||||
}else{
|
||||
this.videoContext.play();
|
||||
}
|
||||
})
|
||||
uni.removeStorageSync('noBuyVideoIndex')
|
||||
this.noBuyVideoIndex = null
|
||||
} else {
|
||||
this.videoContext.play();
|
||||
}
|
||||
} else { //没有播放权限打开购买弹窗
|
||||
this.openPay()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user