Fix:4505 【旅居商城小程序】旅居主页视频显示问题,未固定显示在第一页
This commit is contained in:
@@ -11,14 +11,28 @@
|
|||||||
/>
|
/>
|
||||||
<view>
|
<view>
|
||||||
<view class="cover-box">
|
<view class="cover-box">
|
||||||
<u-swiper
|
<swiper
|
||||||
:list="store.banner"
|
style="height: 500rpx"
|
||||||
:autoplay="true"
|
:autoplay="swiperAutoplay"
|
||||||
:circular="true"
|
:circular="true"
|
||||||
height="500rpx"
|
@change="swiperChange"
|
||||||
indicator
|
>
|
||||||
indicatorInactiveColor="rgba(255,255,255,0.5)"
|
<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>
|
||||||
<view class="v12-pa-3 v12-justify-between v12-align-center">
|
<view class="v12-pa-3 v12-justify-between v12-align-center">
|
||||||
<view class="sojum-title">{{ store.name }}</view>
|
<view class="sojum-title">{{ store.name }}</view>
|
||||||
@@ -347,6 +361,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
swiperAutoplay: true,
|
||||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
videoStyle: {
|
videoStyle: {
|
||||||
width: '750rpx',
|
width: '750rpx',
|
||||||
@@ -398,6 +413,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
goHousekeeperDetail(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -649,10 +679,7 @@ export default {
|
|||||||
getJiaLouDetail(this.id).then(res => {
|
getJiaLouDetail(this.id).then(res => {
|
||||||
this.store = res.data || {}
|
this.store = res.data || {}
|
||||||
if(res.data.video) {
|
if(res.data.video) {
|
||||||
this.store.banner = [
|
this.store.banner.unshift(res.data.video)
|
||||||
res.data.video,
|
|
||||||
...this.store.banner
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
this.getNews()
|
this.getNews()
|
||||||
this.getJiaLouProductList()
|
this.getJiaLouProductList()
|
||||||
|
|||||||
Reference in New Issue
Block a user