增加支付跳转盘抽奖

This commit is contained in:
2025-01-13 17:37:51 +08:00
parent 8029d157b6
commit f410719b46
4 changed files with 42 additions and 35 deletions

View File

@@ -2,7 +2,7 @@
"version" : "1.0", "version" : "1.0",
"configurations" : [ "configurations" : [
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {

View File

@@ -5,11 +5,11 @@
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1" @change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200"> @transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
<swiper-item v-for="(item,index) in videoList" :key="index"> <swiper-item v-for="(item,index) in videoList" :key="index">
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand" :showControls="control.showControls" :current="current" <list-item-vue :total="list.length" :item="item" :isCommand="isCommand"
:isCollect="isCollect" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :showControls="control.showControls" :current="current" :isCollect="isCollect"
:playSpeeds="playSpeeds" :index="index" :nowIndex="nowIndex" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
@dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)" :index="index" :nowIndex="nowIndex" @dianzanClick="dianzanClick(item,index)" @share="share(item)"
@popupShow="popupShow($event,item,index)"></list-item-vue> @zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@@ -21,12 +21,11 @@
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)"> <cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')"> <view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect" <list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
:isCommand="isCommand" :isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
:showControls="control.showControls" @toDetail="toDetail(item,index)" @itemMounted="itemMounted" @itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
@controlstoggles="controlstoggles" :index="index" :instance="instance" :nowIndex="nowIndex" :nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
@appear="appear($event,item,index)" :playSpeeds="playSpeeds" @disappear="disappear(item,index)" @disappear="disappear(item,index)" @dianzanClick="dianzanClick(item,index)" @share="share(item)"
@dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)" @zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
@popupShow="popupShow($event,item,index)"></list-item-vue>
</view> </view>
</cell> </cell>
</list> </list>
@@ -317,7 +316,7 @@
console.log('disappear nowIndex' + nowIndex.value); console.log('disappear nowIndex' + nowIndex.value);
console.log('cacheIndex' + cacheIndex); console.log('cacheIndex' + cacheIndex);
nowIndex.value = cacheIndex nowIndex.value = cacheIndex
const item=props.list[nowIndex.value] const item = props.list[nowIndex.value]
if (!item.videoUrl) { if (!item.videoUrl) {
popupShow('pay', item, nowIndex.value) popupShow('pay', item, nowIndex.value)
} }
@@ -331,6 +330,7 @@
async function payOrder(data) { async function payOrder(data) {
const res = await Api.payOrder(data) const res = await Api.payOrder(data)
if (res) { if (res) {
uni.setStorageSync('nobuyCourseId',popup.data.courseId)
// #ifdef APP // #ifdef APP
uni.navigateTo({ uni.navigateTo({
url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url
@@ -401,6 +401,7 @@
function jiClick(item, index) { function jiClick(item, index) {
initing=false
let newCurrent = (current.value + 1) % 3; let newCurrent = (current.value + 1) % 3;
videoList.value[newCurrent] = item; videoList.value[newCurrent] = item;
current.value = newCurrent; current.value = newCurrent;
@@ -427,24 +428,27 @@
clearTimeout(positonmer) clearTimeout(positonmer)
console.log('goListPosition:' + index) console.log('goListPosition:' + index)
const el = refList.value[index] const el = refList.value[index]
if ($mountedComponents[props.list.length - 1] && $mountedComponents[index]) { if (initing) {
domModule.scrollToElement(el, { if (!$mountedComponents[props.list.length - 1]) {
animated: false positonmer = setTimeout(() => {
}) goListPosition(index)
initing = false; }, 200)
const item = props.list[index] return
setVideoList(item) }
insertHistory()
} else {
// 延迟设置元素位置,(可能视频位置比较靠后数据未渲染完毕)
positonmer = setTimeout(() => {
goListPosition(index)
}, 200)
} }
domModule.scrollToElement(el, {
animated: false
})
initing = false;
const item = props.list[index]
setVideoList(item)
insertHistory()
} }
function popupClose(key) { function popupClose(key) {
if (key) { if (key) {
popup[key] = false popup[key] = false
@@ -699,11 +703,11 @@
'width': '750rpx', 'width': '750rpx',
} }
}) })
function videoListUpdata(){ function videoListUpdata() {
videoList.value=videoList.value.map(v=>{ videoList.value = videoList.value.map(v => {
const item=props.list.find(listItem=>listItem.courseDetailsId==v.courseDetailsId) const item = props.list.find(listItem => listItem.courseDetailsId == v.courseDetailsId)
return item?item:v return item ? item : v
}) })
} }
defineExpose({ defineExpose({

View File

@@ -31,8 +31,7 @@
getOrderInfo({ getOrderInfo({
orderId: state.orderId orderId: state.orderId
}).then(res => { }).then(res => {
console.log(res); if (res == 1) {
if (res.data == 1) {
uni.hideLoading() uni.hideLoading()
const sysInfo = uni.getSystemInfoSync(); const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios' let isIos = sysInfo.platform == 'ios'

View File

@@ -73,9 +73,13 @@
await init() await init()
refVideoList.value.videoListUpdata() refVideoList.value.videoListUpdata()
const drawRes=await Api.getDrawCount() const drawRes=await Api.getDrawCount()
if(drawRes.count>0){ console.log(drawRes);
const nobuyCourseId=uni.getStorageSync('nobuyCourseId')
const item=state.list.find(v=>v.courseId==nobuyCourseId)
uni.clearStorageSync('nobuyCourseId')
if(drawRes.count*1>0&&nobuyCourseId!==null&&nobuyCourseId!==undefined&&item.videoUrl){
uni.navigateTo({ uni.navigateTo({
url:'pages/me/prizeDraw' url:'/pages/me/prizeDraw'
}) })
} }
} }