Fix:4505 【旅居商城小程序】旅居主页视频显示问题,未固定显示在第一页

This commit is contained in:
linxi
2025-11-11 15:22:26 +08:00
parent 512915ea2a
commit b5b6bdd678
+38 -11
View File
@@ -11,14 +11,28 @@
/>
<view>
<view class="cover-box">
<u-swiper
:list="store.banner"
:autoplay="true"
<swiper
style="height: 500rpx"
:autoplay="swiperAutoplay"
:circular="true"
height="500rpx"
indicator
indicatorInactiveColor="rgba(255,255,255,0.5)"
/>
@change="swiperChange"
>
<swiper-item v-for="(item, index) in store.banner" :key="index">
<video
v-if="item.includes('.mp4')"
:src="item"
style="width: 100%; height: 100%"
@play="videoPlay"
@ended="videoEnd"
@pause="videoEnd"
></video>
<image
v-else
:src="item"
style="width: 100%; height: 100%"
></image>
</swiper-item>
</swiper>
</view>
<view class="v12-pa-3 v12-justify-between v12-align-center">
<view class="sojum-title">{{ store.name }}</view>
@@ -347,6 +361,7 @@ export default {
},
data() {
return {
swiperAutoplay: true,
webUrl: this.$VUE_APP_RESOURCES_URL,
videoStyle: {
width: '750rpx',
@@ -398,6 +413,21 @@ export default {
}
},
methods: {
swiperChange(e) {
const current = e.detail.current;
const currentItem = this.store.banner[current];
// if (currentItem.includes('.mp4')) {
// this.swiperAutoplay = false;
// } else {
// this.swiperAutoplay = true;
// }
},
videoPlay() {
this.swiperAutoplay = false;
},
videoEnd() {
this.swiperAutoplay = true;
},
// 跳转管家详情
goHousekeeperDetail(item) {
uni.navigateTo({
@@ -649,10 +679,7 @@ export default {
getJiaLouDetail(this.id).then(res => {
this.store = res.data || {}
if(res.data.video) {
this.store.banner = [
res.data.video,
...this.store.banner
]
this.store.banner.unshift(res.data.video)
}
this.getNews()
this.getJiaLouProductList()