修改首页轮播颤抖问题

master
chen 2021-11-08 15:49:29 +08:00
parent a194f70e65
commit a8ffd5663b
1 changed files with 36 additions and 3 deletions

View File

@ -25,7 +25,21 @@
<view class="pad-x180"> <view class="pad-x180">
<!-- 自定义轮播 --> <!-- 自定义轮播 -->
<view :style="{marginTop: (statusHNH+60)+'px'}"> <view :style="{marginTop: (statusHNH+60)+'px'}">
<swiper-pu :bannerList="bannerList"></swiper-pu> <!-- <swiper-pu :bannerList="bannerList"></swiper-pu> -->
<view class="banner-box">
<swiper :current="bcurrent" @change="changeBanner" :style="{height: 200+'px'}" :autoplay="isAutoPlay" :circular="true" :interval="3000" :duration="500">
<swiper-item v-for="(item,index) in bannerList" :key="index">
<view @tap="chooseImg(index)" class="posir">
<image :style="{borderRadius:0+'px',height:200+'px'}" class="img" :src="item.imgSrc" mode="aspectFill"></image>
<image @tap.stop="playVideo(index)" v-if="item.isVideo" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);width: 126rpx;height: 126rpx;z-index: 1;" src="/static/public/video.png" mode=""></image>
</view>
</swiper-item>
</swiper>
<!-- 指示点 -->
<view class="dot-box" :style="{bottom:18+'px'}">
<view :class="bcurrent==indexd ? 'dotActive' : 'dotMo'" v-for="(itemd,indexd) in bannerList.length" :key="indexd"></view>
</view>
</view>
</view> </view>
<!-- 宫格 --> <!-- 宫格 -->
<view v-if="gonggList.length>1" class="mar-zy30 bacf radius10 pad-s25 mar-s10 disac fw"> <view v-if="gonggList.length>1" class="mar-zy30 bacf radius10 pad-s25 mar-s10 disac fw">
@ -132,7 +146,9 @@
bannerList:[],// bannerList:[],//
jieDuan:false, jieDuan:false,
isNewRenderDone:false ,// isNewRenderDone:false ,//
isQuan:true isQuan:true,
bcurrent:0,
isAutoPlay:false
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@ -147,6 +163,9 @@
this.isZanw = false this.isZanw = false
} }
}, },
onHide() {
this.isAutoPlay = false;
},
onShow() { onShow() {
log('输出的解构') log('输出的解构')
this.checkNet() this.checkNet()
@ -162,6 +181,7 @@
uni.setStorageSync('chu',1) uni.setStorageSync('chu',1)
} }
this.checkKT()// this.checkKT()//
this.isAutoPlay = true;
}, },
onShareAppMessage(res) {}, onShareAppMessage(res) {},
onLoad(options) { onLoad(options) {
@ -217,6 +237,15 @@
this.$toolAll.tools.buriedPointAll()//id this.$toolAll.tools.buriedPointAll()//id
}, },
methods: { methods: {
changeBanner(e){
this.bcurrent = e.detail.current//
},
playVideo(index){
// console.log('');
uni.navigateTo({
url:`/pagesB/video/playVideo?src=${this.bannerList[index].url}&posterSrc=${this.bannerList[index].poster}`
})
},
closeEv(){ closeEv(){
this.isQuan = false; this.isQuan = false;
}, },
@ -506,5 +535,9 @@
</script> </script>
<style> <style>
.banner-box{position: relative;}
.img{width:100%;}
.dot-box{position: absolute;bottom: 36rpx;display: flex;justify-content: center;width: 100%;}
.dotActive{width: 22rpx;height: 12rpx;margin-right: 10rpx;border-radius: 20rpx; background-color: rgba(56, 117, 246, 1);}
.dotMo{width: 12rpx;height: 12rpx;margin-right: 10rpx;border-radius: 100%;background-color: rgba(191, 191, 191, 1);}
</style> </style>