抖动bug修改

This commit is contained in:
1154079537 2024-05-22 17:29:52 +08:00
parent 6478239fc2
commit b0ccfc9f29
2 changed files with 121 additions and 82 deletions

View File

@ -90,10 +90,10 @@
</view> --> </view> -->
<WaterfallsFlow v-if="hostProduct.length>0" :wfList='hostProduct' @itemTap="goDetail" :type="0" <WaterfallsFlow v-if="hostProduct.length>0" :wfList='hostProduct' @itemTap="goDetail" :type="0"
:sale_type="sale_type" /> :sale_type="sale_type" />
<view class='pictrue' v-if="!loading && hostProduct.length==0"> <!-- <view class='pictrue' v-if="!loading && hostProduct.length==0">
<image :src="`${domain}/static/images/noCart.png`"></image> <image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品看点别的吧</view> <view>暂无商品看点别的吧</view>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
@ -187,11 +187,14 @@
mounted() { mounted() {
this.getArticleList(); this.getArticleList();
uni.$on('scroll', res => { uni.$on('scroll', res => {
if (res && res.scrollTop > this.tabsTop) {
this.isShow = false; uni.$u.debounce(() => {
} else { if (res && res.scrollTop > this.tabsTop) {
this.isShow = true; this.isShow = false;
} } else {
this.isShow = true;
}
}, 500)
}) })
}, },

View File

@ -2,8 +2,8 @@
<view> <view>
<view class='newsList'> <view class='newsList'>
<view class='swiper' v-if="imgUrls.length > 0" style="background-color: #fff;"> <view class='swiper' v-if="imgUrls.length > 0" style="background-color: #fff;">
<swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval"
indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666"> :duration="duration" indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666">
<block v-for="(item,index) in imgUrls" :key="index"> <block v-for="(item,index) in imgUrls" :key="index">
<swiper-item> <swiper-item>
<navigator :url="'/pages/news_details/index?id='+item.id"> <navigator :url="'/pages/news_details/index?id='+item.id">
@ -13,10 +13,13 @@
</block> </block>
</swiper> </swiper>
</view> </view>
<view class='nav' v-if="navList.length > 0" style="background-color: #fff;margin-top: 0;padding-top: 30rpx;"> <view class='nav' v-if="navList.length > 0"
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;"> style="background-color: #fff;margin-top: 0;padding-top: 30rpx;">
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft"
style="width:auto;overflow:hidden;">
<block v-for="(item,index) in navList" :key="index"> <block v-for="(item,index) in navList" :key="index">
<view class='item' :class='active==item.article_category_id?"on":""' @click='tabSelect(item.article_category_id)'> <view class='item' :class='active==item.article_category_id?"on":""'
@click='tabSelect(item.article_category_id)'>
<view>{{item.title}}</view> <view>{{item.title}}</view>
<view class='line bg-color' v-if="active==item.article_category_id"></view> <view class='line bg-color' v-if="active==item.article_category_id"></view>
</view> </view>
@ -25,24 +28,29 @@
</view> </view>
<view class='list'> <view class='list'>
<block v-for="(item,index) in articleList" :key="index"> <block v-for="(item,index) in articleList" :key="index">
<navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none' class='item acea-row row-between-wrapper my-card' <navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none'
:class="{'my-card0': index==0}"> class='item acea-row row-between-wrapper my-card' :class="{'my-card0': index==0}">
<block v-if="index==0"> <block v-if="index==0">
<image lazy-load style="width: 100%;height: 100%;" :src='item.image_input' mode="aspectFill"></image> <image lazy-load style="width: 100%;height: 100%;" :src='item.image_input'
<view class="bottom-text"> mode="aspectFill"></image>
<view class='name line2'>{{item.title}}</view> <view class="bottom-text">
<view style="color: #C4C4C4;font-size: 24rpx;padding-top: 10rpx;">{{URLdate(item.create_time)}}</view> <view class='name line2'>{{item.title}}</view>
</view> <view style="color: #C4C4C4;font-size: 24rpx;padding-top: 10rpx;">
</block> {{URLdate(item.create_time)}}
</view>
</view>
</block>
<block v-else> <block v-else>
<view class='text acea-row row-column-between' style="height: 100%;width: 550rpx;"> <view class='text'
<view class='name line2'>{{item.title}}</view> style="height: 100%;width: 550rpx;display: flex;flex-direction: column;justify-content: space-between;">
<view>{{URLdate(item.create_time)}}</view> <view class='name line2'>{{item.title}}</view>
</view> <view>{{URLdate(item.create_time)}}</view>
<view class='pictrue'> </view>
<image lazy-load style="width: 100%;height: 100%;" :src='item.image_input' mode="aspectFill"></image> <view class='pictrue'>
</view> <image lazy-load style="width: 100%;height: 100%;" :src='item.image_input'
</block> mode="aspectFill"></image>
</view>
</block>
</navigator> </navigator>
</block> </block>
</view> </view>
@ -53,7 +61,6 @@
<view class="txt">暂无新闻信息~</view> <view class="txt">暂无新闻信息~</view>
</view> </view>
</view> </view>
<!-- <home></home> -->
</view> </view>
</template> </template>
@ -103,14 +110,13 @@
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onLoad: function(options) { onLoad: function(options) {
this.status = false; this.status = false;
this.page = 1; this.page = 1;
this.articleList = []; this.articleList = [];
if(options.type) { if (options.type) {
this.active=options.type; this.active = options.type;
this.getCidArticle(); this.getCidArticle();
} } else this.getArticleCate();
else this.getArticleCate();
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
@ -169,19 +175,19 @@
this.getCidArticle(); this.getCidArticle();
} }
}, },
URLdate(date){ URLdate(date) {
// Date // Date
const currentDate = new Date(date); const currentDate = new Date(date);
// //
const year = currentDate.getFullYear(); const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 01 const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 01
const day = String(currentDate.getDate()).padStart(2, '0'); const day = String(currentDate.getDate()).padStart(2, '0');
// xxxxxxxx // xxxxxxxx
const formattedDate = `${year}${month}${day}`; const formattedDate = `${year}${month}${day}`;
return formattedDate; return formattedDate;
} }
} }
} }
</script> </script>
@ -190,22 +196,26 @@
page { page {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
} }
.newsList .swiper { .newsList .swiper {
width: 100%; width: 100%;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
padding: 0 30rpx; padding: 0 30rpx;
} }
.newsList .swiper swiper { .newsList .swiper swiper {
width: 100%; width: 100%;
height: 365rpx; height: 365rpx;
position: relative; position: relative;
} }
.newsList .swiper .slide-image { .newsList .swiper .slide-image {
width: 100%; width: 100%;
height: 335rpx; height: 335rpx;
border-radius: 6rpx; border-radius: 6rpx;
} }
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
.newsList .swiper .wx-swiper-dot { .newsList .swiper .wx-swiper-dot {
width: 12rpx !important; width: 12rpx !important;
@ -214,9 +224,11 @@
transform: rotate(-45deg); transform: rotate(-45deg);
transform-origin: 0 100%; transform-origin: 0 100%;
} }
.newsList .swiper .wx-swiper-dot~.wx-swiper-dot { .newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
margin-left: 5rpx; margin-left: 5rpx;
} }
.newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal { .newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal {
margin-bottom: -15rpx; margin-bottom: -15rpx;
} }
@ -230,12 +242,15 @@
transform: rotate(-45deg); transform: rotate(-45deg);
transform-origin: 0 100%; transform-origin: 0 100%;
} }
.newsList .swiper .uni-swiper-dot~.uni-swiper-dot { .newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
margin-left: 5rpx; margin-left: 5rpx;
} }
.newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal { .newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
margin-bottom: -15rpx; margin-bottom: -15rpx;
} }
// #endif // #endif
.newsList .nav { .newsList .nav {
padding: 0 30rpx; padding: 0 30rpx;
@ -244,6 +259,7 @@
box-sizing: border-box; box-sizing: border-box;
margin-top: 43rpx; margin-top: 43rpx;
} }
.newsList .nav .item { .newsList .nav .item {
display: inline-block; display: inline-block;
font-size: 32rpx; font-size: 32rpx;
@ -256,12 +272,15 @@
padding-bottom: 20rpx; padding-bottom: 20rpx;
text-align: center; text-align: center;
} }
.newsList .nav .item.on { .newsList .nav .item.on {
color: #282828; color: #282828;
} }
.newsList .nav .item~.item { .newsList .nav .item~.item {
margin-left: 46rpx; margin-left: 46rpx;
} }
.newsList .nav .item .line { .newsList .nav .item .line {
width: 24rpx; width: 24rpx;
height: 4rpx; height: 4rpx;
@ -272,93 +291,110 @@
left: 50%; left: 50%;
margin-left: -12rpx; margin-left: -12rpx;
} }
.newsList .list .item { .newsList .list .item {
margin: 0 30rpx; margin: 0 30rpx;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
padding: 35rpx 0; padding: 35rpx 0;
} }
.newsList .list .item .pictrue { .newsList .list .item .pictrue {
width: 250rpx; width: 250rpx;
height: 156rpx; height: 156rpx;
} }
.newsList .list .item .pictrue image { .newsList .list .item .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 6rpx; border-radius: 6rpx;
} }
.newsList .list .item .text { .newsList .list .item .text {
width: 420rpx; width: 420rpx;
height: 160rpx; height: 160rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.newsList .list .item .text .name { .newsList .list .item .text .name {
font-size: 30rpx; font-size: 30rpx;
color: #282828; color: #282828;
} }
.newsList .list .item .picList .pictrue { .newsList .list .item .picList .pictrue {
width: 335rpx; width: 335rpx;
height: 210rpx; height: 210rpx;
margin-top: 30rpx; margin-top: 30rpx;
} }
.newsList .list .item .picList.on .pictrue { .newsList .list .item .picList.on .pictrue {
width: 217rpx; width: 217rpx;
height: 136rpx; height: 136rpx;
} }
.newsList .list .item .picList .pictrue image { .newsList .list .item .picList .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 6rpx; border-radius: 6rpx;
} }
.newsList .list .item .time { .newsList .list .item .time {
text-align: right; text-align: right;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
margin-top: 22rpx; margin-top: 22rpx;
} }
.noCommodity{
.noCommodity {
border: none; border: none;
} }
.empty-box{
.empty-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 200rpx; margin-top: 200rpx;
image{
image {
width: 414rpx; width: 414rpx;
height: 240rpx; height: 240rpx;
} }
.txt{
.txt {
font-size: 26rpx; font-size: 26rpx;
color: #999; color: #999;
text-align: center; text-align: center;
} }
} }
.my-card{
background-color: #fff !important; .my-card {
margin: 20rpx !important; background-color: #fff !important;
padding: 20rpx !important; margin: 20rpx !important;
border-radius: 20rpx !important; padding: 20rpx !important;
overflow: hidden; border-radius: 20rpx !important;
height: 160rpx !important; overflow: hidden;
.pictrue{ height: 160rpx !important;
height: 116rpx !important;
width: 116rpx !important; .pictrue {
} height: 116rpx !important;
} width: 116rpx !important;
.my-card0{ }
padding: 0 !important; }
height: 478rpx !important;
position: relative; .my-card0 {
.bottom-text{ padding: 0 !important;
position: absolute; height: 478rpx !important;
bottom: 0; position: relative;
left: 0;
width: 100%; .bottom-text {
color: #fff; position: absolute;
background-color: rgba(0, 0, 0, 0.3); bottom: 0;
padding: 20rpx; left: 0;
} width: 100%;
} color: #fff;
</style> background-color: rgba(0, 0, 0, 0.3);
padding: 20rpx;
}
}
</style>