金币解锁优化

This commit is contained in:
GaoHao
2024-12-26 16:55:22 +08:00
parent 68b54a75f7
commit 4995135cda

View File

@@ -575,11 +575,7 @@
}, },
//播放时的回掉 //播放时的回掉
videoPlay(videoId, courseDetailsId) { videoPlay(videoId, courseDetailsId) {
console.log(courseDetailsId)
console.log(this.playFlag)
// this.courseDetailsId = courseDetailsId
if (!this.playFlag) { if (!this.playFlag) {
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, true);
this.playFlag = true this.playFlag = true
httpsRequest.getT('app/course/viewCourse', { httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId, courseId: this.courseId,
@@ -622,12 +618,14 @@
console.log("appear===" + e) console.log("appear===" + e)
console.log("appear===" + index) console.log("appear===" + index)
// this.courseDetailsId = e // this.courseDetailsId = e
console.log(e)
this.current = index this.current = index
this.showControls = true this.showControls = true
this.isShowVideo = e this.isShowVideo = e
this.scrollIntoViews = 'video' + index this.scrollIntoViews = 'video' + index
this.scrollIntoView = 'video' + index this.scrollIntoView = 'video' + index
console.log(this.scrollIntoViews, '当前位置') console.log(this.scrollIntoViews, '当前位置')
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId);
//播放并更新video的上下文 //播放并更新video的上下文
this.startPlay(index) this.startPlay(index)
//插入历史记录 //插入历史记录
@@ -1066,30 +1064,37 @@
//单集解锁 //单集解锁
data.courseDetailsId = this.videoList[this.current].courseDetailsId data.courseDetailsId = this.videoList[this.current].courseDetailsId
} }
console.log(this.videoList[this.current].courseDetailsId)
console.log((num && num == 10) ? '/app/order/insertCourseOrders/limit10' :
'/app/order/insertCourseOrders')
httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' : httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' :
'/app/order/insertCourseOrders', data).then(res => { '/app/order/insertCourseOrders', data).then(res => {
console.log(3) console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.ordersId = res.data.orders.ordersId //记录订单id
this.payMoney = res.data.orders.payMoney //记录订单价格 console.log(res.status && res.status == 1)
if (type == 1) { //金币
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
} 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 {
if (res.status && res.status == 1) { if (res.status && res.status == 1) {
this.showPay = false //关闭购买选择弹窗 this.showPay = false //关闭购买选择弹窗
this.isOrder = true this.isOrder = true
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,
true); true);
return; return;
} else{
this.ordersId = res.data.orders.ordersId //记录订单id
this.payMoney = res.data.orders.payMoney //记录订单价格
if (type == 1) { //金币
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
} 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({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
@@ -1102,7 +1107,8 @@
console.log("orderId==" + orderId) console.log("orderId==" + orderId)
httpsRequest.postT("/app/order/payOrders", { httpsRequest.postT("/app/order/payOrders", {
orderId: orderId, orderId: orderId,
}).then(res => { }).then(res => {
console.log("orderIds==" + res)
if (res.code == 0) { if (res.code == 0) {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@@ -1228,9 +1234,9 @@
//播放结束后播放下一集 //播放结束后播放下一集
ended() { ended() {
if (this.current < this.videoList.length - 1) { if (this.current < this.videoList.length - 1) {
// this.current += 1
this.$nextTick(() => { this.$nextTick(() => {
let courseDetailsId = this.videoList[this.current + 1].courseDetailsId this.current += 1
let courseDetailsId = this.videoList[this.current].courseDetailsId
console.log(courseDetailsId, '开始移动了') console.log(courseDetailsId, '开始移动了')
const el = this.$refs['list' + courseDetailsId][0] const el = this.$refs['list' + courseDetailsId][0]
listDom.scrollToElement(el, {}) listDom.scrollToElement(el, {})
@@ -1300,6 +1306,7 @@
id: courseId, id: courseId,
token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '' token: uni.getStorageSync('token') ? uni.getStorageSync('token') : ''
}; };
console.log(courseDetailsId)
httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => { httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => {
if (res.code == 0) { if (res.code == 0) {