81 lines
2.2 KiB
TypeScript
81 lines
2.2 KiB
TypeScript
import {
|
|
CalculatorOutlined,
|
|
GlobalOutlined,
|
|
InboxOutlined,
|
|
PictureOutlined,
|
|
ShopOutlined,
|
|
} from '@ant-design/icons';
|
|
import type { ReactNode } from 'react';
|
|
|
|
export interface RouteMenuConfig {
|
|
/** 路由路径 */
|
|
path: string;
|
|
/** 菜单键值(与 path 相同) */
|
|
key: string;
|
|
/** 菜单图标 */
|
|
icon: ReactNode;
|
|
/** 菜单标签 */
|
|
label: string;
|
|
/** 页面标题 */
|
|
title: string;
|
|
/** 页面副标题 */
|
|
subtitle: string;
|
|
}
|
|
|
|
/** 左侧一级菜单,顺序与 docs/requirements/account-store-watermark.md 的导航约定一致 */
|
|
export const routeMenuConfig: RouteMenuConfig[] = [
|
|
{
|
|
path: '/online-products',
|
|
key: '/online-products',
|
|
icon: <GlobalOutlined />,
|
|
label: '在线商品',
|
|
title: '在线商品',
|
|
subtitle: '按 SKU 查看平台已上架商品与同步状态',
|
|
},
|
|
{
|
|
path: '/collection',
|
|
key: '/collection',
|
|
icon: <InboxOutlined />,
|
|
label: '采集箱',
|
|
title: '采集箱',
|
|
subtitle: '查看已采集的商品,进入编辑上架',
|
|
},
|
|
{
|
|
path: '/shops',
|
|
key: '/shops',
|
|
icon: <ShopOutlined />,
|
|
label: '店铺管理',
|
|
title: '店铺管理',
|
|
subtitle: '绑定平台店铺授权与水印',
|
|
},
|
|
{
|
|
path: '/watermarks',
|
|
key: '/watermarks',
|
|
icon: <PictureOutlined />,
|
|
label: '水印管理',
|
|
title: '水印管理',
|
|
subtitle: '维护水印模板并绑定到店铺',
|
|
},
|
|
{
|
|
path: '/pricing',
|
|
key: '/pricing',
|
|
icon: <CalculatorOutlined />,
|
|
label: '定价工具',
|
|
title: '定价工具',
|
|
subtitle: '独立试算与物流计价规则',
|
|
},
|
|
];
|
|
|
|
/** 根据路径获取页面标题信息 */
|
|
export const getPageInfo = (path: string): { title: string; subtitle: string } => {
|
|
if (path === '/' || path === '') {
|
|
const first = routeMenuConfig[0];
|
|
return { title: first.title, subtitle: first.subtitle };
|
|
}
|
|
if (path.startsWith('/products/')) {
|
|
return { title: '商品编辑', subtitle: '商品 AI 编辑页:SPU/SKU、媒体、定价与发布' };
|
|
}
|
|
const config = routeMenuConfig.find((item) => path.startsWith(item.path));
|
|
return config ? { title: config.title, subtitle: config.subtitle } : getPageInfo('/');
|
|
};
|