Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 561a142d
authored
Nov 11, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化左侧菜单栏样式
1 parent
d0b7eb87
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2786 additions
and
253 deletions
apps/web/shell/src/layouts/BasicLayout.tsx
apps/web/shell/src/layouts/SideNav.tsx
apps/web/shell/src/theme/design.css
docs/sider-redesign.html
packages/design-tokens/src/themeConfig.ts
apps/web/shell/src/layouts/BasicLayout.tsx
View file @
561a142
import { bus } from 'wujie';
import { bus } from 'wujie';
import { PAGE_LEAVE_EVENT } from '@uj/contracts';
import { PAGE_LEAVE_EVENT } from '@uj/contracts';
import { Layout, Menu, Avatar, Dropdown, Button, Breadcrumb } from 'antd';
import { Layout, Avatar, Dropdown, Breadcrumb } from 'antd';
import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
import { Suspense, useEffect, useMemo, useState } from 'react';
import { Suspense, useEffect, useMemo, useState } from 'react';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import {
DashboardOutlined,
ShopOutlined,
UploadOutlined,
LogoutOutlined,
UserOutlined,
TeamOutlined,
AuditOutlined,
AppstoreOutlined,
FolderOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
GiftOutlined,
FileSyncOutlined,
FundOutlined,
TransactionOutlined,
SolutionOutlined,
HomeOutlined,
SettingOutlined,
CarOutlined,
FundProjectionScreenOutlined,
AimOutlined,
ExperimentOutlined,
ControlOutlined,
ToolOutlined,
SendOutlined,
ReconciliationOutlined,
UserSwitchOutlined,
FileTextOutlined,
SafetyCertificateOutlined,
WechatOutlined,
PayCircleOutlined,
} from '@ant-design/icons';
import { useAccess, buildMenus, type MenuGroupDef } from '@/access';
import { useAccess, buildMenus, type MenuGroupDef } from '@/access';
import { useAppStore } from '@/store/useAppStore';
import { useAppStore } from '@/store/useAppStore';
import { menu as menuApi, cancelRequests } from '@/api';
import { menu as menuApi, cancelRequests } from '@/api';
...
@@ -44,13 +12,10 @@ import { Logo } from '@/components/Logo';
...
@@ -44,13 +12,10 @@ import { Logo } from '@/components/Logo';
import { Skeleton } from '@uj/ui';
import { Skeleton } from '@uj/ui';
import menuJson from '@/config/menu.json';
import menuJson from '@/config/menu.json';
import { roleLabels } from '@/access';
import { roleLabels } from '@/access';
import
type { MenuProps } from 'antd
';
import
SideNav from './SideNav
';
const { Header, Sider, Content } = Layout;
const { Header, Sider, Content } = Layout;
/** antd Menu 的单条目类型:MenuProps['items'] 联合里的成员(普通项 / 分组 / 分割线…) */
type MenuItemType = NonNullable<MenuProps['items']>[number];
/* ---------- 菜单数据:以后端 /system/menu/tree/current 为准,menu.json 仅作接口未就绪时的兜底 ---------- */
/* ---------- 菜单数据:以后端 /system/menu/tree/current 为准,menu.json 仅作接口未就绪时的兜底 ---------- */
// 前端专属菜单:后端菜单树不下发「工作台」(它是所有角色的落地页,不该被权限挡),
// 前端专属菜单:后端菜单树不下发「工作台」(它是所有角色的落地页,不该被权限挡),
...
@@ -72,62 +37,8 @@ const EXTRA_TITLES: Record<string, string> = {
...
@@ -72,62 +37,8 @@ const EXTRA_TITLES: Record<string, string> = {
'/profile': '个人资料',
'/profile': '个人资料',
};
};
// 图标注册表:菜单数据(后端 sys_menu.icon / 兜底 menu.json)只存图标名,渲染时查表。
// 图标注册表与 resolveIcon 已随自绘导航移到 ./SideNav.tsx:
// 这里刻意用字面量而不是 `import * as antdIcons` 动态取:后者会把 894 个图标全打进首屏。
// 二级菜单不再渲染图标,白名单现在只服务一级业务域与「工作台」单入口。
// 代价是后端新增菜单图标必须在这里同步登记一行,漏了会在 dev 控制台点名(见 resolveIcon)。
const iconMap: Record<string, React.ReactNode> = {
DashboardOutlined: <DashboardOutlined />,
ShopOutlined: <ShopOutlined />,
UploadOutlined: <UploadOutlined />,
TeamOutlined: <TeamOutlined />,
AuditOutlined: <AuditOutlined />,
UserOutlined: <UserOutlined />,
GiftOutlined: <GiftOutlined />,
FileSyncOutlined: <FileSyncOutlined />,
FundOutlined: <FundOutlined />,
TransactionOutlined: <TransactionOutlined />,
SolutionOutlined: <SolutionOutlined />,
HomeOutlined: <HomeOutlined />,
SettingOutlined: <SettingOutlined />,
// 二手车管理(scripts/usedcar-menu-complete.sql)
CarOutlined: <CarOutlined />,
FundProjectionScreenOutlined: <FundProjectionScreenOutlined />,
AimOutlined: <AimOutlined />,
ExperimentOutlined: <ExperimentOutlined />,
ControlOutlined: <ControlOutlined />,
ToolOutlined: <ToolOutlined />,
SendOutlined: <SendOutlined />,
ReconciliationOutlined: <ReconciliationOutlined />,
UserSwitchOutlined: <UserSwitchOutlined />,
FileTextOutlined: <FileTextOutlined />,
SafetyCertificateOutlined: <SafetyCertificateOutlined />,
WechatOutlined: <WechatOutlined />,
PayCircleOutlined: <PayCircleOutlined />,
};
/** 后端未下发图标(icon 为 null)或图标名未登记时的兜底图标 */
const DEFAULT_MENU_ICON: React.ReactNode = <AppstoreOutlined />;
/** 一级分组既无自身图标、也无子项可借时的兜底图标:折叠成图标栏时也有可点的入口 */
const GROUP_DEFAULT_ICON: React.ReactNode = <FolderOutlined />;
// 后端下发的 icon 是「antd 图标名字符串」,这里查表换成 React 节点。
// 未登记的图标名会静默回落兜底图标 —— 这正是之前「菜单全是同一个图标」排查起来很痛苦的原因,
// 故开发环境对未知图标名告警一次(同名只报一次,避免菜单每项刷屏)。
const warnedIcons = new Set<string>();
function resolveIcon(
name: string | null | undefined,
fallback: React.ReactNode = DEFAULT_MENU_ICON,
): React.ReactNode {
const hit = name ? iconMap[name] : undefined;
if (hit) return hit;
if (name && import.meta.env.DEV && !warnedIcons.has(name)) {
warnedIcons.add(name);
console.warn(
`[menu] 图标「${name}」未在 src/layouts/BasicLayout.tsx 的 iconMap 中登记,已回落兜底图标。` +
`请在 iconMap 补一行,或让后端改发已支持的值。`,
);
}
return fallback;
}
// 兜底菜单:接口失败/尚未返回时使用(与 src/config/menu.json 对应)
// 兜底菜单:接口失败/尚未返回时使用(与 src/config/menu.json 对应)
const fallbackGroups: MenuGroupDef[] = (() => {
const fallbackGroups: MenuGroupDef[] = (() => {
...
@@ -149,8 +60,9 @@ fallbackGroups.forEach((g) =>
...
@@ -149,8 +60,9 @@ fallbackGroups.forEach((g) =>
}),
}),
);
);
/** 一级分组的 SubMenu key 前缀:与页面 path 区分,onClick 据此挡掉非路由 key。
/** 一级分组在 openKeys 里的 key 前缀:与页面 path 区分,避免 key 撞车。
* 分组名需保持唯一(后端菜单树的既有约束)——同名分组本就是配置错误,不让前端悄悄掩盖。 */
* 分组名需保持唯一(后端菜单树的既有约束)——同名分组本就是配置错误,不让前端悄悄掩盖。
* 自绘 SideNav 不接触这个格式,只按分组名问答(见 isGroupOpen / onToggleGroup)。 */
const GROUP_KEY_PREFIX = 'group:';
const GROUP_KEY_PREFIX = 'group:';
const groupKey = (group: string) => `${GROUP_KEY_PREFIX}${group}`;
const groupKey = (group: string) => `${GROUP_KEY_PREFIX}${group}`;
...
@@ -186,32 +98,16 @@ export default function BasicLayout() {
...
@@ -186,32 +98,16 @@ export default function BasicLayout() {
[remoteGroups],
[remoteGroups],
);
);
// -> antd Menu items(后端树已在 buildMenus 内与 permCodes 取过交集;兜底菜单按权限过滤)
// 交给自绘 SideNav 的分组:权限过滤后剔除空组,避免出现点不开的空章节。
// 普通分组渲染成【可折叠的 SubMenu】:点一级标题即可收起/展开其下的二级菜单项,
// 这里只做过滤,不再把数据翻译成 antd Menu items —— 渲染结构由 SideNav 负责。
// 取代原先 type:'group' 标题组(inline 模式下永远展开、点不动)。菜单变多后靠折叠控制侧边栏长度。
// can 来自 AccessProvider 的 useMemo value,引用稳定,故 useMemo 能真正固定住引用。
// hideTitle 分组仍是平铺到顶层的普通菜单项(如「工作台」单入口),保持一点即达。
const visibleGroups: MenuGroupDef[] = useMemo(
// SubMenu key 统一加 'group:' 前缀,与页面 path 区分开,避免 key 撞车。
() =>
const items: MenuItemType[] = groups.flatMap<MenuItemType>((g) => {
groups
const children = g.children
.map((g) => ({ ...g, children: g.children.filter((m) => !m.resource || can(m.resource)) }))
.filter((m) => !m.resource || can(m.resource))
.filter((g) => g.children.length > 0),
.map((m) => ({
[groups, can],
key: m.path,
);
icon: resolveIcon(m.icon),
label: m.label,
}));
if (!children.length) return []; // 权限过滤后的空组不渲染,避免出现点不开的空 SubMenu
if (g.hideTitle) return children;
return [
{
key: groupKey(g.group),
// 一级图标取后端产品分组节点自己的 icon;没登记才借首个子项,
// 再没有才落 FolderOutlined——借子项会让一级图标跟着二级的 sort 变,所以只当兜底。
icon: resolveIcon(g.icon, children[0]?.icon ?? GROUP_DEFAULT_ICON),
label: g.group,
children,
},
];
});
const flat = groups.flatMap((g) => g.children);
const flat = groups.flatMap((g) => g.children);
// 非菜单页面(如 /profile)不匹配任何菜单项:菜单不高亮,页题走 EXTRA_TITLES。
// 非菜单页面(如 /profile)不匹配任何菜单项:菜单不高亮,页题走 EXTRA_TITLES。
...
@@ -229,20 +125,18 @@ export default function BasicLayout() {
...
@@ -229,20 +125,18 @@ export default function BasicLayout() {
const current = flat.find((m) => m.path === selectedKey);
const current = flat.find((m) => m.path === selectedKey);
const currentGroup = groups.find((g) => g.children.some((m) => m.path === selectedKey));
const currentGroup = groups.find((g) => g.children.some((m) => m.path === selectedKey));
// 当前页所属的
可折叠分组:默认展开这一组
,让用户一进来就能看到自己所在的位置。
// 当前页所属的
业务域章节:默认展开这一章
,让用户一进来就能看到自己所在的位置。
// hideTitle 组(工作台)是平铺的
普通项,没有 SubMenu
,返回 null 不参与展开。
// hideTitle 组(工作台)是平铺的
单入口,没有章节头
,返回 null 不参与展开。
const activeGroupKey =
const activeGroupKey =
currentGroup && !currentGroup.hideTitle ? groupKey(currentGroup.group) : null;
currentGroup && !currentGroup.hideTitle ? groupKey(currentGroup.group) : null;
//
一级菜单展开状态(受控
):
//
章节展开状态(受控,存 'group:' 前缀 key
):
// - 惰性初始化为首帧就只展开当前
分组
、其余收起,既避免「先全收起再弹开」的闪烁,
// - 惰性初始化为首帧就只展开当前
章节
、其余收起,既避免「先全收起再弹开」的闪烁,
// 也是「菜单多了」之后控制侧边栏长度的关键。
// 也是「菜单多了」之后控制侧边栏长度的关键。
// - 用户点
一级标题只增删自己那一组(onOpenChange 全量回写
),不做手风琴式强制收起;
// - 用户点
章节头只增删自己那一组(onToggleGroup
),不做手风琴式强制收起;
// effect 依赖刻意不含 openKeys,否则收起当前分组后会被立刻弹回、永远关不上。
// effect 依赖刻意不含 openKeys,否则收起当前分组后会被立刻弹回、永远关不上。
// - 路由 / 菜单数据 / Sider 折叠态变化时清掉失效分组 key、补上当前分组,保证选中项始终可见。
// - 路由 / 菜单数据 / 侧栏折叠态变化时清掉失效 key、补上当前章节,保证选中项始终可见。
// collapsed 必加:@rc-component/menu 进入 inlineCollapsed 会触发 onOpenChange([]),
// collapsed 仍在依赖里:折叠→展开后按当前路由重校准一次,位置不会丢。
// 受控 openKeys 下它恢复展开时写不回缓存(Menu.js 的 setMergedOpenKeys 对受控无效),
// 不重新校准会让「收起侧栏再展开」把所有分组连同当前位置一起收起。
// - 内容未变返回原引用避免多余渲染;依赖都是稳定值(groups 已 useMemo)。
// - 内容未变返回原引用避免多余渲染;依赖都是稳定值(groups 已 useMemo)。
const [openKeys, setOpenKeys] = useState<string[]>(() =>
const [openKeys, setOpenKeys] = useState<string[]>(() =>
activeGroupKey ? [activeGroupKey] : [],
activeGroupKey ? [activeGroupKey] : [],
...
@@ -256,6 +150,16 @@ export default function BasicLayout() {
...
@@ -256,6 +150,16 @@ export default function BasicLayout() {
});
});
}, [groups, activeGroupKey, collapsed]);
}, [groups, activeGroupKey, collapsed]);
// SideNav 不关心 openKeys 的 key 格式('group:' 前缀是 BasicLayout 的内部约定),
// 只按分组名问「开没开」、按分组名请求切换,避免两处各自拼 key。
const isGroupOpen = (name: string) => openKeys.includes(groupKey(name));
const onToggleGroup = (name: string) => {
const key = groupKey(name);
setOpenKeys((prev) => (prev.includes(key) ? prev.filter((k) => k !== key) : [...prev, key]));
};
const activeGroupName = currentGroup?.group ?? null;
const roleLabel = roleCodes.length ? roleCodes.join(' / ') : roleLabels[role];
// 面包屑:分组 > 当前页;分组名与页题同名(如「工作台」)时只留一级,避免重复。
// 面包屑:分组 > 当前页;分组名与页题同名(如「工作台」)时只留一级,避免重复。
// 非菜单页(/profile)无分组,只显示 EXTRA_TITLES 登记的页题。
// 非菜单页(/profile)无分组,只显示 EXTRA_TITLES 登记的页题。
const crumbTitles = [
const crumbTitles = [
...
@@ -286,7 +190,7 @@ export default function BasicLayout() {
...
@@ -286,7 +190,7 @@ export default function BasicLayout() {
trigger={null}
trigger={null}
width={216}
width={216}
collapsedWidth={68}
collapsedWidth={68}
className=
"uj-sider"
className=
{`uj-sider${collapsed ? ' is-collapsed' : ''}`}
>
>
{/* 品牌区 */}
{/* 品牌区 */}
<div className={`uj-sider-brand${collapsed ? ' is-collapsed' : ''}`}>
<div className={`uj-sider-brand${collapsed ? ' is-collapsed' : ''}`}>
...
@@ -299,41 +203,31 @@ export default function BasicLayout() {
...
@@ -299,41 +203,31 @@ export default function BasicLayout() {
)}
)}
</div>
</div>
{/* 菜单区 */}
{/* 自绘侧栏导航:只接收过滤后的分组与受控展开态,不再经过 antd Menu。
<div className="uj-sider-menu">
折叠控制已收进 SideNav 底部(导航的操作放回导航容器),Header 只留面包屑。 */}
<Menu
<SideNav
theme="dark"
groups={visibleGroups}
mode="inline"
selectedKey={selectedKey}
className="uj-menu"
activeGroupName={activeGroupName}
selectedKeys={selectedKey ? [selectedKey] : []}
isGroupOpen={isGroupOpen}
openKeys={openKeys}
onToggleGroup={onToggleGroup}
onOpenChange={(keys) => setOpenKeys(keys.map(String))}
collapsed={collapsed}
items={items}
onToggleCollapsed={toggleCollapsed}
onClick={({ key }) => {
roleLabel={roleLabel}
// 一级标题点击走 onOpenChange、不产生 onClick;这里仍按「分组 key 不导航」兜底,
onNavigate={(path) => {
// 防止分组 key 被误当作路由跳进 404。
if (key.startsWith(GROUP_KEY_PREFIX)) return;
// 切菜单先中断上一页的在途请求:alive 保活的子应用不会卸载,旧响应回来会写脏 state。
// 切菜单先中断上一页的在途请求:alive 保活的子应用不会卸载,旧响应回来会写脏 state。
// 广播给所有保活子应用(各自 cancelRequests),主壳自己的在途请求在这里一并取消。
// 广播给所有保活子应用(各自 cancelRequests),主壳自己的在途请求在这里一并取消。
bus.$emit(PAGE_LEAVE_EVENT);
bus.$emit(PAGE_LEAVE_EVENT);
cancelRequests();
cancelRequests();
navigate(key
);
navigate(path
);
}}
}}
/>
/>
</div>
</Sider>
</Sider>
<Layout style={{ minWidth: 0 }}>
<Layout style={{ minWidth: 0 }}>
<Header className="uj-header">
<Header className="uj-header">
{/* 左:
折叠 + 面包屑(分组 > 当前页)
*/}
{/* 左:
面包屑(分组 > 当前页);折叠控制在侧栏底部
*/}
<div className="uj-header-left">
<div className="uj-header-left">
<Button
type="text"
aria-label="切换菜单"
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
onClick={toggleCollapsed}
className="uj-header-fold"
/>
{crumbItems.length > 0 && <Breadcrumb className="uj-header-crumb" items={crumbItems} />}
{crumbItems.length > 0 && <Breadcrumb className="uj-header-crumb" items={crumbItems} />}
</div>
</div>
...
@@ -395,9 +289,7 @@ export default function BasicLayout() {
...
@@ -395,9 +289,7 @@ export default function BasicLayout() {
/>
/>
<div className="uj-header-user-text">
<div className="uj-header-user-text">
<span className="n">{currentUser.name}</span>
<span className="n">{currentUser.name}</span>
<span className="r">
<span className="r">{roleLabel}</span>
{roleCodes.length ? roleCodes.join(' / ') : roleLabels[role]}
</span>
</div>
</div>
</button>
</button>
</Dropdown>
</Dropdown>
...
...
apps/web/shell/src/layouts/SideNav.tsx
0 → 100644
View file @
561a142
import { useCallback, useEffect, useRef, useState } from 'react';
import type { ReactNode } from 'react';
import { createPortal } from 'react-dom';
import {
DashboardOutlined,
ShopOutlined,
UploadOutlined,
TeamOutlined,
AuditOutlined,
AppstoreOutlined,
FolderOutlined,
GiftOutlined,
FileSyncOutlined,
FundOutlined,
TransactionOutlined,
SolutionOutlined,
HomeOutlined,
SettingOutlined,
CarOutlined,
FundProjectionScreenOutlined,
AimOutlined,
ExperimentOutlined,
ControlOutlined,
ToolOutlined,
SendOutlined,
ReconciliationOutlined,
UserSwitchOutlined,
FileTextOutlined,
SafetyCertificateOutlined,
WechatOutlined,
PayCircleOutlined,
RightOutlined,
} from '@ant-design/icons';
import type { MenuGroupDef } from '@/access';
/**
* 侧栏导航(自绘,不走 antd Menu)。
*
* 为什么自绘:重设计后一级是「章节头」——四列网格(图标 / 标题槽 / 子项数 / 展开指示),
* 二级是导轨下的纯文字项,且章节头与子项高度不同。antd Menu 的 SubMenu 把两者共用
* itemHeight,标题内容包在 .ant-menu-title-content 里由内容撑宽;要让标题槽 flex:1、
* 右端对齐到同一条线,只能覆盖组件内部盒模型 —— design.css 旧注释自己就写过
* 「折叠态居中尤其敏感,任何 width / padding-inline 覆盖都会算歪」。
* 用 type:'group' 自定义 label 也不行:group 标题在 inline 模式下点不动,会把
* BasicLayout 里「原先 group 标题永远展开才换成 SubMenu」的修复回退掉。
*
* 因此只换渲染层:数据仍是后端菜单树经 buildMenus 得到的 MenuGroupDef[],
* 权限过滤 / selectedKey 最长前缀 / openKeys 受控校准 / 切页时的
* PAGE_LEAVE_EVENT + cancelRequests + navigate 全部留在 BasicLayout,本组件不碰。
*
* 二级菜单刻意不渲染 m.icon:12 个不同线性图标在 34px 行里会形成锯齿边,
* 且 iconMap 是白名单,后端新增页面漏登记就会静默回落。二级改用导轨上的统一节点,
* 选中信号也由该节点承担(半透明点 → 品牌蓝实心 + 亮环)。后端 sys_menu.icon
* 字段不动,一级分组与工作台单入口仍按 icon 渲染。
*/
interface SideNavProps {
/** 权限过滤后的分组(空组已剔除),由 BasicLayout 生成 */
groups: MenuGroupDef[];
selectedKey: string;
/** 当前页所属分组名;null 表示当前页是平铺单入口或非菜单页 */
activeGroupName: string | null;
isGroupOpen: (name: string) => boolean;
onToggleGroup: (name: string) => void;
collapsed: boolean;
onToggleCollapsed: () => void;
onNavigate: (path: string) => void;
/** 底部信息条:当前登录角色,取自登录态而非写死 */
roleLabel: string;
}
/** 图标注册表:只登记用到的字面量,避免 `import * as antdIcons` 把 894 个图标打进首屏。
* 现在只有一级分组与工作台单入口会查表;二级不查,故后端给二级配的图标名无需登记。 */
const iconMap: Record<string, ReactNode> = {
DashboardOutlined: <DashboardOutlined />,
ShopOutlined: <ShopOutlined />,
UploadOutlined: <UploadOutlined />,
TeamOutlined: <TeamOutlined />,
AuditOutlined: <AuditOutlined />,
GiftOutlined: <GiftOutlined />,
FileSyncOutlined: <FileSyncOutlined />,
FundOutlined: <FundOutlined />,
TransactionOutlined: <TransactionOutlined />,
SolutionOutlined: <SolutionOutlined />,
HomeOutlined: <HomeOutlined />,
SettingOutlined: <SettingOutlined />,
CarOutlined: <CarOutlined />,
FundProjectionScreenOutlined: <FundProjectionScreenOutlined />,
AimOutlined: <AimOutlined />,
ExperimentOutlined: <ExperimentOutlined />,
ControlOutlined: <ControlOutlined />,
ToolOutlined: <ToolOutlined />,
SendOutlined: <SendOutlined />,
ReconciliationOutlined: <ReconciliationOutlined />,
UserSwitchOutlined: <UserSwitchOutlined />,
FileTextOutlined: <FileTextOutlined />,
SafetyCertificateOutlined: <SafetyCertificateOutlined />,
WechatOutlined: <WechatOutlined />,
PayCircleOutlined: <PayCircleOutlined />,
};
const DEFAULT_MENU_ICON: ReactNode = <AppstoreOutlined />;
const GROUP_DEFAULT_ICON: ReactNode = <FolderOutlined />;
const warnedIcons = new Set<string>();
function resolveIcon(
name: string | null | undefined,
fallback: ReactNode = DEFAULT_MENU_ICON,
): ReactNode {
const hit = name ? iconMap[name] : undefined;
if (hit) return hit;
if (name && import.meta.env.DEV && !warnedIcons.has(name)) {
warnedIcons.add(name);
console.warn(
`[menu] 一级图标「${name}」未在 SideNav.tsx 的 iconMap 中登记,已回落兜底图标。` +
`请在 iconMap 补一行,或让后端改发已支持的值。`,
);
}
return fallback;
}
/**
* 折叠控制线稿:与 docs/sider-redesign.html 的 fold / unfold 路径逐条一致。
* 不用 antd MenuFoldOutlined / MenuUnfoldOutlined —— 那两个是「带方框 + 三条横线」的
* 汉堡图标,和侧栏的极简线稿语言不符,是原型与实现最直观的一处不一致。
*/
const FOLD_PATHS: Record<'fold' | 'unfold', string[]> = {
fold: ['M14 5l-7 7 7 7', 'M20 5v14'],
unfold: ['M10 5l7 7-7 7', 'M4 5v14'],
};
function FoldGlyph({ collapsed }: { collapsed: boolean }) {
return (
<svg
width="15"
height="15"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.7"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
{FOLD_PATHS[collapsed ? 'unfold' : 'fold'].map((d) => (
<path key={d} d={d} />
))}
</svg>
);
}
interface PopoverState {
group: MenuGroupDef;
top: number;
}
export default function SideNav({
groups,
selectedKey,
activeGroupName,
isGroupOpen,
onToggleGroup,
collapsed,
onToggleCollapsed,
onNavigate,
roleLabel,
}: SideNavProps) {
const navRef = useRef<HTMLElement>(null);
const [fade, setFade] = useState({ top: false, bottom: false });
const [popover, setPopover] = useState<PopoverState | null>(null);
const solo = groups.filter((g) => g.hideTitle).flatMap((g) => g.children);
const chapters = groups.filter((g) => !g.hideTitle);
/** 长菜单的上下渐隐:只在真的还有内容时出现,静默提示可滚动。 */
const syncFade = useCallback(() => {
const el = navRef.current;
if (!el) return;
const more = el.scrollHeight - el.clientHeight;
const top = el.scrollTop > 4;
const bottom = more > 4 && el.scrollTop < more - 4;
setFade((prev) => (prev.top === top && prev.bottom === bottom ? prev : { top, bottom }));
}, []);
useEffect(() => {
syncFade();
window.addEventListener('resize', syncFade);
return () => window.removeEventListener('resize', syncFade);
}, [syncFade, groups, collapsed, popover]);
/** 折叠态浮层:点外部或 Esc 关闭。浮层 portal 到 body,避开 .ant-layout-sider 的 overflow:hidden。 */
useEffect(() => {
if (!popover) return;
const onDocClick = (e: MouseEvent) => {
const target = e.target as HTMLElement | null;
if (!target?.closest('.uj-nav-popover') && !target?.closest('.uj-chap-head')) {
setPopover(null);
}
};
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') setPopover(null);
};
document.addEventListener('click', onDocClick);
document.addEventListener('keydown', onKey);
return () => {
document.removeEventListener('click', onDocClick);
document.removeEventListener('keydown', onKey);
};
}, [popover]);
// 展开侧栏时浮层失去意义,立即收掉,避免展开后出现一块悬空面板。
useEffect(() => {
if (!collapsed) setPopover(null);
}, [collapsed]);
const handleChapterClick = (group: MenuGroupDef, anchorTop: number) => {
if (collapsed) {
// 浮层跟随锚点,但按真实子项数估高后夹回视口内:
// 二手车管理 12 项在矮窗口里不夹会整块溢出屏幕底部。
const estimated = 44 + group.children.length * 32;
const top = Math.max(12, Math.min(anchorTop, window.innerHeight - estimated - 12));
setPopover((prev) => (prev?.group.group === group.group ? null : { group, top }));
return;
}
onToggleGroup(group.group);
};
return (
<>
<nav className="uj-nav" ref={navRef} onScroll={syncFade} aria-label="主导航">
<div className="uj-zone-label">工作区</div>
{solo.map((m) => {
const active = selectedKey === m.path;
return (
<button
key={m.path}
type="button"
className={`uj-solo${active ? ' is-active' : ''}`}
title={m.label}
aria-current={active ? 'page' : undefined}
onClick={() => onNavigate(m.path)}
>
<span className="uj-solo-ico">{resolveIcon(m.icon)}</span>
<span className="uj-solo-txt">{m.label}</span>
</button>
);
})}
<div className="uj-zone-sep" />
<div className="uj-zone-label">业务域</div>
{chapters.map((g) => {
const open = isGroupOpen(g.group);
const current = activeGroupName === g.group;
return (
<div
key={g.group}
className={`uj-chapter${open ? ' is-open' : ''}${current ? ' is-current' : ''}`}
>
<button
type="button"
className="uj-chap-head"
title={g.group}
aria-expanded={collapsed ? undefined : open}
onClick={(e) => handleChapterClick(g, e.currentTarget.getBoundingClientRect().top)}
>
<span className="uj-chap-ico">
{resolveIcon(
g.icon,
g.children[0] ? resolveIcon(g.children[0].icon) : GROUP_DEFAULT_ICON,
)}
</span>
<span className="uj-chap-label">{g.group}</span>
<span className="uj-chap-count">{g.children.length}</span>
<span className="uj-chap-chev">
<RightOutlined />
</span>
</button>
{!collapsed && open && (
<div className="uj-chap-body">
{g.children.map((m) => {
const active = selectedKey === m.path;
return (
<button
key={m.path}
type="button"
className={`uj-leaf${active ? ' is-active' : ''}`}
title={m.label}
aria-current={active ? 'page' : undefined}
onClick={() => onNavigate(m.path)}
>
<span className="uj-leaf-node" aria-hidden="true" />
<span className="uj-leaf-txt">{m.label}</span>
</button>
);
})}
</div>
)}
</div>
);
})}
</nav>
<div className={`uj-nav-fade is-top${fade.top ? ' is-on' : ''}`} aria-hidden="true" />
<div className={`uj-nav-fade is-bottom${fade.bottom ? ' is-on' : ''}`} aria-hidden="true" />
<div className="uj-sider-foot">
<button
type="button"
className="uj-fold-btn"
onClick={onToggleCollapsed}
aria-label={collapsed ? '展开导航' : '收起导航'}
title={collapsed ? '展开导航' : '收起导航'}
>
<FoldGlyph collapsed={collapsed} />
</button>
{!collapsed && (
<div className="uj-foot-meta">
<span className="n">{roleLabel}</span>
<span className="e">当前登录角色</span>
</div>
)}
</div>
{popover &&
createPortal(
<div className="uj-nav-popover" role="menu" style={{ top: popover.top }}>
<div className="uj-pop-title">{popover.group.group}</div>
{popover.group.children.map((m) => (
<button
key={m.path}
type="button"
role="menuitem"
className={`uj-pop-item${selectedKey === m.path ? ' is-active' : ''}`}
onClick={() => {
onNavigate(m.path);
setPopover(null);
}}
>
{m.label}
</button>
))}
</div>,
document.body,
)}
</>
);
}
apps/web/shell/src/theme/design.css
View file @
561a142
...
@@ -30,18 +30,9 @@
...
@@ -30,18 +30,9 @@
background
:
linear-gradient
(
160deg
,
#0b1437
0%
,
#16245a
100%
);
background
:
linear-gradient
(
160deg
,
#0b1437
0%
,
#16245a
100%
);
}
}
/* Sider 菜单:胶囊态选中 + 隐藏默认右侧指示条。
/* 自绘 SideNav 后这一块已无对应 DOM:原先覆盖 .ant-menu-inline 选中态的三条规则
圆角/高度全部由 themeConfig 的 Menu token 下发(itemBorderRadius: 6 / itemHeight: 40),
连同「圆角/高度由 Menu token 下发」的注释一并删除,不留死规则当假证据。
这里不再写死几何量,避免和 token 打架。 */
侧栏现在的全部样式在下面「侧栏导航(自绘 SideNav)」段。 */
.uj-sider
.ant-menu-inline
.ant-menu-item
{
margin-top
:
2px
;
}
.uj-sider
.ant-menu-inline
.ant-menu-item-selected
::after
{
display
:
none
;
}
.uj-sider
.ant-menu-inline
.ant-menu-item-selected
{
font-weight
:
600
;
}
/* ============ 登录页 ============ */
/* ============ 登录页 ============ */
.uj-login-wrap
{
.uj-login-wrap
{
...
@@ -411,35 +402,33 @@
...
@@ -411,35 +402,33 @@
position
:
relative
;
position
:
relative
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
/* 垂直 matte 深蓝,色值全部取品牌深色系(#0B1437 同族):
/* 三层背景:品牌区一道极淡的径向光弧(不是横贯整条的亮带)+ 自上而下收敛的近实色。
顶部与登录页左栏 (#0B1437) 同一色,中段 #14204E 同时是折叠弹出层 (darkPopupBg) 的底色,
菜单区保持近实色保证可读性,层次交给光弧、左缘标尺、章节刻度与激活域淡染。 */
保证「主题深色 = 菜单深色 = 弹层深色」三者同源,不再各写一套蓝。 */
background
:
background
:
linear-gradient
(
180deg
,
#0b1437
0%
,
#14204e
55%
,
#0a1230
100%
);
radial-gradient
(
132%
46%
at
-10%
-6%
,
rgba
(
43
,
92
,
230
,
0.28
),
rgba
(
43
,
92
,
230
,
0
)
66%
),
linear-gradient
(
180deg
,
#0b1437
0%
,
#0d1739
52%
,
#09112e
100%
);
box-shadow
:
4px
0
20px
-14px
rgba
(
6
,
12
,
38
,
0.5
);
box-shadow
:
4px
0
20px
-14px
rgba
(
6
,
12
,
38
,
0.5
);
/* 侧
边菜单不再有 CSS 旋钮:高度 / 左右留白 / 圆角 / 图标尺寸 / 折叠宽度
/* 侧
栏已改为自绘 SideNav(layouts/SideNav.tsx):所有几何量由下面的 .uj-* 规则定义,
全部写在 themeConfig.ts 的 components.Menu token 里,由组件自身参与计算
。 */
不再依赖 ConfigProvider 的 Menu token,也不覆盖任何 .ant-* 组件内部盒模型
。 */
}
}
/* 左侧菜单栏「地脚线 / 地面」:与登录页时钟底部同一套墙地语言,但整体收细 ——
/* 左缘 1px 索引标尺:与章节刻度同一套语言,给纯色侧栏一条可读的纵向基准。
12px 高(原 20px),交界亮线 1px(原 2px),AO 带压缩到 1–8px,光晕减弱。
z-index: 0 保证它压在背景上、但不盖住任何刻度与文字。 */
保留呼应、去掉抢眼的粗线条。 */
.uj-sider
::before
{
.uj-sider
::after
{
content
:
''
;
content
:
''
;
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
right
:
0
;
top
:
56px
;
bottom
:
0
;
bottom
:
46px
;
height
:
12
px
;
width
:
1
px
;
z-index
:
1
;
z-index
:
0
;
pointer-events
:
none
;
pointer-events
:
none
;
background
:
background
:
linear-gradient
(
/* 1. 墙地交界受光亮线:1px,弱化到不抢 */
180deg
,
linear-gradient
(
180deg
,
rgba
(
198
,
220
,
255
,
0.34
)
0
1px
,
transparent
1px
),
rgba
(
91
,
141
,
239
,
0.3
),
/* 2. 墙根投影(AO):1–8px 渐虚,比原版收窄一半 */
rgba
(
198
,
220
,
255
,
0.07
)
26%
,
linear-gradient
(
180deg
,
transparent
1px
,
rgba
(
2
,
6
,
18
,
0.5
)
4px
,
rgba
(
2
,
6
,
18
,
0
)
8px
),
rgba
(
198
,
220
,
255
,
0.07
)
74%
,
/* 3. 地面主调:近墙受光略亮、向前(下)渐沉 */
rgba
(
91
,
141
,
239
,
0.12
)
linear-gradient
(
180deg
,
rgba
(
26
,
40
,
82
,
0.92
)
0%
,
rgba
(
6
,
10
,
28
,
0.97
)
100%
),
);
/* 4. 地面反光光晕:减弱,只留一点呼吸 */
radial-gradient
(
82%
240%
at
50%
0%
,
rgba
(
120
,
160
,
255
,
0.12
),
rgba
(
120
,
160
,
255
,
0
)
60%
);
}
}
.uj-sider
>
.ant-layout-sider-children
{
.uj-sider
>
.ant-layout-sider-children
{
display
:
flex
;
display
:
flex
;
...
@@ -472,61 +461,566 @@
...
@@ -472,61 +461,566 @@
color
:
#fff
;
color
:
#fff
;
font-size
:
15px
;
font-size
:
15px
;
font-weight
:
700
;
font-weight
:
700
;
letter-spacing
:
1px
;
/* 中文标题不放大字距;0.5px 只给字标一点呼吸,不再是旧版 1px */
letter-spacing
:
0.5px
;
}
}
.uj-sider-brand-text
.s
{
.uj-sider-brand-text
.s
{
color
:
rgba
(
255
,
255
,
255
,
0.38
);
color
:
rgba
(
255
,
255
,
255
,
0.38
);
font-size
:
10px
;
font-size
:
10px
;
letter-spacing
:
0.6px
;
letter-spacing
:
0.6px
;
/* uppercase 只作用于这行英文副标,中文菜单一律不用 */
text-transform
:
uppercase
;
text-transform
:
uppercase
;
}
}
/* 菜单滚动区:只负责接管滚动与隐藏滚动条。
/* ============ 侧栏导航(自绘 SideNav) ============
横向留白不再由这里承担 —— 由 Menu 的 itemMarginInline token 承担(见 themeConfig.ts)。
章节头是固定四列网格:20px 图标 / 1fr 标题槽 / auto 域计数 / 12px 展开指示。
加 scrollbar-gutter: stable both-edges:即使滚动条真的占了宽度,
所有一级行的标题槽起点与宽度完全一致、右端也对齐到同一条线,
浏览器也会在**两侧同时**预留相同空间,左右不会因此失对称。 */
3/4/5 字标题的长度差被槽内留白吸收,不再表现为右边缘参差。
.uj-sider-menu
{
中文字距一律 0 —— 旧版 .ant-menu-submenu-title 的 letter-spacing: 2px
会把字数差按字数线性放大,那才是「不协调」的直接来源。 */
.uj-nav
{
flex
:
1
;
flex
:
1
;
min-height
:
0
;
min-height
:
0
;
overflow-y
:
auto
;
overflow-y
:
auto
;
/* 底部预留地脚线(地面)高度,避免菜单最后一项被 .uj-sider::after 的地面带遮挡 */
overflow-x
:
hidden
;
padding-block
:
10px
16px
;
padding
:
10px
0
18px
;
padding-inline
:
0
;
scrollbar-gutter
:
stable
both-edges
;
scrollbar-width
:
none
;
scrollbar-width
:
none
;
}
}
.uj-
sider-menu
::-webkit-scrollbar
{
.uj-
nav
::-webkit-scrollbar
{
width
:
0
;
width
:
0
;
height
:
0
;
height
:
0
;
}
}
/* 菜单:本文件**只做主题着色**。
/* 长菜单的上下滚动边界提示:只在真的还有内容时出现 */
所有几何量(高度、左右留白、内间距、圆角、图标尺寸、折叠宽度)都不在此覆盖,
.uj-nav-fade
{
改由 ConfigProvider 的 Menu token 下发(见 src/theme/themeConfig.ts 的 components.Menu)——
position
:
absolute
;
那是 antd 官方认可的定制入口,组件内部的宽度/居中计算会跟着 token 一起重算,不会互相打架。
left
:
0
;
折叠态的图标居中尤其依赖这一点:antd 原生用 marginInline + paddingInline:calc(50% - 图标宽/2 - margin),
right
:
0
;
任何对 width / padding-inline 的 CSS 覆盖都会把它算歪。 */
height
:
26px
;
.uj-menu.ant-menu-dark
{
z-index
:
2
;
pointer-events
:
none
;
opacity
:
0
;
transition
:
opacity
180ms
ease
;
}
.uj-nav-fade.is-on
{
opacity
:
1
;
}
.uj-nav-fade.is-top
{
top
:
56px
;
background
:
linear-gradient
(
180deg
,
rgba
(
11
,
20
,
55
,
0.96
),
rgba
(
11
,
20
,
55
,
0
));
}
.uj-nav-fade.is-bottom
{
bottom
:
46px
;
background
:
linear-gradient
(
0deg
,
rgba
(
10
,
18
,
48
,
0.96
),
rgba
(
10
,
18
,
48
,
0
));
}
/* 区段标 / 分区线 */
.uj-zone-label
{
height
:
28px
;
display
:
flex
;
align-items
:
center
;
padding
:
0
14px
;
font-size
:
11px
;
font-weight
:
500
;
letter-spacing
:
0.5px
;
color
:
rgba
(
255
,
255
,
255
,
0.42
);
white-space
:
nowrap
;
}
.uj-zone-sep
{
height
:
1px
;
margin
:
10px
14px
12px
;
background
:
rgba
(
198
,
220
,
255
,
0.09
);
}
/* 工作台单入口(hideTitle 组,平铺到顶层) */
.uj-solo
{
position
:
relative
;
height
:
38px
;
width
:
calc
(
100%
-
16px
);
margin
:
0
8px
4px
;
padding
:
0
10px
;
border
:
0
;
border-radius
:
6px
;
background
:
transparent
;
background
:
transparent
;
display
:
grid
;
grid-template-columns
:
20px
minmax
(
0
,
1
fr
);
align-items
:
center
;
gap
:
10px
;
color
:
rgba
(
255
,
255
,
255
,
0.66
);
text-align
:
left
;
cursor
:
pointer
;
}
/* hover = 选中态的低强度预览:同一条品牌蓝光楔、同样的四个停靠点,每档约 4 成强度。
不加短刻度与亮环 —— 那两个只属于「当前页」,hover 只预告可点,不伪造位置。
:not(.is-active) 显式排除当前项,避免依赖规则先后顺序。 */
.uj-solo
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.uj-solo-ico
{
width
:
20px
;
height
:
20px
;
display
:
grid
;
place-items
:
center
;
font-size
:
17px
;
}
}
/* 一级菜单(SubMenu)标题:沿用原先分组标题的字重/字距/大小写;
.uj-solo-txt
{
字号与颜色仍由 themeConfig 的 token 下发。间距一律不写——antd 自身会让标题与菜单项对齐,
font-size
:
13px
;
手动设 padding 反而容易错位(折叠态图标居中尤其敏感)。 */
font-weight
:
500
;
.uj-menu.ant-menu-dark
.ant-menu-submenu-title
{
white-space
:
nowrap
;
overflow
:
hidden
;
}
/* 选中页:从左端短刻度向右淡出的「光楔」,取代贯穿整行的等宽蓝色长条。
左端 3px×16px 短刻度 + 节点亮环 + 文字提亮,三重信号都不占满整行。 */
.uj-solo.is-active
{
color
:
#fff
;
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
}
.uj-solo.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
16px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--uj-brand-light
,
#5b8def
);
box-shadow
:
0
0
10px
-2px
rgba
(
91
,
141
,
239
,
0.7
);
}
.uj-solo.is-active
.uj-solo-ico
{
color
:
var
(
--uj-brand-light
,
#5b8def
);
}
/* 业务域章节头 */
/* 组内紧密、组间分明:间距预算主要花在章节之间,
而不是给 12 个二级项逐个加 gap(那样长菜单会失控)。 */
.uj-chapter
{
position
:
relative
;
margin-bottom
:
10px
;
}
.uj-chapter
+
.uj-chapter
{
margin-top
:
6px
;
}
.uj-chap-head
{
position
:
relative
;
height
:
36px
;
width
:
calc
(
100%
-
16px
);
margin
:
0
8px
;
padding
:
0
10px
0
6px
;
border
:
0
;
border-radius
:
6px
;
background
:
transparent
;
display
:
grid
;
grid-template-columns
:
20px
minmax
(
0
,
1
fr
)
auto
12px
;
align-items
:
center
;
gap
:
8px
;
color
:
rgba
(
255
,
255
,
255
,
0.72
);
text-align
:
left
;
cursor
:
pointer
;
}
.uj-chap-head
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
/* 左缘章节刻度:把纯色侧栏读成一册带书脊刻度的目录。
未激活章只留 2×10px 极淡刻痕,激活章才拉长成整段蓝刻度。 */
.uj-chap-head
::before
{
content
:
''
;
position
:
absolute
;
left
:
-8px
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
2px
;
height
:
10px
;
border-radius
:
0
2px
2px
0
;
background
:
rgba
(
198
,
220
,
255
,
0.1
);
transition
:
background
180ms
ease
;
}
/* hover 的刻痕转品牌蓝但仍是 10px 短刻:与激活章的拉长蓝刻度同族、不同长度 */
.uj-chap-head
:hover::before
{
background
:
rgba
(
91
,
141
,
239
,
0.5
);
}
.uj-chap-ico
{
width
:
20px
;
height
:
20px
;
display
:
grid
;
place-items
:
center
;
font-size
:
17px
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
}
.uj-chap-head
:hover
.uj-chap-ico
{
color
:
rgba
(
255
,
255
,
255
,
0.82
);
}
/* 固定标题槽:起点与宽度由四列网格保证,字数差被槽内留白吸收 */
.uj-chap-label
{
font-size
:
13px
;
font-weight
:
600
;
font-weight
:
600
;
letter-spacing
:
2px
;
letter-spacing
:
0
;
text-transform
:
uppercase
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
/* 右端真实子项数(等宽数字),同时预告该域展开后的长度 */
/* 域计数退到背景层:位置与等宽仍是锚点,但不再用亮色抢标题 */
.uj-chap-count
{
font-size
:
11px
;
font-weight
:
400
;
font-variant-numeric
:
tabular-nums
;
color
:
rgba
(
198
,
220
,
255
,
0.12
);
min-width
:
16px
;
text-align
:
right
;
transition
:
color
160ms
ease
;
}
/* 只在交互时短暂提亮,静态视图里计数始终退在标题之后 */
.uj-chap-head
:hover
.uj-chap-count
{
color
:
rgba
(
198
,
220
,
255
,
0.58
);
}
.uj-chap-chev
{
width
:
12px
;
height
:
12px
;
display
:
grid
;
place-items
:
center
;
font-size
:
11px
;
color
:
rgba
(
255
,
255
,
255
,
0.34
);
transition
:
transform
200ms
cubic-bezier
(
0.22
,
0.61
,
0.36
,
1
);
}
.uj-chapter.is-open
.uj-chap-chev
{
transform
:
rotate
(
90deg
);
}
}
/* 选中态左侧指示条:用 inset 阴影画,不占盒模型空间,
.uj-chapter.is-current
.uj-chap-head
{
因此不会改变组件的宽高,也不会干扰折叠态的居中计算。
color
:
#fff
;
颜色取 --uj-brand-light(品牌亮色档),与登录页点缀、选中底 (primary 的 alpha) 同族。 */
}
.uj-menu.ant-menu-dark
.ant-menu-item-selected
{
.uj-chapter.is-current
.uj-chap-ico
{
box-shadow
:
inset
3px
0
0
0
var
(
--uj-brand-light
,
#5b8def
);
color
:
var
(
--uj-brand-light
,
#5b8def
);
}
.uj-chapter.is-current
.uj-chap-count
{
color
:
rgba
(
198
,
220
,
255
,
0.62
);
}
/* 激活域:把通用短刻痕拉长成整段蓝刻度(全侧栏唯一的重音) */
.uj-chapter.is-current
.uj-chap-head
::before
{
top
:
6px
;
bottom
:
6px
;
height
:
auto
;
transform
:
none
;
background
:
var
(
--uj-brand-light
,
#5b8def
);
}
/* 章节体 + 竖向导轨:把「这一章里的这些页」串成一组 */
.uj-chap-body
{
position
:
relative
;
padding
:
6px
0
8px
;
}
/* 激活域一层极淡的染色:域 > 页 两级光,不再靠整行实底铺满 */
.uj-chapter.is-current
.uj-chap-body
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.06
),
rgba
(
43
,
92
,
230
,
0
)
64%
);
}
/* 导轨与短横压到 0.09:12 条短横连成一排时 0.16 会形成发亮的虚线带 */
.uj-chap-body
::before
{
content
:
''
;
position
:
absolute
;
left
:
23px
;
top
:
-4px
;
bottom
:
16px
;
width
:
1px
;
background
:
rgba
(
198
,
220
,
255
,
0.04
);
}
.uj-chapter.is-current
.uj-chap-body
::before
{
background
:
rgba
(
91
,
141
,
239
,
0.08
);
}
/* 二级项:不渲染语义图标,统一用导轨上的节点。
12 个各不相同的线性图标在 34px 行里会形成锯齿边,且 iconMap 白名单
会让后端新增页面漏登记时静默回落。选中信号也由该节点承担。 */
.uj-leaf
{
position
:
relative
;
height
:
36px
;
width
:
calc
(
100%
-
16px
);
margin
:
0
8px
;
padding
:
0
10px
0
26px
;
border
:
0
;
border-radius
:
6px
;
background
:
transparent
;
display
:
grid
;
grid-template-columns
:
12px
minmax
(
0
,
1
fr
);
align-items
:
center
;
gap
:
8px
;
color
:
rgba
(
255
,
255
,
255
,
0.58
);
text-align
:
left
;
cursor
:
pointer
;
}
/* 从导轨接到节点的短横,让层级是真连起来的而不是两条平行线 */
.uj-leaf
::before
{
content
:
''
;
position
:
absolute
;
left
:
15px
;
top
:
50%
;
width
:
12px
;
height
:
1px
;
background
:
rgba
(
198
,
220
,
255
,
0.04
);
}
.uj-chapter.is-current
.uj-leaf
::before
{
background
:
rgba
(
91
,
141
,
239
,
0.08
);
}
/* hover 与选中共用一条光楔,只是强度约 4 成;当前项不参与 hover 反馈 */
.uj-leaf
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
rgba
(
255
,
255
,
255
,
0.92
);
}
/* 只点亮 hover 这一根的短横,不会让 12 根连成亮带 */
.uj-leaf
:not
(
.is-active
)
:hover::before
{
background
:
rgba
(
91
,
141
,
239
,
0.24
);
}
.uj-leaf-node
{
width
:
12px
;
height
:
12px
;
display
:
grid
;
place-items
:
center
;
}
.uj-leaf-node
::after
{
content
:
''
;
width
:
5px
;
height
:
5px
;
border-radius
:
50%
;
background
:
rgba
(
255
,
255
,
255
,
0.28
);
transition
:
background
160ms
ease
,
box-shadow
160ms
ease
;
}
/* 节点圆点也走品牌蓝递进:hover 淡蓝 → 选中亮蓝 + 亮环 */
.uj-leaf
:not
(
.is-active
)
:hover
.uj-leaf-node
::after
{
background
:
rgba
(
91
,
141
,
239
,
0.62
);
}
.uj-leaf-txt
{
font-size
:
13px
;
font-weight
:
400
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
/* 选中页:从左端短刻度向右淡出的「光楔」,取代贯穿整行的等宽蓝色长条。
左端 3px×16px 短刻度 + 节点亮环 + 文字提亮,三重信号都不占满整行。 */
.uj-leaf.is-active
{
color
:
#fff
;
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
}
.uj-leaf.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
16px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--uj-brand-light
,
#5b8def
);
box-shadow
:
0
0
10px
-2px
rgba
(
91
,
141
,
239
,
0.7
);
}
.uj-leaf.is-active
.uj-leaf-txt
{
font-weight
:
500
;
}
/* 选中项那根短横仍是章内最亮的,但压一档避免刺眼 */
.uj-leaf.is-active
::before
{
background
:
rgba
(
91
,
141
,
239
,
0.78
);
}
.uj-leaf.is-active
.uj-leaf-node
::after
{
background
:
var
(
--uj-brand-light
,
#5b8def
);
box-shadow
:
0
0
0
3px
rgba
(
91
,
141
,
239
,
0.22
);
}
/* 底部系统区:折叠控制收回导航容器内,信息条只显示真实登录角色 */
.uj-sider-foot
{
flex
:
none
;
height
:
46px
;
border-top
:
1px
solid
rgba
(
198
,
220
,
255
,
0.09
);
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
padding
:
0
12px
;
}
.uj-fold-btn
{
width
:
28px
;
height
:
28px
;
flex
:
none
;
border
:
0
;
border-radius
:
5px
;
background
:
transparent
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
display
:
grid
;
place-items
:
center
;
/* 尺寸由内联 SVG 的 15px 决定,不再靠 font-size 撑 antd 图标 */
cursor
:
pointer
;
}
.uj-fold-btn
:hover
{
background
:
rgba
(
255
,
255
,
255
,
0.07
);
color
:
#fff
;
}
.uj-foot-meta
{
display
:
flex
;
flex-direction
:
column
;
line-height
:
1.3
;
min-width
:
0
;
overflow
:
hidden
;
}
.uj-foot-meta
.n
{
font-size
:
11px
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.uj-foot-meta
.e
{
font-size
:
10px
;
color
:
rgba
(
255
,
255
,
255
,
0.28
);
white-space
:
nowrap
;
}
/* 键盘焦点:所有导航按钮共用一条可见焦点环 */
.uj-sider
button
:focus-visible
,
.uj-nav-popover
button
:focus-visible
{
outline
:
2px
solid
var
(
--uj-brand-light
,
#5b8def
);
outline-offset
:
2px
;
}
/* 折叠态(68px 图标栏):只留图标,两条区段标收成一条线 */
.uj-sider.is-collapsed
.uj-nav-fade
,
.uj-sider.is-collapsed
.uj-zone-label
,
.uj-sider.is-collapsed
.uj-chap-label
,
.uj-sider.is-collapsed
.uj-chap-count
,
.uj-sider.is-collapsed
.uj-chap-chev
,
.uj-sider.is-collapsed
.uj-solo-txt
,
.uj-sider.is-collapsed
.uj-foot-meta
{
display
:
none
;
}
.uj-sider.is-collapsed
.uj-zone-sep
{
margin
:
10px
18px
12px
;
}
.uj-sider.is-collapsed
.uj-chap-head
,
.uj-sider.is-collapsed
.uj-solo
{
grid-template-columns
:
20px
;
justify-content
:
center
;
padding
:
0
;
gap
:
0
;
}
.uj-sider.is-collapsed
.uj-sider-foot
{
justify-content
:
center
;
padding
:
0
;
}
/* 折叠态唯一的位置信号,加粗一档才看得见 */
.uj-sider.is-collapsed
.uj-chapter.is-current
.uj-chap-head
::before
{
width
:
3px
;
}
/* 折叠态子项浮层:portal 到 body,避开 .ant-layout-sider 的 overflow: hidden */
.uj-nav-popover
{
position
:
fixed
;
left
:
76px
;
z-index
:
1100
;
min-width
:
184px
;
max-height
:
calc
(
100vh
-
24px
);
overflow-y
:
auto
;
padding
:
6px
;
background
:
#101b42
;
border
:
1px
solid
rgba
(
198
,
220
,
255
,
0.14
);
border-radius
:
8px
;
box-shadow
:
0
12px
32px
-10px
rgba
(
2
,
6
,
20
,
0.7
);
}
.uj-pop-title
{
font-size
:
11px
;
color
:
rgba
(
255
,
255
,
255
,
0.42
);
padding
:
6px
10px
8px
;
letter-spacing
:
0.5px
;
}
.uj-pop-item
{
position
:
relative
;
display
:
block
;
width
:
100%
;
height
:
32px
;
padding
:
0
10px
;
border
:
0
;
border-radius
:
5px
;
background
:
transparent
;
color
:
rgba
(
255
,
255
,
255
,
0.66
);
font-size
:
13px
;
text-align
:
left
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
cursor
:
pointer
;
}
/* 折叠态浮层与展开态共用同一套 hover / 选中语言,不能留一版旧的整行实底 */
.uj-pop-item
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.uj-pop-item.is-active
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.uj-pop-item.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
14px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--uj-brand-light
,
#5b8def
);
box-shadow
:
0
0
8px
-2px
rgba
(
91
,
141
,
239
,
0.6
);
}
@media
(
prefers-reduced-motion
:
reduce
)
{
.uj-chap-chev
,
.uj-chap-head
::before
,
.uj-chap-count
,
.uj-nav-fade
,
.uj-leaf-node
::after
{
transition
:
none
;
}
}
}
/* 折叠态(Sider 收起成图标栏)不再隐藏标题:
antd 自身会把 SubMenu 标题文字收起、只留图标,hover 弹出子菜单浮层。
若照旧对标题容器 display:none,会把折叠态下唯一的图标入口一起干掉,菜单就点不动了。
折叠态的展开/收起由 antd 浮层接管,openKeys 只作用于展开态。 */
/* ============ 应用骨架:Header ============ */
/* ============ 应用骨架:Header ============ */
/* 实底白 + 1px 实线:去掉毛玻璃(半透明 + blur 是「柔」的主要来源之一),
/* 实底白 + 1px 实线:去掉毛玻璃(半透明 + blur 是「柔」的主要来源之一),
...
@@ -546,15 +1040,7 @@
...
@@ -546,15 +1040,7 @@
gap
:
8px
;
gap
:
8px
;
white-space
:
nowrap
;
white-space
:
nowrap
;
}
}
.uj-header-fold
{
/* 折叠按钮已移入侧栏底部(.uj-fold-btn),Header 里不再有 .uj-header-fold。 */
font-size
:
18px
;
color
:
#4a5568
;
margin-inline-end
:
4px
;
}
.uj-header-fold
:hover
{
color
:
#2b5ce6
!important
;
background
:
#f2f4f9
!important
;
}
/* 面包屑:antd Breadcrumb 承载结构,这里只定字号(末级=页题,其余=分组) */
/* 面包屑:antd Breadcrumb 承载结构,这里只定字号(末级=页题,其余=分组) */
.uj-header-crumb
{
.uj-header-crumb
{
white-space
:
nowrap
;
white-space
:
nowrap
;
...
...
docs/sider-redesign.html
0 → 100644
View file @
561a142
<!doctype html>
<html
lang=
"zh-CN"
>
<head>
<meta
charset=
"UTF-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<title>
侧栏重设计 · 优加门店上架
</title>
<style>
/* ============================================================
原型作用域。产品真实令牌见 packages/design-tokens/src/tokens.css
本文件自包含,不加载任何外部字体 / 图标 / 脚本。
============================================================ */
:root
{
--nav-ink
:
#0b1437
;
--nav-ink-2
:
#0d1739
;
--nav-rail
:
#2b5ce6
;
--nav-rail-lit
:
#5b8def
;
--nav-label
:
#e8edf8
;
--nav-label-dim
:
rgba
(
255
,
255
,
255
,
0.42
);
/* 域计数退到背景层:位置与等宽仍是锚点,但不再用亮色抢标题。
0.12 / 0.08 为超人在实现里继续调暗后的定稿,本稿回灌同步。 */
--nav-count
:
rgba
(
198
,
220
,
255
,
0.12
);
--nav-line
:
rgba
(
198
,
220
,
255
,
0.09
);
/* 12 条短横连成一排时 0.16 会形成发亮的虚线带,压到 0.09 只留层级 */
--nav-line-strong
:
rgba
(
198
,
220
,
255
,
0.09
);
--nav-rail-soft
:
rgba
(
91
,
141
,
239
,
0.08
);
--brand
:
#2b5ce6
;
--brand-hover
:
#4b75ea
;
--page
:
#f4f6fa
;
--surface
:
#ffffff
;
--surface-2
:
#f8fafc
;
--border
:
#e6ebf2
;
--divider
:
#eef1f6
;
--text-1
:
#1d2533
;
--text-2
:
#4a5568
;
--text-3
:
#8a94a6
;
--shadow-card
:
0
1px
2px
rgba
(
16
,
24
,
40
,
0.05
),
0
2px
6px
-2px
rgba
(
16
,
24
,
40
,
0.08
);
--ease
:
cubic-bezier
(
0.22
,
0.61
,
0.36
,
1
);
}
*
{
box-sizing
:
border-box
;
}
html
,
body
{
height
:
100%
;
margin
:
0
;
}
body
{
font-family
:
'PingFang'
,
-apple-system
,
BlinkMacSystemFont
,
'Segoe UI'
,
Roboto
,
'PingFang SC'
,
'Microsoft YaHei'
,
sans-serif
;
font-size
:
14px
;
color
:
var
(
--text-1
);
background
:
var
(
--page
);
-webkit-font-smoothing
:
antialiased
;
}
button
{
font
:
inherit
;
color
:
inherit
;
cursor
:
pointer
;
}
button
:focus-visible
,
[
tabindex
]
:focus-visible
{
outline
:
2px
solid
var
(
--nav-rail-lit
);
outline-offset
:
2px
;
border-radius
:
4px
;
}
/* ============ 骨架 ============ */
.app
{
display
:
flex
;
height
:
100vh
;
overflow
:
hidden
;
}
/* ============ 侧栏 ============ */
.sider
{
position
:
relative
;
flex
:
none
;
width
:
216px
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
/* 三层背景:品牌区一道极淡的径向光弧(不是横贯整条的亮带)+ 自上而下收敛的近实色。
菜单区保持近实色保证可读性,层次交给光弧、左缘标尺与激活域淡染。 */
background
:
radial-gradient
(
132%
46%
at
-10%
-6%
,
rgba
(
43
,
92
,
230
,
0.28
),
rgba
(
43
,
92
,
230
,
0
)
66%
),
linear-gradient
(
180deg
,
var
(
--nav-ink
)
0%
,
var
(
--nav-ink-2
)
52%
,
#09112e
100%
);
box-shadow
:
4px
0
20px
-14px
rgba
(
6
,
12
,
38
,
0.5
);
transition
:
width
0.24s
var
(
--ease
);
overflow
:
hidden
;
}
/* 左缘 1px 索引标尺:与激活域刻度同一套语言,给纯色长条一个可读的纵向基准。
z-index:0 保证它压在背景上、但不会盖住任何刻度与文字。 */
.sider
::before
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
56px
;
bottom
:
46px
;
width
:
1px
;
z-index
:
0
;
pointer-events
:
none
;
background
:
linear-gradient
(
180deg
,
rgba
(
91
,
141
,
239
,
0.3
),
rgba
(
198
,
220
,
255
,
0.07
)
26%
,
rgba
(
198
,
220
,
255
,
0.07
)
74%
,
rgba
(
91
,
141
,
239
,
0.12
)
);
}
.is-collapsed
.sider
{
width
:
68px
;
}
/* 品牌区 */
.brand
{
height
:
56px
;
flex
:
none
;
display
:
flex
;
align-items
:
center
;
gap
:
10px
;
padding
:
0
14px
;
border-bottom
:
1px
solid
var
(
--nav-line
);
}
.is-collapsed
.brand
{
justify-content
:
center
;
padding
:
0
;
}
.brand-mark
{
width
:
34px
;
height
:
34px
;
flex
:
none
;
border-radius
:
9.5px
;
background
:
linear-gradient
(
135deg
,
#2b5ce6
0%
,
#5b8def
100%
);
display
:
grid
;
place-items
:
center
;
color
:
#fff
;
font-weight
:
800
;
font-size
:
13.6px
;
letter-spacing
:
1px
;
box-shadow
:
0
6px
16px
-6px
rgba
(
43
,
92
,
230
,
0.6
);
user-select
:
none
;
}
.brand-text
{
display
:
flex
;
flex-direction
:
column
;
line-height
:
1.25
;
white-space
:
nowrap
;
overflow
:
hidden
;
}
.brand-text
.t
{
color
:
#fff
;
font-size
:
15px
;
font-weight
:
700
;
letter-spacing
:
0.5px
;
}
.brand-text
.s
{
color
:
rgba
(
255
,
255
,
255
,
0.38
);
font-size
:
9.5px
;
letter-spacing
:
0.7px
;
text-transform
:
uppercase
;
margin-top
:
2px
;
}
.is-collapsed
.brand-text
{
display
:
none
;
}
/* 菜单滚动区 */
.nav
{
flex
:
1
;
min-height
:
0
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
padding
:
10px
0
18px
;
scrollbar-width
:
none
;
}
.nav
::-webkit-scrollbar
{
width
:
0
;
height
:
0
;
}
/* 长菜单的滚动边界提示:只在真的还有内容时出现,静默地告诉用户上下都能走 */
.nav-fade
{
position
:
absolute
;
left
:
0
;
right
:
0
;
height
:
26px
;
pointer-events
:
none
;
z-index
:
2
;
opacity
:
0
;
transition
:
opacity
0.18s
var
(
--ease
);
}
.nav-fade.top
{
top
:
56px
;
background
:
linear-gradient
(
180deg
,
rgba
(
11
,
20
,
55
,
0.96
),
rgba
(
11
,
20
,
55
,
0
));
}
.nav-fade.bottom
{
bottom
:
46px
;
background
:
linear-gradient
(
0deg
,
rgba
(
10
,
18
,
48
,
0.96
),
rgba
(
10
,
18
,
48
,
0
));
}
.nav-fade.is-on
{
opacity
:
1
;
}
.is-collapsed
.nav-fade
{
display
:
none
;
}
/* 区段标:不是编号,只是分区名 */
.zone-label
{
height
:
28px
;
display
:
flex
;
align-items
:
center
;
padding
:
0
14px
;
font-size
:
11px
;
font-weight
:
500
;
letter-spacing
:
0.5px
;
color
:
var
(
--nav-label-dim
);
white-space
:
nowrap
;
}
/* 折叠态:两个区段标退化成一条线就够,两条短线反而把图标栏切碎 */
.is-collapsed
.zone-label
{
display
:
none
;
}
.zone-sep
{
height
:
1px
;
margin
:
10px
14px
12px
;
background
:
var
(
--nav-line
);
}
.is-collapsed
.zone-sep
{
margin
:
10px
18px
12px
;
}
/* 工作台:单入口,独立段 */
.solo
{
position
:
relative
;
height
:
38px
;
margin
:
0
8px
4px
;
padding
:
0
10px
;
display
:
grid
;
grid-template-columns
:
20px
1
fr
;
align-items
:
center
;
gap
:
10px
;
border-radius
:
6px
;
color
:
rgba
(
255
,
255
,
255
,
0.66
);
cursor
:
pointer
;
border
:
0
;
background
:
transparent
;
width
:
calc
(
100%
-
16px
);
text-align
:
left
;
}
/* hover = 选中态的低强度预览:同一条品牌蓝光楔、同样的四个停靠点,每档约 4 成强度。
不加短刻度与亮环 —— 那两个只属于「当前页」,hover 只预告可点,不伪造位置。 */
.solo
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.solo
.ico
{
width
:
20px
;
height
:
20px
;
display
:
grid
;
place-items
:
center
;
color
:
inherit
;
}
.solo
.txt
{
font-size
:
13px
;
font-weight
:
500
;
white-space
:
nowrap
;
overflow
:
hidden
;
}
.solo.is-active
{
color
:
#fff
;
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
}
.solo.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
16px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--nav-rail-lit
);
box-shadow
:
0
0
10px
-2px
rgba
(
91
,
141
,
239
,
0.7
);
}
.solo.is-active
.ico
{
color
:
var
(
--nav-rail-lit
);
}
.is-collapsed
.solo
{
grid-template-columns
:
20px
;
justify-content
:
center
;
padding
:
0
;
margin
:
0
8px
4px
;
gap
:
0
;
}
.is-collapsed
.solo
.txt
{
display
:
none
;
}
/* ============ 章节(一级菜单) ============ */
/* 组内紧密、组间分明:间距预算主要花在章节之间,
而不是给 12 个二级项逐个加 gap(那样长菜单会失控)。 */
.chapter
{
position
:
relative
;
margin-bottom
:
10px
;
}
.chapter
+
.chapter
{
margin-top
:
6px
;
}
/* 章节头:固定四列网格 —— 字数协调的结构基础
[20px 图标][1fr 标题槽][auto 域计数][12px 展开指示]
标题槽宽度在所有一级行中完全相同,右端也对齐到同一条线。 */
.chap-head
{
position
:
relative
;
height
:
36px
;
width
:
calc
(
100%
-
16px
);
margin
:
0
8px
;
padding
:
0
10px
0
6px
;
border
:
0
;
background
:
transparent
;
display
:
grid
;
grid-template-columns
:
20px
1
fr
auto
12px
;
align-items
:
center
;
gap
:
8px
;
color
:
rgba
(
255
,
255
,
255
,
0.72
);
text-align
:
left
;
border-radius
:
6px
;
}
.chap-head
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.chap-head
.ico
{
width
:
20px
;
height
:
20px
;
display
:
grid
;
place-items
:
center
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
}
.chap-head
:hover
.ico
{
color
:
rgba
(
255
,
255
,
255
,
0.82
);
}
.chap-head
.label
{
min-width
:
0
;
font-size
:
13px
;
font-weight
:
600
;
letter-spacing
:
0
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.chap-head
.count
{
font-size
:
11px
;
font-weight
:
400
;
font-variant-numeric
:
tabular-nums
;
color
:
var
(
--nav-count
);
min-width
:
16px
;
text-align
:
right
;
transition
:
color
0.16s
ease
;
}
/* 只在交互时短暂提亮,静态视图里计数始终退在标题之后 */
.chap-head
:hover
.count
{
color
:
rgba
(
198
,
220
,
255
,
0.58
);
}
.chap-head
.chev
{
width
:
12px
;
height
:
12px
;
display
:
grid
;
place-items
:
center
;
transition
:
transform
0.2s
var
(
--ease
);
color
:
rgba
(
255
,
255
,
255
,
0.34
);
}
.chapter.is-open
.chap-head
.chev
{
transform
:
rotate
(
90deg
);
}
.chapter.is-current
.chap-head
{
color
:
#fff
;
}
.chapter.is-current
.chap-head
.ico
{
color
:
var
(
--nav-rail-lit
);
}
.chapter.is-current
.chap-head
.count
{
color
:
rgba
(
198
,
220
,
255
,
0.62
);
}
/* 左缘章节刻度:把纯色侧栏读成一册带书脊刻度的目录。
未激活章只留 2×10px 极淡刻痕,激活章才拉长成整段蓝刻度。 */
.chap-head
::before
{
content
:
''
;
position
:
absolute
;
left
:
-8px
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
2px
;
height
:
10px
;
border-radius
:
0
2px
2px
0
;
background
:
rgba
(
198
,
220
,
255
,
0.1
);
transition
:
background
0.18s
ease
;
}
/* hover 的刻痕转品牌蓝但仍是 10px 短刻:与激活章的拉长蓝刻度同族、不同长度 */
.chap-head
:hover::before
{
background
:
rgba
(
91
,
141
,
239
,
0.5
);
}
/* 激活域的 2px 长刻度:全侧栏唯一的重音 */
.chapter.is-current
.chap-head
::before
{
top
:
6px
;
bottom
:
6px
;
height
:
auto
;
transform
:
none
;
background
:
var
(
--nav-rail-lit
);
}
/* 对齐轴可视化(评审辅助,非产品界面) */
.show-axis
.chap-head
.label
{
box-shadow
:
inset
-1px
0
0
0
rgba
(
91
,
141
,
239
,
0.55
);
}
.show-axis
.chap-head
.count
{
box-shadow
:
inset
1px
0
0
0
rgba
(
91
,
141
,
239
,
0.55
);
}
.show-axis
.chap-head
{
background
:
rgba
(
91
,
141
,
239
,
0.055
);
}
/* 旧版字距复现:用于对比 */
.legacy
.chap-head
.label
{
letter-spacing
:
2px
;
text-transform
:
uppercase
;
}
/* 折叠态:只留图标,文字/计数/箭头退场 */
.is-collapsed
.chap-head
{
grid-template-columns
:
20px
;
justify-content
:
center
;
padding
:
0
;
gap
:
0
;
margin
:
0
8px
;
}
.is-collapsed
.chap-head
.label
,
.is-collapsed
.chap-head
.count
,
.is-collapsed
.chap-head
.chev
{
display
:
none
;
}
/* 折叠态唯一的位置信号,加粗一档才看得见 */
.is-collapsed
.chapter.is-current
.chap-head
::before
{
left
:
-8px
;
width
:
3px
;
}
/* ============ 章节体 + 导轨 ============ */
.chap-body
{
position
:
relative
;
display
:
none
;
padding
:
6px
0
8px
;
}
.chapter.is-open
.chap-body
{
display
:
block
;
}
/* 激活域一层极淡的染色:域 > 页 两级光,不再靠整行实底铺满 */
.chapter.is-current
.chap-body
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.06
),
rgba
(
43
,
92
,
230
,
0
)
64%
);
}
.is-collapsed
.chap-body
{
display
:
none
!important
;
}
/* 竖向导轨:把「这一章里的这些页」串成一组 */
.chap-body
::before
{
content
:
''
;
position
:
absolute
;
left
:
23px
;
top
:
-4px
;
bottom
:
16px
;
width
:
1px
;
background
:
var
(
--nav-line-strong
);
}
.chapter.is-current
.chap-body
::before
{
background
:
var
(
--nav-rail-soft
);
}
/* 二级项:统一导轨节点,不渲染语义图标(与落地 SideNav 一致) */
.leaf
{
position
:
relative
;
height
:
36px
;
width
:
calc
(
100%
-
16px
);
margin
:
0
8px
;
padding
:
0
10px
0
26px
;
border
:
0
;
background
:
transparent
;
display
:
grid
;
grid-template-columns
:
12px
minmax
(
0
,
1
fr
);
align-items
:
center
;
gap
:
8px
;
color
:
rgba
(
255
,
255
,
255
,
0.58
);
text-align
:
left
;
border-radius
:
6px
;
}
/* 从导轨接到节点的短横,让层级是真连起来的 */
.leaf
::before
{
content
:
''
;
position
:
absolute
;
left
:
15px
;
top
:
50%
;
width
:
12px
;
height
:
1px
;
background
:
var
(
--nav-line-strong
);
}
.chapter.is-current
.leaf
::before
{
background
:
var
(
--nav-rail-soft
);
}
/* hover 与选中共用一条光楔,只是强度约 4 成;当前项不参与 hover 反馈 */
.leaf
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
rgba
(
255
,
255
,
255
,
0.92
);
}
/* 只点亮 hover 这一根的短横,不会让 12 根连成亮带 */
.leaf
:not
(
.is-active
)
:hover::before
{
background
:
rgba
(
91
,
141
,
239
,
0.24
);
}
.node
{
width
:
12px
;
height
:
12px
;
display
:
grid
;
place-items
:
center
;
}
.node
::after
{
content
:
''
;
width
:
5px
;
height
:
5px
;
border-radius
:
50%
;
background
:
rgba
(
255
,
255
,
255
,
0.28
);
transition
:
background
0.16s
ease
,
box-shadow
0.16s
ease
;
}
/* 节点圆点也走品牌蓝递进:hover 淡蓝 → 选中亮蓝 + 亮环 */
.leaf
:not
(
.is-active
)
:hover
.node
::after
{
background
:
rgba
(
91
,
141
,
239
,
0.62
);
}
.leaf
.txt
{
font-size
:
13px
;
font-weight
:
400
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
/* 选中页:从左端短刻度向外淡出的「光楔」,取代贯穿整行的蓝色长条。
左端 3px×16px 短刻度 + 导轨节点亮环 + 文字提亮,三重信号都不占满整行。 */
.leaf.is-active
{
color
:
#fff
;
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
}
.leaf.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
16px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--nav-rail-lit
);
box-shadow
:
0
0
10px
-2px
rgba
(
91
,
141
,
239
,
0.7
);
}
/* 选中项那根短横仍是章内最亮的,但压一档避免刺眼 */
.leaf.is-active
::before
{
background
:
rgba
(
91
,
141
,
239
,
0.78
);
}
.leaf.is-active
.node
::after
{
background
:
var
(
--nav-rail-lit
);
box-shadow
:
0
0
0
3px
rgba
(
91
,
141
,
239
,
0.22
);
}
.leaf.is-active
.txt
{
font-weight
:
500
;
}
/* 底部:从 Header 收回侧栏的折叠控制 + 一行真实角色信息 */
.sider-foot
{
flex
:
none
;
height
:
46px
;
border-top
:
1px
solid
var
(
--nav-line
);
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
padding
:
0
12px
;
}
.fold-btn
{
height
:
28px
;
flex
:
none
;
width
:
28px
;
border
:
0
;
border-radius
:
5px
;
background
:
transparent
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
display
:
grid
;
place-items
:
center
;
}
.fold-btn
:hover
{
background
:
rgba
(
255
,
255
,
255
,
0.07
);
color
:
#fff
;
}
.foot-meta
{
display
:
flex
;
flex-direction
:
column
;
line-height
:
1.3
;
min-width
:
0
;
overflow
:
hidden
;
}
.foot-meta
.n
{
font-size
:
11px
;
color
:
rgba
(
255
,
255
,
255
,
0.5
);
white-space
:
nowrap
;
}
.foot-meta
.e
{
font-size
:
10px
;
color
:
rgba
(
255
,
255
,
255
,
0.28
);
white-space
:
nowrap
;
letter-spacing
:
0.3px
;
}
.is-collapsed
.foot-meta
{
display
:
none
;
}
.is-collapsed
.sider-foot
{
justify-content
:
center
;
padding
:
0
;
}
/* 折叠态浮层 */
.popover
{
position
:
fixed
;
z-index
:
40
;
min-width
:
184px
;
padding
:
6px
;
background
:
#101b42
;
border
:
1px
solid
rgba
(
198
,
220
,
255
,
0.14
);
border-radius
:
8px
;
box-shadow
:
0
12px
32px
-10px
rgba
(
2
,
6
,
20
,
0.7
);
display
:
none
;
}
.popover.is-visible
{
display
:
block
;
}
.popover
.p-title
{
font-size
:
11px
;
color
:
var
(
--nav-label-dim
);
padding
:
6px
10px
8px
;
letter-spacing
:
0.5px
;
}
.popover
.p-item
{
position
:
relative
;
display
:
block
;
width
:
100%
;
height
:
32px
;
padding
:
0
10px
;
border
:
0
;
border-radius
:
5px
;
background
:
transparent
;
color
:
rgba
(
255
,
255
,
255
,
0.66
);
font-size
:
13px
;
text-align
:
left
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
/* 折叠态浮层与展开态共用同一套 hover / 选中语言,不能留一版旧的整行实底 */
.popover
.p-item
:not
(
.is-active
)
:hover
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.12
)
0%
,
rgba
(
43
,
92
,
230
,
0.04
)
30%
,
rgba
(
43
,
92
,
230
,
0.01
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.popover
.p-item.is-active
{
background
:
linear-gradient
(
90deg
,
rgba
(
43
,
92
,
230
,
0.28
)
0%
,
rgba
(
43
,
92
,
230
,
0.1
)
30%
,
rgba
(
43
,
92
,
230
,
0.02
)
62%
,
rgba
(
43
,
92
,
230
,
0
)
82%
);
color
:
#fff
;
}
.popover
.p-item.is-active
::after
{
content
:
''
;
position
:
absolute
;
left
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
3px
;
height
:
14px
;
border-radius
:
0
2px
2px
0
;
background
:
var
(
--nav-rail-lit
);
box-shadow
:
0
0
8px
-2px
rgba
(
91
,
141
,
239
,
0.6
);
}
/* ============ 右侧内容区 ============ */
.main
{
flex
:
1
;
min-width
:
0
;
display
:
flex
;
flex-direction
:
column
;
background
:
var
(
--page
);
}
.topbar
{
height
:
56px
;
flex
:
none
;
background
:
var
(
--surface
);
border-bottom
:
1px
solid
var
(
--border
);
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
padding
:
0
20px
;
gap
:
12px
;
}
.crumb
{
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
font-size
:
13px
;
color
:
var
(
--text-3
);
min-width
:
0
;
}
.crumb
.sep
{
color
:
var
(
--text-3
);
opacity
:
0.5
;
}
.crumb
.now
{
color
:
var
(
--text-1
);
font-weight
:
500
;
}
.who
{
display
:
flex
;
align-items
:
center
;
gap
:
9px
;
flex
:
none
;
}
.avatar
{
width
:
32px
;
height
:
32px
;
border-radius
:
50%
;
background
:
linear-gradient
(
135deg
,
#2b5ce6
,
#5b8def
);
display
:
grid
;
place-items
:
center
;
color
:
#fff
;
font-size
:
12px
;
font-weight
:
600
;
}
.who-txt
{
display
:
flex
;
flex-direction
:
column
;
line-height
:
1.3
;
}
.who-txt
.n
{
font-size
:
13px
;
color
:
var
(
--text-1
);
}
.who-txt
.r
{
font-size
:
11px
;
color
:
var
(
--text-3
);
}
.content
{
flex
:
1
;
min-height
:
0
;
overflow
:
auto
;
padding
:
16px
20px
32px
;
}
/* 原型工具条:明确与产品界面分开 */
.toolbar
{
background
:
var
(
--surface
);
border
:
1px
solid
var
(
--border
);
border-radius
:
8px
;
box-shadow
:
var
(
--shadow-card
);
padding
:
12px
14px
;
margin-bottom
:
14px
;
}
.toolbar-hd
{
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
margin-bottom
:
10px
;
}
.toolbar-hd
.tag
{
font-size
:
10px
;
letter-spacing
:
0.4px
;
color
:
var
(
--brand
);
background
:
#eef3ff
;
border
:
1px
solid
#d6e2fb
;
border-radius
:
4px
;
padding
:
2px
6px
;
font-weight
:
600
;
}
.toolbar-hd
.desc
{
font-size
:
12px
;
color
:
var
(
--text-3
);
}
.tools
{
display
:
flex
;
flex-wrap
:
wrap
;
gap
:
8px
;
}
.tool
{
height
:
30px
;
padding
:
0
11px
;
border
:
1px
solid
var
(
--border
);
border-radius
:
6px
;
background
:
var
(
--surface
);
font-size
:
12px
;
color
:
var
(
--text-2
);
display
:
inline-flex
;
align-items
:
center
;
gap
:
6px
;
}
.tool
:hover
{
border-color
:
#c3d2f5
;
color
:
var
(
--brand
);
}
.tool
[
aria-pressed
=
'true'
]
{
background
:
#eef3ff
;
border-color
:
#c3d2f5
;
color
:
var
(
--brand
);
font-weight
:
600
;
}
.tool
.dot
{
width
:
6px
;
height
:
6px
;
border-radius
:
50%
;
background
:
currentColor
;
opacity
:
0.55
;
}
/* 仿真业务页:给侧栏一个真实的上下文 */
.page-card
{
background
:
var
(
--surface
);
border
:
1px
solid
var
(
--border
);
border-radius
:
10px
;
box-shadow
:
var
(
--shadow-card
);
overflow
:
hidden
;
}
.page-hd
{
padding
:
16px
18px
;
border-bottom
:
1px
solid
var
(
--divider
);
display
:
flex
;
align-items
:
baseline
;
gap
:
10px
;
}
.page-hd
h1
{
margin
:
0
;
font-size
:
16px
;
font-weight
:
600
;
letter-spacing
:
0.2px
;
}
.page-hd
.sub
{
font-size
:
12px
;
color
:
var
(
--text-3
);
}
.stats
{
display
:
grid
;
grid-template-columns
:
repeat
(
4
,
1
fr
);
gap
:
1px
;
background
:
var
(
--divider
);
}
.stat
{
background
:
var
(
--surface
);
padding
:
16px
18px
;
}
.stat
.k
{
font-size
:
12px
;
color
:
var
(
--text-3
);
}
.stat
.v
{
font-size
:
22px
;
font-weight
:
600
;
margin-top
:
6px
;
font-variant-numeric
:
tabular-nums
;
letter-spacing
:
-0.3px
;
}
.stat
.v
small
{
font-size
:
12px
;
font-weight
:
400
;
color
:
var
(
--text-3
);
margin-left
:
4px
;
}
.table
{
margin-top
:
1px
;
background
:
var
(
--divider
);
}
.row
{
display
:
grid
;
grid-template-columns
:
1.4
fr
1
fr
0.8
fr
0.8
fr
;
gap
:
12px
;
padding
:
11px
18px
;
background
:
var
(
--surface
);
font-size
:
13px
;
color
:
var
(
--text-2
);
border-bottom
:
1px
solid
var
(
--divider
);
}
.row
:last-child
{
border-bottom
:
0
;
}
.row.th
{
background
:
var
(
--surface-2
);
color
:
var
(
--text-header
,
#5a6779
);
font-size
:
12px
;
font-weight
:
500
;
}
.row
.num
{
font-variant-numeric
:
tabular-nums
;
}
.pill
{
display
:
inline-block
;
font-size
:
11px
;
padding
:
2px
8px
;
border-radius
:
4px
;
border
:
1px
solid
;
}
.pill.ok
{
color
:
#16a34a
;
background
:
#e9f7ef
;
border-color
:
#c6ebd6
;
}
.pill.wait
{
color
:
#d97706
;
background
:
#fdf3e5
;
border-color
:
#f6dfba
;
}
/* 设计说明 */
.notes
{
margin-top
:
14px
;
background
:
var
(
--surface
);
border
:
1px
solid
var
(
--border
);
border-radius
:
10px
;
box-shadow
:
var
(
--shadow-card
);
overflow
:
hidden
;
}
.notes
summary
{
padding
:
14px
18px
;
font-size
:
14px
;
font-weight
:
600
;
cursor
:
pointer
;
list-style
:
none
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
.notes
summary
::-webkit-details-marker
{
display
:
none
;
}
.notes
summary
::after
{
content
:
'展开'
;
font-size
:
12px
;
font-weight
:
400
;
color
:
var
(
--text-3
);
}
.notes
[
open
]
summary
::after
{
content
:
'收起'
;
}
.notes
summary
:hover
{
background
:
var
(
--surface-2
);
}
.notes-body
{
padding
:
0
18px
18px
;
border-top
:
1px
solid
var
(
--divider
);
}
.notes-body
h3
{
font-size
:
13px
;
margin
:
16px
0
8px
;
color
:
var
(
--text-1
);
}
.notes-body
p
,
.notes-body
li
{
font-size
:
12.5px
;
line-height
:
1.75
;
color
:
var
(
--text-2
);
margin
:
0
0
6px
;
}
.notes-body
ul
{
padding-left
:
18px
;
margin
:
0
0
8px
;
}
.notes-body
code
{
font-family
:
'SFMono-Regular'
,
Consolas
,
monospace
;
font-size
:
11.5px
;
background
:
#f2f4f8
;
border
:
1px
solid
#e6ebf2
;
border-radius
:
3px
;
padding
:
1px
5px
;
color
:
#334
;
}
.tokens
{
display
:
grid
;
grid-template-columns
:
repeat
(
auto-fill
,
minmax
(
180px
,
1
fr
));
gap
:
8px
;
margin-top
:
8px
;
}
.tok
{
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
font-size
:
11.5px
;
color
:
var
(
--text-2
);
border
:
1px
solid
var
(
--border
);
border-radius
:
6px
;
padding
:
7px
9px
;
}
.sw
{
width
:
16px
;
height
:
16px
;
border-radius
:
4px
;
flex
:
none
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.07
);
}
.tok
b
{
font-weight
:
600
;
color
:
var
(
--text-1
);
}
.legend
{
font-size
:
11.5px
;
color
:
var
(
--text-3
);
margin-top
:
12px
;
padding-top
:
10px
;
border-top
:
1px
dashed
var
(
--border
);
}
@media
(
max-width
:
900px
)
{
.stats
{
grid-template-columns
:
repeat
(
2
,
1
fr
);
}
.who-txt
{
display
:
none
;
}
}
@media
(
prefers-reduced-motion
:
reduce
)
{
*,
*
::before
,
*
::after
{
transition
:
none
!important
;
animation
:
none
!important
;
}
}
</style>
</head>
<body>
<div
class=
"app"
id=
"app"
>
<!-- ================= 侧栏 ================= -->
<aside
class=
"sider"
id=
"sider"
aria-label=
"主导航"
>
<div
class=
"brand"
>
<div
class=
"brand-mark"
>
UJ
</div>
<div
class=
"brand-text"
>
<span
class=
"t"
>
优加门店上架
</span>
<span
class=
"s"
>
Store Launch Platform
</span>
</div>
</div>
<nav
class=
"nav"
id=
"nav"
>
<div
class=
"zone-label"
>
工作区
</div>
<button
type=
"button"
class=
"solo"
id=
"solo"
data-name=
"工作台"
>
<span
class=
"ico"
data-icon=
"dashboard"
></span>
<span
class=
"txt"
>
工作台
</span>
</button>
<div
class=
"zone-sep"
></div>
<div
class=
"zone-label"
>
业务域
</div>
<div
id=
"chapters"
></div>
</nav>
<div
class=
"nav-fade top"
id=
"fadeTop"
aria-hidden=
"true"
></div>
<div
class=
"nav-fade bottom"
id=
"fadeBottom"
aria-hidden=
"true"
></div>
<div
class=
"sider-foot"
>
<button
type=
"button"
class=
"fold-btn"
id=
"foldBtn"
aria-label=
"收起导航"
title=
"收起导航"
>
<span
data-icon=
"fold"
></span>
</button>
<div
class=
"foot-meta"
>
<span
class=
"n"
>
运营管理员
</span>
<span
class=
"e"
>
当前登录角色
</span>
</div>
</div>
</aside>
<!-- 折叠态浮层 -->
<div
class=
"popover"
id=
"popover"
role=
"menu"
></div>
<!-- ================= 内容区 ================= -->
<div
class=
"main"
>
<header
class=
"topbar"
>
<div
class=
"crumb"
>
<span
id=
"crumbGroup"
>
门店上架
</span>
<span
class=
"sep"
>
/
</span>
<span
class=
"now"
id=
"crumbNow"
>
门店审批
</span>
</div>
<div
class=
"who"
>
<div
class=
"avatar"
>
李
</div>
<div
class=
"who-txt"
><span
class=
"n"
>
李明
</span><span
class=
"r"
>
运营管理员
</span></div>
</div>
</header>
<div
class=
"content"
>
<!-- 原型演示控制:标注为非产品界面 -->
<section
class=
"toolbar"
aria-label=
"原型演示控制"
>
<div
class=
"toolbar-hd"
>
<span
class=
"tag"
>
原型工具
</span>
<span
class=
"desc"
>
以下控件仅用于评审演示,不属于产品界面
</span>
</div>
<div
class=
"tools"
>
<button
type=
"button"
class=
"tool"
id=
"tFold"
aria-pressed=
"false"
>
<span
class=
"dot"
></span>
折叠侧栏
</button>
<button
type=
"button"
class=
"tool"
id=
"tAxis"
aria-pressed=
"false"
>
<span
class=
"dot"
></span>
显示对齐轴
</button>
<button
type=
"button"
class=
"tool"
id=
"tLegacy"
aria-pressed=
"false"
>
<span
class=
"dot"
></span>
对比旧版字距
</button>
<button
type=
"button"
class=
"tool"
id=
"tStress"
aria-pressed=
"false"
>
<span
class=
"dot"
></span>
字数压力测试
</button>
<button
type=
"button"
class=
"tool"
id=
"tAll"
>
展开全部
</button>
<button
type=
"button"
class=
"tool"
id=
"tReset"
>
恢复默认
</button>
</div>
</section>
<!-- 仿真业务页 -->
<section
class=
"page-card"
aria-label=
"页面内容示意"
>
<div
class=
"page-hd"
>
<h1
id=
"pageTitle"
>
门店审批
</h1>
<span
class=
"sub"
>
示意内容 · 非真实业务数据
</span>
</div>
<div
class=
"stats"
>
<div
class=
"stat"
>
<div
class=
"k"
>
待审批门店
</div>
<div
class=
"v"
>
24
<small>
家
</small></div>
</div>
<div
class=
"stat"
>
<div
class=
"k"
>
本周通过
</div>
<div
class=
"v"
>
86
<small>
家
</small></div>
</div>
<div
class=
"stat"
>
<div
class=
"k"
>
平均时效
</div>
<div
class=
"v"
>
1.8
<small>
天
</small></div>
</div>
<div
class=
"stat"
>
<div
class=
"k"
>
驳回待补
</div>
<div
class=
"v"
>
7
<small>
家
</small></div>
</div>
</div>
<div
class=
"table"
>
<div
class=
"row th"
>
<span>
门店名称
</span><span>
所属区域
</span><span>
提交时间
</span><span>
状态
</span>
</div>
<div
class=
"row"
>
<span>
优加 · 城西银泰店
</span><span>
华东 / 杭州
</span
><span
class=
"num"
>
11-11 09:42
</span
><span><span
class=
"pill wait"
>
待审批
</span></span>
</div>
<div
class=
"row"
>
<span>
优加 · 滨江星光店
</span><span>
华东 / 杭州
</span
><span
class=
"num"
>
11-11 09:18
</span
><span><span
class=
"pill wait"
>
待审批
</span></span>
</div>
<div
class=
"row"
>
<span>
优加 · 未来科技城店
</span><span>
华东 / 杭州
</span
><span
class=
"num"
>
11-10 17:03
</span
><span><span
class=
"pill ok"
>
已通过
</span></span>
</div>
<div
class=
"row"
>
<span>
优加 · 钱江新城店
</span><span>
华东 / 杭州
</span
><span
class=
"num"
>
11-10 15:26
</span
><span><span
class=
"pill ok"
>
已通过
</span></span>
</div>
</div>
</section>
<!-- 设计说明 -->
<details
class=
"notes"
>
<summary>
设计计划与落地映射
</summary>
<div
class=
"notes-body"
>
<h3>
一、字数不齐的根因(代码证据)
</h3>
<ul>
<li>
<code>
apps/web/shell/src/theme/design.css:515-519
</code>
一级
<code>
.ant-menu-submenu-title
</code>
的
<code>
letter-spacing: 2px
</code>
让中文每字多 2px,5 字标题比 3 字多 4px,字数差被
CSS 放大;
<code>
text-transform: uppercase
</code>
对中文无效。
</li>
<li>
<code>
packages/design-tokens/src/themeConfig.ts:109-111
</code>
的
<code>
itemHeight: 40
</code>
让一级标题与二级项等高同边界,菜单变多后没有章节节奏。
</li>
<li>
真实一级名:工作台 3(平铺单入口)、门店上架 / 积分管理 / 系统设置 4、二手车管理
5;二手车管理下 12
个二级项(
<code>
scripts/usedcar-menu-complete.sql:46-127
</code>
)。
</li>
</ul>
<h3>
二、字数协调:固定标题槽 + 双端对齐轴
</h3>
<p>
章节头是四列网格
<code>
20px 图标 / 1fr 标题槽 / auto 域计数 / 12px 展开指示
</code
>
。所有一级行的标题槽起点相同、宽度相同,右端的计数与箭头也对齐到同一条线 ——
字数差被槽内留白吸收,不表现为右边缘参差。右侧计数取自后端菜单树的真实子项数(3 / 4
/ 12 / 2),等宽数字,同时预告该域展开后的长度。
</p>
<p>
明确不做:不改业务文案凑字数(后端下发、破坏语义);不用
<code>
text-align-last: justify
</code>
撑满(3 字会被拉成散字);不加 01/02
编号(业务域不是序列)。
</p>
<p>
点「显示对齐轴」可看到标题槽右边界与计数左边界;点「对比旧版字距」会复现 2px
字距,直观看差异;点「字数压力测试」把章节名临时替换为 3–7
字演示串验证容纳能力。状态也可用 URL hash 直达:
<code>
#all
</code>
/
<code>
#collapsed
</code>
/
<code>
#axis
</code>
/
<code>
#legacy
</code>
/
<code>
#stress
</code>
/
<code>
#bottom
</code>
(可逗号组合)。
</p>
<h3>
三、企业级内涵:章节制 + 导轨
</h3>
<ul>
<li>
侧栏分品牌区 / 工作区 / 业务域 / 底部系统区四段,用 1px
极低对比线切开;深蓝渐变压到近实色,去掉原 55% 处发亮的
<code>
#14204E
</code>
。
</li>
<li>
章节头与二级项同为 36px(原
40px),靠字重、导轨与组间留白区分层级;
<b>
组内紧密、组间分明
</b>
——12 项组不逐项加
gap,把间距预算留给章节之间(10–16px),长菜单才不失控。 展开章内一根 1px
竖向导轨串起所有子项,激活域导轨转品牌蓝。
</li>
<li>
<b>
二级菜单不渲染语义图标
</b>
:改成导轨上的统一圆点 +
从导轨接过来的短横,选中时圆点转品牌蓝实心带亮环。理由:12 个不同线性形状在 36px
行里形成锯齿边;图标在一级负责识别业务域,二级靠缩进与文字定位;
<code
>
iconMap
</code
>
白名单的配错半径从「所有页面」缩到「4 个一级域」。
<b
>
后端
<code>
sys_menu.icon
</code>
字段不动
</b
>
,只是前端不读二级的。
</li>
<li>
激活信号三级递进:左缘章节刻度(未激活 2×10px 极淡刻痕 / 激活拉长成 2px 品牌蓝)→
激活域一层 6% 淡染 → 选中页向右淡出的光楔 + 节点亮环。
不铺满整行的等宽底色,其余全暗。
</li>
<li>
折叠态 68px 图标栏,hover 弹出该域子项;折叠按钮从 Header
收回侧栏底部,激活域刻度加粗到 3px(68px 栏里唯一的位置信号)。
</li>
<li>
长菜单上下各 26px
渐隐遮罩,只在真的还有内容时出现,静默提示可滚动;折叠态两条区段标收成一条线,不把图标栏切碎。
</li>
</ul>
<h3>
四、Token(沿用品牌资产,不另起色系)
</h3>
<div
class=
"tokens"
>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #0b1437"
></span><b>
nav-ink
</b>
#0B1437
</div>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #0d1739"
></span><b>
nav-ink-2
</b>
#0D1739
</div>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #2b5ce6"
></span><b>
nav-rail
</b>
#2B5CE6
</div>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #5b8def"
></span><b>
nav-rail-lit
</b>
#5B8DEF
</div>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #e8edf8"
></span><b>
nav-label
</b>
#E8EDF8
</div>
<div
class=
"tok"
>
<span
class=
"sw"
style=
"background: #303b50"
></span><b>
nav-count
</b>
rgba(198,220,255,.12)
</div>
</div>
<p
style=
"margin-top: 10px"
>
字阶:品牌名 15/700 · 章节头 13/600 · 二级项 13/400 · 域计数 11 等宽数字 · 品牌副标
10/0.7px(唯一保留 uppercase 处,因为它是英文)。中文标题一律
<code>
letter-spacing: 0
</code>
。
</p>
<h3>
五、已落地实现(本稿与代码一致)
</h3>
<p>
落地路径定为
<b>
自绘 SideNav
</b>
:
<code>
type:'group'
</code>
会回退「一级可折叠」(group 标题在 inline 模式下点不动);继续用 antd SubMenu +
自定义 label 则要覆盖
<code>
.ant-menu-title-content
</code>
盒模型才能撑开四列网格,且章节头 32 / 子项 34
的高度差 token 表达不了,等于给组件打一串 CSS 补丁。自绘只换渲染层。
</p>
<ul>
<li>
<b>
新增
</b>
<code>
apps/web/shell/src/layouts/SideNav.tsx
</code>
:四列网格章节头、真实子项计数
<code>
g.children.length
</code>
、导轨 + 短横 +
统一节点、激活刻度、滚动渐隐、折叠态浮层(portal 到 body,点外部 / Esc
关闭)、
<code>
aria-expanded / aria-current / focus-visible / reduced-motion
</code
>
。图标白名单只服务一级域与工作台单入口。
</li>
<li>
<code>
BasicLayout.tsx
</code>
:删掉 antd
<code>
<
Menu
>
</code>
与
<code>
items
</code>
构造,改为传
<code>
visibleGroups
</code>
(权限过滤后剔空组)与
<code>
isGroupOpen / onToggleGroup
</code>
;
<code>
selectedKey
</code>
最长前缀、
<code
>
openKeys
</code
>
受控校准、
<code>
onNavigate
</code>
里的
<code>
PAGE_LEAVE_EVENT / cancelRequests / navigate
</code>
三段原样保留;折叠按钮从
Header 收回侧栏底部。
</li>
<li>
<code>
theme/design.css
</code>
:替换 Sider / Menu 段,删渐变中段亮色、
<code
>
::after
</code
>
地面带、
<code>
letter-spacing: 2px
</code>
与
<code>
uppercase
</code>
;新增全部
<code>
.uj-*
</code>
自绘样式,不覆盖任何
<code>
.ant-*
</code>
内部盒模型。
</li>
<li>
<code>
packages/design-tokens/src/themeConfig.ts
</code>
:移除 9 个无消费的
<code>
dark*
</code>
token 与
<code>
collapsedWidth
</code>
(旧注释「必须与 Sider
保持一致」已失效);保留 light Menu 几何 token,唯一的消费者是 Header 头像下拉。
</li>
</ul>
<h3>
六、本轮反馈调整(本稿与代码同步)
</h3>
<ul>
<li>
<b>
折叠按钮对齐
</b>
:落地代码原用 antd
<code>
MenuFoldOutlined / MenuUnfoldOutlined
</code
>
(带方框与三条横线),与稿子里的极简线稿不一致;改成与原型逐路径相同的自绘
SVG(chevron + 竖线,15px / stroke 1.7)。
</li>
<li>
<b>
间距
</b>
:区段标 26→28、章节头 32→36、二级项 34→36、章节间距
4/2→10/6、章节体内边距 2/6→6/8;组内仍紧密,预算留给组间。
</li>
<li>
<b>
背景创新
</b>
:选中项整行等宽蓝底 → 从左端 3×16px 短刻度向右淡出的光楔(82%
处归零);侧栏加品牌区径向光弧、左缘 1px 索引标尺、每章一枚 2×10px
刻痕(激活章拉长成蓝刻度),激活域再加一层 6% 淡染。
</li>
<li>
<b>
域计数降对比
</b>
:
<code>
#7E8DB0
</code>
→
<code>
rgba(198,220,255,.12)
</code>
(超人在实现里继续压暗后的最终值),字重
500→400,只在 hover / 激活时短暂提亮;激活态
<code>
#A9BBE8
</code>
→
<code>
rgba(198,220,255,.62)
</code>
。
</li>
<li>
<b>
连接线调暗
</b>
:导轨与短横
<code>
.16
</code>
→
<code>
.09
</code>
,激活章
<code>
.42
</code>
→
<code>
.08
</code>
(同上,继续压暗后的定稿),选中项那根短横
<code>
.78
</code>
;12 条短横不再连成发亮的虚线带。
</li>
<li>
<b>
hover 与选中统一
</b>
:hover 原是整行白灰底
<code>
rgba(255,255,255,.05~.055)
</code
>
,与选中光楔两套语言。改成
<b>
选中态的低强度预览
</b>
——同一条品牌蓝光楔、同样四个停靠点,每档约
4 成强度(
<code>
.12/.04/.01/0
</code>
vs
<code>
.28/.10/.02/0
</code>
);短刻度与亮环仍只属于「当前页」,hover 用
<code>
:not(.is-active)
</code>
显式排除。刻痕 hover 转品牌蓝
<code>
.5
</code>
、节点圆点
<code>
.62
</code>
、单根短横
<code>
.24
</code>
,都是同族递进。折叠态浮层也一并换掉旧的整行实底(选中项补 3×14px
短刻度)。
</li>
</ul>
<div
class=
"legend"
>
菜单文案取自
<code>
packages/biz/src/config/menu.json
</code>
与
<code>
scripts/*-menu-complete.sql
</code>
的真实后端配置;页面指标卡、门店列表、角色名是演示数据,不代表真实业务。后端
<code>
sys_menu.icon
</code>
字段未改动,只是前端不再渲染二级图标。
</div>
</div>
</details>
</div>
</div>
</div>
<script>
/* ---------------- 图标:内联 stroke SVG,无外部依赖 ---------------- */
const
P
=
{
dashboard
:
'<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>'
,
store
:
'<path d="M3 9l1.6-5h14.8L21 9"/><path d="M4 9v11h16V9"/><path d="M3 9a3 3 0 0 0 6 0 3 3 0 0 0 6 0 3 3 0 0 0 6 0"/><path d="M10 20v-6h4v6"/>'
,
gift
:
'<rect x="3" y="9" width="18" height="12" rx="1.5"/><path d="M3 13h18M12 9v12"/><path d="M12 9C9 9 7 8 7 6a2.5 2.5 0 0 1 5 0c0 2 2 3 0 3zM12 9c3 0 5-1 5-3a2.5 2.5 0 0 0-5 0c0 2-2 3 0 3z"/>'
,
car
:
'<path d="M4 16v2.5M20 16v2.5"/><path d="M3 16l1.5-6A2 2 0 0 1 6.4 8.5h11.2A2 2 0 0 1 19.5 10L21 16v1H3v-1z"/><circle cx="7" cy="16" r="1.4"/><circle cx="17" cy="16" r="1.4"/><path d="M5 13h14"/>'
,
settings
:
'<circle cx="12" cy="12" r="3"/><path d="M12 2.5v2.2M12 19.3v2.2M21.5 12h-2.2M4.7 12H2.5M18.7 5.3l-1.6 1.6M6.9 17.1l-1.6 1.6M18.7 18.7l-1.6-1.6M6.9 6.9L5.3 5.3"/>'
,
upload
:
'<path d="M12 16V4m0 0L8 8m4-4l4 4"/><path d="M4 15v4a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-4"/>'
,
audit
:
'<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 9h8M8 13h5M8 17l2 2 4-4"/>'
,
list
:
'<path d="M8 6h12M8 12h12M8 18h12"/><path d="M4 6h.01M4 12h.01M4 18h.01"/>'
,
chart
:
'<path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/>'
,
target
:
'<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.2"/>'
,
flask
:
'<path d="M9 3h6M10 3v6L4.5 18a1.5 1.5 0 0 0 1.3 2.2h12.4A1.5 1.5 0 0 0 19.5 18L14 9V3"/><path d="M7 15h10"/>'
,
sliders
:
'<path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/>'
,
tool
:
'<path d="M14.5 6.5a4.5 4.5 0 0 0-5.9 5.9L3 18l3 3 5.6-5.6a4.5 4.5 0 0 0 5.9-5.9l-2.6 2.6-2.4-2.4 2.6-2.6z"/>'
,
send
:
'<path d="M21 3L10 14M21 3l-7 18-4-7-7-4 18-7z"/>'
,
ledger
:
'<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 8h8M8 12h8M8 16h5"/>'
,
swap
:
'<path d="M16 3h5v5"/><path d="M21 3l-6 6a6 6 0 0 0-8 8L3 21"/><path d="M8 21H3v-5"/><path d="M3 21l6-6"/>'
,
file
:
'<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5M9 13h7M9 17h7"/>'
,
shield
:
'<path d="M12 2l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V5z"/><path d="M9 12l2 2 4-4"/>'
,
wechat
:
'<path d="M9 4C5 4 2 6.7 2 10c0 1.9 1 3.6 2.7 4.7L4 17l2.6-1.3c.8.2 1.6.3 2.4.3"/><path d="M22 15c0-2.8-2.7-5-6-5s-6 2.2-6 5 2.7 5 6 5c.7 0 1.4-.1 2-.3L20 21l-.6-2c1.6-.9 2.6-2.3 2.6-4z"/>'
,
pay
:
'<circle cx="12" cy="12" r="9"/><path d="M12 6v12M9 9.5h4a1.8 1.8 0 0 1 0 3.6h-2a1.8 1.8 0 0 0 0 3.6h4"/>'
,
chev
:
'<path d="M9 5l7 7-7 7"/>'
,
fold
:
'<path d="M14 5l-7 7 7 7"/><path d="M20 5v14"/>'
,
unfold
:
'<path d="M10 5l7 7-7 7"/><path d="M4 5v14"/>'
,
dot
:
'<circle cx="12" cy="12" r="3"/>'
,
};
function
svg
(
name
,
size
)
{
return
(
'<svg width="'
+
(
size
||
16
)
+
'" height="'
+
(
size
||
16
)
+
'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'
+
(
P
[
name
]
||
P
.
dot
)
+
'</svg>'
);
}
function
paintIcons
(
root
)
{
root
.
querySelectorAll
(
'[data-icon]'
).
forEach
(
function
(
el
)
{
var
n
=
el
.
getAttribute
(
'data-icon'
);
var
s
=
15
;
if
(
el
.
closest
(
'.chev'
))
s
=
11
;
else
if
(
el
.
closest
(
'.chap-head'
)
||
el
.
closest
(
'.solo'
))
s
=
17
;
el
.
innerHTML
=
svg
(
n
,
s
);
});
}
/* ---------------- 菜单数据:全部取自真实后端配置 ---------------- */
const
DOMAINS
=
[
{
id
:
'store'
,
name
:
'门店上架'
,
icon
:
'store'
,
children
:
[
{
name
:
'导入门店信息'
,
icon
:
'upload'
},
{
name
:
'门店审批'
,
icon
:
'audit'
},
{
name
:
'门店列表'
,
icon
:
'list'
},
],
},
{
id
:
'points'
,
name
:
'积分管理'
,
icon
:
'gift'
,
children
:
[
{
name
:
'积分核销订单'
,
icon
:
'file'
},
{
name
:
'用户积分明细'
,
icon
:
'chart'
},
{
name
:
'积分提现管理'
,
icon
:
'pay'
},
{
name
:
'积分提现审批'
,
icon
:
'audit'
},
],
},
{
id
:
'usedcar'
,
name
:
'二手车管理'
,
icon
:
'car'
,
children
:
[
{
name
:
'数据看板'
,
icon
:
'chart'
},
{
name
:
'线索管理'
,
icon
:
'target'
},
{
name
:
'评估管理'
,
icon
:
'flask'
},
{
name
:
'运营管理'
,
icon
:
'sliders'
},
{
name
:
'车辆管理'
,
icon
:
'tool'
},
{
name
:
'交付单管理'
,
icon
:
'send'
},
{
name
:
'车辆台账'
,
icon
:
'ledger'
},
{
name
:
'离职继承'
,
icon
:
'swap'
},
{
name
:
'报告管理'
,
icon
:
'file'
},
{
name
:
'车况信息'
,
icon
:
'shield'
},
{
name
:
'一客一群(预生成)'
,
icon
:
'wechat'
},
{
name
:
'付款管理'
,
icon
:
'pay'
},
],
},
{
id
:
'system'
,
name
:
'系统设置'
,
icon
:
'settings'
,
children
:
[
{
name
:
'角色管理'
,
icon
:
'dot'
},
{
name
:
'账号管理'
,
icon
:
'dot'
},
],
},
];
/* 字数压力测试用的演示串(3/4/5/7 字),非业务文案;只替换业务域章节,工作台保持真实文案 */
const
STRESS
=
[
'运营域'
,
'门店上架'
,
'二手车管理'
,
'一客一群预生成'
];
let
state
=
{
collapsed
:
false
,
axis
:
false
,
legacy
:
false
,
stress
:
false
,
open
:
{
store
:
true
,
points
:
false
,
usedcar
:
false
,
system
:
false
},
active
:
'store:门店审批'
,
popover
:
null
,
};
/* ---------------- 渲染 ---------------- */
const
chaptersEl
=
document
.
getElementById
(
'chapters'
);
const
popover
=
document
.
getElementById
(
'popover'
);
function
domainName
(
d
,
i
)
{
return
state
.
stress
?
STRESS
[
i
]
:
d
.
name
;
}
function
isCurrentDomain
(
d
)
{
return
state
.
active
!==
'工作台'
&&
state
.
active
.
split
(
':'
)[
0
]
===
d
.
id
;
}
function
render
()
{
chaptersEl
.
innerHTML
=
DOMAINS
.
map
(
function
(
d
,
i
)
{
var
current
=
isCurrentDomain
(
d
);
var
open
=
!!
state
.
open
[
d
.
id
];
var
leaves
=
d
.
children
.
map
(
function
(
c
)
{
var
key
=
d
.
id
+
':'
+
c
.
name
;
// 二级不渲染 m.icon:后端 sys_menu.icon 字段保留(一级还要用),只是前端不读它。
return
(
'<button type="button" class="leaf'
+
(
state
.
active
===
key
?
' is-active'
:
''
)
+
'" data-key="'
+
key
+
'" title="'
+
c
.
name
+
'">'
+
'<span class="node" aria-hidden="true"></span>'
+
'<span class="txt">'
+
c
.
name
+
'</span>'
+
'</button>'
);
})
.
join
(
''
);
return
(
'<div class="chapter'
+
(
open
?
' is-open'
:
''
)
+
(
current
?
' is-current'
:
''
)
+
'" data-id="'
+
d
.
id
+
'">'
+
'<button type="button" class="chap-head" data-toggle="'
+
d
.
id
+
'" aria-expanded="'
+
open
+
'" title="'
+
domainName
(
d
,
i
)
+
'">'
+
'<span class="ico" data-icon="'
+
d
.
icon
+
'"></span>'
+
'<span class="label">'
+
domainName
(
d
,
i
)
+
'</span>'
+
'<span class="count">'
+
d
.
children
.
length
+
'</span>'
+
'<span class="chev" data-icon="chev"></span>'
+
'</button>'
+
'<div class="chap-body">'
+
leaves
+
'</div>'
+
'</div>'
);
}).
join
(
''
);
paintIcons
(
chaptersEl
);
renderSolo
();
syncActiveCopy
();
updateFade
();
}
function
renderSolo
()
{
var
el
=
document
.
getElementById
(
'solo'
);
el
.
classList
.
toggle
(
'is-active'
,
state
.
active
===
'工作台'
);
el
.
querySelector
(
'.txt'
).
textContent
=
'工作台'
;
paintIcons
(
el
);
}
function
syncActiveCopy
()
{
var
label
,
group
;
if
(
state
.
active
===
'工作台'
)
{
label
=
'工作台'
;
group
=
'工作区'
;
}
else
{
var
parts
=
state
.
active
.
split
(
':'
);
var
d
=
DOMAINS
.
find
(
function
(
x
)
{
return
x
.
id
===
parts
[
0
];
});
label
=
parts
[
1
];
group
=
d
?
d
.
name
:
'业务域'
;
}
document
.
getElementById
(
'crumbNow'
).
textContent
=
label
;
document
.
getElementById
(
'crumbGroup'
).
textContent
=
group
;
document
.
getElementById
(
'pageTitle'
).
textContent
=
label
;
}
function
applyFlags
()
{
var
app
=
document
.
getElementById
(
'app'
);
app
.
classList
.
toggle
(
'is-collapsed'
,
state
.
collapsed
);
app
.
classList
.
toggle
(
'show-axis'
,
state
.
axis
);
app
.
classList
.
toggle
(
'legacy'
,
state
.
legacy
);
document
.
getElementById
(
'tFold'
).
setAttribute
(
'aria-pressed'
,
String
(
state
.
collapsed
));
document
.
getElementById
(
'tAxis'
).
setAttribute
(
'aria-pressed'
,
String
(
state
.
axis
));
document
.
getElementById
(
'tLegacy'
).
setAttribute
(
'aria-pressed'
,
String
(
state
.
legacy
));
document
.
getElementById
(
'tStress'
).
setAttribute
(
'aria-pressed'
,
String
(
state
.
stress
));
var
fb
=
document
.
getElementById
(
'foldBtn'
);
fb
.
setAttribute
(
'aria-label'
,
state
.
collapsed
?
'展开导航'
:
'收起导航'
);
fb
.
title
=
state
.
collapsed
?
'展开导航'
:
'收起导航'
;
fb
.
querySelector
(
'span'
).
setAttribute
(
'data-icon'
,
state
.
collapsed
?
'unfold'
:
'fold'
);
paintIcons
(
fb
);
if
(
!
state
.
collapsed
)
hidePopover
();
updateFade
();
}
function
updateFade
()
{
var
n
=
document
.
getElementById
(
'nav'
);
var
more
=
n
.
scrollHeight
-
n
.
clientHeight
;
document
.
getElementById
(
'fadeTop'
).
classList
.
toggle
(
'is-on'
,
n
.
scrollTop
>
4
);
document
.
getElementById
(
'fadeBottom'
)
.
classList
.
toggle
(
'is-on'
,
more
>
4
&&
n
.
scrollTop
<
more
-
4
);
}
document
.
getElementById
(
'nav'
).
addEventListener
(
'scroll'
,
updateFade
);
function
showPopover
(
d
,
anchor
)
{
var
rect
=
anchor
.
getBoundingClientRect
();
popover
.
innerHTML
=
'<div class="p-title">'
+
domainName
(
d
,
DOMAINS
.
indexOf
(
d
))
+
'</div>'
+
d
.
children
.
map
(
function
(
c
)
{
var
key
=
d
.
id
+
':'
+
c
.
name
;
return
(
'<button type="button" class="p-item'
+
(
state
.
active
===
key
?
' is-active'
:
''
)
+
'" data-key="'
+
key
+
'">'
+
c
.
name
+
'</button>'
);
})
.
join
(
''
);
popover
.
classList
.
add
(
'is-visible'
);
popover
.
style
.
left
=
rect
.
right
+
8
+
'px'
;
var
h
=
Math
.
min
(
popover
.
offsetHeight
||
300
,
window
.
innerHeight
-
24
);
popover
.
style
.
top
=
Math
.
max
(
12
,
Math
.
min
(
rect
.
top
,
window
.
innerHeight
-
h
-
12
))
+
'px'
;
state
.
popover
=
d
.
id
;
}
function
hidePopover
()
{
popover
.
classList
.
remove
(
'is-visible'
);
state
.
popover
=
null
;
}
/* ---------------- 交互 ---------------- */
chaptersEl
.
addEventListener
(
'click'
,
function
(
e
)
{
var
head
=
e
.
target
.
closest
(
'[data-toggle]'
);
if
(
head
)
{
var
id
=
head
.
getAttribute
(
'data-toggle'
);
var
d
=
DOMAINS
.
find
(
function
(
x
)
{
return
x
.
id
===
id
;
});
if
(
state
.
collapsed
)
{
if
(
state
.
popover
===
id
)
{
hidePopover
();
return
;
}
showPopover
(
d
,
head
);
}
else
{
state
.
open
[
id
]
=
!
state
.
open
[
id
];
render
();
}
return
;
}
var
leaf
=
e
.
target
.
closest
(
'.leaf'
);
if
(
leaf
)
{
select
(
leaf
.
getAttribute
(
'data-key'
));
}
});
document
.
getElementById
(
'solo'
).
addEventListener
(
'click'
,
function
()
{
select
(
'工作台'
);
});
popover
.
addEventListener
(
'click'
,
function
(
e
)
{
var
item
=
e
.
target
.
closest
(
'.p-item'
);
if
(
item
)
{
select
(
item
.
getAttribute
(
'data-key'
));
hidePopover
();
}
});
document
.
addEventListener
(
'click'
,
function
(
e
)
{
if
(
state
.
popover
&&
!
e
.
target
.
closest
(
'.popover'
)
&&
!
e
.
target
.
closest
(
'[data-toggle]'
))
hidePopover
();
});
function
select
(
key
)
{
state
.
active
=
key
;
var
id
=
key
.
split
(
':'
)[
0
];
if
(
id
!==
'工作台'
)
state
.
open
[
id
]
=
true
;
render
();
document
.
getElementById
(
'nav'
).
scrollTop
=
document
.
getElementById
(
'nav'
).
scrollTop
;
}
/* 工具条 */
function
toggleFold
()
{
state
.
collapsed
=
!
state
.
collapsed
;
applyFlags
();
}
document
.
getElementById
(
'foldBtn'
).
addEventListener
(
'click'
,
toggleFold
);
document
.
getElementById
(
'tFold'
).
addEventListener
(
'click'
,
toggleFold
);
document
.
getElementById
(
'tAxis'
).
addEventListener
(
'click'
,
function
()
{
state
.
axis
=
!
state
.
axis
;
applyFlags
();
});
document
.
getElementById
(
'tLegacy'
).
addEventListener
(
'click'
,
function
()
{
state
.
legacy
=
!
state
.
legacy
;
applyFlags
();
});
document
.
getElementById
(
'tStress'
).
addEventListener
(
'click'
,
function
()
{
state
.
stress
=
!
state
.
stress
;
render
();
});
document
.
getElementById
(
'tAll'
).
addEventListener
(
'click'
,
function
()
{
DOMAINS
.
forEach
(
function
(
d
)
{
state
.
open
[
d
.
id
]
=
true
;
});
state
.
collapsed
=
false
;
applyFlags
();
render
();
});
document
.
getElementById
(
'tReset'
).
addEventListener
(
'click'
,
function
()
{
state
=
{
collapsed
:
false
,
axis
:
false
,
legacy
:
false
,
stress
:
false
,
open
:
{
store
:
true
,
points
:
false
,
usedcar
:
false
,
system
:
false
},
active
:
'store:门店审批'
,
popover
:
null
,
};
hidePopover
();
applyFlags
();
render
();
});
window
.
addEventListener
(
'resize'
,
function
()
{
if
(
window
.
innerWidth
<
720
&&
!
state
.
collapsed
)
{
state
.
collapsed
=
true
;
}
applyFlags
();
});
/* URL hash 直达状态,方便评审截图 / 分享具体状态:
#all 展开全部 · #collapsed 折叠栏 · #axis 对齐轴 · #legacy 旧版字距 · #stress 字数压力 */
(
function
initFromHash
()
{
var
h
=
location
.
hash
.
replace
(
/^#/
,
''
).
split
(
','
);
if
(
h
.
indexOf
(
'all'
)
>=
0
)
DOMAINS
.
forEach
(
function
(
d
)
{
state
.
open
[
d
.
id
]
=
true
;
});
if
(
h
.
indexOf
(
'collapsed'
)
>=
0
)
state
.
collapsed
=
true
;
if
(
h
.
indexOf
(
'axis'
)
>=
0
)
state
.
axis
=
true
;
if
(
h
.
indexOf
(
'legacy'
)
>=
0
)
state
.
legacy
=
true
;
if
(
h
.
indexOf
(
'stress'
)
>=
0
)
state
.
stress
=
true
;
})();
/* 首帧 */
paintIcons
(
document
.
getElementById
(
'sider'
));
render
();
applyFlags
();
if
(
window
.
innerWidth
<
720
)
{
state
.
collapsed
=
true
;
applyFlags
();
}
if
(
location
.
hash
.
indexOf
(
'bottom'
)
>=
0
)
{
var
navEl
=
document
.
getElementById
(
'nav'
);
navEl
.
scrollTop
=
navEl
.
scrollHeight
;
updateFade
();
}
</script>
</body>
</html>
packages/design-tokens/src/themeConfig.ts
View file @
561a142
...
@@ -91,29 +91,21 @@ export const themeConfig: ThemeConfig = {
...
@@ -91,29 +91,21 @@ export const themeConfig: ThemeConfig = {
siderBg
:
'transparent'
,
siderBg
:
'transparent'
,
bodyBg
:
palette
.
surface
.
page
,
bodyBg
:
palette
.
surface
.
page
,
},
},
/**
* 侧栏已改为自绘 SideNav(apps/web/shell/src/layouts/SideNav.tsx),不再渲染 antd Menu。
* 这里只保留 light Menu 仍会消费的几何 token —— 目前唯一的消费者是 BasicLayout
* 右上角头像下拉(Dropdown 内部就是 Menu)。
*
* 原先 9 个 dark* token 与 collapsedWidth 随暗色侧栏一起移除:侧栏配色、折叠宽度、
* 选中态现在全部由 design.css 的 .uj-* 规则与 <Sider> 的 width / collapsedWidth 负责,
* 两边各写一份才是漂移的来源(旧的「必须与 collapsedWidth 保持一致」注释已失效)。
*/
Menu
:
{
Menu
:
{
// —— 颜色(暗色模式)——
darkItemBg
:
'transparent'
,
darkSubMenuItemBg
:
'transparent'
,
darkItemColor
:
'rgba(255,255,255,.62)'
,
darkItemHoverBg
:
'rgba(255,255,255,.06)'
,
darkItemHoverColor
:
'#FFFFFF'
,
darkItemSelectedBg
:
'rgba(43,92,230,.22)'
,
darkItemSelectedColor
:
'#FFFFFF'
,
darkGroupTitleColor
:
'rgba(255,255,255,.32)'
,
// 折叠态弹出的子菜单底:与 .uj-sider 中段色一致,避免弹出层露出 antd 默认的深蓝黑
darkPopupBg
:
'#14204E'
,
// —— 几何:全部走 token,不在 design.css 里用 CSS 覆盖组件内部盒模型 ——
// antd 会用 itemMarginInline 参与折叠态居中计算(paddingInline: calc(50% - 图标宽/2 - itemMarginInline)),
// 所以「胶囊左右留白」必须由这个 token 给,不能用 CSS margin 顶替。
itemMarginInline
:
8
,
itemMarginInline
:
8
,
itemBorderRadius
:
6
,
itemBorderRadius
:
6
,
itemHeight
:
40
,
itemHeight
:
40
,
iconSize
:
15
,
iconSize
:
15
,
groupTitleFontSize
:
10.5
,
groupTitleFontSize
:
10.5
,
// 必须与 <Sider collapsedWidth={68}> 保持一致:Menu 折叠态有自己的 collapsedWidth,
// 两者不等会让菜单比侧栏宽(溢出)或窄(留缝)。
collapsedWidth
:
68
,
},
},
Card
:
{
Card
:
{
borderRadiusLG
:
radius
.
card
,
borderRadiusLG
:
radius
.
card
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment