From fa72a47277f9d386f21c7432e1cbd1cbc535cc11 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Tue, 24 Dec 2024 10:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A010=E9=9B=86=E5=92=8C=E5=85=A8?= =?UTF-8?q?=E5=89=A7=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- me/detail/detail.nvue | 27 +++++++++++++---- me/detail/detail.vue | 69 ++++++++++++++++++++++++++----------------- readme.md | 1 + 3 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 readme.md diff --git a/me/detail/detail.nvue b/me/detail/detail.nvue index 2f79759..8c5dc6e 100644 --- a/me/detail/detail.nvue +++ b/me/detail/detail.nvue @@ -149,7 +149,19 @@ style="font-size: 24rpx;color: #999;padding: 0 34rpx;margin: 20rpx 0; auto;text-align: left;width: 100%;"> {{getRedEnvelopeTips}} - + + + + + {{info.price}}元解锁全剧 + + + + + + {{info.wholesalePrice}}元解锁10集视频 + + @@ -1025,9 +1037,9 @@ * 1:购买整部视频 * 2:购买单集视频 */ - payVideo(type) { + payVideo(type,num) { if (uni.getStorageSync('token')) { - this.submitPay(type) + this.submitPay(type,num) } else { uni.navigateTo({ url: "/pages/login/login" @@ -1035,13 +1047,16 @@ } }, //使用金币购买 - submitPay(type) { + submitPay(type,num) { let data = { courseId: this.courseId } - + if(!num){ + //单集解锁 + data.courseDetailsId = this.videoList[this.current].courseDetailsId + } data.courseDetailsId = this.videoList[this.current].courseDetailsId - httpsRequest.getT('/app/order/insertCourseOrders', data).then(res => { + httpsRequest.getT((num && num == 10)?'/app/order/insertCourseOrders/limit10': '/app/order/insertCourseOrders', data).then(res => { if (res.code == 0) { this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 diff --git a/me/detail/detail.vue b/me/detail/detail.vue index d90f1aa..3d27952 100644 --- a/me/detail/detail.vue +++ b/me/detail/detail.vue @@ -41,8 +41,8 @@ - + @@ -199,10 +199,22 @@ {{getRedEnvelopeTips}} + + + + {{info.price}}元解锁10集视频 + + + + + + {{info.wholesalePrice}}元解锁10集视频 + + - {{countPrice*scale}}金币解锁单集视频 + {{countPrice*scale}}金币解锁单集视频 @@ -654,7 +666,7 @@ }, onShow() { console.log('onSHow video'); - + //当应用从后台进入前台时自动播放 if (this.videoContext) { this.videoContext.play() @@ -748,7 +760,7 @@ this.meunTop = 37 // #endif - + // const windowResizeCallback = (res) => { // console.log('变化后的窗口宽度=' + res.size.windowWidth) // console.log('变化后的窗口高度=' + res.size.windowHeight) @@ -844,7 +856,7 @@ event.preventDefault(); }, //点击封面打开弹窗 - openShowPay(val,inx,url) { + openShowPay(val, inx, url) { console.log(val) console.log(inx) console.log(url) @@ -1256,10 +1268,11 @@ }, /** * @param {Object} type 类型 + * @param {Object} num 集数 * 1:购买整部视频 * 2:购买单集视频 */ - payVideo(type) { + payVideo(type, num) { if (uni.getStorageSync('token')) { // #ifdef MP-TOUTIAO if (!this.checked) { @@ -1270,7 +1283,7 @@ return } // #endif - this.submitPay(type) + this.submitPay(type, num) } else { uni.navigateTo({ url: "/pages/login/login" @@ -1300,13 +1313,15 @@ this.showMoney = data }, //使用金币购买 - submitPay(type) { + submitPay(type, num) { let data = { courseId: this.courseId } - - data.courseDetailsId = this.videoList[this.current].courseDetailsId - this.$Request.getT('/app/order/insertCourseOrders', data).then(res => { + if(!num){ + //单集解锁 + data.courseDetailsId = this.videoList[this.current].courseDetailsId + } + this.$Request.getT((num && num == 10)?'/app/order/insertCourseOrders/limit10': '/app/order/insertCourseOrders', data).then(res => { if (res.code == 0) { this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 @@ -1322,7 +1337,7 @@ } } else { - if ( res.status && res.status == 1) { + if (res.status && res.status == 1) { this.showPay = false //关闭购买选择弹窗 this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, true); @@ -1468,12 +1483,12 @@ this.$forceUpdate() }, //选择播放 - selectPlay(item,type) {//price //videoUrl + selectPlay(item, type) { //price //videoUrl // 根据选择的courseDetailsId拿到meunList列表中的相同数据的下标 const index = this.meunList.findIndex(menu => menu.courseDetailsId === item.courseDetailsId); this.videoList = [this.meunList[index]] this.current = 0 - if ( this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type ) { + if (this.videoList[this.current].videoUrl == '' && this.videoList[this.current].price <= 0 && !type) { this.getDataList(this.courseId, this.courseDetailsId, true, 'select') return; } @@ -1573,8 +1588,8 @@ let indexs = -1 if (courseDetailsId) { //从记录进来的 - console.log(courseDetailsId) - console.log(this.meunList) + console.log(courseDetailsId) + console.log(this.meunList) this.meunList.map((item, index) => { if (item.courseDetailsId == courseDetailsId) { indexs = index @@ -1583,7 +1598,7 @@ console.log(indexs) if (indexs != -1) { //找到了 if (Number(indexs + 1) === this.meunList.length) { //最后一条 - console.log("最后一条") + console.log("最后一条") if (this.meunList.length == 1) { //只有一条 this.videoList = this.meunList.slice(0, 3) @@ -1602,7 +1617,7 @@ } } else if (Number(indexs) === Number(this.meunList.length - 1)) { //倒数第二条 - console.log("倒数第二条") + console.log("倒数第二条") if (this.meunList.length == 1) { //只有一条 this.videoList = this.meunList.slice(0, 3) @@ -1624,7 +1639,7 @@ } else { console.log("如果不是最后一条,也不是倒数第二条") //如果不是最后一条,也不是倒数第二条,则从找到的位置开始往后拿三条数据放入数组 - if ( indexs == 0 ) { + if (indexs == 0) { this.videoList = [ this.meunList[this.meunList .length - 2], @@ -1632,7 +1647,7 @@ .length - 1], this.meunList[0], ] - } else if ( indexs == 1) { + } else if (indexs == 1) { this.videoList = [ this.meunList[this.meunList .length - 1], @@ -1640,10 +1655,10 @@ this.meunList[1], ] } else { - this.videoList = this.meunList.slice(indexs-2, - indexs-2 + 3) + this.videoList = this.meunList.slice(indexs - 2, + indexs - 2 + 3) } - + } } else { //没找到直接拿前三条数据即可 @@ -1651,7 +1666,7 @@ } } else { //新的视频 // //视频数组//直接拿前三条 - + this.videoList = this.meunList.slice(0, 3) indexs = 0 @@ -1706,8 +1721,8 @@ }) - if ( t == 'select') { - this.selectPlay(this.videoList[this.current],true) + if (t == 'select') { + this.selectPlay(this.videoList[this.current], true) } } } else { diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..42f1213 --- /dev/null +++ b/readme.md @@ -0,0 +1 @@ +[](https://app.apifox.com/project/5657406) \ No newline at end of file