抖动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> -->
<WaterfallsFlow v-if="hostProduct.length>0" :wfList='hostProduct' @itemTap="goDetail" :type="0"
: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>
<view>暂无商品看点别的吧</view>
</view>
</view> -->
</view>
</view>
</template>
@ -187,11 +187,14 @@
mounted() {
this.getArticleList();
uni.$on('scroll', res => {
if (res && res.scrollTop > this.tabsTop) {
this.isShow = false;
} else {
this.isShow = true;
}
uni.$u.debounce(() => {
if (res && res.scrollTop > this.tabsTop) {
this.isShow = false;
} else {
this.isShow = true;
}
}, 500)
})
},

View File

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