fix(admin-jd): 别店快照类目树不再冒充本店——整树零命中时收树并点名
- jdCategoryCountTree 增 treeMatched(树内任一节点 count>0);侧栏据此判「内置授权树 与本店不同源」:JD_CATEGORY_TREE 是 2026-11-16 从花屿巷旗舰店抓的固定快照, 家居日用店打开时整树 0 命中、商品全落树外兜底,旧行为让界面看着像这家店卖女装。 - 整树零命中 ⇒ 树默认收起成一行「授权类目树(本店无匹配)」、点开给一句固定快照说明; 兜底行照旧单名等值可选(筛选不因收树失效);树内有命中时渲染与判据都不变。 - 判据:jd-category-tree.test.ts +1(treeMatched 三态)、mount +3(收起/点开/不误伤); 反向验证关掉判据=2 红。后管 node --test 1977 绿、vitest 250 绿、vue-tsc rc=0; 源码钉子基线只动本笔 cases 14→15(pins/reads 不变)。 - 可读性基线逐条点名:JdCategorySidebar.vue 846→890 行(本笔 +44,树消歧模板/文案/CSS)。
This commit is contained in:
@@ -181,6 +181,11 @@ export interface JdCategoryCountTree {
|
||||
extra: JdCategoryCountEntry[]
|
||||
/** 兜底组计数和(徽标直接用)。 */
|
||||
extraTotal: number
|
||||
/** 树内是否有任一节点真有行命中(count>0)。false+extra 非空=当前库内商品的类目名
|
||||
* 一个都不在这棵内置快照树上——侧栏据此把整棵树收成一行提示、不以别店的树冒充本店;
|
||||
* 树上节点全 0(如家居店打开服饰快照树)时这也是**结构性判断**,不是「数据还没到」
|
||||
* (数据没到=extra 也空,不触发)。 */
|
||||
treeMatched: boolean
|
||||
}
|
||||
|
||||
/** /categories 计数行 → 树形计数聚合(v1.6 蓝图 Phase 1)。同名跨支叶(短裤/唐装/
|
||||
@@ -226,5 +231,12 @@ export function jdCategoryCountTree(entries: JdCategoryCountEntry[]): JdCategory
|
||||
extra.push({ name, productCount: count })
|
||||
extraTotal += count
|
||||
}
|
||||
return { roots, extra, extraTotal }
|
||||
let treeMatched = false
|
||||
for (const [name, count] of counts) {
|
||||
if (treeNames.has(name) && count > 0) {
|
||||
treeMatched = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return { roots, extra, extraTotal, treeMatched }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user