From f410719b46a3a7a7dadd79ec4f5e97199b5ee2f4 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Mon, 13 Jan 2025 17:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E7=9B=98=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 2 +- components/my-video-list/my-video-list.vue | 64 ++++++++++++---------- pages/pays/pays.vue | 3 +- pages/video/detail.nvue | 8 ++- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index e466870..15f1188 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,7 +2,7 @@ "version" : "1.0", "configurations" : [ { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" }, { diff --git a/components/my-video-list/my-video-list.vue b/components/my-video-list/my-video-list.vue index 13c1b46..879bfeb 100644 --- a/components/my-video-list/my-video-list.vue +++ b/components/my-video-list/my-video-list.vue @@ -5,11 +5,11 @@ @change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1" @transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200"> - + @@ -21,12 +21,11 @@ + :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)" @dianzanClick="dianzanClick(item,index)" @share="share(item)" + @zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"> @@ -317,7 +316,7 @@ console.log('disappear nowIndex' + nowIndex.value); console.log('cacheIndex' + cacheIndex); nowIndex.value = cacheIndex - const item=props.list[nowIndex.value] + const item = props.list[nowIndex.value] if (!item.videoUrl) { popupShow('pay', item, nowIndex.value) } @@ -331,6 +330,7 @@ async function payOrder(data) { const res = await Api.payOrder(data) if (res) { + uni.setStorageSync('nobuyCourseId',popup.data.courseId) // #ifdef APP uni.navigateTo({ url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url @@ -401,6 +401,7 @@ function jiClick(item, index) { + initing=false let newCurrent = (current.value + 1) % 3; videoList.value[newCurrent] = item; current.value = newCurrent; @@ -427,24 +428,27 @@ clearTimeout(positonmer) console.log('goListPosition:' + index) const el = refList.value[index] - if ($mountedComponents[props.list.length - 1] && $mountedComponents[index]) { - domModule.scrollToElement(el, { - animated: false - }) - initing = false; - const item = props.list[index] - setVideoList(item) - insertHistory() - } else { - // 延迟设置元素位置,(可能视频位置比较靠后数据未渲染完毕) - positonmer = setTimeout(() => { - goListPosition(index) - }, 200) + if (initing) { + if (!$mountedComponents[props.list.length - 1]) { + positonmer = setTimeout(() => { + goListPosition(index) + }, 200) + return + } } + domModule.scrollToElement(el, { + animated: false + }) + initing = false; + const item = props.list[index] + setVideoList(item) + insertHistory() } + + function popupClose(key) { if (key) { popup[key] = false @@ -699,11 +703,11 @@ 'width': '750rpx', } }) - - function videoListUpdata(){ - videoList.value=videoList.value.map(v=>{ - const item=props.list.find(listItem=>listItem.courseDetailsId==v.courseDetailsId) - return item?item:v + + function videoListUpdata() { + videoList.value = videoList.value.map(v => { + const item = props.list.find(listItem => listItem.courseDetailsId == v.courseDetailsId) + return item ? item : v }) } defineExpose({ diff --git a/pages/pays/pays.vue b/pages/pays/pays.vue index 1d90841..2301efc 100644 --- a/pages/pays/pays.vue +++ b/pages/pays/pays.vue @@ -31,8 +31,7 @@ getOrderInfo({ orderId: state.orderId }).then(res => { - console.log(res); - if (res.data == 1) { + if (res == 1) { uni.hideLoading() const sysInfo = uni.getSystemInfoSync(); let isIos = sysInfo.platform == 'ios' diff --git a/pages/video/detail.nvue b/pages/video/detail.nvue index 09f126e..824d10d 100644 --- a/pages/video/detail.nvue +++ b/pages/video/detail.nvue @@ -73,9 +73,13 @@ await init() refVideoList.value.videoListUpdata() 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({ - url:'pages/me/prizeDraw' + url:'/pages/me/prizeDraw' }) } }