视频列表支付更新

This commit is contained in:
2025-01-13 15:50:56 +08:00
parent 2ef47931e5
commit 3433ebb6aa
4 changed files with 92 additions and 89 deletions

View File

@@ -5,8 +5,7 @@
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
<swiper-item v-for="(item,index) in videoList" :key="index">
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand" :rightStyle="rightStyle"
:infoStyle="infoStyle" :showControls="control.showControls" :current="current"
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand" :showControls="control.showControls" :current="current"
:isCollect="isCollect" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles"
:playSpeeds="playSpeeds" :index="index" :nowIndex="nowIndex"
@dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)"
@@ -22,7 +21,7 @@
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
:rightStyle="rightStyle" :infoStyle="infoStyle" :isCommand="isCommand"
:isCommand="isCommand"
:showControls="control.showControls" @toDetail="toDetail(item,index)" @itemMounted="itemMounted"
@controlstoggles="controlstoggles" :index="index" :instance="instance" :nowIndex="nowIndex"
@appear="appear($event,item,index)" :playSpeeds="playSpeeds" @disappear="disappear(item,index)"
@@ -230,9 +229,7 @@
function controlstoggles(e) {
control.showControls = e.detail.show
console.log(control.showControls);
control.showBack = control.showControls
console.log(control);
}
const speeds = reactive({
@@ -320,8 +317,11 @@
console.log('disappear nowIndex' + nowIndex.value);
console.log('cacheIndex' + cacheIndex);
nowIndex.value = cacheIndex
const item=props.list[nowIndex.value]
if (!item.videoUrl) {
popupShow('pay', item, nowIndex.value)
}
cacheIndex = null
console.log('disappear,nowIndex=' + nowIndex.value);
}
}
@@ -330,11 +330,10 @@
//非金币支付
async function payOrder(data) {
const res = await Api.payOrder(data)
console.log(res);
if (res) {
// #ifdef APP
uni.navigateTo({
url: '/pages/pays/pays?orderId=' + res.orderId + '&url=' + res.h5Url
url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url
});
// #endif
// #ifdef H5
@@ -344,15 +343,14 @@
}
//金币支付
async function goldPay(data) {
emits('update', {
index: popup.index
})
console.log(popup.index);
const res = await Api.goldPay(data)
if (res) {
uni.showToast({
title: '解锁成功',
icon: 'none'
})
popupClose()
emits('update', {
index: popup.index
})
@@ -437,9 +435,10 @@
setVideoList(item)
insertHistory()
} else {
// 延迟设置元素位置,(可能视频位置比较靠后数据未渲染完毕)
positonmer = setTimeout(() => {
goListPosition(index)
}, 30)
}, 200)
}
}
@@ -459,8 +458,8 @@
console.log(item);
popup[key] = true
if (item) {
popup['data'] = item
popup['index'] = index
popup.data = item
popup.index = index
}
}
@@ -689,42 +688,6 @@
const nowDanjiPrice = computed(() => {
return videoList.value[current.value].price
})
const rightStyle = computed(() => {
const item = props.list[nowIndex.value]
if (!item.videoUrl) {
return {
transform: `translateX(0)`
}
}
// #ifdef H5
return {
transform: `translateX(${!control.showControls?'0':60}px)`
}
// #endif
// #ifdef APP
return {
transform: `translateX(${control.showControls?'0':60}px)`
}
// #endif
})
const infoStyle = computed(() => {
const item = props.list[nowIndex.value]
if (!item.videoUrl) {
return {
transform: `translateX(0)`
}
}
// #ifdef H5
return {
transform: `translateX(${!control.showControls?0:'-110%'})`
}
// #endif
// #ifdef APP
return {
transform: `translateX(${control.showControls?0:'-110%'})`
}
// #endif
})
function loadmore() {
console.log('loadmore');
@@ -735,6 +698,16 @@
'width': '750rpx',
}
})
function videoListUpdata(){
videoList.value=videoList.value.map(v=>{
const item=props.list.find(listItem=>listItem.courseDetailsId==v.courseDetailsId)
return item?item:v
})
}
defineExpose({
videoListUpdata
})
</script>
<style lang="scss" scoped>