This commit is contained in:
weipengfei 2024-03-27 16:39:59 +08:00
parent 66a882a309
commit 78044465b1
6 changed files with 29 additions and 24 deletions

View File

@ -140,11 +140,12 @@ export function getBrandlist(data) {
* 获取推荐产品 * 获取推荐产品
* *
*/ */
export function getProductHot(page, limit, sale_type, enLoad=false) { export function getProductHot(page, limit, sale_type, rand=0, enLoad=false) {
return request.get("product/spu/recommend", { return request.get("product/spu/recommend", {
page: page === undefined ? 1 : page, page: page === undefined ? 1 : page,
limit: limit === undefined ? 10 : limit, limit: limit === undefined ? 10 : limit,
sale_type: sale_type || null sale_type: sale_type || null,
rand: rand
}, { }, {
noAuth: true, noAuth: true,
enLoad: enLoad enLoad: enLoad

View File

@ -36,19 +36,22 @@
</view> </view>
<!-- 资讯 --> <!-- 资讯 -->
<view v-if="showTab&&list.length>0" @click="navTo('/pages/news_list/index?type=20')" style="display: flex;justify-content: flex-end;padding-bottom: 16rpx;font-size: 26rpx;color: #333;"> <view v-if="showTab&&list.length>0" @click="navTo('/pages/news_list/index?type=20')" style="display: flex;justify-content: space-between;padding-bottom: 20rpx;font-size: 26rpx;color: #999999;height: 70rpx;align-items: center;">
更多资讯<u-icon name="arrow-right" color="#333"></u-icon> <view style="font-size: 28rpx;background-color: #40ae36;color: #fff;padding: 4rpx 16rpx 6rpx 16rpx;border-radius: 90rpx;">里海新闻</view>
<view style="display: flex;">更多<u-icon name="arrow-right" size="12" color="#999"></u-icon></view>
</view> </view>
<view class="information" v-if="showTab&&list.length>0"> <view class="information" v-if="showTab&&list.length>0">
<view class="nav-item" @click="navTo(`/pages/news_details/index?id=${item.article_id}`)" v-for="(item, index) in list" :key="item.article_id"> <scroll-view scroll-x style="height: 230rpx;width: 700rpx;white-space: nowrap;">
<view class="nav-item-up" style="overflow: hidden;"> <view class="nav-item" style="display: inline-block;margin-right: 16rpx;" @click="navTo(`/pages/news_details/index?id=${item.article_id}`)" v-for="(item, index) in list" :key="item.article_id">
<image :src="item.image_input" mode="aspectFill"></image> <view class="nav-item-up" style="overflow: hidden;">
</view> <image :src="item.image_input" mode="aspectFill"></image>
<view class="nav-item-down"> </view>
<view class="nav-item-down-title">{{item.title}}</view> <view class="nav-item-down">
<view class="nav-item-down-desc">{{item.synopsis}}</view> <view class="nav-item-down-title">{{item.title}}</view>
</view> <view class="nav-item-down-desc">{{item.synopsis}}</view>
</view> </view>
</view>
</scroll-view>
</view> </view>
<!-- tab导航 --> <!-- tab导航 -->
@ -161,7 +164,7 @@
getArticleList(){ getArticleList(){
getArticleList(20,{ getArticleList(20,{
page: 1, page: 1,
limit: 3 limit: 10
}).then(res=>{ }).then(res=>{
this.list = res.data.list; this.list = res.data.list;
}) })
@ -312,9 +315,9 @@
} }
.information{ .information{
display: flex; // display: flex;
justify-content: space-between; // justify-content: space-between;
margin-bottom: 20rpx; // margin-bottom: 20rpx;
.nav-item { .nav-item {
width: 227rpx; width: 227rpx;

View File

@ -2,8 +2,8 @@
"name" : "惠农生活", "name" : "惠农生活",
"appid" : "__UNI__3A527D1", "appid" : "__UNI__3A527D1",
"description" : "", "description" : "",
"versionName" : "2.0.12", "versionName" : "2.0.15",
"versionCode" : 2012, "versionCode" : 2015,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@ -115,14 +115,13 @@
{ {
"path": "pages/news_list/index", "path": "pages/news_list/index",
"style": { "style": {
"navigationBarTitleText": "资讯消息" "navigationBarTitleText": "里海新闻"
} }
}, },
{ {
"path": "pages/news_details/index", "path": "pages/news_details/index",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
// "navigationBarTitleText": "资讯详情" // "navigationBarTitleText": "资讯详情"
} }
}, },

View File

@ -464,7 +464,7 @@
hostProduct: [[],[],[],[]], hostProduct: [[],[],[],[]],
hostIndex: 0, hostIndex: 0,
hotPage: 1, hotPage: 1,
hotLimit: 30, hotLimit: 20,
hotScroll: true, hotScroll: true,
hotLoading: [false, false, false, false], hotLoading: [false, false, false, false],
hotTitle: '加载更多', hotTitle: '加载更多',
@ -1041,7 +1041,7 @@
if (that.hotLoading[e]) return; if (that.hotLoading[e]) return;
that.hotLoading[e] = true; that.hotLoading[e] = true;
that.hotTitle = '加载中'; that.hotTitle = '加载中';
getProductHot(that.hotPage, that.hotLimit, 1).then(res => { getProductHot(that.hotPage, that.hotLimit, 1, 1).then(res => {
let list = res.data.list; let list = res.data.list;
let productList = that.hostProduct; let productList = that.hostProduct;
if(!productList[e]) productList[e] = []; if(!productList[e]) productList[e] = [];
@ -1050,6 +1050,7 @@
that.hotScroll = hotScroll; that.hotScroll = hotScroll;
that.hotLoading[e] = false; that.hotLoading[e] = false;
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多'; that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
that.$set(that, 'hostProduct', productList); that.$set(that, 'hostProduct', productList);
if(this.hostIndex==e) this.$forceUpdate(); if(this.hostIndex==e) this.$forceUpdate();
that.$set(that, 'hotPage', that.hotPage + 1); that.$set(that, 'hotPage', that.hotPage + 1);
@ -1068,6 +1069,7 @@
query.page = that.hotPage; query.page = that.hotPage;
query.limit = that.hotLimit; query.limit = that.hotLimit;
query.sale_type = 1; query.sale_type = 1;
query.rand = 1;
getProductslist({ getProductslist({
...query ...query
}).then(res => { }).then(res => {

View File

@ -288,7 +288,7 @@
} }
.newsList .list .item .text { .newsList .list .item .text {
width: 420rpx; width: 420rpx;
height: 156rpx; height: 160rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }