feat(phase-4): 京东商品上架用户端页(v1.5 蓝图 docs/ITERATION_PLAN.md §4 Phase 4)——JdPublishTab(分类 jdCollect.groups 唯一源→选品分页 owner 过滤→跨页勾选→改价三档→建单 queuePayload 直推→useLiveTaskBoard 行级面板+credential-fatal 同形接入)+tool-catalog 占位卡转正式+router 注册;后端面板读侧 JdCollectController 同形五端点(products/dashboard/history/progressBatch/delete)+JdPublishBoardService(无 scope_state,进度真源=明细行级四档)+JdProductQueryService.pageForUser(归属表两步下推不夹原生 SQL);激活 Phase 0 预置 5 支 Pending 契约;判据:JdPublishBoardServiceTest 5+JdProductQueryServiceUserPageTest 4+outlet 分母 138/72(写+2 读+3 随面板端点)、endpoints 冻结快照+progress/batch 清单+1、终态窄集合台账+JdPublishTab 1、catch 块 319→324 全非静默、占位 mount 锁翻转两条断言;vue-tsc rc0、用户端 node --test 1078/1078+vitest mount 90/90、后端点名 6 类 41 例 BUILD SUCCESS、快检四面格(后端 9.5/客户端 10.0/用户端 9.6)绿,唯一红格=后管 mount 组件挂载格,甄别=他窗在飞 admin 件输出含 failed 子串触发 ruler vfail 脆弱判据(实跑 cmd /c npx vitest run RC=0、188/188 全过,本笔零后管文件)
This commit is contained in:
@@ -91,7 +91,11 @@ const BASELINE = {
|
||||
// 都能看到」):JdCollectTab.vue 的 loadGroups catch——分类只是展示项,拉取失败
|
||||
// ElMessage.warning 当场说给用户、原文只进 console,采集主路照常;非静默,
|
||||
// silent 一格没涨,只进 blocks。
|
||||
blocks: 319,
|
||||
// 324 = 319 + 5(2026-11-18 v1.5 Phase 4 京东商品上架用户端):JdPublishTab.vue +
|
||||
// jd-publish.ts 新增 5 支 try/catch(分类/商品列表拉取失败落到界面反馈、激活失败
|
||||
// 降级为提示由客户端兜底拉取认领、重试/建单入口异常 ElMessage),全部非静默
|
||||
// ("新增静默文件"断言未触发),silent 一格没涨,只进 blocks。
|
||||
blocks: 324,
|
||||
// 2026-10-30(ops Phase 6/可读棘轮):ApiSecretSettingsPanel.vue 1113→775 行,面板里那处
|
||||
// 静默 catch(余额查询失败只 console.warn、界面留空)随 loadBalance 整块搬进
|
||||
// useProxyPlan.ts。不是新增静默:面板 1→0、新文件记 1,silent 总数与 blocks 都一格没动,
|
||||
|
||||
@@ -90,6 +90,7 @@ test('test_progress_batch_paths_match_controllers', () => {
|
||||
'/api/shop-data-crawl/tasks/progress/batch',
|
||||
'/api/withdraw/tasks/progress/batch',
|
||||
'/api/jd-collect/tasks/progress/batch',
|
||||
'/api/jd-publish/tasks/progress/batch',
|
||||
].sort(),
|
||||
'progress/batch 端点应与 Java controller 路由一一对应',
|
||||
)
|
||||
@@ -338,6 +339,19 @@ test('test_endpoints_frozen_snapshot', () => {
|
||||
"progressBatch": "/api/jd-collect/tasks/progress/batch",
|
||||
"deleteTask": "/api/jd-collect/tasks/{taskId}"
|
||||
},
|
||||
// 2026-11-18 v1.5 Phase 4:京东商品上架(建单/激活/选品/面板七件)。建单响应 queuePayload
|
||||
// 由服务端组装(type=jd-product-publish-run 与 SPI 同值,铁律 32 第三件),页面原样投
|
||||
// api.enqueue_json;分类读取唯一来源仍是 jdCollect.groups(B113-01,AC-9 源码绊线钉死)。
|
||||
"jdPublish": {
|
||||
"create": "/api/jd-publish/tasks",
|
||||
"activate": "/api/jd-publish/tasks/{taskId}/activate",
|
||||
"products": "/api/jd-publish/products",
|
||||
"dashboard": "/api/jd-publish/dashboard",
|
||||
"history": "/api/jd-publish/history",
|
||||
"progressBatch": "/api/jd-publish/tasks/progress/batch",
|
||||
"progress": "/api/jd-publish/tasks/{taskId}/progress",
|
||||
"deleteTask": "/api/jd-publish/tasks/{taskId}"
|
||||
},
|
||||
"userSecret": {
|
||||
"bundle": "/api/user-secrets",
|
||||
"save": "/api/user-secrets/{moduleKey}",
|
||||
|
||||
@@ -28,11 +28,11 @@ test('京东工作台只有两个菜单:获取店铺数据 + 商品上架', ()
|
||||
assert.ok(JD_TOOL_MAP.get('jd-collect'), 'JD_TOOL_MAP 应按 id 命中获取店铺数据')
|
||||
})
|
||||
|
||||
test('获取店铺数据指向采集页,商品上架先做占位菜单', () => {
|
||||
test('获取店铺数据指向采集页,商品上架已转正式挂 /jd-publish(v1.5 Phase 4)', () => {
|
||||
const collect = JD_TOOLS.find((tool) => tool.id === 'jd-collect')
|
||||
const publish = JD_TOOLS.find((tool) => tool.id === 'jd-publish')
|
||||
assert.equal(collect?.href, '/jd-collect', '获取店铺数据应指向 /jd-collect')
|
||||
assert.equal(publish?.href, undefined, '商品上架先做假菜单:不得挂路由')
|
||||
assert.equal(publish?.href, '/jd-publish', '商品上架已转正式:指向 /jd-publish(占位态已随 v1.5 Phase 4 下线)')
|
||||
})
|
||||
|
||||
test('路由器注册京东工作台与采集页', () => {
|
||||
@@ -40,6 +40,7 @@ test('路由器注册京东工作台与采集页', () => {
|
||||
assert.ok(router.includes("path: '/jd-console'"), 'router 缺 /jd-console')
|
||||
assert.ok(router.includes('JdConsolePage.vue'), 'router 未指向 JdConsolePage')
|
||||
assert.ok(router.includes("path: '/jd-collect'"), 'router 缺 /jd-collect')
|
||||
assert.ok(router.includes("path: '/jd-publish'"), 'router 缺 /jd-publish(v1.5 Phase 4 转正式)')
|
||||
})
|
||||
|
||||
test('首页京东入口与亚马逊/视频并列', () => {
|
||||
|
||||
@@ -9,8 +9,8 @@ import { join } from 'node:path'
|
||||
* 1. **立即生效**(AC-9 前端绊线,B113-01):`/api/jd-collect/groups` 是京东分类的
|
||||
* 唯一读取口——全 src 不得出现第三个裸 URL 消费点;发布页要分类数据必须走
|
||||
* endpoints.jdCollect.groups 的既有 fetch 函数(出现第二个分类口即红)。
|
||||
* 2. **Pending Phase 4**(每支带 skip):JdPublishTab(分类→商品→改价→建单→实时面板)
|
||||
* 落地后移除对应 skip 跑绿——蓝图 §4 Phase 4【待激活验收测试】登记的就是这份清单。
|
||||
* 2. **Phase 4 契约**(2026-11-18 随 Phase 4 落地移除 skip 正式激活):JdPublishTab
|
||||
* (分类→商品→改价→建单→实时面板)的 5 支验收契约,蓝图 §4 Phase 4【待激活验收测试】清单。
|
||||
*/
|
||||
|
||||
const ROOT = process.cwd()
|
||||
@@ -45,19 +45,19 @@ test('AC-9: 京东分类读取口全 src 唯一(B113-01 绊线)', () => {
|
||||
|
||||
// ---------------------------------------------------------- Pending Phase 4
|
||||
|
||||
test('AC-9: JdPublishTab 分类选择消费唯一 groups 出口', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
|
||||
test('AC-9: JdPublishTab 分类选择消费唯一 groups 出口', () => {
|
||||
const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
|
||||
assert.ok(tab.includes('jdCollect'), 'JdPublishTab 的分类数据必须走 endpoints.jdCollect/groups 既有 fetch(AC-9),不得自拼 URL')
|
||||
assert.ok(!tab.includes('jd-collect/groups'), 'JdPublishTab 不得裸写分类 URL(B113-01 绊线)')
|
||||
})
|
||||
|
||||
test('AC-9: 商品列表只拉归属当前用户的行(owner 过滤)', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
|
||||
test('AC-9: 商品列表只拉归属当前用户的行(owner 过滤)', () => {
|
||||
const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
|
||||
assert.ok(tab.includes('productIds') || tab.includes('productId'),
|
||||
'JdPublishTab 建单提交必须携带勾选的商品 id 集合(服务端按 owner 校验,跨用户商品 0 返回)')
|
||||
})
|
||||
|
||||
test('建单请求体形状:categoryId + productIds + priceRule{mode,value}', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
|
||||
test('建单请求体形状:categoryId + productIds + priceRule{mode,value}', () => {
|
||||
const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
|
||||
// 蓝图 §3 死契约:POST /api/jd-publish/tasks 请求体 {categoryId, productIds[], priceRule:{mode,value?}}
|
||||
assert.ok(tab.includes('categoryId'), '建单体缺 categoryId(所选自定义分类)')
|
||||
@@ -66,13 +66,13 @@ test('建单请求体形状:categoryId + productIds + priceRule{mode,value}',
|
||||
'priceRule.mode 三档(none/percent/fixed)必须与蓝图 §3 同值')
|
||||
})
|
||||
|
||||
test('endpoints 注册 jdPublish 端点组(建单/items/chunk 三件)', { skip: 'Pending Phase 4: endpoints 扩组后移除 skip' }, () => {
|
||||
test('endpoints 注册 jdPublish 端点组(建单/items/chunk 三件)', () => {
|
||||
const endpoints = read('src/shared/api/endpoints.ts', 'endpoints.ts')
|
||||
assert.ok(endpoints.includes('jdPublish'), 'endpoints.ts 缺 jdPublish 端点组')
|
||||
assert.ok(endpoints.includes('/api/jd-publish/tasks'), 'jdPublish 组缺建单端点 /api/jd-publish/tasks')
|
||||
})
|
||||
|
||||
test('商品上架占位卡转正式:jd-publish 卡挂 /jd-publish 路由', { skip: 'Pending Phase 4: 占位卡转正式时移除 skip(须同步改 jd-console-tool-catalog.test.ts 的占位锁)' }, () => {
|
||||
test('商品上架占位卡转正式:jd-publish 卡挂 /jd-publish 路由', () => {
|
||||
const catalog = read('src/pages/jd/tool-catalog.ts', 'jd/tool-catalog.ts')
|
||||
const router = read('src/router/index.ts', 'router/index.ts')
|
||||
assert.ok(/id:\s*'jd-publish'[\s\S]*?href:\s*'\/jd-publish'/.test(catalog),
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
*
|
||||
* 三件事一起判,缺一条就是假绿:
|
||||
* ① 两个菜单名都在 DOM 里(获取店铺数据 / 商品上架);
|
||||
* ② 获取店铺数据是「可用」卡片(有 href → router-link 分支,文案是「打开工具」);
|
||||
* ③ 商品上架是「假菜单」:没有 href,点开只弹一句「暂未开通」,不发任何请求。
|
||||
* ② 两张卡都是「可用」卡片(有 href → router-link 分支,文案是「打开工具」);
|
||||
* ③ 商品上架卡(v1.5 Phase 4 由占位转正式)的 router-link 指向 /jd-publish。
|
||||
*
|
||||
* 历史锁(2026-11-17):本文件原本钉「商品上架是假菜单(tool-card--pending,点开只弹
|
||||
* 暂未开通)」;占位随 Phase 4 转正式后这两条断言翻转为可用卡形状,假菜单分支在
|
||||
* JdConsolePage 保留为通用防御(后续新工具再用)。
|
||||
*
|
||||
* 跑法:cd frontend-vue && npx vitest run(tests/mount/** 由 vitest.config.ts 收)。
|
||||
*/
|
||||
@@ -20,8 +24,8 @@ function mountConsole() {
|
||||
global: {
|
||||
stubs: {
|
||||
NotificationBell: true,
|
||||
RouterLink: { template: '<a class="router-link-stub"><slot /></a>' },
|
||||
'router-link': { template: '<a class="router-link-stub"><slot /></a>' },
|
||||
RouterLink: { props: ['to'], template: '<a class="router-link-stub" :data-to="to"><slot /></a>' },
|
||||
'router-link': { props: ['to'], template: '<a class="router-link-stub" :data-to="to"><slot /></a>' },
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -47,21 +51,19 @@ describe('京东工作台两个菜单', () => {
|
||||
expect(w.findAll('.tool-card').length).toBe(2)
|
||||
})
|
||||
|
||||
it('获取店铺数据是可用卡片,商品上架是占位(暂未开通)', () => {
|
||||
it('两张卡都是可用卡片(转正式后无占位态)', () => {
|
||||
const w = mountConsole()
|
||||
const cards = w.findAll('.tool-card')
|
||||
expect(cards[0].classes()).not.toContain('tool-card--pending')
|
||||
expect(cards[0].text()).toContain('打开工具')
|
||||
expect(cards[1].classes()).toContain('tool-card--pending')
|
||||
expect(cards[1].text()).toContain('暂未开通')
|
||||
expect(cards[1].classes()).not.toContain('tool-card--pending')
|
||||
expect(cards[1].text()).toContain('打开工具')
|
||||
})
|
||||
|
||||
it('点假菜单只弹提示,不跳转', async () => {
|
||||
it('商品上架卡的 router-link 指向 /jd-publish(占位已转正式)', () => {
|
||||
const w = mountConsole()
|
||||
const pending = w.findAll('.tool-card')[1]
|
||||
await pending.trigger('click')
|
||||
const toast = w.find('.toast')
|
||||
expect(toast.text()).toContain('商品上架暂未开通')
|
||||
expect(toast.classes()).toContain('show')
|
||||
const links = w.findAll('a.router-link-stub').map((a) => a.attributes('data-to'))
|
||||
expect(links).toContain('/jd-collect')
|
||||
expect(links).toContain('/jd-publish')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -46,6 +46,8 @@ const NARROW_LEDGER: Record<string, number> = {
|
||||
'src/pages/brand/components/BrandProductRiskTab.vue': 2,
|
||||
'src/pages/brand/components/BrandSimilarAsinTab.vue': 1,
|
||||
'src/pages/jd/JdCollectTab.vue': 1,
|
||||
// v1.5 Phase 4:商品上架页同形(settleOnTaskStatuses 需含 CANCELLED,与采集页同因不入共用词表)
|
||||
'src/pages/jd/JdPublishTab.vue': 1,
|
||||
'src/shared/composables/useLiveTaskBoard.ts': 2,
|
||||
}
|
||||
const NARROW_BASELINE_TOTAL = Object.values(NARROW_LEDGER).reduce((a, b) => a + b, 0)
|
||||
|
||||
Reference in New Issue
Block a user