Files
crawler-plugin/admin-frontend-vue/src/config/platform-scope.ts
T

43 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 平台 tab 口径的唯一清单(2026-11-16 用户定案「亚马逊/京东不混一起」)。
* 仿 company-scope.ts 的形状:单独成文件而不是塞进 routes.ts——护栏用例要从这里
* 反读清单与注册表对撞,放在一起会成环。 */
export type PlatformTabId = 'amazon' | 'jd'
export interface PlatformTabDef {
id: PlatformTabId
label: string
}
/** 侧边栏顶部平台 tab 的固定顺序:亚马逊在前(存量主体),京东在后。 */
export const PLATFORM_TABS: readonly PlatformTabDef[] = [
{ id: 'amazon', label: '亚马逊' },
{ id: 'jd', label: '京东' },
]
/** 京东侧独占菜单的 menuKey 唯一清单(与 routes.ts 的 menuKey 逐字一致,用例钉住)。
* 2026-11-17 晚:分类管理子菜单(admin_jd_category_manage,V204)随「京东分类管理并到
* 京东数据库分类编辑里」用户口径整体下线(页/路由/菜单行 V208 删),key 从清单摘除。
* 后续京东新页面上线把 key 加进这里即可,清单外的 key(含店铺管理/生成记录等
* 存量页)一律归亚马逊或双侧清单。 */
export const JD_MENU_KEYS: readonly string[] = [
'admin_jd_database',
]
/** 双侧共用菜单(2026-11-17 用户口径「这些亚马逊这边也要有」):三个账号域页面在两个
* 平台 tab 下都显示——同一套组件、按当前 tab 给接口传 platform,各自只看/管各自平台的
* 账号、分组、公司(后端 V206 三表加列,存量默认亚马逊,京东侧数据在编辑弹窗里翻档)。 */
export const BOTH_PLATFORM_MENU_KEYS: readonly string[] = [
'admin_users',
'admin_group_manage',
'admin_companies',
]
/** menuKey → 平台归属清单(唯一判定出口):京东独占 → ['jd'];双侧清单 → ['amazon','jd'];
* 其余(未知 key 在内)默认亚马逊。 */
export function platformsOfMenuKey(key: string): PlatformTabId[] {
if (JD_MENU_KEYS.includes(key)) return ['jd']
if (BOTH_PLATFORM_MENU_KEYS.includes(key)) return ['amazon', 'jd']
return ['amazon']
}