From 33a80b53cd7b5a9e79c811c6e2a24baa9e1ed145 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Sat, 6 Apr 2024 17:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/recommend/index.vue | 8 ++++++-- manifest.json | 4 ++-- pages/index/index.vue | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/components/recommend/index.vue b/components/recommend/index.vue index e3e93af..951150b 100644 --- a/components/recommend/index.vue +++ b/components/recommend/index.vue @@ -67,7 +67,7 @@ - + 暂无商品,看点别的吧 @@ -123,7 +123,11 @@ sale_type:{ type: [Number, String], default: 1 - } + }, + loading:{ + type: Boolean, + default: false + }, }, data() { return { diff --git a/manifest.json b/manifest.json index 085599d..3478d90 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "惠农生活", "appid" : "__UNI__3A527D1", "description" : "", - "versionName" : "2.0.18", - "versionCode" : 2018, + "versionName" : "2.0.21", + "versionCode" : 2021, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages/index/index.vue b/pages/index/index.vue index fee067b..50611ea 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -89,7 +89,7 @@ + @changeRecommedTab="changeRecommedTab" showTab :indexP="true" :isLogin="isLogin" :loading="loading"> @@ -170,7 +170,7 @@ 暂无商品,去看点什么吧 - + @@ -441,7 +441,6 @@ privacyStatus: false, errorNetwork: false, userInfo: {}, - loading: false, statusBarHeight: statusBarHeight, navIndex: 0, navTop: [], @@ -1049,6 +1048,7 @@ that.hotLoading[e] = true; that.hotTitle = '加载中'; getProductHot(that.hotPage, that.hotLimit, 1, 1).then(res => { + res.data.list = this.shuffleArray(res.data.list); let list = res.data.list; let productList = that.hostProduct; if (!productList[e]) productList[e] = []; @@ -1082,6 +1082,7 @@ getProductslist({ ...query }).then(res => { + res.data.list = this.shuffleArray(res.data.list); let list = res.data.list; let productList = that.hostProduct; if (!productList[e]) productList[e] = []; @@ -1096,6 +1097,15 @@ that.$set(that, 'hotLimit', res.data.limit); }); }, + + // 数组乱序 + shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + return array; + }, getCateData() { getCateData().then(res => {