From bea1211a5687ac2ed46d92db5eefa15248b6aa1e Mon Sep 17 00:00:00 2001
From: Jacob <hlnie@tohours.com>
Date: 星期一, 12 十月 2026 16:47:18 +0800
Subject: [PATCH] fix: manifest 生成时忽略行尾差异避免无意义重写
---
pages/goods_cate/goods_cate.vue | 106 +++++++++-------------------------------------------
1 files changed, 19 insertions(+), 87 deletions(-)
diff --git a/pages/goods_cate/goods_cate.vue b/pages/goods_cate/goods_cate.vue
index 3073585..8821bde 100644
--- a/pages/goods_cate/goods_cate.vue
+++ b/pages/goods_cate/goods_cate.vue
@@ -13,7 +13,7 @@
<scroll-view scroll-y="true" scroll-with-animation='true'
:style="{height: (height-280/750*windowWidth) + 'px'}" :scroll-into-view="'menu_item'+navActive">
<view class='item acea-row row-center-wrapper menu_item' :id="'menu_item'+index"
- :class='index==navActive?"on":""' v-for="(item,index) in categoryList" :key="item._key"
+ :class='index==navActive?"on":""' v-for="(item,index) in categoryList" :key="index"
@click='tap(index,"b"+index)'>
<image v-if="item.extra" class="img" :src="item.extra" mode="aspectFill"></image>
<view class="text">{{item.name}}</view>
@@ -25,7 +25,7 @@
<scroll-view :scroll-into-view="'subMenu_item'+subActive" scroll-x="true" scroll-with-animation='true'
style="width: 100%;">
<view class="subMenu_wrapper">
- <block v-for="(itemn,indexn) in categoryList[navActive].child" :key="itemn._key"><text
+ <block v-for="(itemn,indexn) in categoryList[navActive].child" :key="indexn"><text
class="subMenu_item" :id="'subMenu_item'+indexn" :class='indexn==subActive?"on":""'
@click='tapSub(indexn)'>{{itemn.name}}</text></block>
</view>
@@ -35,15 +35,15 @@
:style="{top: (categoryList[navActive].show2Category==0?0:118) + 'rpx',height: (height-(categoryList[navActive].show2Category==0?0:(122/750*windowWidth))) + 'px'}">
<scroll-view :scroll-top="scrollTop" class="goodlistScroll" scroll-y="true" style="height:100%;"
:scroll-into-view="scrollIntoView" @scroll="handleScroll" :throttle="false">
- <block v-for="(aitem,aindex) in categoryList" :key="aitem._key">
- <view class="list" v-if="aitem.child.length>0" v-for="(sitem,sindex) in aitem.child" :key="sitem._key"
+ <block v-for="(aitem,aindex) in categoryList" :key="aindex">
+ <view class="list" v-if="aitem.child.length>0" v-for="sitem,sindex in aitem.child" :key="sindex"
:style="(aindex==categoryList.length-1&&sindex==aitem.child.length-1)?('min-height:'+(height-370/750*windowWidth)+'px'):''"
:id="'list'+aindex+'_'+sindex">
<view class="list_title">{{sitem.name}}</view>
<view class="list_wrapper cf">
<view class="list_column cfl">
<block style="float:left" v-if="sitem.productArr.length>0"
- v-for="(gitem,gindex) in sitem.productArr" :key="gitem._key">
+ v-for="(gitem,gindex) in sitem.productArr" :key="gindex">
<GoodBlock v-if="gindex%2==0" :size="'small'" :pageName="'鍒嗙被'"
:moduleName="'鍒嗙被鍟嗗搧鍒楄〃'" :careBeanRate="careBeanRate" :goodsInfo="gitem">
</GoodBlock>
@@ -51,7 +51,7 @@
</view>
<view class="list_column cfr">
<block style="float:left" v-if="sitem.productArr.length>0"
- v-for="(gitem,gindex) in sitem.productArr" :key="gitem._key">
+ v-for="(gitem,gindex) in sitem.productArr" :key="gindex">
<GoodBlock v-if="gindex%2==1" :size="'small'" :pageName="'鍒嗙被'"
:moduleName="'鍒嗙被鍟嗗搧鍒楄〃'" :careBeanRate="careBeanRate" :goodsInfo="gitem">
</GoodBlock>
@@ -66,14 +66,14 @@
<view class="list_wrapper cf">
<view class="list_column cfl">
<block v-if="aitem.productArr.length>0" v-for="(gitem,gindex) in aitem.productArr"
- :key="gitem._key">
+ :key="gindex">
<GoodBlock v-if="gindex%2==0" :pageName="'鍒嗙被'" :moduleName="'鍒嗙被鍟嗗搧鍒楄〃'"
:careBeanRate="careBeanRate" :goodsInfo="gitem"></GoodBlock>
</block>
</view>
<view class="list_column cfr">
<block v-if="aitem.productArr.length>0" v-for="(gitem,gindex) in aitem.productArr"
- :key="gitem._key">
+ :key="gindex">
<GoodBlock v-if="gindex%2==1" :pageName="'鍒嗙被'" :moduleName="'鍒嗙被鍟嗗搧鍒楄〃'"
:careBeanRate="careBeanRate" :goodsInfo="gitem"></GoodBlock>
</block>
@@ -399,8 +399,6 @@
uni.showLoading();
getCategoryList().then(res => {
that.categoryList = res.data;
- // [P0-浼樺寲] 瑁呴厤闃舵涓烘墍鏈夊垎绫昏妭鐐规墦 _key锛屼緵妯℃澘 :key 浣跨敤
- that.ensureCategoryKey(that.categoryList);
// 閲嶇疆璁℃暟锛岄伩鍏嶉噸澶嶈繘鍏ラ〉闈㈡椂绱Н
that.totalGetNum = 0;
that.finishNum = 0;
@@ -445,83 +443,19 @@
that.getAllProductList(false, index);
}
};
- // [P0-浼樺寲] 棣栧睆鍒嗙被锛堝綋鍓峮avActive锛夛細绔嬪嵆骞跺彂鍙戣捣锛屼笉璧颁换浣曢槦鍒楋紝鏈�澶ч檺搴︾缉鐭灞� loading 鏃堕暱
- loadCate(that.navActive);
- // [P0-浼樺寲] 鍏朵綑鍒嗙被锛氭瀯寤轰换鍔″垪琛紝璧颁笅鏂瑰苟鍙戦檺娴佹睜锛岄伩鍏嶄竴娆℃�у崰婊� wx.request queue 鎷栨參棣栧睆
- let otherTasks = [];
- that.categoryList.forEach((it, idx) => {
- if (idx !== that.navActive) otherTasks.push({ index: idx });
- });
- that.runCategoryTasksWithLimit(otherTasks, 4);
+ // 褰撳墠鍒嗙被浼樺厛璇锋眰锛屼繚璇侀灞忔暟鎹渶鍏堣繑鍥�
+ loadCate(that.navActive);
+ that.categoryList.forEach((item, index) => {
+ if (index != that.navActive) {
+ loadCate(index);
+ }
+ })
- })
- },
- // [P0-浼樺寲] 骞跺彂闄愭祦宸ュ叿锛氶櫎棣栧睆鍒嗙被澶栵紝鍏朵綑鍒嗙被鐨勮姹傜粡鐢辨澶勫彂璧�
- runCategoryTasksWithLimit(tasks, limit) {
- let that = this;
- if (!tasks || !tasks.length) return Promise.resolve();
- const queue = tasks.slice();
- const executing = [];
- const launch = () => {
- while (queue.length && executing.length < limit) {
- const task = queue.shift();
- const item = that.categoryList[task.index];
- if (!item) continue;
- let promise;
- if (item.child && item.child.length > 0) {
- const subPromises = [];
- item.child.forEach((sub, subIdx) => {
- subPromises.push(that.getAllProductList('isSub', task.index, subIdx));
- });
- promise = Promise.all(subPromises);
- } else {
- promise = that.getAllProductList(false, task.index);
- }
- // 鐢� .catch 鍖呬竴灞傞伩鍏嶅崟涓け璐ユ嫋鍨暣姹�
- const tracked = promise.catch(() => {});
- tracked.finally(() => {
- const idx = executing.indexOf(tracked);
- if (idx >= 0) executing.splice(idx, 1);
- }).catch(() => {});
- executing.push(tracked);
- }
- };
- const next = () => {
- launch();
- if (executing.length === 0) return Promise.resolve();
- return Promise.race(executing).then(next, next);
- };
- return next();
- },
- // [P0-浼樺寲] 涓哄垎绫昏妭鐐规墦 _key锛氶潪 H5 骞冲彴鐨� v-for :key 蹇呴』涓虹畝鍗曞彉閲忥紝
- // 鏁呭湪鏁版嵁瑁呴厤闃舵棰勫厛鍦� item 涓婂姞 _key锛屾ā鏉跨敤 :key="item._key" 寮曠敤
- ensureCategoryKey: function(list) {
- if (!Array.isArray(list)) return;
- list.forEach((item, i) => {
- if (!item) return;
- if (item.id != null) item._key = 'c-' + item.id;
- else if (!item._key) item._key = 'c0-' + i;
- if (item.child && item.child.length) {
- item.child.forEach((sub, j) => {
- if (!sub) return;
- if (sub.id != null) sub._key = 's-' + sub.id;
- else if (!sub._key) sub._key = 's0-' + i + '-' + j;
- });
- }
- });
- },
- // [P0-浼樺寲] 涓哄晢鍝佽妭鐐规墦 _key
- ensureProductKey: function(list) {
- if (!Array.isArray(list)) return;
- list.forEach((g, k) => {
- if (!g) return;
- if (g.id != null && !g._key) g._key = 'p-' + g.id;
- else if (!g._key) g._key = 'pk-' + k;
- });
- },
- // 褰撳墠鍒嗙被鏁版嵁鍏ㄩ儴灏辩华鍚庣珛鍗冲叧闂叏灞弆oading锛屼笉蹇呯瓑寰呮墍鏈夊垎绫�
- checkFirstScreen(index1) {
+ })
+ },
+ // 褰撳墠鍒嗙被鏁版嵁鍏ㄩ儴灏辩华鍚庣珛鍗冲叧闂叏灞弆oading锛屼笉蹇呯瓑寰呮墍鏈夊垎绫�
+ checkFirstScreen(index1) {
let that = this;
if (that.firstScreenReady || index1 != that.navActive) return;
if ((that.catePending[index1] || 0) <= 0) {
@@ -631,8 +565,6 @@
cid: isSub ? that.categoryList[index1].child[index2].id : that.categoryList[index1].id,
}).then(res => {
let list = res.data.list;
- // [P0-浼樺寲] 瑁呴厤闃舵涓哄晢鍝佽妭鐐规墦 _key锛屼緵妯℃澘 :key 浣跨敤
- that.ensureProductKey(list);
// 褰撳墠娴忚鍒嗙被鍗虫椂娓叉煋锛涘叾浣欏垎绫昏繘鍏ョ紦鍐查槦鍒楁壒閲忔覆鏌擄紝
// 閬垮厤鍑犲崄娆�$set鍚勮嚜瑙﹀彂涓�娆″叏閲忓垪琛ㄦ覆鏌�
if (index1 == that.navActive && !that.firstScreenReady) {
--
Gitblit v1.4.0