From b0ccfc9f2967adcc70f15f601c710a0e3aafd49f Mon Sep 17 00:00:00 2001
From: 1154079537 <1154079537@qq.com>
Date: Wed, 22 May 2024 17:29:52 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E5=8A=A8bug=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/recommend/index.vue | 17 +--
pages/news_list/index.vue | 186 ++++++++++++++++++++-------------
2 files changed, 121 insertions(+), 82 deletions(-)
diff --git a/components/recommend/index.vue b/components/recommend/index.vue
index 467c6d6..d5ae696 100644
--- a/components/recommend/index.vue
+++ b/components/recommend/index.vue
@@ -90,10 +90,10 @@
-->
-
+
@@ -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)
})
},
diff --git a/pages/news_list/index.vue b/pages/news_list/index.vue
index dcaac7f..10a9a15 100644
--- a/pages/news_list/index.vue
+++ b/pages/news_list/index.vue
@@ -2,8 +2,8 @@
-
+
@@ -13,10 +13,13 @@
-
-
+
+
-
+
{{item.title}}
@@ -25,24 +28,29 @@
-
-
-
-
- {{item.title}}
- {{URLdate(item.create_time)}}
-
-
+
+
+
+
+ {{item.title}}
+
+ {{URLdate(item.create_time)}}
+
+
+
-
- {{item.title}}
- {{URLdate(item.create_time)}}
-
-
-
-
-
+
+ {{item.title}}
+ {{URLdate(item.create_time)}}
+
+
+
+
+
@@ -53,7 +61,6 @@
暂无新闻信息~
-
@@ -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'); // 月份从0开始,需要加1并补零
- const day = String(currentDate.getDate()).padStart(2, '0');
-
- // 格式化成 xxxx年xx月xx日 的格式
- 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'); // 月份从0开始,需要加1并补零
+ const day = String(currentDate.getDate()).padStart(2, '0');
+
+ // 格式化成 xxxx年xx月xx日 的格式
+ const formattedDate = `${year}年${month}月${day}日`;
+ return formattedDate;
+ }
}
}
@@ -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;
- }
- }
-
+
+ .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;
+ }
+ }
+
\ No newline at end of file