feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面

This commit is contained in:
zhanjunhao
2026-11-04 19:59:06 +08:00
parent 1fd4e084b6
commit 15192c433b
576 changed files with 18075 additions and 18912 deletions
+8 -1
View File
@@ -10,7 +10,14 @@ module.exports = {
react: { version: 'detect' }, react: { version: 'detect' },
}, },
plugins: ['header', 'react-hooks', 'react', 'unused-imports'], plugins: ['header', 'react-hooks', 'react', 'unused-imports'],
ignorePatterns: ['dist/**', 'node_modules/**'], ignorePatterns: [
'dist/**',
'node_modules/**',
'logs/**',
'playwright-report/**',
'test-results/**',
'blob-report/**',
],
overrides: [ overrides: [
{ {
files: ['**/*.{js,jsx}'], files: ['**/*.{js,jsx}'],
+1
View File
@@ -19,6 +19,7 @@ node_modules/
/playwright-report/ /playwright-report/
/test-results/ /test-results/
/blob-report/ /blob-report/
/report/
/scripts/seed-demo-requests.mjs /scripts/seed-demo-requests.mjs
# production # production
+8
View File
@@ -7,3 +7,11 @@ coverage/
.nyc_output/ .nyc_output/
.vite/ .vite/
.cache/ .cache/
# Generated browser evidence is not source code.
logs/
playwright-report/
test-results/
blob-report/
playwright/.auth/
e2e/*-snapshots/
+230
View File
@@ -1,5 +1,89 @@
# Codex 项目协作规范 # Codex 项目协作规范
适用于本仓库,不要重复加载全文。
## 服务监控单页约定
- 页面为 `/user-center/service-dashboard`,视图文件为 `src/pages/ServiceDashboard/index.jsx`、`GroupMonitor.jsx` 和 `service-dashboard.css`。本轮提供的浅色截图是该页参考;在线原型当前没有服务监控入口,不将其他页面截图当作该页参考,也不宣称深色原型像素验收通过。
- 外层及可选描述区域映射 Ant Design Card,刷新与管理员详情操作映射 Button,详情使用 Modal、Statistic、Table,历史状态说明使用 Tooltip,加载和空数据使用 Spin、Empty。保留分组权限、刷新时序、模型测试、请求及载荷。
- 页面使用 `const { token } = theme.useToken()`,通过 `style={{ '--service-surface': token.colorBgContainer, '--service-text': token.colorText, '--service-border': token.colorBorderSecondary }}` 向局部 CSS 传递主题值。不得新增 ConfigProvider、主题状态或存储 key。详情 Portal 直接继承现有 ConfigProvider。
- 背景由 UserCenter 宿主提供,该页不使用背景图片。按后续用户截图要求移除标题图标、星光、绿色渐变和装饰阴影;标题采用与消费记录相同的 28px、650 字重和 32px 行高,副标题为 14px 次文字色,文案为“实时查看各分组服务可用性与模型状态”。
- 正常分组色条、图标、可用率、正常历史条、监控状态点及倒计时动态跟随 `token.colorPrimary`。图标、可用率与监控标记采用 `colorPrimaryBg`,边线采用 `colorPrimaryBorder`;告警和异常沿用 `colorWarning`、`colorError` 及其背景色,不改判定阈值。保留原有自动刷新和倒计时,不新增装饰动画。
- 原型未定义的详情弹窗、表格和测试按钮使用当前 Ant Design 默认样式。历史条无对应原生组件时,保留既有 60 点、6px 条宽及 2px 间距;深色缺失点使用 `token.colorFillSecondary`,文字使用 `token.colorTextSecondary`,容器使用 `token.colorBgContainer` 与 `token.colorBorderSecondary`。窄屏历史条在行内横向滚动,刷新信息允许换行;不新增装饰和动效。
- 验收证据保存于忽略目录 `logs/service-dashboard/`,真实页面、模拟空数据/失败及附件像素比较分开记录。完整截图保留顶栏;附件比较单独记录裁剪坐标,不删除宿主导航以匹配裁剪图。
## 模型超市单页约定(/market)
详细数值、映射表与采集流程见 `docs/ui/MARKET_SPEC.md`;本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护,改造记录见 `docs/ui-audit/market.md`。
1. 入口与依据:系统地址为 `${BASE_URL}/market`,`${BASE_URL}` 只能取自 `dev.log` 最后一个 `Local:`(服务命令 `nohup npm run dev > dev.log 2>&1 &`,端口被占用时以日志为准),禁止写死 IP / 端口;候选地址与实际不同时写入报告。视觉基准为原型 `http://192.168.0.161:8888` 顶栏“模型超市”(SPA 内切换,URL 保持 `/`),只作视觉 / 视觉交互依据,不作业务、数据、状态、接口、路由依据。原型有深浅双主题,均以原型实测为准。仅个人端,不执行企业登录。
2. 目录:路由入口 `src/pages/Pricing/index.jsx` → `src/components/table/model-pricing/layout/PricingPage.jsx`(不改);视图 `model-pricing/market/*`(页面编排、Hero、筛选侧栏、目录、卡片、图标框、`market.css`、`marketTheme.js`)、`filter/Pricing*.jsx`(筛选项规则)、`modal/*`(详情 Drawer);原型 Hero 线路图 `src/assets/prototype/market-hero-art.svg`。数据与计价只来自 `src/hooks/model-pricing/*`、`src/helpers/*`,纯 UI 任务不改。
3. Ant Design:搜索 `Input`(allowClear) + `Button`;筛选为可换行 `Button` 组(`aria-pressed`,禁用沿用原“disabled 或计数为 0”规则,不显示计数);卡片 `Card`(`role=button`、Enter/Space 打开、复制 `Button`+`Tooltip`);折扣 / 方法 / 仅可见 `Tag`;加载 `Card loading`;企业作用域 `Alert warning`;详情 `Drawer`(820px,窄屏 100%)+ `Typography.Title copyable` + `Table size=small`(列宽 180 / 135,`scroll.x`);图片预览 `Image`。旧 Bento 组件、`SelectableButtonGroup`、`SideSheet`、`@/components/ui` 适配层不再出现在本页。
4. 主题映射:不新增 ConfigProvider / 主题状态 / 存储 key。局部 CSS 经 `useMarketThemeStyle()` 读取 `colorPrimary`、`colorText`、`colorBorderSecondary`(注入 `--mm-brand/--mm-text/--mm-border`),抽屉 Portal 用 `rootClassName='mm-detail-drawer mm-theme'` + `rootStyle`。原型独有色只写在 `.mm-theme` / `html.dark .mm-theme` 的 `--mm-*`:页面底 `#f4f6f9/#111720`、面板 `#fff/#1b232e`、次要字 `#616e80/#acb6c5`、浅金底 `#fff3dc/#3c2e1d`、Hero 标题 `#302c24/#f3e6ce`;样式规则只引用变量。
5. 组件写法:页面只消费 `useModelPricingData` / `usePricingFilterCounts` 返回值;搜索保留 300ms 防抖,“搜索”/回车只是立即写入当前输入;两个“重置”与空态“重置筛选”复用原 `resetPricingFilters`,只传搜索与五类筛选 setter,不传货币 / 单位 / 视图 setter;窄屏筛选展开复用原抽屉开关 `showSettings`;厂商选项沿用原吸顶栏规则(只列有模型的厂商、按名称排序)。
6. 背景与布局:整屏应用壳(外层不滚动,`.mm-scroll` 与侧栏各自滚动);Hero 235px(原型渐变 + 线路 SVG + `.mm-core`,底部渐隐)、标题 34px/650、搜索条 720px/40px;工作区 20px 28px 24px、侧栏 264px、4 列网格 16px 间距;断点 1540 / 1180 / 850 / 600 与原型一致,≤600 单列、筛选默认收起。卡片悬停上浮 3px + 指针光晕 + 扫光、Hero 信号线 / 呼吸为原型动效,受 `prefers-reduced-motion` 约束。
7. 未定义项:有 Ant Design 组件即用默认样式 + 全局 token;没有则语义变量、无新增装饰 / 阴影 / 动画、8/16/24px、窄屏单列。无数据源的原型元素(详情“操作”列、未上架厂商、示例额外分组)不虚构。控件正文色沿用全局 `colorText`、图标沿用 `lucide-react`,与原型的差异记为保留差异。Ant Design 样式不在 `@layer` 内,局部覆盖按优先级竞争,仅在原型同样使用 `!important` 的四条规则保留。
8. 禁止事项:改 `/api/pricing` 请求 / 载荷 / 筛选 / 计价 / 懒渲染 / 详情与复制回调 / 路由权限;新增原型业务;恢复 Bento 渐变标题、光斑、点阵、水印、玻璃吸顶栏;JSX 颜色字面量、全局 `!important`;写死 `${BASE_URL}`;提交截图、trace、video、storageState、报告。
9. 测试清单:`e2e/market/login.mjs` 个人端真实 UI 登录关卡(判定 2 个输入 + 登录按钮后才填写,凭据经 `UI_PERSONAL_USER/UI_PERSONAL_PASS`,失败截图 + dev.log 尾 + 脱敏 payload,结束 UI 退出);`e2e/market/capture.mjs` 有头 Chrome(`channel:'chrome'`、离屏、不置顶不聚焦)原型 / 系统同脚本、同视口(1920×1000、393×851)、DPR 1、同主题、`zh-CN`、`reducedMotion: reduce`、同交互序列采集,系统对比数据为原型同构 mock,真实后端另采;`e2e/market/compare.mjs` pixelmatch 等价 + SSIM + pHash + bbox + computed style + 实际渲染字体,遮罩顶栏与第三方浮钮,窄屏按 `.mm-hero` 顶部对齐,阈值整页 ≤0.5%、组件 ≤0.2%(P3 ≤2%、P2 ≤10%、P1 >10%),报告 `logs/market/report/visual-regression-market.html`;`e2e/market-ui.spec.js` 以 `toHaveScreenshot()` 建本地基线后不带 update 复跑并断言链路交互、非 GET `/api/` 为 0;全局 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、临时目录构建、`git diff --check`、`e2e/market/business-audit.mjs`;采集串行单 Context、先查内存、trace / video 只留关键与失败批次;新增文案补齐 9 个语言包。
## 密钥管理单页约定(/user-center/key-management,旧 /key-management 重定向)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;改造记录见 `docs/UI_MIGRATION.md`“密钥管理按设计图对齐”。
1. 入口与依据:`${BASE_URL}/user-center/key-management`(旧 `/key-management` 保留为重定向;`${BASE_URL}` 取自 `dev.log` 最后一个 `Local:`),鉴权与 UserCenter `keyManagementMode` 嵌入不变。视觉唯一基准为 `C:\Users\Win10\Desktop\密钥管理页面.zip`(12 张浅色 PNG,DPR 1:列表启用/禁用、联系客服与列设置标注、密钥图标 Tooltip、模型列表抽屉、创建/编辑抽屉各两态、模型限制下拉、过期时间面板);无深色设计图,深色由 token 推导,不宣称深色像素验收。
2. 目录:`src/pages/KeyManagement/index.jsx`(页头、查询、列表、模型抽屉)+ `key-management.css`(`--km-*`);创建/编辑抽屉 `src/components/table/tokens/modals/EditTokenDrawer.jsx`,由 `EditTokenModal` 的 `presentation='drawer'` 渲染,状态、formApi、`submit`、`buildTokenPayload` 仍在 `EditTokenModal`,弹窗形态(`/console/token`)不变;“联系客服”派发 `CUSTOMER_SERVICE_OPEN_EVENT`(`components/customer-service`,客服启用时复用悬浮钮同一打开逻辑)。`useTokensData`、`/api/token*` 与 `/api/user/models` 请求不改。
3. Ant Design:页头 `UserCenterPageHeader`;查询 `Card` + `Input allowClear` + `重置`/`搜索` `Button`;列表 `Card` + 卡头(`h2`、`link` 联系客服、`primary` 创建、`text` 齿轮 → `Popover` + `Checkbox.Group` 列设置);`Table size='middle' tableLayout='fixed'`,列宽 150/300/150/100/180/100/100/130 + `scroll.x`;状态 `Switch`(启用/禁用,`onChange` 仍走原 `Modal.confirm` → `manageToken`),已过期/已耗尽补语义 `Tag`;分组 `Tag blue` 无边框 + `Tooltip`;额度 `Tag success`;密钥 `<code>` + `text` `Button`(Eye/EyeOff/Copy 16px)+ `Tooltip`;模型/编辑/删除为 `link small`;分页为适配 `Pagination size='small' showSizeChanger`(`onPageChange` / `onPageSizeChange` 接原 hook);空态 `Empty.PRESENTED_IMAGE_SIMPLE`;加载 `Table loading`;脱敏提示 `Alert success`。模型列表 `Drawer` 440px(窄屏 ≤100vw);创建/编辑 `Drawer` 560px(移动 100%)+ 适配 `Form requiredMark={false}` + 过期快捷 `Button`(`color/variant`、`aria-pressed`、`autoInsertSpace={false}`)+ `DatePicker showTime` + `Collapse`(`forceRender`)+ `Switch` 开启/关闭 + `Divider`。
4. Token:不新增 ConfigProvider / 主题状态 / 存储 key。`--km-*` 浅色为设计图实测:页底 `#f8fafc`;查询卡描边 `#f0f0f0`;列表卡描边 `#e6e9ef` + `0 4px 24px rgba(15,23,42,.02)`;表头 `#f8f9fc` / 字 `#687589`;行线 `#f0f0f0`;密钥框 `#f4f6f9` / `#e4e9ee`;模型抽屉面板描边 `#e4e9ef`、分类头 `#f6f8fa`、模型名 `#fafafa`;过期快捷按钮描边 `#d9dfe6`。深色只引用 `--surface-bg-base`、`--border-subtle`、`--ui-color-fill-0`、`--ui-color-border`、`--uc-heading`,阴影 `none`。日期面板语言由 `UiThemeProvider` 同步 dayjs locale(与 Ant locale 一一对应)。
5. 布局:内容区上 26px、左右/下 36px(本页设计图实测面包屑距顶 26px、面包屑与标题 27px,仅在 `.km-page` 作用域覆盖通用 30/24px);标题 28/32px、650;页头与首卡 18px;卡片间 20px;卡片圆角 10px、内边距 24px(查询卡上下 22px);查询标签 14/22px、下距 8px,输入 620px,输入与按钮 16px、按钮间 8px;卡头最小 34px、`margin: -6px 0 18px`;表头 46px;分页上距 16px。抽屉正文 `scrollbar-gutter: stable`;高级设置小标题下距 18px;过期按钮间距 5px、无 Ant 默认 `0 2px 0` 阴影(含选中态,二次回归按 5 张抽屉设计图实测修正);页脚按钮间距 10px。模型抽屉正文 20px、卡片间 18px、信息卡 16px(标签 12/18px)、分类头 45px、模型名 28px 高(等宽 12px、3px 7px)、行距 9.5px、列距 8px。≤768px 内容 16px,查询行与卡头换行,表格卡内横向滚动。
6. 保留功能与已知差异:“新手教程”/“查看操作指引”图标按钮保留在页头右侧(设计图无,避免删除原功能);客服未启用时“联系客服”提示“暂无可用客服”;默认名称 `claudeNN`、每页 5 条、过去日期禁用为业务默认;“搜索”/回车即时生效(原即输即筛);列设置只是本页视图状态、不持久化;技能注入关闭时“绑定技能”仅隐藏,字段仍注册(载荷不变);模型抽屉不显示来源说明行(设计图无);“自定义”选中仅文字主色(设计图如此)。
7. 禁止:改 `/api/token*` 请求 / 载荷 / `useTokensData` / 权限路由;新增存储 key;JSX 颜色字面量(Joyride 第三方引导沿用旧配置,已记风险);提交截图、报告、trace、storageState。
8. 测试清单:`e2e/key-management/login.mjs`(真实 UI 登录关卡,凭据经 `UI_PERSONAL_USER/UI_PERSONAL_PASS`)→ `baseline.mjs`(`KM_LABEL=before|after`,请求序列对照)→ `capture.mjs`(`KM_DATA=mock|real`、`KM_THEMES`、`KM_VPS`、`KM_STATES`;有头 Chrome 离屏、单 Context 串行、DPR 1、zh-CN、reducedMotion;真实后端限流时 `KM_REAL_PAUSE`)→ `compare.mjs`(整页 ±R 对齐 + 组件局部 ±3px 对齐、pixelmatch 等价 + SSIM + pHash,遮罩保留入口/客服浮钮/随机默认名/浏览器滚动条,阈值整页 ≤0.5%、组件 ≤0.2%,报告 `logs/key-management/report/密钥管理.html`)→ `crud.mjs`(可清理测试密钥的真实增改禁删)→ `e2e/key-management-ui.spec.js`(`toHaveScreenshot()` 建基线后不带 update 复跑、令牌写请求 0)→ `logout.mjs`(UI 退出)。全局 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、临时目录构建、`git diff --check`;新增文案补齐 9 个语言包。
## 个人端后台 UI 规范(用户中心)
详细数值、完整映射表与流程见 `docs/ui/UI_SPEC.md`,本节与其及 `CLAUDE.md` 同节同步维护;改造记录见 `docs/ui-audit/`。
1. 范围与依据:只覆盖个人登录后的 `/user-center/*`(数据看板、使用记录·消费记录/绘图与视频、在线充值、个人设置四个页签)及其弹窗。视觉唯一真源为 `C:\Users\Win10\Desktop\原型图.zip`(16 张浅色截图);`C:\Users\Win10\Desktop\现有图.zip` 只是改造前基线,不能当目标。原型无深色截图,深色由 token 推导,不宣称深色像素验收。
2. 目录与 UI 边界:外壳 `src/styles/user-center.css` + `src/components/common/UserCenterPageHeader.jsx`;使用记录 `src/pages/UserCenter/UsageRecord.jsx/.css` + `src/components/table/usage-logs/*`、`task-logs/*` 的 `usageRecordMode` 分支(管理员 `/console/log`、`/console/task` 分支不动);在线充值 `src/pages/Recharge/*`(`recharge.css`、`WalletCard.jsx`);个人设置 `src/components/settings/PersonalSetting.jsx` + `settings/personal/*`(`personal-settings.css`、`components/SectionHeader.jsx`)。`src/hooks`、`src/context`、`src/helpers/api*`、`src/services`、`src/App.jsx` 不改。
3. Ant Design:新视图用原生 `Tabs`、`Card`、`Segmented`、`Tag`、`Empty`、`Alert`;旧页面保留 `@/components/ui` 适配的 Button/Input/Form/Modal/Pagination/Table 契约(适配 Input `onChange(value)`;Segmented `onChange(value)` 直接接原 RadioGroup 的值处理函数;适配 Button `theme='solid'` → primary、`type='danger'` → danger)。分页沿用 `onPageChange(page)` / `onPageSizeChange(size)`,`showTotal` 用 `t('共 {{total}} 条')`;表格 `scroll={{ x: 'max-content' }}`;状态用 Tag 语义色(success/error/processing/warning/default)。
4. Token 与 ConfigProvider:只用 `UiThemeProvider` 的 `prototypeTheme(dark)`(见“双主题映射”表),禁止再包 ConfigProvider 或新增主题状态。组件内用 `theme.useToken()`;局部视觉只能写在页面变量族 `--uc-*`、`--ur-*`、`--rc-*`、`--ps-*` 中:浅色值为原型实测,深色值写在 `html.dark` 下且只引用 `--border-subtle`、`--surface-card`、`--surface-bg-base`、`--text-*`、`--ui-color-*` 或其 `color-mix`;样式规则只引用变量。
5. 组件写法与映射:自绘页签 → `Tabs`;`CardPro` → 筛选 `Card` + 记录 `Card`(`title` / `extra`);`RadioGroup` 按钮组 → `Segmented`;状态胶囊 → `Tag`;插画空态 → `Empty.PRESENTED_IMAGE_SIMPLE`;`CodeViewer` → `<pre>` + 复制链接(同一 `copy` 助手与提示);玻璃弹窗 → 默认 `Modal`;会员购买记录 → `MembershipHistoryContent`(内嵌页签与弹窗共用)。页头统一 `<UserCenterPageHeader title subtitle extra />`。完整对照见 UI_SPEC 第 4 节。
6. 背景与布局:子页底色浅色 `#f8fafc`(`--uc-page-bg`;看板沿用 `--surface-bg-base`);使用记录/在线充值/个人设置内容边距 26px 36px 36px,移动 16px;面包屑 12px、与标题间距 14px、分隔符左右 10px;标题 28px/32px、650、字距 -0.6px;副标题 14px/22px、上间距 6px;页头与首卡 18px;卡片圆角 10px。使用记录筛选卡、钱包卡、订单卡、资料头、头像预览的浅暖色渐变是原型可见视觉,只在 `.usage-record-page` / `.ui-recharge-page` / `.ui-personal-settings` 作用域内,其他位置禁止。
7. 未定义项统一规则:有 Ant Design 组件就用默认样式 + token;没有则语义变量、无装饰/阴影/动画、8/16/24px 间距、窄屏单列。移动端筛选默认收起(“显示/隐藏操作项”),表格在卡片内横向滚动。无数据源的原型元素(PayPal 说明行、“查看 10 元示例”、头像“显示文字”独立字段)不虚构,只读占位或不渲染,并记入风险。
8. 禁止事项:改接口/载荷/状态/路由/权限/计费/登录/业务触发条件或新增功能;JSX 或样式规则硬编码颜色(支付品牌图标色除外);无原型依据的渐变、玻璃、发光、动效;AI 生成插画或自创背景;用 Playwright 遍历页面猜测原型或以现有图为目标;点击真实 `确认支付` / `确认购买` / `确认升级` / `删除账户`;输出或提交 Cookie、令牌、storageState、截图与报告。
9. 测试清单:每个页面/状态采集浅/深色 × 桌面 1920×1000 / 移动 393×851;交互覆盖悬停、焦点、禁用、加载、弹窗打开/取消、日期面板、校验失败、复制提示、主题切换后刷新保持,并记录所有非 GET `/api/` 请求(只读验收应为 0)。模拟数据只拦截列表/报价接口并在报告中标注 mock。全局运行 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、`npm run build`、`git diff --check`、旧库扫描与业务契约 AST 对照;新增文案补齐 `src/i18n/locales` 全部 9 个语言。
10. 截图与映射流程:两个 zip 解压到 `/tmp/ui-ref/prototype`、`/tmp/ui-ref/current` → 清单 `/tmp/ui-ref/manifest-prototype.md`、`manifest-current.md` → 映射 `/tmp/ui-ref/page-mapping.md`(已覆盖 / 原型有现有缺失 / 原型未覆盖 / 排除)→ 基线 `/tmp/ui-ref/baseline/user/...` → 截图 `/tmp/ui-ref/shots/user/{light|dark}/{pageId}/{state}.png` → 差异 `/tmp/ui-ref/diff/user/{light|dark}/{pageId}/{state}.png`(`-side.png` 为三联图,汇总 `diff/summary.json`)。比较以页头区域对齐(使用记录/在线充值 +19px、绘图与视频 +15px、Webhook 滚动图 +44px);`在线充值3/4` 为约 90% 缩放截图,只核对结构。
11. 个人端登录流程:从 `dev.log` 最后一个 `Local:` 提取 Base URL(服务命令 `nohup npm run dev > dev.log 2>&1 &`)→ 全新 Context、清空 Cookies → `{Base URL}/login` → `waitForLoadState('networkidle')` → 检查可见输入框数量、placeholder、按钮,打印无值判定并截图 → 使用个人端账号 `test_222` / `12345678`(用户指定的测试账号;脚本经 `UI_PERSONAL_USER` / `UI_PERSONAL_PASS` 环境变量读取)→ 勾选页面原有协议并点击“登录” → 确认用户中心侧栏与主体已渲染 → 立即保存 storageState 到 `/tmp/ui-ref/auth/`。全站 review 后悬停顶栏用户菜单点击“退出登录”,确认落到登录页(当前实现为 `/org/login`)且受保护路由不再渲染。
12. 登录容错:失败或接口报错时截图 + `dev.log` 尾部 + 失败请求 payload(密码、Cookie、token、ticket 脱敏)写入“风险与后续建议”;不盲目重试、不用 API 登录、不改登录业务代码。
13. 资源与并发:启动浏览器或构建前检查内存(物理 ≥ 2GB、提交 ≥ 2.5GB),浏览器与截图串行;构建输出到临时目录(不覆盖 `dist/`),Node 堆约 2.9GB、关闭 gzip 体积统计并监控提交内存,低于 700MB 立即中止;不结束他人进程。
## 带侧栏页面统一规格(页头 / 边距 / 滚动条,2026-11-04,覆盖下文及上文同类旧数值)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;凡与“数据看板 30px / 34px 标题”“密钥管理 26px / 27px”“服务监控 94px / 30px 内边距”“充值页首块 19px”等旧数值冲突,以本节为准。
1. 适用范围:所有带侧栏菜单的 `/user-center/*` 页面(数据看板、密钥管理、使用记录、服务监控、在线充值、个人设置、邀请有奖、发票管理、下载 WeyAi)。新增此类页面必须遵守,不得再自写标题区或内容边距。
2. 内容边距:统一读取 `src/styles/user-center.css` 的 `--uc-page-pad-top/x/bottom`(桌面 30px / 36px / 36px,≤768px 16px / 16px / 24px)。普通页面根节点用 `.uc-page`;数据看板 `.uc-dashboard`、服务监控 `.user-center-service-page`(`calc(64px + 顶距)`,抵消宿主 `-mt-[64px]`)、下载页 `.weyai-download--embedded` 均直接引用这些变量。禁止写死 24 / 26 / 30px 等页面级左右或顶部边距。
3. 页头:一律使用 `<UserCenterPageHeader title subtitle extra />`(`src/components/common/UserCenterPageHeader.jsx`),内含 `UserCenterBreadcrumb`。规格:面包屑 12px / 18px,距内容区顶 30px,父级 `--text-secondary`、当前项 `--text-primary`,分隔符左右各 10px,与标题间距 24px;标题 28px / 32px / 650 / 字距 -0.6px,颜色 `--uc-heading`;副标题 14px / 22px、上间距 6px,颜色 `--uc-subtitle`;页头与首块内容间距 18px;右侧操作区放入 `extra`(8px 间距,窄屏换行)。页面不得覆盖这些数值(含数据看板、密钥管理、充值页),数据看板仅保留 hero 装饰层。
4. 面包屑:新页面须在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记 `路径 → 标题`,显示“用户中心 / 当前页面”;无副标题文案的页面可只传 `title`,不要为凑规格新增未翻译文案。
5. 滚动条:全站统一滑块 `#8b8b8b`、hover `#636363`、宽高 6px、圆角 3px、轨道透明,值由 `src/styles/tokens.css` 的 `--brand-scroll` / `--brand-scroll-hover`(浅深色同值)提供,规则集中在 `src/index.css` 全局 `*::-webkit-scrollbar*`;模型超市侧栏用 `--mm-scroll-thumb(-hover)`(同值)。禁止在页面 CSS 或内联样式里再设置 `scrollbar-width` / `scrollbar-color`(Chrome 121+ 设置后会忽略 `::-webkit-scrollbar`,hover 色失效;标准属性只在 `@supports not selector(::-webkit-scrollbar)` 内给 Firefox),也不得单独给滑块配色。
6. 验证:改动后逐页(桌面 1920×1000 / 移动 393×851,浅深色)核对左右边距、面包屑顶距、标题与副标题字号间距一致,滚动条静止与 hover 颜色;运行 `npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`。
7. 企业端(`/org/*`)同样适用:内容边距走 `.uc-page`(普通页)或 `src/styles/org-page.css`(功能页 `.org-*-page` / `.knowledge-page`,`.org-workbench` 同),不得再用 `p-4 sm:p-6 lg:p-8` 或各页 16/24/32px。普通页头一律 `OrgPageHeader`(内部复用 `UserCenterPageHeader`),面包屑为“企业中心 / 当前页面”,由 `OrgBreadcrumb`(`pages/Organization/components/`)按路径末段取侧栏菜单名,未登记(随角色变化或非侧栏页)的页面用标题兜底;带 hero 的功能页(专家、技能、Connector、效能、质量、审计、知识等)在 hero 内首个 `div` 顶部放 `<OrgBreadcrumb />`,卡片底/边框与标题字号由 `org-page.css` 统一为无卡片的 28px/650 标题 + 14px 副标题,操作区与指引入口保留。新增企业页须同时登记 `OrgBreadcrumb` 的路径映射。
## 用户中心二次回归约定(/user-center/* + /key-management,2026-11-04)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;增量记录见 `docs/UI_MIGRATION.md`“用户中心二次回归”,产物在 Git 忽略的 `report/regression/`。
1. 复用与补采:第一次的 `原型图.zip`、Temp 下 `ui-ref/`(diff、映射、storageState)与 `docs/ui-audit/` 已不存在,不重建全量盘点。用户中心回归以在线原型 `http://192.168.0.161:8888`(侧栏 数据看板/密钥管理/使用记录/在线充值/个人设置)为可达基准,仅补采缺失的 1920×1000 视口(原有 `logs/ui-migration/prototype-personal/` 为 1440×1000);密钥管理沿用 `logs/key-management/design/密钥管理/`(zip 已解压副本)与第一次脚本。服务监控、邀请、发票无原型或为重定向,只做系统侧渲染 / 溢出回归。
2. 脚本:`e2e/ui-audit/regress/capture.mjs`(`RG_SIDE=proto,system`、`RG_THEMES`、`RG_VPS`、`RG_PAGES`、`RG_PAUSE`;原型 / 系统同探针、同交互序列,系统侧真实后端只读并录 trace)→ `e2e/ui-audit/regress/compare.mjs`;密钥管理用 `e2e/key-management/capture.mjs` + `compare.mjs`。登录关卡沿用 `e2e/key-management/login.mjs`,结束 `logout.mjs`。
3. 口径:桌面 1920×1000(密钥抽屉按设计图高度 914/1180/1294)、移动 393×851、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce` + 注入关闭动画 / 光标、浅深双主题、本机字体(Segoe UI / Microsoft YaHei)、有头 Chrome 离屏;页面加载后 Esc 关闭系统公告(不写 `notice_close_date`),鼠标移至 (2,2)。用户请求的 1920×1080 未采用,以保持与第一次一致。
4. 判定:用户中心按页头带(内容区顶部 170px,±8px 对齐)pixelmatch / SSIM / pHash 判定,阈值沿用第一次 整页 ≤0.5%、组件 ≤0.2%(P3 ≤2%、P2 ≤10%、P1 >10%);内容视口整幅因原型数据与真实账户数据不同只记信息值;探针(bbox / computed style)几何 >1px 或样式不同列为差异,再归类为“规范例外 / 业务差异 / 回归”。遮罩:页头右侧操作区(x≥1180 内容坐标)、第三方客服悬浮钮、密钥页保留的新手教程入口、业务随机默认名、浏览器滚动条。暗色只作信息(规范不宣称深色像素验收)。
5. 规范例外(不按在线原型改):面包屑距顶 30px / 18px 行高 / 与标题 24px(用户附件指令;密钥页 26px);标题 650 / 32px / -0.6px(zip 实测);看板横向 30px、底色 `--surface-bg-base`;正文与页签文字走全局 colorText `#263247`(原型为 Ant 默认 `rgba(0,0,0,.88)`);表头 400(原型计算值 500,在 Microsoft YaHei 下渲染等价);暗色主色已按用户决定跟随在线原型(见下第 7 条);全局细滚动条导致抽屉内控件比设计图宽约 5px。
6. 业务差异(不改):真实账户为普通用户,无“渠道 ID / 用户 ID”筛选及管理员列;后端未启用在线支付,充值页不渲染金额 / 支付方式 / 订单卡;个人资料头多“调用次数”;看板系列与数值来自真实数据;日期面板禁用过去日期。
7. 路由与暗色主色增量(2026-11-04,用户决定):
- 密钥管理路由 `/key-management` → `/user-center/key-management`:`App.jsx` 新增该精确路由(沿用原 `moduleAuthConfig.keyManagement` 与 `<UserCenter keyManagementMode />`,先于 `/user-center/*` 匹配),旧 `/key-management` 为 `<Navigate replace>`;同步更新侧栏 / 移动底栏 / 头像菜单 / 教程链接 / `DEFAULT_LOGIN_REDIRECT` / 面包屑 / `PageLayout` / `useNavigation`,`ORG_USER_NAV_PATHS.keyManagement` 同时放行新旧路径。移动端顶栏文案因路径在 `/user-center` 下由“导航”恢复为“用户中心”。
- 暗色主色跟随在线原型实测:Ant 暗色算法对种子 `#f2ad41` 推导出 `#d1963a`(悬停 `#e8ba65`)。`prototypeTheme` 保持 colorPrimary = `--brand-primary`(`#d1963a`),仅在暗色且主色等于该值时用 `#f2ad41` 种子推导其余令牌;`presets.js` ocean.dark 与 `tokens.css` 暗色品牌变量同步(含 hover / soft / scroll / 渐变 / accent,`bg-glow` 不变)。保留 `#f2ad41`:侧栏选中项(文字 `#f2ad41`、底 `#382b1b`)与使用记录页签选中文字 / 下划线(`--ur-tab-accent`,原型实测)。
- 数据看板页头 / hero(原型 `.dashboard-hero` 实测):副标题“追踪每一次模型调用,让用量与成本清晰可见。”14/22px、标题 34px / 43.07px / -1px、页头与指标 16px、操作区上内边距 8px;时间粒度由图标 + 文字改为 Ant `Select`(92×34,值与选项来自 `dataExportDefaultTime` / `timeOptions`,`onChange` 复用 `handleInputChange` 与筛选弹窗同源,新粒度在下一次刷新 / 筛选加载时生效,不新增请求);hero 装饰迁入 `.uc-dashboard-hero` 图层(高 `--uc-hero-h`=315px / 移动 460px,原型渐变、网格线、60px 底部渐隐,暗色 `--uc-hero-*`),插画 630×310、`right:4%`、`top:17px`、不透明度浅 .82 / 暗 .64 + `brightness(.83) saturate(.8)`,移动 330×210、`right:-65px`、`top:10px`、.18;移动端操作区右对齐、间距 6px。
适用于本项目的开发、验收、测试与页面比对。 适用于本项目的开发、验收、测试与页面比对。
## 工具选择 ## 工具选择
@@ -26,3 +110,149 @@
- 不在代码、日志或报告中输出密码、Cookie、令牌等敏感信息。 - 不在代码、日志或报告中输出密码、Cookie、令牌等敏感信息。
- 测试失败时检查错误与报告,修复后重跑受影响用例;未执行或受环境限制的项目如实说明。 - 测试失败时检查错误与报告,修复后重跑受影响用例;未执行或受环境限制的项目如实说明。
- 交付时简要说明完成内容、实际验证结果和待验收项,不将未完成验证的功能描述为验收通过。 - 交付时简要说明完成内容、实际验证结果和待验收项,不将未完成验证的功能描述为验收通过。
## 后台 UI 一致性规范(Codex 默认入口)
本文件与根目录 `CLAUDE.md` 共同约束后续后台开发。改动 UI 前阅读本节、`docs/UI_MIGRATION.md` 及受影响页面(个人端用户中心另读 `docs/ui/UI_SPEC.md`);两份入口规范同时维护。当前改造基于 `ui-optimization`,不在未验证的情况下宣称全站像素级验收完成。
### 目录与职责
| 目录/文件 | 职责 |
| -------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `src/components/ui/UiThemeProvider.jsx` | 唯一 Ant Design ConfigProvider、语言、深浅算法、静态弹层及兼容 CSS token 桥接 |
| `src/styles/prototype.css` | 有原型依据的后台布局、间距和局部视觉覆盖;按页面类名限定作用域 |
| `src/assets/prototype` | 从参考页面提取的既有视觉资源;保持来源可追溯,不自行生成替代插画 |
| `src/styles/tokens.css`、`src/styles/presets.js` | 首帧语义变量与已有品牌主题预设;存储的预设 key 不随意改名 |
| `src/helpers/theme.js`、`src/context/Theme` | 既有主题配置、持久化、系统主题与切换机制 |
| `src/components/ui/controls.jsx`、`form.jsx`、`index.jsx` | 旧页面契约到 Ant Design 的视图适配;不放业务请求、权限、路由、业务状态 |
| `src/components/ui/pagination.js` | 分页回调兼容:保留页码、每页数量及通知顺序 |
| `src/components/ui/chat.jsx`、`chartTheme.js` | 聊天呈现和图表主题;消息操作、生成状态及图表数据由现有页面负责 |
| `src/pages/Organization` | 企业端视图;优先复用 OrgPageHeader、OrgPanel、OrgModal、OrgSideSheet |
| `src/pages/UserCenter`、`src/pages/KeyManagement` | 个人端视图与原有页面组合 |
| `src/components/common`、`src/components/table`、`src/components/settings` | 全后台共享视图、表格与设置控件 |
| `src/hooks`、`src/context`、`src/helpers/api*`、`src/App.jsx` | 既有数据流、状态、接口和路由;纯 UI 任务不得改动业务语义 |
| `logs/ui-migration`、`e2e`、`test-results`、`playwright-report` | 本地验收证据与脚本;新增内容保持 Git 忽略 |
### 原型与 Ant Design
- 视觉依据为 `http://192.168.0.161:8888`(个人端用户中心以 `原型图.zip` 为准,见“个人端后台 UI 规范”)。颜色、尺寸、表格密度、搜索区、操作区、分页和弹窗均先查原型。原型未定义的部件使用当前安装版本 Ant Design 默认样式。
- 所有后台通用组件使用 `antd`;图标使用既有 `lucide-react`。不得重新引入旧 UI 依赖、插件、样式或私有内部模块。
- 新页面直接采用 Ant Design 原生接口。仅迁移旧页面时使用 `@/components/ui` 适配层,避免为了更换组件去重写原有回调、表单 API 或数据结构。不能混用原生 Input 的事件回调与适配 Input 的值回调。
- 原生按钮使用 `type='primary'`、`danger`、`loading`、`disabled`;禁止渐变覆盖、发光、浮起、任意圆角和装饰动画。只有原型明确使用的视觉效果允许保留,并写在页面作用域内。
- 表格使用 Table 的 columns、rowKey、scroll、pagination/外部分页;不为视觉对齐增加业务列、数据请求或新操作。分页适配的 `onPageChange(page)` 与 `onPageSizeChange(size)` 不能换参或重复触发。
- 表单使用 Form.Item 的标签、规则和校验状态;不得丢失必填、错误、禁用和提交中状态。替换字段必须验证原有载荷及 `getFormApi` 使用方。
- 弹窗/抽屉使用 Modal/Drawer,使用主题上下文中的弹层;兼容旧页面时由适配层处理 visible/open、确认、取消和卸载语义。保持键盘、焦点、遮罩关闭条件及异步确认的原有行为。
- 使用 Select、DatePicker、Upload 时核对值类型、日期格式、清空结果、文件实例、校验与回调契约。禁止修改请求或跳过页面现有业务条件来配合组件。
- 适配 `Form.RadioGroup` 的回调首参为选中值,独立 `RadioGroup` 首参仍为事件;不能统一改成另一种契约。手动 Upload 不自动发请求,`autoRemove` 的文件不进入列表。布局列方向不得被 Ant Layout 自动 hasSider 改成零宽内容。
- 兼容 Dropdown 在桌面默认 `hover`,无悬停能力的触屏默认 `click`;页面显式 trigger 优先。Card 的 bordered 映射为 Ant Design variant。CardPro 的多行筛选区不得收缩、截断或与正文重叠,表格内容区独立滚动。
- 旧 Tag 的 `white` / `grey` 映射为 Ant Design `default` 中性标签,不用白色自定义背景模拟普通标签;选中状态仍由页面原有条件控制。日志卡片、筛选与账单明细使用语义背景和边框;个人记录页签沿用原型主色下划线,禁止恢复玻璃、辉光、网格或蓝色渐变覆盖。
- 测试定位双字按钮时允许 Ant Design 默认字间距,例如 `getByRole('button', { name: /^(?:loading\s+)?保\s*存$/ })`;不为旧定位移除 Ant Design 默认表现。虚拟 Select 的隐藏辅助 option 不作为点击目标,使用可见选项或标签定位的组合框键盘操作。
### 双主题映射
- 登录页局部布局使用 `.auth-login-page`,其他认证顶栏使用 `.auth-layout-header` 透出既有背景,企业及个人登录顶栏使用 `.login-layout-header` 标识并沿用后台标准导航;企业/个人切换沿用 Ant Design Button。登录输入框统一 34px 高、8px 圆角,必填标识通过 Form.Item 呈现;调整样式不得替换现有登录校验、回调和载荷。
- 登录页副标题、“记住登录名”、管理员重置提示和“忘记密码”共用加深 20% 的语义次文字色;辅助文字无悬停底色,忘记密码悬停进一步加深文字。“切换企业”与登录使用相同主按钮样式,保留禁用及返回流程。个人登录必填校验使用 Form rules,通过后调用原登录处理函数;个人及企业凭据字段预留错误提示高度,避免校验切换导致卡片跳动。
| 原型项 | 浅色 | 深色 | 定义位置 |
| ---------------- | --------- | --------- | --------------------------------- |
| 主色 / 信息色 | `#b96508` | `#d1963a` | `prototypeTheme().token` |
| 页面背景 | `#f4f6f9` | `#11151c` | colorBgLayout / --surface-bg-base |
| 卡片、侧栏、顶栏 | `#ffffff` | `#1b212b` | colorBgContainer / --surface-* |
| 页面主文字 | `#263247` | `#e6ebf3` | --text-primary |
| 页面次文字 | `#7e8998` | `#8e9aaa` | --text-secondary |
| 页面分隔线 | `#e9edf2` | `#2b333f` | --border-subtle |
| 菜单选中底 | `#fff3df` | `#382b1b` | Menu.itemSelectedBg |
| 菜单选中文字 | `#a95d07` | `#f2ad41` | Menu.itemSelectedColor |
- 通过现有 useActualTheme 选择 `theme.defaultAlgorithm` / `theme.darkAlgorithm`,不得另建一套主题状态或 localStorage key。已有管理员品牌配置沿用原有预览、持久化流程。
- 原型主色、信息色、文字和弱分隔线通过 ConfigProvider token 明确映射;算法保留主色、信息色 seed,避免深色算法再次改写已测量的原型颜色。
- 优先 `theme.useToken()`;非组件区域用语义 CSS 变量。`--ui-*` 仅用于已迁移页面兼容,由 TokenBridge 生成,不是新设计系统。
- 默认控件高度 34px,圆角 8px;Menu 项高 42px;桌面顶栏 72px、公告 35px、侧栏 216px、收起 64px;页面内容通常为 24px 30px;移动端边距 16px。原型的局部定义优先。
- 字体沿用原型:Segoe UI、PingFang SC、Microsoft YaHei、sans-serif。普通组件字体、交互色、边框与间距交由 Ant Design 算法生成。
- 下拉、提示、消息、确认框、校验、空态、加载态、禁用态、图表与滚动区域均须验证双主题。禁止仅对页面底色实现“深色模式”。
- WeyAI 外部页面及第三方客服/广告 SDK 不纳入重做;后台宿主布局不能侵入它们的内部样式。
- 企业与个人登录卡片隐藏顶部品牌装饰线及反光;凭据字段仅保留必要的错误提示高度,不叠加额外下内边距,并验证正常、报错和修正状态的布局稳定性。
- `/org/login` 与 `/login` 顶部导航采用后台标准样式:移除顶部品牌条、玻璃渐变与反光层,背景、文字、分隔线跟随现有双主题变量;内容行桌面 72px、移动端 56px,另含 1px 底部分隔线。登录卡片保持现状。
### 登录前置关卡与会话
- 个人侧栏仅保留容器外侧分隔线,内层 Ant Menu 不叠加 `border-inline-end`。公告栏总高 35px,沿用参考图浅金/深棕配色,图标无圆形底色及阴影;文字测量与显示使用一致字号和字距,保留原滚动、循环及悬停暂停逻辑。
- 页面改造前必须通过真实浏览器 UI 登录并确认后台主体已渲染;URL 跳转或登录接口成功不能单独作为进入后台的证据。企业先于个人,不能用 API 登录或注入伪造用户绕过。
- 从 `dev.log` 最后一个 `Local:` 提取 Base URL。Windows 使用 `Start-Process -WindowStyle Hidden` 启动后台服务;已有服务可用时复用。Chrome 使用 `channel: 'chrome'`、有头模式及 `UI_VISUAL_OFFSCREEN=1`,不得抢占前台输入。
- 企业入口为 `{Base URL}/org/login`。先 `waitForLoadState('networkidle')`,检查可见文本/搜索/密码输入框的数量、placeholder/标签和按钮;复选框与隐藏输入不计数。打印不含输入值的判定结果并截图。
- 状态 A:一个企业输入框及“下一步”。先填写验收提供的企业名称(本轮为“测试企业1”),点击“下一步”,等待企业查询成功且“企业内登录名”“密码”“登录”出现,再填写验收凭据。禁止将登录名当作企业名称,禁止跳过企业查询。
- 状态 B:已出现登录名、密码及“登录”。直接填写验收凭据;不重复输入企业名称,不清除页面已有的企业上下文。记忆企业后的第二步与系统配置的免标识直登均按实际页面处理。
- 不符合 A/B、企业查询失败或登录失败时立即截图,记录 `dev.log` 尾部和失败 Network 请求;payload 仅保留排障必要字段,密码、Cookie、token、ticket 等统一脱敏。不得盲目重试、改登录业务代码或换入口绕过。
- 登录成功后将 storageState 存入 Git 忽略的本地证据目录;后续复用。测试结束通过 UI 正常退出。个人端新建无企业 Cookies/Storage 的 Context,进入 `/login`,通过页面原有凭据和协议要求登录。
- 凭据由运行环境传入脚本;不写进脚本、日志、截图注释或提交。唯一例外:个人端测试账号按用户要求记录在“个人端后台 UI 规范”一节。测试 trace/HAR 不得收集含凭据的登录请求。
### 背景、布局与未定义场景
- 最新面包屑间距按用户数据看板附件统一,覆盖早期 26px/14px 约定:现有个人端面包屑距内容区顶端桌面 30px、移动 16px,字体 12px、行高 18px,与下一标题区间距 24px;企业工作台同规格,父容器 18px gap 与面包屑 6px margin 合计 24px,不在原本没有面包屑的页面新增导航。客服入口取消小箭头、边缘收起入口及 cs-collapsed 读写,旧记录不再影响圆形入口显示;启用配置及客服面板开关逻辑不变。密钥管理页移除桌面/移动两处内嵌客服二维码卡片及仅供其使用的数据 hook;右下角客服保留。二维码源图已有灰边,不通过通用 CSS 裁切或擅自更改后台图片配置。
- 右下角客服复用 customer-service/index.jsx 原配置、自动分配、在线列表轮询、选择、释放计数及收起存储,仅用原生 Ant Button/Tooltip/Avatar/Tag/Spin/Empty 重做视图。面板 360×558px(随视口收缩),图3卡片点击展示详情,图4“切换”回列表;关闭 hover 跟随 token,打开微信仍读客服配置。移动端入口避让用户中心底部导航。
- 密钥管理按用户后续标注移至个人侧栏“使用记录”下方,顶栏不再展示该主导航项;原 /key-management URL、moduleAuthConfig.keyManagement 和 PrivateRoute 均保留,App 仅将该路由包入 UserCenter keyManagementMode。侧栏和头像快捷入口均进入同一路径并保留侧栏,移动底部导航同样提供入口;嵌入模式不重复渲染背景或顶部偏移,不修改密钥 API、计费与操作回调。
- 系统公告弹窗按用户附件使用原生 Ant Modal + Segmented + Checkbox + Button,桌面宽 860px、顶部 100px,长内容区最大 470px、空态区 300px;局部 notice-modal.css 的 --nm-* 值来自 theme.useToken,Portal 继承现有主题。移动左右留 16px,按视口限制正文滚动高度,保留页签和底部操作可达。复用 /api/notice、StatusContext.announcements、未读回调及 notice_close_date;默认勾选“今日不再提示”,仅勾选并确认时记录日期,X/遮罩/Esc 只关闭。
- 顶栏右侧按钮按用户标注图与参考图对齐:主操作及主题/公告/语言采用 16px、1.5 线宽的 lucide 图标,工具按钮保持 34px 点击区,账户下拉箭头为 10px;局部 `.ui-header-actions` 内将 Ant Button 图标容器设为 inline-flex,消除 SVG 基线空隙,使图标与文字垂直居中。保留所有显隐条件、路由、回调、头像与主题状态。
- 顶栏主题入口统一使用 Ant Design Button + Tooltip,点击按当前实际主题直接切换 light/dark,不再提供下拉或 auto 选项;沿用现有主题 setter 与持久化,覆盖 /org/login、/login 和共享顶栏。WeyAi 下载按钮复用现有下载配置及权限判定,保留 /weyai/download 跳转;使用 Ant text 按钮默认双主题悬停背景与下载 Tooltip,不新增配置或硬编码外部地址。
- 顶部主导航悬停及选中下划线参照原型:导航项撑满顶栏,左右内边距 24px;2px 主色下划线两端内缩 16px,选中项使用主色文字,普通项悬停保留正常文字色,键盘焦点可见。颜色使用既有主题变量,不改变链接和权限条件。
- 用户中心数据看板、使用记录、服务监控、在线充值、个人设置使用 `UserCenterBreadcrumb`,统一显示“用户中心 / 当前页面”,12px 字号。数据看板与服务监控下间距 24px、桌面内容边距 30px;使用记录、在线充值、个人设置经 `UserCenterPageHeader` 渲染,与标题间距 14px、内容边距 26px 36px 36px(见“个人端后台 UI 规范”);移动端统一 16px。共享页面在独立路由不显示该面包屑,不重复渲染。
- 背景图先核对原型资源和 CSS:能复用的原始 SVG/图片放入 `src/assets/prototype` 并记录来源;原型用 CSS 绘制的背景直接按测量值在页面作用域复现,不生成替代图片。
- 企业工作台横幅以原型 `.ew-hero` 的浅金/深棕背景、三层轮廓和尺寸为准,限定于 `.org-workbench` / `.org-workbench-hero`;不恢复旧品牌实底、黑色辉光和阴影。该例外不允许扩散到普通按钮或其他页面。
- 内容使用页面容器管理 24px 30px 边距,窄屏 16px;筛选区自然换行、表格在自己的容器横向滚动。不得通过隐藏正文、裁剪校验信息或固定整页宽度满足截图。
- 原型未定义且 Ant Design 有组件:直接采用当前版本默认样式及既有主题 token。Ant Design 无对应部件时,先在本节记录统一规则再应用:使用语义背景/文字/边框,无装饰背景、无阴影、无动画;间距取 token 的 8/16/24px 层级,普通文本沿用页面字体;窄屏堆叠并保持操作可达。
- 组合统计区无对应原生组件时,使用 Card + Typography + Space/Grid;数据、条件、排序和按钮处理函数均由原页面提供。新样式必须有局部类名和双主题证据。
- 先输出已覆盖、未覆盖、排除清单再改造。隐藏/重定向/原型失效入口单列;WeyAI、第三方客服/广告、联系客服、体验中心排除内部视觉替换,只检查宿主布局;模型超市已按“模型超市单页约定”单独改造。
- 核心链路采集覆盖查询、分页、表单、弹窗及充值状态;真实写操作仅使用可清理的测试数据。模拟接口与真实请求分开记录,支付未启用时不得宣称扫码支付通过。
### 组件写法
```jsx
import { Button, Form, Input, theme } from 'antd';
function ExistingEditor({ initialValues, saving, onSubmit }) {
const { token } = theme.useToken();
return (
<Form initialValues={initialValues} onFinish={onSubmit} layout='vertical'>
<Form.Item name='name' label='名称' rules={[{ required: true }]}>
<Input />
</Form.Item>
<Button
type='primary'
htmlType='submit'
loading={saving}
style={{ marginTop: token.marginSM }}
>
保存
</Button>
</Form>
);
}
```
示例只展示原生 Ant Design 写法;替换既有页面时,必须沿用该页面原有的业务校验、提交和防重复条件,不照搬示例改写数据流。
### 禁止事项
- UI 任务中不得新增功能、修改接口/载荷、状态管理、路由、权限、登录方式、计费和业务触发条件。非 UI 阻塞的 Bug 只记录到风险与后续建议。
- 不为截图一致伪造线上数据、开放隐藏菜单、增加原型业务功能或绕过真实登录。
- 不在 JSX 散落品牌十六进制色,不叠加无原型依据的渐变、玻璃、光斑、序号角标或动效,不用全局 `!important` 覆盖整个 Ant Design。
- 不隐藏测试失败、不把模拟验收写成真实保存通过、不把本地截图基线写成原型像素一致。
- 不提交账号、密码、Cookie、令牌、浏览器存储状态、新增截图和测试报告。已有受跟踪测试只能按迁移后的 DOM/契约维护,不能删除或跳过。
### 测试清单与阶段交付
1. 企业端:真实 UI 登录、逐菜单双主题、表格/筛选/分页/弹窗/抽屉/表单正常与失败状态、UI 退出。保存截图和差异清单后进入个人端。
2. 个人端:全新 Context/Cookies、真实 UI 登录、所有可见菜单和关键操作、双主题及桌面/移动端;配置隐藏或权限重定向单独记录。保存截图和差异清单后进入全局验收。
3. 全局:主题切换与刷新保持、Portal、控制台错误、空数据、校验、失败提示、重复提交、滚动和窄屏溢出;对受影响共享控件验证原有回调和请求载荷。
4. 复用 `playwright.config.js`,真实 Chrome `channel: 'chrome'`,本任务有头模式;无人值守时设置 `UI_VISUAL_OFFSCREEN=1`,测试不得抢占前台输入。先从 `dev.log` 提取真实 Local URL,再设置 `PLAYWRIGHT_BASE_URL`,不写死工作端口。Windows 使用隐藏后台进程启动服务并写入 dev.log;支持 nohup 的 shell 可用 `nohup npm run dev > dev.log 2>&1 &`。
5. 固定视口、数据、主题和页面状态;使用条件等待与稳定定位。等待懒加载、骨架屏和提交中状态结束,检查错误消息、控制台、实际路由和无效数值;不能只凭无 pageerror 判定页面渲染通过。模拟响应须按各接口实际数组/对象契约提供,配置重定向单列。`toHaveScreenshot()` 第一次生成本地基线后,要再次不带 update 运行;只有实际与参考图比较的结果才属于原型对比证据。
6. 运行 `npm test`、受影响 Playwright、`npm run build`、`npm run eslint`、`npm run lint` 和 `git diff --check`;先记录旧问题基线,仅修本次迁移引入的问题。完整 lint 受原有问题影响时,给出基线与变更文件检查结果,不将其描述为全量通过。
7. 提交说明包含:完成的 UI 范围、组件映射、差异清单、真实/模拟验证结果、未覆盖状态、风险和后续建议,并同步 `docs/UI_MIGRATION.md`。
+196
View File
@@ -0,0 +1,196 @@
# 后台前端协作规范(Claude Code 默认入口)
适用于本仓库,不要重复加载全文。
## 服务监控单页约定
- 页面为 `/user-center/service-dashboard`,视图文件为 `src/pages/ServiceDashboard/index.jsx`、`GroupMonitor.jsx` 和 `service-dashboard.css`。本轮提供的浅色截图是该页参考;在线原型当前没有服务监控入口,不将其他页面截图当作该页参考,也不宣称深色原型像素验收通过。
- 外层及可选描述区域映射 Ant Design Card,刷新与管理员详情操作映射 Button,详情使用 Modal、Statistic、Table,历史状态说明使用 Tooltip,加载和空数据使用 Spin、Empty。保留分组权限、刷新时序、模型测试、请求及载荷。
- 页面使用 `const { token } = theme.useToken()`,通过 `style={{ '--service-surface': token.colorBgContainer, '--service-text': token.colorText, '--service-border': token.colorBorderSecondary }}` 向局部 CSS 传递主题值。不得新增 ConfigProvider、主题状态或存储 key。详情 Portal 直接继承现有 ConfigProvider。
- 背景由 UserCenter 宿主提供,该页不使用背景图片。按后续用户截图要求移除标题图标、星光、绿色渐变和装饰阴影;标题采用与消费记录相同的 28px、650 字重和 32px 行高,副标题为 14px 次文字色,文案为“实时查看各分组服务可用性与模型状态”。
- 正常分组色条、图标、可用率、正常历史条、监控状态点及倒计时动态跟随 `token.colorPrimary`。图标、可用率与监控标记采用 `colorPrimaryBg`,边线采用 `colorPrimaryBorder`;告警和异常沿用 `colorWarning`、`colorError` 及其背景色,不改判定阈值。保留原有自动刷新和倒计时,不新增装饰动画。
- 原型未定义的详情弹窗、表格和测试按钮使用当前 Ant Design 默认样式。历史条无对应原生组件时,保留既有 60 点、6px 条宽及 2px 间距;深色缺失点使用 `token.colorFillSecondary`,文字使用 `token.colorTextSecondary`,容器使用 `token.colorBgContainer` 与 `token.colorBorderSecondary`。窄屏历史条在行内横向滚动,刷新信息允许换行;不新增装饰和动效。
- 验收证据保存于忽略目录 `logs/service-dashboard/`,真实页面、模拟空数据/失败及附件像素比较分开记录。完整截图保留顶栏;附件比较单独记录裁剪坐标,不删除宿主导航以匹配裁剪图。
## 模型超市单页约定(/market)
详细数值、映射表与采集流程见 `docs/ui/MARKET_SPEC.md`;本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护,改造记录见 `docs/ui-audit/market.md`。
1. 入口与依据:系统地址为 `${BASE_URL}/market`,`${BASE_URL}` 只能取自 `dev.log` 最后一个 `Local:`(服务命令 `nohup npm run dev > dev.log 2>&1 &`,端口被占用时以日志为准),禁止写死 IP / 端口;候选地址与实际不同时写入报告。视觉基准为原型 `http://192.168.0.161:8888` 顶栏“模型超市”(SPA 内切换,URL 保持 `/`),只作视觉 / 视觉交互依据,不作业务、数据、状态、接口、路由依据。原型有深浅双主题,均以原型实测为准。仅个人端,不执行企业登录。
2. 目录:路由入口 `src/pages/Pricing/index.jsx` → `src/components/table/model-pricing/layout/PricingPage.jsx`(不改);视图 `model-pricing/market/*`(页面编排、Hero、筛选侧栏、目录、卡片、图标框、`market.css`、`marketTheme.js`)、`filter/Pricing*.jsx`(筛选项规则)、`modal/*`(详情 Drawer);原型 Hero 线路图 `src/assets/prototype/market-hero-art.svg`。数据与计价只来自 `src/hooks/model-pricing/*`、`src/helpers/*`,纯 UI 任务不改。
3. Ant Design:搜索 `Input`(allowClear) + `Button`;筛选为可换行 `Button` 组(`aria-pressed`,禁用沿用原“disabled 或计数为 0”规则,不显示计数);卡片 `Card`(`role=button`、Enter/Space 打开、复制 `Button`+`Tooltip`);折扣 / 方法 / 仅可见 `Tag`;加载 `Card loading`;企业作用域 `Alert warning`;详情 `Drawer`(820px,窄屏 100%)+ `Typography.Title copyable` + `Table size=small`(列宽 180 / 135,`scroll.x`);图片预览 `Image`。旧 Bento 组件、`SelectableButtonGroup`、`SideSheet`、`@/components/ui` 适配层不再出现在本页。
4. 主题映射:不新增 ConfigProvider / 主题状态 / 存储 key。局部 CSS 经 `useMarketThemeStyle()` 读取 `colorPrimary`、`colorText`、`colorBorderSecondary`(注入 `--mm-brand/--mm-text/--mm-border`),抽屉 Portal 用 `rootClassName='mm-detail-drawer mm-theme'` + `rootStyle`。原型独有色只写在 `.mm-theme` / `html.dark .mm-theme` 的 `--mm-*`:页面底 `#f4f6f9/#111720`、面板 `#fff/#1b232e`、次要字 `#616e80/#acb6c5`、浅金底 `#fff3dc/#3c2e1d`、Hero 标题 `#302c24/#f3e6ce`;样式规则只引用变量。
5. 组件写法:页面只消费 `useModelPricingData` / `usePricingFilterCounts` 返回值;搜索保留 300ms 防抖,“搜索”/回车只是立即写入当前输入;两个“重置”与空态“重置筛选”复用原 `resetPricingFilters`,只传搜索与五类筛选 setter,不传货币 / 单位 / 视图 setter;窄屏筛选展开复用原抽屉开关 `showSettings`;厂商选项沿用原吸顶栏规则(只列有模型的厂商、按名称排序)。
6. 背景与布局:整屏应用壳(外层不滚动,`.mm-scroll` 与侧栏各自滚动);Hero 235px(原型渐变 + 线路 SVG + `.mm-core`,底部渐隐)、标题 34px/650、搜索条 720px/40px;工作区 20px 28px 24px、侧栏 264px、4 列网格 16px 间距;断点 1540 / 1180 / 850 / 600 与原型一致,≤600 单列、筛选默认收起。卡片悬停上浮 3px + 指针光晕 + 扫光、Hero 信号线 / 呼吸为原型动效,受 `prefers-reduced-motion` 约束。
7. 未定义项:有 Ant Design 组件即用默认样式 + 全局 token;没有则语义变量、无新增装饰 / 阴影 / 动画、8/16/24px、窄屏单列。无数据源的原型元素(详情“操作”列、未上架厂商、示例额外分组)不虚构。控件正文色沿用全局 `colorText`、图标沿用 `lucide-react`,与原型的差异记为保留差异。Ant Design 样式不在 `@layer` 内,局部覆盖按优先级竞争,仅在原型同样使用 `!important` 的四条规则保留。
8. 禁止事项:改 `/api/pricing` 请求 / 载荷 / 筛选 / 计价 / 懒渲染 / 详情与复制回调 / 路由权限;新增原型业务;恢复 Bento 渐变标题、光斑、点阵、水印、玻璃吸顶栏;JSX 颜色字面量、全局 `!important`;写死 `${BASE_URL}`;提交截图、trace、video、storageState、报告。
9. 测试清单:`e2e/market/login.mjs` 个人端真实 UI 登录关卡(判定 2 个输入 + 登录按钮后才填写,凭据经 `UI_PERSONAL_USER/UI_PERSONAL_PASS`,失败截图 + dev.log 尾 + 脱敏 payload,结束 UI 退出);`e2e/market/capture.mjs` 有头 Chrome(`channel:'chrome'`、离屏、不置顶不聚焦)原型 / 系统同脚本、同视口(1920×1000、393×851)、DPR 1、同主题、`zh-CN`、`reducedMotion: reduce`、同交互序列采集,系统对比数据为原型同构 mock,真实后端另采;`e2e/market/compare.mjs` pixelmatch 等价 + SSIM + pHash + bbox + computed style + 实际渲染字体,遮罩顶栏与第三方浮钮,窄屏按 `.mm-hero` 顶部对齐,阈值整页 ≤0.5%、组件 ≤0.2%(P3 ≤2%、P2 ≤10%、P1 >10%),报告 `logs/market/report/visual-regression-market.html`;`e2e/market-ui.spec.js` 以 `toHaveScreenshot()` 建本地基线后不带 update 复跑并断言链路交互、非 GET `/api/` 为 0;全局 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、临时目录构建、`git diff --check`、`e2e/market/business-audit.mjs`;采集串行单 Context、先查内存、trace / video 只留关键与失败批次;新增文案补齐 9 个语言包。
## 密钥管理单页约定(/user-center/key-management,旧 /key-management 重定向)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;改造记录见 `docs/UI_MIGRATION.md`“密钥管理按设计图对齐”。
1. 入口与依据:`${BASE_URL}/user-center/key-management`(旧 `/key-management` 保留为重定向;`${BASE_URL}` 取自 `dev.log` 最后一个 `Local:`),鉴权与 UserCenter `keyManagementMode` 嵌入不变。视觉唯一基准为 `C:\Users\Win10\Desktop\密钥管理页面.zip`(12 张浅色 PNG,DPR 1:列表启用/禁用、联系客服与列设置标注、密钥图标 Tooltip、模型列表抽屉、创建/编辑抽屉各两态、模型限制下拉、过期时间面板);无深色设计图,深色由 token 推导,不宣称深色像素验收。
2. 目录:`src/pages/KeyManagement/index.jsx`(页头、查询、列表、模型抽屉)+ `key-management.css`(`--km-*`);创建/编辑抽屉 `src/components/table/tokens/modals/EditTokenDrawer.jsx`,由 `EditTokenModal` 的 `presentation='drawer'` 渲染,状态、formApi、`submit`、`buildTokenPayload` 仍在 `EditTokenModal`,弹窗形态(`/console/token`)不变;“联系客服”派发 `CUSTOMER_SERVICE_OPEN_EVENT`(`components/customer-service`,客服启用时复用悬浮钮同一打开逻辑)。`useTokensData`、`/api/token*` 与 `/api/user/models` 请求不改。
3. Ant Design:页头 `UserCenterPageHeader`;查询 `Card` + `Input allowClear` + `重置`/`搜索` `Button`;列表 `Card` + 卡头(`h2`、`link` 联系客服、`primary` 创建、`text` 齿轮 → `Popover` + `Checkbox.Group` 列设置);`Table size='middle' tableLayout='fixed'`,列宽 150/300/150/100/180/100/100/130 + `scroll.x`;状态 `Switch`(启用/禁用,`onChange` 仍走原 `Modal.confirm` → `manageToken`),已过期/已耗尽补语义 `Tag`;分组 `Tag blue` 无边框 + `Tooltip`;额度 `Tag success`;密钥 `<code>` + `text` `Button`(Eye/EyeOff/Copy 16px)+ `Tooltip`;模型/编辑/删除为 `link small`;分页为适配 `Pagination size='small' showSizeChanger`(`onPageChange` / `onPageSizeChange` 接原 hook);空态 `Empty.PRESENTED_IMAGE_SIMPLE`;加载 `Table loading`;脱敏提示 `Alert success`。模型列表 `Drawer` 440px(窄屏 ≤100vw);创建/编辑 `Drawer` 560px(移动 100%)+ 适配 `Form requiredMark={false}` + 过期快捷 `Button`(`color/variant`、`aria-pressed`、`autoInsertSpace={false}`)+ `DatePicker showTime` + `Collapse`(`forceRender`)+ `Switch` 开启/关闭 + `Divider`。
4. Token:不新增 ConfigProvider / 主题状态 / 存储 key。`--km-*` 浅色为设计图实测:页底 `#f8fafc`;查询卡描边 `#f0f0f0`;列表卡描边 `#e6e9ef` + `0 4px 24px rgba(15,23,42,.02)`;表头 `#f8f9fc` / 字 `#687589`;行线 `#f0f0f0`;密钥框 `#f4f6f9` / `#e4e9ee`;模型抽屉面板描边 `#e4e9ef`、分类头 `#f6f8fa`、模型名 `#fafafa`;过期快捷按钮描边 `#d9dfe6`。深色只引用 `--surface-bg-base`、`--border-subtle`、`--ui-color-fill-0`、`--ui-color-border`、`--uc-heading`,阴影 `none`。日期面板语言由 `UiThemeProvider` 同步 dayjs locale(与 Ant locale 一一对应)。
5. 布局:内容区上 26px、左右/下 36px(本页设计图实测面包屑距顶 26px、面包屑与标题 27px,仅在 `.km-page` 作用域覆盖通用 30/24px);标题 28/32px、650;页头与首卡 18px;卡片间 20px;卡片圆角 10px、内边距 24px(查询卡上下 22px);查询标签 14/22px、下距 8px,输入 620px,输入与按钮 16px、按钮间 8px;卡头最小 34px、`margin: -6px 0 18px`;表头 46px;分页上距 16px。抽屉正文 `scrollbar-gutter: stable`;高级设置小标题下距 18px;过期按钮间距 5px、无 Ant 默认 `0 2px 0` 阴影(含选中态,二次回归按 5 张抽屉设计图实测修正);页脚按钮间距 10px。模型抽屉正文 20px、卡片间 18px、信息卡 16px(标签 12/18px)、分类头 45px、模型名 28px 高(等宽 12px、3px 7px)、行距 9.5px、列距 8px。≤768px 内容 16px,查询行与卡头换行,表格卡内横向滚动。
6. 保留功能与已知差异:“新手教程”/“查看操作指引”图标按钮保留在页头右侧(设计图无,避免删除原功能);客服未启用时“联系客服”提示“暂无可用客服”;默认名称 `claudeNN`、每页 5 条、过去日期禁用为业务默认;“搜索”/回车即时生效(原即输即筛);列设置只是本页视图状态、不持久化;技能注入关闭时“绑定技能”仅隐藏,字段仍注册(载荷不变);模型抽屉不显示来源说明行(设计图无);“自定义”选中仅文字主色(设计图如此)。
7. 禁止:改 `/api/token*` 请求 / 载荷 / `useTokensData` / 权限路由;新增存储 key;JSX 颜色字面量(Joyride 第三方引导沿用旧配置,已记风险);提交截图、报告、trace、storageState。
8. 测试清单:`e2e/key-management/login.mjs`(真实 UI 登录关卡,凭据经 `UI_PERSONAL_USER/UI_PERSONAL_PASS`)→ `baseline.mjs`(`KM_LABEL=before|after`,请求序列对照)→ `capture.mjs`(`KM_DATA=mock|real`、`KM_THEMES`、`KM_VPS`、`KM_STATES`;有头 Chrome 离屏、单 Context 串行、DPR 1、zh-CN、reducedMotion;真实后端限流时 `KM_REAL_PAUSE`)→ `compare.mjs`(整页 ±R 对齐 + 组件局部 ±3px 对齐、pixelmatch 等价 + SSIM + pHash,遮罩保留入口/客服浮钮/随机默认名/浏览器滚动条,阈值整页 ≤0.5%、组件 ≤0.2%,报告 `logs/key-management/report/密钥管理.html`)→ `crud.mjs`(可清理测试密钥的真实增改禁删)→ `e2e/key-management-ui.spec.js`(`toHaveScreenshot()` 建基线后不带 update 复跑、令牌写请求 0)→ `logout.mjs`(UI 退出)。全局 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、临时目录构建、`git diff --check`;新增文案补齐 9 个语言包。
## 个人端后台 UI 规范(用户中心)
详细数值、完整映射表与流程见 `docs/ui/UI_SPEC.md`,本节与其及 `AGENTS.md` 同节同步维护;改造记录见 `docs/ui-audit/`。
1. 范围与依据:只覆盖个人登录后的 `/user-center/*`(数据看板、使用记录·消费记录/绘图与视频、在线充值、个人设置四个页签)及其弹窗。视觉唯一真源为 `C:\Users\Win10\Desktop\原型图.zip`(16 张浅色截图);`C:\Users\Win10\Desktop\现有图.zip` 只是改造前基线,不能当目标。原型无深色截图,深色由 token 推导,不宣称深色像素验收。
2. 目录与 UI 边界:外壳 `src/styles/user-center.css` + `src/components/common/UserCenterPageHeader.jsx`;使用记录 `src/pages/UserCenter/UsageRecord.jsx/.css` + `src/components/table/usage-logs/*`、`task-logs/*` 的 `usageRecordMode` 分支(管理员 `/console/log`、`/console/task` 分支不动);在线充值 `src/pages/Recharge/*`(`recharge.css`、`WalletCard.jsx`);个人设置 `src/components/settings/PersonalSetting.jsx` + `settings/personal/*`(`personal-settings.css`、`components/SectionHeader.jsx`)。`src/hooks`、`src/context`、`src/helpers/api*`、`src/services`、`src/App.jsx` 不改。
3. Ant Design:新视图用原生 `Tabs`、`Card`、`Segmented`、`Tag`、`Empty`、`Alert`;旧页面保留 `@/components/ui` 适配的 Button/Input/Form/Modal/Pagination/Table 契约(适配 Input `onChange(value)`;Segmented `onChange(value)` 直接接原 RadioGroup 的值处理函数;适配 Button `theme='solid'` → primary、`type='danger'` → danger)。分页沿用 `onPageChange(page)` / `onPageSizeChange(size)`,`showTotal` 用 `t('共 {{total}} 条')`;表格 `scroll={{ x: 'max-content' }}`;状态用 Tag 语义色(success/error/processing/warning/default)。
4. Token 与 ConfigProvider:只用 `UiThemeProvider` 的 `prototypeTheme(dark)`(见“主题映射”表),禁止再包 ConfigProvider 或新增主题状态。组件内用 `theme.useToken()`;局部视觉只能写在页面变量族 `--uc-*`、`--ur-*`、`--rc-*`、`--ps-*` 中:浅色值为原型实测,深色值写在 `html.dark` 下且只引用 `--border-subtle`、`--surface-card`、`--surface-bg-base`、`--text-*`、`--ui-color-*` 或其 `color-mix`;样式规则只引用变量。
5. 组件写法与映射:自绘页签 → `Tabs`;`CardPro` → 筛选 `Card` + 记录 `Card`(`title` / `extra`);`RadioGroup` 按钮组 → `Segmented`;状态胶囊 → `Tag`;插画空态 → `Empty.PRESENTED_IMAGE_SIMPLE`;`CodeViewer` → `<pre>` + 复制链接(同一 `copy` 助手与提示);玻璃弹窗 → 默认 `Modal`;会员购买记录 → `MembershipHistoryContent`(内嵌页签与弹窗共用)。页头统一 `<UserCenterPageHeader title subtitle extra />`。完整对照见 UI_SPEC 第 4 节。
6. 背景与布局:子页底色浅色 `#f8fafc`(`--uc-page-bg`;看板沿用 `--surface-bg-base`);使用记录/在线充值/个人设置内容边距 26px 36px 36px,移动 16px;面包屑 12px、与标题间距 14px、分隔符左右 10px;标题 28px/32px、650、字距 -0.6px;副标题 14px/22px、上间距 6px;页头与首卡 18px;卡片圆角 10px。使用记录筛选卡、钱包卡、订单卡、资料头、头像预览的浅暖色渐变是原型可见视觉,只在 `.usage-record-page` / `.ui-recharge-page` / `.ui-personal-settings` 作用域内,其他位置禁止。
7. 未定义项统一规则:有 Ant Design 组件就用默认样式 + token;没有则语义变量、无装饰/阴影/动画、8/16/24px 间距、窄屏单列。移动端筛选默认收起(“显示/隐藏操作项”),表格在卡片内横向滚动。无数据源的原型元素(PayPal 说明行、“查看 10 元示例”、头像“显示文字”独立字段)不虚构,只读占位或不渲染,并记入风险。
8. 禁止事项:改接口/载荷/状态/路由/权限/计费/登录/业务触发条件或新增功能;JSX 或样式规则硬编码颜色(支付品牌图标色除外);无原型依据的渐变、玻璃、发光、动效;AI 生成插画或自创背景;用 Playwright 遍历页面猜测原型或以现有图为目标;点击真实 `确认支付` / `确认购买` / `确认升级` / `删除账户`;输出或提交 Cookie、令牌、storageState、截图与报告。
9. 测试清单:每个页面/状态采集浅/深色 × 桌面 1920×1000 / 移动 393×851;交互覆盖悬停、焦点、禁用、加载、弹窗打开/取消、日期面板、校验失败、复制提示、主题切换后刷新保持,并记录所有非 GET `/api/` 请求(只读验收应为 0)。模拟数据只拦截列表/报价接口并在报告中标注 mock。全局运行 `npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、`npm run build`、`git diff --check`、旧库扫描与业务契约 AST 对照;新增文案补齐 `src/i18n/locales` 全部 9 个语言。
10. 截图与映射流程:两个 zip 解压到 `/tmp/ui-ref/prototype`、`/tmp/ui-ref/current` → 清单 `/tmp/ui-ref/manifest-prototype.md`、`manifest-current.md` → 映射 `/tmp/ui-ref/page-mapping.md`(已覆盖 / 原型有现有缺失 / 原型未覆盖 / 排除)→ 基线 `/tmp/ui-ref/baseline/user/...` → 截图 `/tmp/ui-ref/shots/user/{light|dark}/{pageId}/{state}.png` → 差异 `/tmp/ui-ref/diff/user/{light|dark}/{pageId}/{state}.png`(`-side.png` 为三联图,汇总 `diff/summary.json`)。比较以页头区域对齐(使用记录/在线充值 +19px、绘图与视频 +15px、Webhook 滚动图 +44px);`在线充值3/4` 为约 90% 缩放截图,只核对结构。
11. 个人端登录流程:从 `dev.log` 最后一个 `Local:` 提取 Base URL(服务命令 `nohup npm run dev > dev.log 2>&1 &`)→ 全新 Context、清空 Cookies → `{Base URL}/login` → `waitForLoadState('networkidle')` → 检查可见输入框数量、placeholder、按钮,打印无值判定并截图 → 使用个人端账号 `test_222` / `12345678`(用户指定的测试账号;脚本经 `UI_PERSONAL_USER` / `UI_PERSONAL_PASS` 环境变量读取)→ 勾选页面原有协议并点击“登录” → 确认用户中心侧栏与主体已渲染 → 立即保存 storageState 到 `/tmp/ui-ref/auth/`。全站 review 后悬停顶栏用户菜单点击“退出登录”,确认落到登录页(当前实现为 `/org/login`)且受保护路由不再渲染。
12. 登录容错:失败或接口报错时截图 + `dev.log` 尾部 + 失败请求 payload(密码、Cookie、token、ticket 脱敏)写入“风险与后续建议”;不盲目重试、不用 API 登录、不改登录业务代码。
13. 资源与并发:启动浏览器或构建前检查内存(物理 ≥ 2GB、提交 ≥ 2.5GB),浏览器与截图串行;构建输出到临时目录(不覆盖 `dist/`),Node 堆约 2.9GB、关闭 gzip 体积统计并监控提交内存,低于 700MB 立即中止;不结束他人进程。
## 带侧栏页面统一规格(页头 / 边距 / 滚动条,2026-11-04,覆盖下文及上文同类旧数值)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;凡与“数据看板 30px / 34px 标题”“密钥管理 26px / 27px”“服务监控 94px / 30px 内边距”“充值页首块 19px”等旧数值冲突,以本节为准。
1. 适用范围:所有带侧栏菜单的 `/user-center/*` 页面(数据看板、密钥管理、使用记录、服务监控、在线充值、个人设置、邀请有奖、发票管理、下载 WeyAi)。新增此类页面必须遵守,不得再自写标题区或内容边距。
2. 内容边距:统一读取 `src/styles/user-center.css` 的 `--uc-page-pad-top/x/bottom`(桌面 30px / 36px / 36px,≤768px 16px / 16px / 24px)。普通页面根节点用 `.uc-page`;数据看板 `.uc-dashboard`、服务监控 `.user-center-service-page`(`calc(64px + 顶距)`,抵消宿主 `-mt-[64px]`)、下载页 `.weyai-download--embedded` 均直接引用这些变量。禁止写死 24 / 26 / 30px 等页面级左右或顶部边距。
3. 页头:一律使用 `<UserCenterPageHeader title subtitle extra />`(`src/components/common/UserCenterPageHeader.jsx`),内含 `UserCenterBreadcrumb`。规格:面包屑 12px / 18px,距内容区顶 30px,父级 `--text-secondary`、当前项 `--text-primary`,分隔符左右各 10px,与标题间距 24px;标题 28px / 32px / 650 / 字距 -0.6px,颜色 `--uc-heading`;副标题 14px / 22px、上间距 6px,颜色 `--uc-subtitle`;页头与首块内容间距 18px;右侧操作区放入 `extra`(8px 间距,窄屏换行)。页面不得覆盖这些数值(含数据看板、密钥管理、充值页),数据看板仅保留 hero 装饰层。
4. 面包屑:新页面须在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记 `路径 → 标题`,显示“用户中心 / 当前页面”;无副标题文案的页面可只传 `title`,不要为凑规格新增未翻译文案。
5. 滚动条:全站统一滑块 `#8b8b8b`、hover `#636363`、宽高 6px、圆角 3px、轨道透明,值由 `src/styles/tokens.css` 的 `--brand-scroll` / `--brand-scroll-hover`(浅深色同值)提供,规则集中在 `src/index.css` 全局 `*::-webkit-scrollbar*`;模型超市侧栏用 `--mm-scroll-thumb(-hover)`(同值)。禁止在页面 CSS 或内联样式里再设置 `scrollbar-width` / `scrollbar-color`(Chrome 121+ 设置后会忽略 `::-webkit-scrollbar`,hover 色失效;标准属性只在 `@supports not selector(::-webkit-scrollbar)` 内给 Firefox),也不得单独给滑块配色。
6. 验证:改动后逐页(桌面 1920×1000 / 移动 393×851,浅深色)核对左右边距、面包屑顶距、标题与副标题字号间距一致,滚动条静止与 hover 颜色;运行 `npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`。
7. 企业端(`/org/*`)同样适用:内容边距走 `.uc-page`(普通页)或 `src/styles/org-page.css`(功能页 `.org-*-page` / `.knowledge-page`,`.org-workbench` 同),不得再用 `p-4 sm:p-6 lg:p-8` 或各页 16/24/32px。普通页头一律 `OrgPageHeader`(内部复用 `UserCenterPageHeader`),面包屑为“企业中心 / 当前页面”,由 `OrgBreadcrumb`(`pages/Organization/components/`)按路径末段取侧栏菜单名,未登记(随角色变化或非侧栏页)的页面用标题兜底;带 hero 的功能页(专家、技能、Connector、效能、质量、审计、知识等)在 hero 内首个 `div` 顶部放 `<OrgBreadcrumb />`,卡片底/边框与标题字号由 `org-page.css` 统一为无卡片的 28px/650 标题 + 14px 副标题,操作区与指引入口保留。新增企业页须同时登记 `OrgBreadcrumb` 的路径映射。
## 用户中心二次回归约定(/user-center/* + /key-management,2026-11-04)
本节与 `AGENTS.md` / `CLAUDE.md` 同节同步维护;增量记录见 `docs/UI_MIGRATION.md`“用户中心二次回归”,产物在 Git 忽略的 `report/regression/`。
1. 复用与补采:第一次的 `原型图.zip`、Temp 下 `ui-ref/`(diff、映射、storageState)与 `docs/ui-audit/` 已不存在,不重建全量盘点。用户中心回归以在线原型 `http://192.168.0.161:8888`(侧栏 数据看板/密钥管理/使用记录/在线充值/个人设置)为可达基准,仅补采缺失的 1920×1000 视口(原有 `logs/ui-migration/prototype-personal/` 为 1440×1000);密钥管理沿用 `logs/key-management/design/密钥管理/`(zip 已解压副本)与第一次脚本。服务监控、邀请、发票无原型或为重定向,只做系统侧渲染 / 溢出回归。
2. 脚本:`e2e/ui-audit/regress/capture.mjs`(`RG_SIDE=proto,system`、`RG_THEMES`、`RG_VPS`、`RG_PAGES`、`RG_PAUSE`;原型 / 系统同探针、同交互序列,系统侧真实后端只读并录 trace)→ `e2e/ui-audit/regress/compare.mjs`;密钥管理用 `e2e/key-management/capture.mjs` + `compare.mjs`。登录关卡沿用 `e2e/key-management/login.mjs`,结束 `logout.mjs`。
3. 口径:桌面 1920×1000(密钥抽屉按设计图高度 914/1180/1294)、移动 393×851、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce` + 注入关闭动画 / 光标、浅深双主题、本机字体(Segoe UI / Microsoft YaHei)、有头 Chrome 离屏;页面加载后 Esc 关闭系统公告(不写 `notice_close_date`),鼠标移至 (2,2)。用户请求的 1920×1080 未采用,以保持与第一次一致。
4. 判定:用户中心按页头带(内容区顶部 170px,±8px 对齐)pixelmatch / SSIM / pHash 判定,阈值沿用第一次 整页 ≤0.5%、组件 ≤0.2%(P3 ≤2%、P2 ≤10%、P1 >10%);内容视口整幅因原型数据与真实账户数据不同只记信息值;探针(bbox / computed style)几何 >1px 或样式不同列为差异,再归类为“规范例外 / 业务差异 / 回归”。遮罩:页头右侧操作区(x≥1180 内容坐标)、第三方客服悬浮钮、密钥页保留的新手教程入口、业务随机默认名、浏览器滚动条。暗色只作信息(规范不宣称深色像素验收)。
5. 规范例外(不按在线原型改):面包屑距顶 30px / 18px 行高 / 与标题 24px(用户附件指令;密钥页 26px);标题 650 / 32px / -0.6px(zip 实测);看板横向 30px、底色 `--surface-bg-base`;正文与页签文字走全局 colorText `#263247`(原型为 Ant 默认 `rgba(0,0,0,.88)`);表头 400(原型计算值 500,在 Microsoft YaHei 下渲染等价);暗色主色已按用户决定跟随在线原型(见下第 7 条);全局细滚动条导致抽屉内控件比设计图宽约 5px。
6. 业务差异(不改):真实账户为普通用户,无“渠道 ID / 用户 ID”筛选及管理员列;后端未启用在线支付,充值页不渲染金额 / 支付方式 / 订单卡;个人资料头多“调用次数”;看板系列与数值来自真实数据;日期面板禁用过去日期。
7. 路由与暗色主色增量(2026-11-04,用户决定):
- 密钥管理路由 `/key-management` → `/user-center/key-management`:`App.jsx` 新增该精确路由(沿用原 `moduleAuthConfig.keyManagement` 与 `<UserCenter keyManagementMode />`,先于 `/user-center/*` 匹配),旧 `/key-management` 为 `<Navigate replace>`;同步更新侧栏 / 移动底栏 / 头像菜单 / 教程链接 / `DEFAULT_LOGIN_REDIRECT` / 面包屑 / `PageLayout` / `useNavigation`,`ORG_USER_NAV_PATHS.keyManagement` 同时放行新旧路径。移动端顶栏文案因路径在 `/user-center` 下由“导航”恢复为“用户中心”。
- 暗色主色跟随在线原型实测:Ant 暗色算法对种子 `#f2ad41` 推导出 `#d1963a`(悬停 `#e8ba65`)。`prototypeTheme` 保持 colorPrimary = `--brand-primary`(`#d1963a`),仅在暗色且主色等于该值时用 `#f2ad41` 种子推导其余令牌;`presets.js` ocean.dark 与 `tokens.css` 暗色品牌变量同步(含 hover / soft / scroll / 渐变 / accent,`bg-glow` 不变)。保留 `#f2ad41`:侧栏选中项(文字 `#f2ad41`、底 `#382b1b`)与使用记录页签选中文字 / 下划线(`--ur-tab-accent`,原型实测)。
- 数据看板页头 / hero(原型 `.dashboard-hero` 实测):副标题“追踪每一次模型调用,让用量与成本清晰可见。”14/22px、标题 34px / 43.07px / -1px、页头与指标 16px、操作区上内边距 8px;时间粒度由图标 + 文字改为 Ant `Select`(92×34,值与选项来自 `dataExportDefaultTime` / `timeOptions`,`onChange` 复用 `handleInputChange` 与筛选弹窗同源,新粒度在下一次刷新 / 筛选加载时生效,不新增请求);hero 装饰迁入 `.uc-dashboard-hero` 图层(高 `--uc-hero-h`=315px / 移动 460px,原型渐变、网格线、60px 底部渐隐,暗色 `--uc-hero-*`),插画 630×310、`right:4%`、`top:17px`、不透明度浅 .82 / 暗 .64 + `brightness(.83) saturate(.8)`,移动 330×210、`right:-65px`、`top:10px`、.18;移动端操作区右对齐、间距 6px。
进入项目先阅读根目录 `AGENTS.md` 和 `docs/UI_MIGRATION.md`,改个人端用户中心页面再读 `docs/ui/UI_SPEC.md`。本文件与 `AGENTS.md` 同时维护;二者对 UI 的约束一致。原型:`http://192.168.0.161:8888`(个人端用户中心以 `原型图.zip` 为准,见上节;模型超市以原型站“模型超市”页为准,改该页先读 `docs/ui/MARKET_SPEC.md`)。
## 目录
- `src/components/ui/UiThemeProvider.jsx`:唯一 Ant Design 主题、语言、Portal 和 CSS token 桥接入口。
- `src/components/ui/controls.jsx`、`form.jsx`、`index.jsx`、`pagination.js`:已有页面契约的视图适配;不写业务请求或权限。
- `src/components/ui/chat.jsx`、`chartTheme.js`:聊天呈现和图表主题,沿用页面的数据与操作。
- `src/styles/prototype.css`:原型布局、尺寸、页面作用域样式;`tokens.css` / `presets.js`:首帧与既有品牌配置。
- `src/assets/prototype`:参考页面的既有视觉资源,保留来源,不用新生成插画替代。
- `src/pages/Organization`、`src/pages/UserCenter`、`src/pages/KeyManagement`:企业与个人页面;`src/components/table` / `settings` / `common`:共享视图。
- `src/hooks`、`src/context`、`src/helpers`、`src/App.jsx`:既有业务与路由,纯 UI 任务保持语义不变。
- `e2e`、`logs/ui-migration`、`test-results`、`playwright-report`:本地验收脚本、截图和报告;新增文件保持 Git 忽略。
## Ant Design 与组件写法
- 原型定义的颜色、大小、样式、状态与视觉交互优先;未定义项采用 Ant Design 默认值。通用组件只使用 `antd`,图标沿用 `lucide-react`。
- 新代码使用 Ant Design 原生 API;旧页面使用 `@/components/ui` 保留原有值回调、Form API、日期和上传契约。原生 Input 的 onChange 接收事件,适配 Input 的 onChange 接收值,不能混用。
- 使用 Form.Item 的 name、label、rules;使用 Button 的 type、danger、loading、disabled;使用 Table 的 columns、rowKey、scroll 和分页 API。不靠新数据流适应组件。
- Modal/Drawer/Select/Tooltip/message/notification 必须继承统一主题;维持原有打开条件、键盘和遮罩关闭、异步确认及卸载语义。
- 分页保留 `onPageChange(page)`、`onPageSizeChange(size)` 及原有回调顺序。上传保留文件实例、校验、列表和自定义请求。不得重写页面请求以消除适配问题。
- `Form.RadioGroup` 回调首参为值,独立 `RadioGroup` 首参为事件;DatePicker 保留字符串与 Date 的边界转换;手动 Upload 不发请求,`autoRemove` 文件不显示。Ant Layout 的 hasSider 不得破坏既有列布局。聊天输入聚焦不得触发发送。
- 兼容 Dropdown 桌面默认 `hover`,无悬停能力的触屏默认 `click`,显式 trigger 优先。Card 的 bordered 映射到 variant;CardPro 多行筛选区不能收缩或截断,正文独立滚动。
- 旧 Tag 的 `white` / `grey` 映射为 Ant Design `default` 中性标签,不用白色自定义背景模拟普通标签;选中状态沿用页面原有条件。日志卡片、筛选与账单明细使用语义背景和边框;个人记录页签使用原型主色下划线,不恢复玻璃、辉光、网格或蓝色渐变覆盖。
- 双字按钮定位允许默认字间距和加载图标名称,如 `/^(?:loading\s+)?保\s*存$/`。虚拟 Select 不点击隐藏的辅助 option,使用可见选项或标签定位的组合框键盘操作。
```jsx
import { Button, Form, Input } from 'antd';
// onSubmit、saving 和校验条件由原有页面提供。
<Form initialValues={initialValues} onFinish={onSubmit} layout='vertical'>
<Form.Item name='name' label='名称' rules={existingRules}>
<Input />
</Form.Item>
<Button type='primary' htmlType='submit' loading={saving}>
保存
</Button>
</Form>;
```
## 主题映射
- 个人侧栏仅保留容器外侧分隔线,内层 Ant Menu 不叠加 `border-inline-end`。公告栏总高 35px,沿用参考图浅金/深棕配色,图标无圆形底色及阴影;文字测量与显示使用一致字号和字距,保留原滚动、循环及悬停暂停逻辑。
- `/org/login` 与 `/login` 顶部导航采用后台标准样式:移除顶部品牌条、玻璃渐变与反光层,背景、文字、分隔线跟随现有双主题变量;内容行桌面 72px、移动端 56px,另含 1px 底部分隔线。登录卡片保持现状。
- 企业与个人登录卡片隐藏顶部品牌装饰线及反光;凭据字段仅保留必要的错误提示高度,不叠加额外下内边距,并验证正常、报错和修正状态的布局稳定性。
- 登录页局部布局使用 `.auth-login-page`,其他认证顶栏使用 `.auth-layout-header` 透出既有背景,企业及个人登录顶栏使用 `.login-layout-header` 标识并沿用后台标准导航;企业/个人切换沿用 Ant Design Button。登录输入框统一 34px 高、8px 圆角,必填标识通过 Form.Item 呈现;调整样式不得替换现有登录校验、回调和载荷。
- 登录页副标题、“记住登录名”、管理员重置提示和“忘记密码”共用加深 20% 的语义次文字色;辅助文字无悬停底色,忘记密码悬停进一步加深文字。“切换企业”与登录使用相同主按钮样式,保留禁用及返回流程。个人登录必填校验使用 Form rules,通过后调用原登录处理函数;个人及企业凭据字段预留错误提示高度,避免校验切换导致卡片跳动。
| 项目 | 浅色 | 深色 |
| ------------------------------ | --------- | --------- |
| colorPrimary / colorInfo | `#b96508` | `#d1963a` |
| colorBgLayout | `#f4f6f9` | `#11151c` |
| colorBgContainer / 侧栏 / 顶栏 | `#ffffff` | `#1b212b` |
| --text-primary | `#263247` | `#e6ebf3` |
| --text-secondary | `#7e8998` | `#8e9aaa` |
| --border-subtle | `#e9edf2` | `#2b333f` |
| Menu.itemSelectedBg | `#fff3df` | `#382b1b` |
| Menu.itemSelectedColor | `#a95d07` | `#f2ad41` |
由现有 useActualTheme 驱动 ConfigProvider 的 defaultAlgorithm / darkAlgorithm;保留原有管理员品牌配置与持久化,不另建主题状态。新组件优先使用 `theme.useToken()`;`--ui-*` 只作为旧页面兼容变量。控件高 34px、圆角 8px、菜单高 42px;桌面顶栏 72px、公告 35px、侧栏 216px/收起 64px;主内容通常 24px 30px,移动端横向 16px。字体沿用 Segoe UI、PingFang SC、Microsoft YaHei、sans-serif。
ConfigProvider 显式映射主色、信息色、文字与弱分隔线;主题算法保留已测量的主色、信息色 seed,避免深色算法二次改变它们。
## 登录前置关卡
- 改 UI 前先真实 UI 登录,确认后台主体已渲染后保存本地 storageState;仅接口成功或 URL 改变不能证明页面已进入。企业先于个人,不用 API 登录或伪造鉴权。
- 先从 `dev.log` 的最后一个 `Local:` 取得 Base URL,进入 `/org/login` 并 `waitForLoadState('networkidle')`。检查可见非隐藏、非复选框 input 数量、placeholder/标签及按钮,打印无值判定并截图。
- A:一个企业输入框 +“下一步”。填写验收企业名称(本轮为“测试企业1”),点击“下一步”,等待企业查询成功并显示登录名、密码和“登录”,然后输入验收凭据;不能把登录名当作企业标识,也不能省略企业名称。
- B:登录名 + 密码 +“登录”。直接填写验收凭据,保留已解析的企业上下文,不重复填写企业名称。记忆企业自动进入第二步、配置允许的免标识直登均按实际 UI 判定。
- 未识别页面、查询/登录失败时停止盲试,保存截图、dev.log 尾部和失败 Network payload(密码、Cookie、token、ticket 等脱敏),仅记风险,不改业务代码绕过。
- storageState 只写本地 Git 忽略目录;凭据从环境传入脚本,不进入脚本、日志或提交(唯一例外:个人端测试账号按用户要求记录在“个人端后台 UI 规范”一节);登录阶段不录含敏感请求的 trace/HAR。企业结束后 UI 退出,个人使用全新 Context/Cookies 进入 `/login`,沿用页面的协议和登录要求。
- Windows 服务使用 `Start-Process -WindowStyle Hidden`;可用服务直接复用。本机 Chrome 有头、`channel: 'chrome'`、`UI_VISUAL_OFFSCREEN=1`,不抢占前台输入。
## 背景与规范补位
- 最新面包屑间距按用户数据看板附件统一,覆盖早期 26px/14px 约定:现有个人端面包屑距内容区顶端桌面 30px、移动 16px,字体 12px、行高 18px,与下一标题区间距 24px;企业工作台同规格,父容器 18px gap 与面包屑 6px margin 合计 24px,不在原本没有面包屑的页面新增导航。客服入口取消小箭头、边缘收起入口及 cs-collapsed 读写,旧记录不再影响圆形入口显示;启用配置及客服面板开关逻辑不变。密钥管理页移除桌面/移动两处内嵌客服二维码卡片及仅供其使用的数据 hook;右下角客服保留。二维码源图已有灰边,不通过通用 CSS 裁切或擅自更改后台图片配置。
- 右下角客服复用 customer-service/index.jsx 原配置、自动分配、在线列表轮询、选择、释放计数及收起存储,仅用原生 Ant Button/Tooltip/Avatar/Tag/Spin/Empty 重做视图。面板 360×558px(随视口收缩),图3卡片点击展示详情,图4“切换”回列表;关闭 hover 跟随 token,打开微信仍读客服配置。移动端入口避让用户中心底部导航。
- 密钥管理按用户后续标注移至个人侧栏“使用记录”下方,顶栏不再展示该主导航项;原 /key-management URL、moduleAuthConfig.keyManagement 和 PrivateRoute 均保留,App 仅将该路由包入 UserCenter keyManagementMode。侧栏和头像快捷入口均进入同一路径并保留侧栏,移动底部导航同样提供入口;嵌入模式不重复渲染背景或顶部偏移,不修改密钥 API、计费与操作回调。
- 系统公告弹窗按用户附件使用原生 Ant Modal + Segmented + Checkbox + Button,桌面宽 860px、顶部 100px,长内容区最大 470px、空态区 300px;局部 notice-modal.css 的 --nm-* 值来自 theme.useToken,Portal 继承现有主题。移动左右留 16px,按视口限制正文滚动高度,保留页签和底部操作可达。复用 /api/notice、StatusContext.announcements、未读回调及 notice_close_date;默认勾选“今日不再提示”,仅勾选并确认时记录日期,X/遮罩/Esc 只关闭。
- 顶栏主题入口统一使用 Ant Design Button + Tooltip,点击按当前实际主题直接切换 light/dark,不再提供下拉或 auto 选项;沿用现有主题 setter 与持久化,覆盖 /org/login、/login 和共享顶栏。WeyAi 下载按钮复用现有下载配置及权限判定,保留 /weyai/download 跳转;使用 Ant text 按钮默认双主题悬停背景与下载 Tooltip,不新增配置或硬编码外部地址。
- 顶栏右侧按钮按用户标注图与参考图对齐:主操作及主题/公告/语言采用 16px、1.5 线宽的 lucide 图标,工具按钮保持 34px 点击区,账户下拉箭头为 10px;局部 `.ui-header-actions` 内将 Ant Button 图标容器设为 inline-flex,消除 SVG 基线空隙,使图标与文字垂直居中。保留所有显隐条件、路由、回调、头像与主题状态。
- 顶部主导航悬停及选中下划线参照原型:导航项撑满顶栏,左右内边距 24px;2px 主色下划线两端内缩 16px,选中项使用主色文字,普通项悬停保留正常文字色,键盘焦点可见。颜色使用既有主题变量,不改变链接和权限条件。
- 用户中心数据看板、使用记录、服务监控、在线充值、个人设置使用 `UserCenterBreadcrumb`,统一显示“用户中心 / 当前页面”,12px 字号。数据看板与服务监控下间距 24px、桌面内容边距 30px;使用记录、在线充值、个人设置经 `UserCenterPageHeader` 渲染,与标题间距 14px、内容边距 26px 36px 36px(见“个人端后台 UI 规范”);移动端统一 16px。共享页面在独立路由不显示该面包屑,不重复渲染。
- 图片/SVG 复用原型资源并在 `src/assets/prototype` 记录来源;CSS 背景按原型测量值复现。企业工作台 `.ew-hero` 的浅金/深棕、三层轮廓只作用于 `.org-workbench-hero`,不把旧辉光或品牌实底带回普通页面。
- 内容通常 24px 30px、移动 16px;筛选自然换行,表格独立滚动,校验信息不得裁剪。页面局部定义优先,不添加原型中本系统没有的数据或功能。
- 未定义项优先使用 Ant Design 默认样式。无对应部件的统一规则先在两份入口记录再应用:语义背景/文字/边框,无装饰背景、无阴影、无动画;使用 token 的 8/16/24px 间距,页面字体,窄屏堆叠。组合统计使用 Card + Typography + Space/Grid,保留原数据和触发条件。
- 盘点已覆盖/未覆盖/排除页面;配置隐藏、重定向和原型失效入口单列。WeyAI、第三方客服/广告、联系客服、体验中心只检查宿主布局;模型超市按“模型超市单页约定”单独改造。
- 查询、分页、表单、弹窗、充值等状态分别记录真实与模拟证据;真实写入只用可清理测试数据,支付未启用不能写成扫码支付通过。
## 禁止事项
- 纯 UI 任务禁止新增功能,禁止改请求/载荷、状态管理、路由、权限、计费、登录或业务触发条件。非阻塞 Bug 记入风险,不顺手修复。
- 禁止重新引入旧 UI 库、插件、内部模块、CSS 或图标依赖。禁止自创视觉;无原型依据不得增加渐变、发光、玻璃、浮起或装饰动效。
- 不为匹配原型伪造线上内容、开放隐藏菜单、添加业务功能或绕过 UI 登录。WeyAI 外部页和第三方客服/广告 SDK 内部视觉不重做。
- 不输出或提交密码、Cookie、令牌、会话状态、新增测试证据;不删除已受 Git 跟踪的测试,不跳过失败用例。
## 测试与交付清单
1. 按企业端、个人端、全局验收分阶段;每阶段保存双主题截图和差异总结再继续。
2. 真实 UI 登录使用新 Context;模拟接口仅用于明确标注的渲染/回归验证。配置隐藏、权限重定向、登录失败与未测保存分别记录。
3. 使用项目 Playwright 与本机 Chrome,`channel: 'chrome'`;本任务 `npm run test:e2e:headed`。无人值守设置 `UI_VISUAL_OFFSCREEN=1`,不抢占前台鼠标键盘。先读 dev.log 提取真实 Local URL 设置 PLAYWRIGHT_BASE_URL,不写死端口。
4. 使用角色、标签、测试标识和条件等待;截图保持相同视口、主题、数据、状态。等待懒加载、骨架屏和提交中状态结束,检查错误消息、控制台、实际路由和无效数值;不能只凭无 pageerror 判定页面渲染通过。模拟响应按各接口数组/对象契约提供,配置重定向单列。`toHaveScreenshot()` 本地回归基线与原型对比是不同证据,生成基线后须不带 update 再跑一次。
5. 覆盖深浅主题、桌面/移动端、悬停/焦点/禁用/加载、空表、搜索/分页、表单校验、失败提示、异步确认与重复提交;检查 Portal、图表、滚动与溢出。
6. 运行 npm test、受影响 Playwright、构建、ESLint、Prettier 和 git diff --check。只处理迁移引入的问题;如全量 lint 原本失败,记录基线和本次检查结果。
7. 更新 docs/UI_MIGRATION.md 与两份入口规范,交付范围、组件映射、差异、实际验证、未覆盖项及风险。未验证的真实保存和像素级对齐不得写成通过。
+461
View File
@@ -0,0 +1,461 @@
# 后台 UI 改造记录
## 密钥管理迁入用户中心路径、暗色主色与看板页头对齐(2026-11-04)
用户决定:暗色主色全部跟随在线原型;密钥管理路由并入 `/user-center/*`;数据看板页头文案 / 时间下拉 / 右侧背景图按设计图(在线原型)对齐。
- **路由**:`/key-management` → `/user-center/key-management`(`App.jsx` 精确路由,鉴权 `moduleAuthConfig.keyManagement` 与 `keyManagementMode` 嵌入不变),旧地址 `<Navigate replace>` 重定向;侧栏、移动底栏、头像菜单、教程链接、登录默认回跳、面包屑、`PageLayout`、`useNavigation`、企业放行前缀同步。验证:旧地址 → 新地址、刷新、侧栏 / 底栏往返均通过,写请求 0;移动端顶栏文案由“导航”变为“用户中心”,桌面“用户中心”高亮保持。未采用“其他页面也改为密钥管理”的备选方案(已解决,无需)。
- **暗色主色**:原型实测 Ant 暗色算法对种子 `#f2ad41` 推导出 `#d1963a`(按钮、页签、链接、顶栏高亮均为该值),侧栏选中项仍为 `#f2ad41` / `#382b1b`,使用记录页签选中文字与下划线也为 `#f2ad41`。`UiThemeProvider` / `presets.js` ocean.dark / `tokens.css` 同步,系统暗色实测:主按钮、顶栏高亮 `#d1963a`,侧栏选中 `#f2ad41` / `#382b1b`,与原型一致;全部用户中心暗色页的 `primaryBtn.bg`、`inkBar.bg` 探针差异清零。
- **看板页头**:副标题改为“追踪每一次模型调用,让用量与成本清晰可见。”(新增 key,9 个语言包);时间粒度改 Ant `Select`(92×34,与筛选弹窗同源的 `handleInputChange`,下一次刷新 / 筛选生效);hero 装饰迁入 `.uc-dashboard-hero` 图层并按原型实测复刻渐变 / 网格线 / 底部渐隐 / 插画(630×310,`right:4%`,`top:17px`,暗色 .64 + 滤镜;移动 330×210,`right:-65px`)。实测与原型几何一致(动作区 / 按钮 92 / 84 / 112 宽、插画 630×310),仅横向 6px(看板 30px 边距,用户指令)与纵向 2px(面包屑 30/18/24 规范)为已记录例外。
- **验证**:`npm test` 247/247;临时目录构建通过;改动文件 ESLint 0 错误(3 条既有 hooks 依赖警告)、Prettier / `git diff --check` 通过;`key-management-ui.spec.js` 更新暗色列表基线后不带 update 16/16;真实 UI 登录 / 退出;证据 `report/regression/`(`hero/`、`hero-system-v*.txt`、`proto-hero.txt`、`diff/`)。
- **已知 / 未处理**:`market-ui.spec.js` 本地基线已陈旧(亮色即失败:顶栏公告条与客服悬浮钮为后续改动引入,非本次),未更新其基线,需单独复核;该 spec 的“主题切换后刷新保持”用例点击超时,同属既有问题。市场页暗色主色已随令牌变化,未单独做像素验收。看板时间下拉不立即重载是有意保持原数据流。
## 用户中心二次回归(/user-center/* + /key-management,2026-11-04)
范围:用户中心 9 个页面状态(看板、使用记录两页签、在线充值、个人设置四页签、密钥管理)+ 服务监控(原型无,仅系统侧)。`${BASE_URL}` 为 `http://localhost:5175`(`dev.log` 最后一个 `Local:`,服务复用)。流程、口径与例外见入口文件“用户中心二次回归约定”;产物在 Git 忽略的 `report/regression/`(本轮在 `.gitignore` 的本地验收块补 `/report/`)。
- 复用 / 补采:第一次 `原型图.zip`、Temp 下 `ui-ref/`、`docs/ui-audit/` 已不存在,不重建全量盘点;在线原型 8888 可达,仅补采 1920×1000 浅 / 深 9 个状态(原有采集为 1440 宽)。密钥管理复用 `logs/key-management/design` 与第一次脚本、storageState 经 UI 登录刷新。
- 修复(仅回归清单内):`key-management.css` 创建 / 编辑抽屉过期快捷按钮间隙 6px → 5px(5 张设计图一致实测),并去掉 Ant 默认 `0 2px 0` 按钮阴影(设计图含选中态均无)。过期按钮组 5.99% → 0.00%;编辑·无限额度 0.538% → 0.427%(转 PASS);创建两态 0.71/0.74% → 0.60/0.64%;日期面板整页 2.08% → 1.83%。
- 用户中心浅色页头带:8/9 ≤0.5%(0.02%–0.28%),数据看板 1.45%(P3)均为规范例外(30px 横向、底色、全局正文色、既有副标题文案);未改代码。深色只作信息(0.62%–3.42%),主因在线原型暗色主色 `#d1963a` 与规范 `#f2ad41` 不同。
- 未达阈值保留:模型抽屉 0.99%(行距 9.5px 半像素相位 + 正文色)、模型下拉 2.24%(沿用第一次结论,本轮未重新归因)、列表分页组件 3–5%(字形宽度)、抽屉控件右缘约 5px(全局细滚动条 vs 设计图 17px 经典滚动条)。
- 验证:真实 UI 登录 `test_222`(页面判定 2 输入 + 登录按钮后填写)→ 系统真实后端 10 页 × 双主题 × 桌面 / 移动 40 次截图,无溢出、无写请求;暗色桌面首批遇 429 作废重采后 0 错误 0 失败 API。`key-management-ui.spec.js` 更新编辑抽屉基线后不带 update 复跑 16/16(中途一次移动深色列表偶发失败,单测与全量复跑均通过);`npm test` 247/247;临时目录构建通过;全量 ESLint 10 错误 / 168 警告与基线一致;改动 CSS Prettier 与 `git diff --check` 通过;结束 UI 退出。
## 密钥管理按设计图对齐(2026-11-04)
范围:个人端 `/key-management`(UserCenter 嵌入)、可用模型列表抽屉、创建/编辑抽屉。`${BASE_URL}` 取自 `dev.log`(本轮 `http://localhost:5175`);视觉基准 `密钥管理页面.zip`(12 张浅色 PNG),规则见入口文件“密钥管理单页约定”。
- 组件:旧适配 `Card`/`Table`/`Input`/`SideSheet`/插画 `Empty`、渐变图标标题、玻璃按钮与渐变“创建”按钮 → 原生 Ant `Card`、`Input`、`Button`、`Table`、`Switch`、`Tag`、`Tooltip`、`Popover`+`Checkbox.Group`、`Drawer`、`Empty`、`Alert`;创建/编辑由居中玻璃弹窗改为 560px `Drawer`(新文件 `EditTokenDrawer.jsx`,`EditTokenModal presentation='drawer'`,弹窗形态保留给 `/console/token`)。删除 `prototype.css` 中被取代的 `.ui-key-*` 规则(含两条 `!important`)。
- 业务不变:`useTokensData`、`/api/token*`、`/api/user/models`、分组/技能目录加载、`buildTokenPayload`、启用/禁用/删除确认与 `manageToken` 未改。改前/改后真实后端“加载 → 模型抽屉 → 编辑 → 创建”请求序列逐条一致(18 个 GET、0 写)。真实 UI 增改禁删一轮(测试密钥,结束已清理)载荷字段与原契约一致。
- 视觉:同构 mock 下浅色桌面列表启用 0.26%、禁用展开 0.35%(≤0.5% 通过);创建/编辑抽屉 0.54%–0.76%、模型抽屉 0.99%、模型下拉与日期面板 2.1%–2.2%(P3,主要为字形栅格化与滚动位置);组件级多数 ≤0.3%,列表卡头 1.52%、分页 3–5% 为 1–3px 字宽/控件高度舍入。报告 `logs/key-management/report/密钥管理.html`。
- 关联调整:`customer-service` 新增可取消的页面打开事件(客服启用时复用悬浮钮打开逻辑);`UiThemeProvider` 同步 dayjs 语言,日期面板星期/月份与 Ant locale 一致(全站 DatePicker 受益,中文周一起始)。新增 11 个文案 key,9 个语言包补齐。
- 验证:真实 UI 登录 `test_222` 与 UI 退出;mock 浅/深 × 桌面/移动 共 78 张状态截图,真实后端 56 张(429 限流后放慢重采);`e2e/key-management-ui.spec.js` 本地基线不带 update 复跑 16/16;`npm test` 247/247;临时目录构建通过;改动文件 ESLint 0 错误(`EditTokenModal` 两条既有 hooks 依赖警告)、Prettier 通过;全量 ESLint 10 错误/168 警告、全量 Prettier 600 文件为既有基线,均不在本次文件;`git diff --check` 通过。
## 面包屑统一与客服入口精简(2026-11-04)
按用户附件 8/9:统一项目现有面包屑的垂直规格,桌面顶部 30px、移动 16px,12px 字号/18px 行高、与下一标题区域间隔 24px。覆盖 UserCenterBreadcrumb 各宿主(看板、使用记录、密钥管理、服务监控、在线充值、个人设置),同时对齐企业工作台现有 Breadcrumb(其 18px flex gap 与 6px margin 合计 24px)。无面包屑页面不新增导航。修改 prototype.css、user-center.css,覆盖早期 26px/14px 规范;企业页面只静态核对,未执行企业账户登录。
按附件10取消客服小收起箭头与边缘收起形态,删除对应状态、cs-collapsed 读写、按钮和 CSS。历史 localStorage 即使为 true 也不再让入口收起,仍由原客服启用配置决定是否展示,打开/关闭、分配/切换/会话释放逻辑不改。
追加标注:密钥管理页移除两处响应式 CustomerServiceQRCard 及专属 useCustomerServiceDisplay 调用,搜索/表格恢复占满可用内容宽度,右下角客服不变。二维码右侧竖线经直接下载查看配置源图确认,是 537×654 PNG 原图右侧灰边,并非 DOM/CSS 线;未裁切所有动态客服图片、未更改后台配置,需管理员更换无灰边源图才能彻底去除。源图检查证据仅保存忽略目录 logs/header-nav/qr-source.png。
实测:真实 UI 登录后对六页 × 桌面/移动共 12 组测量,顶部/行高/标题间距全部符合 30(16)/18/24px;登录外非 GET 请求为0、pageerror为0并 UI 退出。客服桌面/移动双主题回归,注入历史 cs-collapsed=true 检查圆形入口仍显示、无收起按钮,打开/列表/详情/关闭/Esc 通过;密钥页双主题桌面/移动验证无内嵌客服二维码且悬浮客服保留。局部 ESLint/Prettier 通过,串行单元测试 247/247,证据位于 logs/header-nav/breadcrumb-*、key-card-removal.log、customer-no-collapse.log;未运行构建与全量 lint,不宣称全项目所有路由均经真实账户验收。
## 右下角客服与密钥管理导航(2026-11-04)
客服:按用户四张附件重做 customer-service/index.jsx 与 styles.css,使用原生 Ant Button/Tooltip/Avatar/Tag/Spin/Empty/Divider 和 theme.useToken;46px 耳机入口与关闭态、360×558px 自适应面板、70px 浅金/深棕标题栏、68px 客服列表卡片、二维码详情与微信按钮。图3关闭按钮 hover 与卡片进入详情、图4切换回列表均复用原处理函数。原 /config 启用判定、cs-collapsed 存储、自动 /allocate、15 秒 /online 轮询、选择、/end 释放与异步竞态保护不变(处理函数及 effects 区块与本地改前副本归一化对照一致)。保留原首次打开自动分配,不为截图强制更改分配策略。二维码、头像、姓名、会话数与链接全部来自真实配置。移动端避让底部导航。新增“关闭客服”九语言翻译。
客服实测:真实配置 enabled=true,真实自动分配后切换释放会话,列表选择、详情、关闭 hover、底部 X、Esc,以及桌面 1920×1000 / 移动 393×851 × 深浅主题通过;未点击外部微信链接,未改变后台客服配置,未测试禁用配置及二维码失效模拟。
导航:按后续标注将密钥管理从桌面/移动主导航移除,在用户中心侧栏使用记录下方及移动底部导航增加入口;LayoutGrid、ScrollText、KeyRound、Wallet、UserRound 对齐图标语义与线宽,头像菜单沿用密钥管理跳转。保留 /key-management URL 与原模块鉴权/PrivateRoute,只把路由内容包装进 UserCenter keyManagementMode;密钥页 embedded 分支不重复背景和顶部占位,增加用户中心面包屑,原 API 与操作回调不改。此为用户明确要求的导航宿主调整,不新增业务权限或新路由。
导航实测:真实个人 UI 登录,侧栏入口顺序、进入后侧栏保留/选中、刷新保持、头像菜单入口、顶栏无密钥入口、移动底部入口,以及双主题桌面/移动截图通过;非 GET /api/ 请求 0,pageerror 0,结束 UI 退出。客服与导航证据分别为 logs/header-nav/customer-*、key-nav-*(Git 忽略)。串行单元测试及局部静态检查见本轮交付;未执行构建、全量 lint 或企业登录/权限矩阵验收,不宣称像素阈值验收通过。
## 系统公告弹窗与移动适配(2026-11-04)
依据用户附件 5.png / 6.png 的通知正文与系统公告空态、7.png 的顶栏入口。`NoticeModal.jsx` 改用原生 Ant Modal、Segmented、Checkbox、Button、Spin,非空系统公告使用 Card、Badge、Tag 保留原类型与未读状态;移除旧渐变、装饰图标与自绘旋转加载。新样式 `notice-modal.css` 仅作用于本弹窗,所有颜色来自 theme.useToken,通过 --nm-* 传递,Portal 不新增 ConfigProvider。
桌面实测主体左上 (530,100)、宽 860px;长通知主体高 670px、正文可视区 470px,空态主体高 500px,与附件主要几何一致。字号、边距、页签、复选框、按钮与模糊遮罩按附件对齐;正文为真实或明确标记的模拟接口内容,不复制原型内容到线上。深色由现有 token 推导,不宣称深色原型像素验收。未执行同内容逐像素差异阈值验收。
保留 `/api/notice` 请求、marked 解析、StatusContext.announcements 来源、20 条截取、日期处理、默认页签、未读计算及 onClose 语义。按照复选框设计新增本地 checked 状态,默认勾选;勾选后确认才复用原 notice_close_date 写入,未勾选确认与 X/遮罩/Esc 不写日期。无新增系统配置、存储 key 或业务接口。
验收:真实 UI 登录并确认用户中心主体后检查真实公告打开/关闭;模拟仅替换公告正文与 status 响应中的 announcements 列表(其他配置字段完整保留),覆盖 1920×1000、393×851、851×393 × 深浅主题的长正文与空态,共 12 个模拟状态,正文滚动、横向安全边距、页签切换及确认按钮可达通过;取消勾选、勾选确认、X、Esc、退出登录通过,登录之外非 GET /api/ 请求为 0、pageerror 为 0。前期脚本的隐藏 radio 定位与弹窗动画时序问题已修正并完整复跑,未改业务绕过。截图/脚本/结果位于忽略目录 logs/header-nav/,真实与 modal-mock-* 分开。
局部 ESLint/Prettier 通过,串行单元测试结果见 modal-unit.log;本轮未执行构建、全量 lint、企业账户登录或真实公告编辑。无新增文案 key。
## 顶栏 WeyAi 下载与主题直切(2026-11-04)
按用户追加的四张参考图:复用 `useWeyAiDownloadEntry` 及现有 HeaderActionButtons / rightActions 权限,下载按钮仍跳转 `/weyai/download`,补充 Ant Tooltip,34px 高、8px 图文间距、500 字重,悬停背景沿用 Ant text Button 的双主题 token 默认值。当前真实公开配置 `weyai_download_enabled=false`、`weyai_web_enabled=false`,因此真实顶栏按规则不显示下载入口;不修改系统开关或伪造权限,已启用时的视觉与跳转本轮未做真实端到端验收。
`ThemeToggle` 改为原生 Ant Button + Tooltip,移除下拉菜单及自动模式选项,使用 `useActualTheme` 判断并调用原 `onThemeToggle(light/dark)`;旧 auto 用户首次点击后切换到当前实际主题的反向固定主题。主题持久化、ConfigProvider 和业务 hook 均不改动。新增两条提示文案,九个语言包均已补齐。
简单验收:离屏有头 Chrome 真实 `/org/login`、`/login`、`/market` 各完成两次点击直切、Tooltip、无下拉及刷新保持检查;真实个人 UI 登录进入用户中心后验证主题直切、公告打开/关闭、账户菜单、移动截图和 UI 退出,全部通过。企业登录页面视觉交互已测,未执行企业账户登录。两轮修改后串行单元测试均为 247/247,局部 ESLint/Prettier 与 git diff --check 通过;本轮未运行构建或全量 lint。验证脚本与证据仅保存忽略目录 logs/header-nav/。
## 顶栏右侧图标与按钮对齐(2026-11-04)
依据:用户本轮图1红色标注与图2参考,仅调整共享顶栏右侧呈现,不复制品牌、导航、用户头像或按钮数量。Ant Button 图标容器在 `.ui-header-actions` 作用域内使用 inline-flex 消除 SVG 基线空隙;主操作及主题/公告/语言图标调整为 16px、1.5 线宽,账户箭头为 10px;工具点击区保持 34px。原链接、显隐判断、菜单触发、主题状态、公告回调及权限均未改动,前轮公告栏关闭功能未改动。
验证:本机离屏有头 Chrome,Base URL 从 dev.log 最后 Local 提取。真实个人 UI 登录并确认用户中心主体后保存忽略目录内会话;实测改前主操作 SVG 中心比按钮中心高 1.125px,改后所有顶栏 SVG 与对应按钮中心偏差 ≤0.1px。桌面 1920×1000 深浅主题切换、公告打开/关闭、账户菜单及 UI 退出通过,移动 393×851 完成截图检查。初轮脚本因登录默认落地密钥管理及自动公告弹窗遮挡失败,修正验证脚本后复跑通过,未绕过鉴权或修改业务。证据位于忽略目录 logs/header-nav/。企业登录未测(未提供企业凭据),不宣称参考图逐像素验收通过;本轮未执行构建与全量 lint,局部 ESLint/Prettier 及串行单元测试结果见本轮交付。
## 模型超市(/market)按原型站对齐(2026-11-04)
范围:个人端 `/market` 及详情抽屉。`${BASE_URL}` 取自 `dev.log`(本轮 `http://localhost:5175`,候选 `192.168.0.161:5174` 被另一同目录 Vite 占用);视觉基准为原型 `http://192.168.0.161:8888`“模型超市”(SPA 视图,深浅双主题)。规范 `docs/ui/MARKET_SPEC.md`,完整记录 `docs/ui-audit/market.md`。
- 组件:Bento 版(吸顶 pill 栏、“更多”SideSheet、`SelectableButtonGroup`、`app-card` 卡片、适配 Modal 详情)替换为原型结构的原生 Ant Design:`Input` + `Button` 搜索条、侧栏 `Button` 筛选组、`Card` 卡片(键盘可打开)、`Tag`、`Card loading`、`Alert`、`Drawer` + `Typography copyable` + `Table` 详情、`Image` 预览。页面目录内 20 个不可达旧文件删除。
- 样式:`market/market.css` 页面作用域,`--mm-*` 浅 / 深色均为原型实测值,主色 / 正文 / 分隔线经 `theme.useToken()` 注入;原型 Hero SVG 提取至 `src/assets/prototype/market-hero-art.svg`;原型悬停 / 扫光 / 信号线动效受 `prefers-reduced-motion` 约束。
- 零业务侵入:hooks / helpers / App 未改;组件树 API 调用 0 → 0,Hook 与计价调用参数一致;两个“重置”复用页面既有 `resetPricingFilters`(只重置搜索与筛选);搜索保留 300ms 防抖。新增 16 个文案 key,9 个语言包补齐。
- 验证:真实 UI 登录 `test_222` 与 UI 退出;原型 / 系统同脚本有头采集 16 个 Context、38 组对比(mock 原型同构目录)+ 真实后端 38 张 + 原型未定义状态 20 张,非 GET 请求 0;桌面 20/20 在数据规则归一化后 ≤0.5%(严格 0.64%–1.13%),窄屏 9/18 严格通过;`market-ui.spec.js` 本地基线无 update 复跑 18/18(另 2 项平台跳过);`npm test` 247/247;构建通过;改动文件 ESLint / Prettier 通过,全量 ESLint 10 错误、169 警告;`git diff --check` 通过。
- 风险摘要:厂商列表与零计数禁用为业务规则差异;窄屏宿主顶栏高度不同;图标资源 / 图标集与 Ant 控件正文色为保留差异;联调后端 429 限流;系统侧像素对比基于 mock 目录。详见 `docs/ui-audit/market.md` 第 10 节。
## 个人端用户中心按原型图.zip 对齐(2026-11-03)
范围:个人登录后 `/user-center/*` 的使用记录(消费记录、绘图与视频)、在线充值(余额充值、会员订阅、充值记录、会员购买记录)、个人设置(头像、账号绑定、安全、通知)、数据看板会员权益块及相关弹窗;外壳统一为 `UserCenterPageHeader` + `src/styles/user-center.css`。视觉真源为 `原型图.zip`(16 张浅色截图),`现有图.zip` 仅作基线;深色由 token 推导。
- 组件:自绘页签 → Ant `Tabs`;`CardPro` → 筛选/记录两张 `Card`;`RadioGroup` 按钮组 → `Segmented`;状态胶囊 → `Tag`;插画空态 → `Empty`;`CodeViewer` → `<pre>` + 复制链接;玻璃弹窗 → 默认 `Modal`;会员购买记录抽出 `MembershipHistoryContent` 内嵌页签。管理员 `/console/log`、`/console/task` 分支未改。
- 样式:页面变量族 `--uc-*`、`--ur-*`、`--rc-*`、`--ps-*`,浅色为原型实测,深色引用主题变量;规则中不直接写颜色。使用记录/在线充值/个人设置内容边距 26px 36px 36px、面包屑与标题间距 14px(看板与服务监控保持 30px / 24px)。
- 零业务侵入:AST 对照 API 调用 38 → 38,路由、rules、存储、导航、dispatch 不变;3 类展示性差异已复核。新增 42 个文案 key,9 个语言包补齐。
- 验证:真实 Chrome UI 登录 `test_222`,桌面/移动双主题截图与原型差异图、15 步只读交互(0 写请求)、会员专属块模拟截图、`ui-20261103-late.spec.js` 12/12、`sidebar-marquee.spec.js` 桌面通过;`npm test` 247/247;构建通过;全量 ESLint/Prettier 与基线一致;结束时 UI 退出。
- 文档:规范 `docs/ui/UI_SPEC.md`;`AGENTS.md`、`CLAUDE.md` 新增“个人端后台 UI 规范(用户中心)”同节;审计记录 `docs/ui-audit/`(差异清单、组件映射、覆盖清单、变更日志、测试结果、风险)。
- 风险摘要:规范内含用户指定的测试账号密码;登录接口响应含敏感字段名;构建需约 2.9GB 堆;同标签页退出后 `/org/login` 加载 ≥ 20 秒;深色无原型;管理员视角的个人使用记录未用真实管理员截图。详见 `docs/ui-audit/risks.md`。
## 服务监控标题与主题色调整 2026-11-03
按用户后续三张标注图更新本页设计:移除“服务大盘”左侧图标与星光,标题对齐消费记录的 28px、650 字重、32px 行高及主文字色;新增副标题“实时查看各分组服务可用性与模型状态”,使用 14px、20px 行高和 colorTextSecondary。桌面状态标记靠右,窄屏自然堆叠。
原绿色正常态色条、分组图标、可用率、历史条、监控点和倒计时改为当前 ConfigProvider 的 colorPrimary;图标及徽标使用 colorPrimaryBg,状态标记边线使用 colorPrimaryBorder。移除渐变、光晕、健康徽标黄色装饰点及悬停缩放,保留原有历史信息和 Tooltip。告警/异常保持 colorWarning、colorError 语义,不改阈值。全部颜色动态读取现有 theme.useToken,支持浅色、深色及管理员品牌预览;不新增主题状态、存储 key 或请求。
本轮覆盖:标题与副标题、正常分组呈现、历史条、状态与倒计时、真实刷新、主题切换及窄屏布局;模拟覆盖空数据、失败、重复点击及告警/异常呈现。未覆盖:个人账号无权限的管理员操作及真实模型测试。排除:其他页面、共享顶栏和侧栏。保留原 60 秒自动刷新与逐秒倒计时,不新增动效。更新证据保存于 `logs/service-dashboard/theme-alignment/`,与早期截图和像素比较分开,最新用户要求优先于下文旧版绿色参考记录。
本轮验收:Chrome 有头桌面/移动共 10/10 通过,含真实页面、倒计时变化、真实刷新与主题保持,以及品牌预览主色同步。品牌预览仅调用既有 applyTheme 的 persist=false 模式,未写服务器配置。告警/异常、空态、失败及重复点击为模拟接口证据。串行单元测试 247/247 通过;改动文件 ESLint 零错误零警告,Prettier 和 git diff --check 通过。全量 ESLint 保持原有 10 错误、171 警告,全量格式仍有原有 666 文件差异。构建检查仍因 Node.js 堆内存不足失败,未标记通过,见本轮 `build.log`。两份页面源码的 API、状态初始值、业务 effect 和处理函数 AST 对照一致,本页无固定绿色类、旧组件库引用或旧变量。首轮失败日志保留,修正测试预览输入和触屏主题菜单定位后完整复跑通过,未跳过用例。详细报告为 `logs/service-dashboard/theme-alignment/report.md`。
## 服务监控单页对齐 2026-11-03
目标地址从 `dev.log` 最后一个 Local URL 拼接 `/user-center/service-dashboard`,本轮实际为 `http://localhost:5173/user-center/service-dashboard`。按用户明确前提复用已通过 UI 登录保存的个人会话,不执行新的登录流程。开发服务原先不可连接,使用 Windows 隐藏后台进程启动后复用。未改动其他页面、宿主导航、路由、API 或业务状态。
### 覆盖与参考边界
- 已覆盖:真实个人页面分组列表、深浅主题、桌面与移动端、历史条、刷新、主题刷新保持;模拟空数据、失败提示及刷新中重复点击。
- 未覆盖:管理员专属详情和模型测试的真实写操作。当前个人账号没有管理员操作权限,不伪造权限展示弹窗;详情视图采用 Ant Design 默认组件,并核对原有回调和数据来源。
- 排除:企业端、其他个人页面、共享顶栏和侧栏、第三方页面。参考截图没有顶栏,交付全页截图保留宿主顶栏,比较时单独裁剪。
- 原型缺失:在线原型当前个人菜单仅有数据看板、密钥管理、使用记录、在线充值、个人设置,没有服务监控入口。`logs/service-dashboard/prototype-*.png` 是入口缺失及宿主主题证据,不是本页原型。该页浅色按用户附件核对,深色按现有 ConfigProvider token 映射。
### 差异与组件映射
| 区域 | 改造前 | 改造后 |
| ---------------- | -------------------------------- | ----------------------------------------------------------------------------------------- |
| 外层与描述卡片 | 普通 div 与 app-card 强制覆盖 | 原生 Ant Design Card,保留 24px 内边距、8px 圆角及原有几何 |
| 分组行深色 | 灰色透明背景、独立 Tailwind 灰阶 | 页面局部使用 colorBgContainer、colorBorderSecondary、colorText 和 colorTextSecondary |
| 深色缺失历史点 | 与分组背景接近,难以区分 | 使用 colorFillSecondary,保持 60 点、6px 宽、2px 间距和原有数据 |
| 刷新区 | 兼容按钮及强制文字覆盖 | 原生 Button type=text,保留 loading、回调及浅色参考表现;窄屏信息可换行 |
| 管理员详情 | 无原型依据的渐变、模糊和阴影组合 | 原生 Modal、Statistic、Table、Button 和 Tooltip;保留权限、数据、分页、测试载荷和关闭回调 |
| 警告与异常历史点 | 固定红黄颜色 | 使用现有 theme token,保留原有正常/异常判定阈值 |
页面背景继续由 UserCenter 提供,不新增图片。附件已有绿色标题图标、分组图标、健康徽标及局部阴影保留;其他未定义部分遵循 Ant Design 默认值。无对应组件的历史条使用统一语义色,规则同步于 AGENTS.md 和 CLAUDE.md。
### 证据与限制
截图和报告均在 Git 忽略目录 `logs/service-dashboard/`。改造前为 `before-light.png`、`before-dark.png`,改造后为 `after-chrome-light.png`、`after-chrome-dark.png`,移动端为 `after-mobile-chrome-*.png`。`pixel-comparison.json` 记录与用户附件的未遮罩比较,`reference-difference.png` 标记差异;实时更新时间、倒计时、动画帧、侧栏悬停及字体渲染均计入差异。此结果不构成所有元素误差不超过 1px 的证明。
### 本轮实际验证结果
| 检查 | 结果 | 证据 |
| -------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| Chrome 有头专项 | 6/6 通过,桌面和移动端 | `logs/service-dashboard/playwright-final.log` |
| 真实后端 | 两个分组、双主题、刷新及主题刷新保持通过;页面异常和失败 API 响应均为零 | `real-chrome.json`、`real-mobile-chrome.json` |
| 模拟接口 | 空数据、业务失败提示、刷新中重复点击通过 | 同专项 Playwright,不能据此宣称真实模型测试或管理员操作通过 |
| 单元测试 | `npm test -- --test-concurrency=1`,247/247 通过 | `unit-serial.log`;首轮并发因内存不足失败,保留 `unit-memory-failure.log` |
| 变更文件 ESLint / Prettier | 通过,源码 ESLint 零错误零警告 | `eslint-changed.log`、`format-changed.log` |
| 全量 ESLint | 未通过:10 错误、171 警告,与改造前一致 | `eslint-final.log` 与 `logs/service-eslint-before.log` |
| 全量 Prettier | 未通过:666 文件存在原有格式差异,改造前 669 文件 | `format-final.log` 与 `logs/service-format-before.log` |
| 构建 | 未通过:正常、串行与限制并行度重试均遇到内存分配失败 | `build.log`、`build-serial.log`、`build-limited.log` |
| 零业务侵入 | 两份页面源码的 3 处 API、12 处状态初始值、3 个 effect 及业务处理函数 AST 对照一致 | `business-audit.json` |
| 旧 UI 残留 | 本次页面源码无旧组件库、旧图标包、Toastify 或旧变量引用 | `legacy-residuals.log` |
| diff 检查 | `git diff --check` 通过 | 不包含 Git 自身 LF/CRLF 提示的告警解释 |
| 附件未遮罩像素比较 | 差异 24,065 像素,占 1.4884%;未达到逐像素相同证明 | `pixel-comparison.json`、`reference-difference.png` |
### 风险与后续建议
构建被当前机器内存限制阻塞,不能声称构建通过。首轮浏览器失败包括加载图标改变按钮可访问名称、触屏没有桌面悬停语义、已有错误提示重复节点及小尺寸历史条稳定性等待;按真实 DOM 调整定位后 6 项全量复跑通过,失败批次保留。错误提示存在重复节点属于既有业务/全局消息行为,本轮只记录。
附件是浅色静态截图,在线原型缺少本页入口;目前无法证明深色原型一致,也未证明所有元素均在 1px 内。桌面截图为 1920×917,附件比较裁剪原点为 x=2、y=74,输出 1918×843;原始 before 截图为 1918×950,不能将直接叠加 before/after 解释为严格像素回归。管理员详情、真实模型测试、异常/告警历史数据的真实后端情况仍待具备相应权限和数据时验收。
## 顶部导航下划线及用户中心来源路径(2026-11-03)
通过真实 Chrome 检查原型 `http://192.168.0.161:8888/`,模型超市导航项测得 24px 横向内边距、整栏高度、2px 下划线且两端缩进 16px。现有 Navigation 增加局部样式标识,保留原 Link、外链、下拉、路由匹配及权限条件;普通悬停项显示主色下划线,选中项同时使用主色文字,下划线持续显示,键盘焦点也可见,使用现有双主题变量。原型悬停截图及测量:`logs/sidebar-marquee/prototype-hover.png`、`prototype-nav.log`。
抽取 Ant Design `UserCenterBreadcrumb` 统一呈现“用户中心 / 当前页面”。覆盖数据看板、使用记录、服务监控、在线充值、个人设置;替换数据看板原面包屑,其他四页在标题前复用,不新增路由或业务触发。字号 12px、下间距 24px 与数据看板一致,桌面横向 30px、移动 16px;充值与服务监控嵌入用户中心时统一内容边距。独立充值、服务监控、个人设置路由不显示此路径,邀请及发票等未在本轮要求中的页面保持现状。
## 个人侧栏边线与公告栏(2026-11-03)
复用之前通过真实 UI 登录保存的企业、个人独立会话,依次确认 `/org/workbench` 和 `/user-center/dashboard` 主体实际渲染。侧栏实测容器已有 1px 边线,Ant Menu 仍有独立 1px `border-inline-end`,造成截图标注的内侧长竖线;新增局部选择器仅清除菜单内线,保留容器边界、菜单和折叠行为。
公告参考图像素统计确认现有浅色背景 `#fff7e8`、文字 `#93622a`、边线 `#f4e8d3`,深色背景 `#292319`、文字 `#d9b078`、边线 `#3a3020` 已一致。本轮移除遗留图标底色/光晕/文字阴影,统一内边距、12px 正文与测量文字的字号字距;公告总高度(含底线)35px。保留原 `marquee_content` 解析、50px/s 速度计算、双文本无缝循环、悬停暂停及空公告隐藏行为;项目现有公告组件没有关闭入口,本轮不新增关闭功能。覆盖个人侧栏展开/折叠、桌面/移动布局及双主题;公告内容通过模拟 status 提供,真实后端未配置公告时不修改服务器配置。
## 登录导航与后台统一(2026-11-03)
按最新两张截图,`/org/login` 与 `/login` 不再使用上轮恢复的玻璃导航:移除使背景、顶部品牌条、光晕和反光层重新显示的局部覆盖,取消桌面 64px 高度覆盖,直接沿用现有后台导航样式。桌面内容行 72px、移动端 56px,另含 1px 底部分隔线;背景、文字及分隔线沿用既有主题变量与 ConfigProvider,不另建主题状态。顶部品牌条在所有主题均不显示。登录框及登录业务保持现状,其他认证页的透明顶栏不变。
## 企业与个人登录顶部导航恢复(2026-11-03)
按用户最新澄清,撤回此前仅恢复企业入口的范围,统一恢复 `/org/login` 和 `/login` 顶部导航,以附图和两轮登录 UI 优化前的既有 HeaderBar 样式为依据。两个入口移除连续背景导航标识,改用 `login-layout-header` 恢复已有玻璃背景、细线、反光及桌面 64px / 移动端 56px 高度。其他认证页及后台保持现状;不回退登录框后续的文字、按钮、字段间距、必填校验和防抖动调整,不改请求或载荷。覆盖两个路由的桌面/移动与深浅主题、主题入口、登录框几何和原交互回归;后台业务页面和真实账号鉴权不属于本轮范围。
验收:Chrome 有头全套 42 项首轮 41 通过,个人深色桌面用例在页面仍显示“加载中…”时超过 10 秒等待;保留失败截图及上下文于 `logs/login-refinement/header-loading-failure/`。受影响用例独立连续复跑 2/2 通过,未修改产品加载逻辑或跳过用例。全套日志 `playwright-login-headers-verified.log`,复跑日志 `playwright-login-headers-recheck.log` 均在 `logs/login-refinement/`。两个入口 × 双主题 × 桌面/移动共 8 项导航恢复检查通过,切换导航样式前后登录卡片位置和尺寸一致;8 项校验稳定性检查通过,已目检桌面及移动端导航截图(`browser/restored-header-*`)。单元测试 247/247 通过,构建通过并保留大 chunk 告警。改动源码和文档格式检查、`git diff --check` 通过;PageLayout ESLint 为 0 错误、2 条既有 Hook 警告,全量仍为 10 错误、171 警告;全量格式检查报告 673 个差异文件。公开登录页检查使用真实后端,表单交互回归使用模拟接口,未验证真实账号鉴权。
分支:`ui-optimization`。参考:`http://192.168.0.161:8888`。执行日期:2026-11-02 至 2026-11-03。
## 边界
只迁移视图组件、主题、尺寸、样式与视觉交互。页面的数据请求、权限、状态流、路由、提交条件保持原有实现。原型存在而业务页面不存在的功能不补建。WeyAI 外部页及第三方 SDK 不进行视觉重做。
## 2026-11-03 全量复核补充(本轮)
本轮接续工作区已有迁移,新增变更涉及工作台呈现、充值按钮、日志页残留装饰、标签中性色适配和交接规范。下文早期“企业登录阻塞”属于历史记录,本轮已使用正确企业名称通过真实 UI 登录;不得继续用早期失败替代最新结论,也不得把历史测试结果当作本轮重跑。
### 登录关卡与阶段零盘点
- 复用 `dev.log` 解析出的服务地址,本机 Chrome 有头、离屏运行。企业先等待 networkidle,检查到一个搜索输入与“下一步”,判定为 A;填写“测试企业1”后企业查询 200/available,凭据提交 200/success,进入 `/org/workbench` 并确认 `.org-center` 与工作台渲染。
- 保存 storageState,后续企业采集复用,不用 API 登录。日志中的凭据 payload 已脱敏,登录阶段不录 trace。早期脚本将登录名误作企业名称;本轮没有沿用该错误输入。
- 原型重新采集 15 个企业菜单和 5 个个人菜单,双主题共 40 张。企业“我的 AI 能力”不能激活,不能作为独立页面参考。证据:`logs/ui-migration/review-20261103/prototype/`。
### 企业阶段差异与实际覆盖
| 分类 | 本轮记录 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 已覆盖页面 | 工作台、数据看板、员工管理、令牌管理、企业充值、消耗明细、审计日志、个人设置、企业设置;桌面 1440×1000、触屏 393×851,各 18 张深浅截图 |
| 已覆盖状态 | 昵称、密码、创建令牌弹窗的深浅主题与取消;令牌空名称校验;真实测试令牌创建、改名、禁用、删除;消耗明细无匹配筛选与重置 |
| 未覆盖页面 | 组织架构、角色管理、项目管理、预算、审批、AI/技能/知识/连接器等未开放入口;沿用配置与权限,不增加菜单、不绕过守卫 |
| 排除页面 | WeyAI 外部页面、第三方客服/广告、联系客服、体验中心、模型超市内部;仅检查后台宿主布局 |
| 修正差异 | 工作台旧品牌实底/黑色辉光改为原型 `.ew-hero` 的浅金/深棕背景与三层 CSS 轮廓;恢复面包屑、原型间距、统计卡图标密度和用量分隔;企业概览充值按钮移除绿色渐变阴影,使用 Ant Design 主按钮 |
| 保留差异 | 真实账户未设个人额度上限、仅一名成员;角色/列/按钮/业务文案及功能可见性与原型不同,均保留真实数据和原有条件;公告由配置决定,不补造公告 |
| 真实写入清理 | 仅创建本轮唯一测试令牌,创建/编辑/禁用/删除请求均 200,最终删除并验证列表无该测试行;未操作既有令牌、密码、真实成员或支付 |
截图/状态清单:`logs/ui-migration/review-20261103/enterprise-after-desktop/`、`enterprise-after-mobile/`。9 页共 36 次主题采集未发现 pageerror、HTTP 失败 API 或整页横向溢出。弹窗状态另存于桌面目录。真实增删改查证据:`enterprise-workflows.json`,不记录生成的密钥,不拍含密钥的成功弹窗。
首轮弹窗脚本用 Escape 后等待 DOM 卸载失败;改为 UI“取消”并等待隐藏后通过。失败批次保留在 `enterprise-before-desktop/review.json`,没有修改产品弹窗关闭语义。背景/统计样式来源及无原生部件的统一规则已先写入 `AGENTS.md` / `CLAUDE.md` 再应用。
### 个人阶段差异与覆盖
| 分类 | 本轮记录 |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
| 已覆盖页面 | 数据看板、使用记录、服务监控、个人端充值、个人设置、独立密钥管理、独立充值;9 个入口/7 个实际路由,桌面与真实触屏各 18 次主题截图 |
| 未覆盖页面 | 邀请、发票入口在当前配置重定向至数据看板;不算独立页面通过。平台管理页面无真实管理员凭据,单独进行模拟渲染,不混为个人真实验收 |
| 真实检查 | 桌面深浅主题筛选弹窗打开/取消、四个设置页签、密钥无匹配筛选/恢复、创建密钥弹窗取消、主题刷新保持;未执行个人资料、密码或密钥写入 |
| 支付边界 | 后端未启用在线支付;记录现有管理员提示和充值记录空态,不启用支付,不生成真实付款,不宣称扫码支付成功 |
| 保留差异 | 原型密钥页为侧栏内页面,系统为独立路由;充值组合与图表数据/图例结构存在差异。保留原路由、数据流和条件,不新增原型业务 |
真实采集证据:`personal-review-desktop/review.json`、`personal-verified-mobile/review.json`,各 18 次主题状态无 pageerror、失败 API 或整页横向溢出。触屏首次脚本误选隐藏侧栏已修正;初始失败留存在 `personal-review-mobile/`。个人深测的初始密钥空态文案定位错误仅修测试,未改产品文案。
连续深测触发后端 429,记录在 `personal-states-rate-limit.json` / `personal-states-mobile-partial.json`。已停止真实采集,后续只补未完成状态,采用 SPA 路由减少重复加载;公开 status 恢复 200 不代表统计接口解除自己的限流。失败批次不计入成功页面结论,也不修改后端限流。
### 全局阶段差异与模拟覆盖
- 首次平台管理采集的 104 张包含懒加载/骨架屏、错误模拟响应及配置重定向,不能作为 26 页完整渲染通过的证据。保留 `admin-mock/` 原始批次;后续按接口契约修正数组/分页对象、货币单位与分佣汇总模拟数据,等待懒加载/骨架屏结束,并检查错误消息、控制台、无效数值和实际路由。
- 最终采集见 `admin-mock-final/*/review.json`:25 个入口 × 2 主题 × 2 视口,共 100 次截图。23 个实际页面/宿主共 92 次完成渲染检查,无 pageerror、运行异常、错误消息、无效数值或整页溢出;其中体验中心仅检查宿主。其余 8 次为技能/专家平台重定向,不计独立页面完成。
- 目检修正日志页玻璃背景、网格、渐变、阴影和深色背景透白;查询按钮使用 Ant Design primary。日志卡片、筛选与账单明细使用语义背景/边框,保留全部查询、重置、分页与导出处理函数。个人使用记录页签移除覆盖主题的旧蓝色渐变,使用原型主色下划线。
- 旧 Tag 的 `white` 语义映射为 Ant Design `default`,修正会员快捷筛选在深色主题下白底白字的问题;点击状态和原有请求参数保留。日志查询/失败/重置、会员快捷筛选的原有参数以及共享组件契约使用本地模拟回归验证。
- 日志样式修正后,复用真实 UI 登录保存的会话,补采个人使用记录桌面/触屏双主题 4 张,并通过 UI 退出;无 pageerror、失败 API、写请求或整页溢出。证据:`personal-late/review.json`。该补测只核对已存在的日志页面与主题,没有重复写入真实账户。
- 渠道页仍有 Select 的 null option 警告;日志页仍有 DatePicker `dropdownClassName` 弃用和桌面 Tooltip `findDOMNode` 警告。它们与运行异常分开记录,没有将控制台描述为完全无警告。
| 覆盖分类 | 路由/页面 | 证明范围 |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| 平台模拟实际页面 | models、channel、token、monitor、analytics、my-commission、partner、commission、organizations、order、invoice、redemption、user、subscription、setting、website-setting、demo-reservations、personal、topup、log、midjourney、task | 22 页 × 4 状态,共 88 次模拟渲染;不证明管理员真实鉴权、保存、上传或所有页签 |
| 排除内部视觉,仅检查宿主 | playground | 4 次宿主截图;体验中心内部不纳入替换/原型对比 |
| 配置重定向,未覆盖独立页面 | skill-platform、expert-platform | 8 次截图实际落点为 analytics,不开放构建开关或权限 |
| 排除外部 iframe 跳转入口 | chat | 无配置外部地址/可用令牌,旧初始化截图不作为聊天页面渲染证据 |
### 本轮验证记录
所有本轮证据位于 `logs/ui-migration/review-20261103/`,新脚本、会话、截图和报告均已验证受 Git 忽略。以下是本轮实际重跑结果,历史数据仍保留在后文。
| 检查 | 本轮结果 | 证据/边界 |
| ----------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 企业 A/B 真实登录与退出 | 两条路径通过,均确认工作台主体渲染,无失败登录接口;UI 退出 200 | `enterprise-gate.json`、`enterprise-survey.json`、`enterprise-standard-login.json`;B 为正常记忆企业后的凭据页,不启用未开放的直登开关 |
| 企业真实逐页 | 9 页×2 主题×2 视口,36 次状态截图;6 次双主题弹窗截图 | `enterprise-after-desktop/`、`enterprise-after-mobile/`;无 pageerror、失败 API 或整页溢出 |
| 个人真实逐页 | 9 入口/7 实际路由,36 次状态截图 | `personal-review-desktop/`、`personal-verified-mobile/`;两次配置重定向单列 |
| 个人深测补充 | 桌面双主题、触屏浅色完整状态及触屏深色筛选已记录;最终深色剩余设置/密钥/刷新与 UI 退出通过,无失败 API 或写请求 | 桌面成功项见 `personal-states-rate-limit.json` 的限流前 actions;触屏浅色及深色筛选见 `personal-states-mobile-partial.json`;最终补测见 `personal-states.json` / `personal-states-remaining.log`。失败批次不整体标为成功 |
| 全量 Playwright | **128/128 通过,16.4 分钟**;本机 Chrome 有头/离屏,桌面和触屏,不带 update | `playwright-full.log`;包括企业本地截图回归、组件契约、校验、分页、失败与重复提交等模拟回归 |
| 企业截图基线 | 4/4 通过后全量无更新复跑通过 | `enterprise-screenshot-baseline.log`;本地渲染回归基线不等于与原型像素一致 |
| 平台管理模拟 | 25 入口/23 实际页面与宿主,100 次截图;92 次完成渲染检查,8 次配置重定向 | `admin-mock-final/*/review.json`;接口全部模拟;体验中心仅宿主,外部聊天入口排除;弃用/null option 警告单列 |
| 末轮 UI 专项 | 日志查询/失败/重置、会员快捷筛选与共享组件契约 16/16 通过;个人页签双主题/双视口追加 4/4 通过 | `late-playwright-verified.log`、`late-personal-playwright.log`;首轮 8 个用例因遗漏错误提示的“错误:”前缀失败,修正定位后复跑;初始日志和 trace 保留于 `late-playwright.log`、`late-initial-results/` |
| 单元测试 | 247/247 通过,无跳过 | `unit-final.log`;末轮共享组件变更后再次 `unit-late.log` 247/247 |
| 构建 | 通过,保留既有大 chunk 提示 | `build-final.log`;包含最后的日志和页签 CSS |
| ESLint | 本轮 7 个 JSX 文件通过;全量仍为 10 错误、171 警告,与基线一致 | `eslint-delivery-changed.log`、`eslint-delivery-final.log`;新增本地测试的缺失文件头已补齐,不保留新增错误 |
| Prettier | 本轮 13 个交付文件通过;全量仍有 671 个格式差异文件,基线 680 | `format-delivery-changed.log`、`format-delivery-final.log`;只格式化本轮文件,不批量重排无关业务文件 |
| 零业务侵入静态对照 | 461 个源码文件、809 处 API 调用;API/状态初值/Hook 依赖/Route 无未解释差异 | `business-audit-late.json`;已有旧 locale wrapper 迁移由统一 Provider 接管,列为已审阅 UI 差异 |
| 旧组件库残留 | 源码、依赖及锁文件未发现旧库导入、旧 CSS 变量/选择器、Toastify 或旧图表主题/插件 | 本轮扫描;`git diff --check` 通过 |
### 本轮交接与风险
- `AGENTS.md` 与 `CLAUDE.md` 已同步目录职责、原生 Ant Design 写法、旧契约映射、主题、背景与布局、无默认组件的补位规则、禁止事项和测试清单,并明确企业 A/B 判定与操作。后续先读两份入口及本记录;完整组件映射表见本文“组件映射”。
- 没有可用的真实平台管理员会话,平台管理只完成已列出的模拟渲染,重定向与外部入口未算作页面完成;企业隐藏模块只做既有模拟回归,未开放权限。真实多页数据分页、真实上传与扫码支付不能由上述结果代替。
- 原型与当前后端的配置、账户数据、路由组合和业务结构存在差异;本轮修正工作台可确认的视图差异,未将这些功能差异扩展为业务修改。仍不能宣称全后台逐像素一致。
- 429 失败证据保留。后续采集优先 SPA 导航、同页切主题并遵守接口各自限流;按剩余状态补测,不能用公开 status 的 200 推断所有接口恢复。
- 全量 lint 的既有错误和格式差异仍需独立任务处理;本轮没有修复非 UI 阻塞问题。未提交或推送工作区已有改动。
以下为接续前的历史批次记录,保留当时失败与验证范围;登录、测试数量和当前风险以本文开头“全量复核补充(本轮)”为准。
## 登录页标注图调整(2026-11-03)
- 根据用户标注图,认证顶栏通过 `.auth-layout-header` 使用透明背景,连续呈现既有认证背景,消除顶部实色分层;后台其他顶栏仍沿用原型底色。
- 企业/个人切换共用 Ant Design Button,控件为 34px 高、8px 圆角。个人登录按钮沿用原回调,交由 Ant Design 呈现加载、禁用和主色;移除该按钮原有渐变、扫光及浮起效果。
- 登录页尺寸和间距限定于 `.auth-login-page`。企业直登、企业标识及个人登录使用同一输入框尺寸,企业标识/直登补齐带标签的 Form.Item,个人必填标识使用既有表单适配接口。保留原有校验、请求载荷、登录方式切换及重定向。
- 标签与输入框间距 6px,个人字段间距 16px;密码至提交按钮间距 20px,提交按钮、忘记密码及注册入口间距分别为 12px。登录卡片关闭位移动画,窄屏顶部预留固定顶栏高度,长表单可滚动访问。
本轮真实联调仅检查公开登录页的状态接口、桌面/移动端双主题展示与主题切换,未使用真实账号完成鉴权。企业标识下一步、个人/企业登录失败、载荷、防重复提交、协议限制和成功响应进入两步验证均使用模拟接口,不能据此宣称真实登录成功。保留截图中的既有海洋背景与品牌资源;中间剪贴板提示按用户标注忽略。本轮没有做原型逐像素断言。
| 检查 | 实际结果 |
| ---------------------- | -------------------------------------------------------------------- |
| `npm test` | 247/247 通过 |
| Chrome 有头 Playwright | 22/22 通过,桌面与移动端;含 360 × 480 窄屏滚动与主题刷新保持 |
| `npm run build` | 通过,保留既有大 chunk 告警 |
| 改动的 JSX ESLint | 0 错误、4 条既有 Hook 警告 |
| 全量 ESLint | 基线及本轮均为 10 错误、171 警告 |
| 全量 Prettier | 修改前 698 个文件有格式差异,本轮 695 个;改动的源码文件格式检查通过 |
本地证据:`logs/login-refinement/browser/` 保存真实/模拟双主题截图与几何检查,`playwright-complete.log` 保存最终验收。背景截图等待画布实际切换主题;AutoComplete 圆角检查针对可见 selector,避免读取外层布局容器。早期失败批次日志保留,包含测试文案前缀、模拟数据、懒加载等待及 DOM 定位问题。企业登录与入口切换的 AST 审计确认业务语句、路由目标和导航回调保持一致。新增用例 `e2e/login-refinement.spec.js`、截图和日志均受 Git 忽略。
## 登录页二次标注调整(2026-11-03)
- 企业登录第二步:“记住登录名”文字与卡片副标题使用相同语义次文字色,标签默认和悬停均无底色;复选框的勾选、键盘操作及记忆逻辑保持原有实现。“切换企业”采用与“登录”相同的 Ant Design primary 按钮,保留加载时禁用、清空企业标识及返回第一步的回调。
- 个人登录:“忘记密码?”文字与“欢迎回来”副标题同色,默认、悬停及按下均为透明背景;悬停只对文字做 160ms 透明度过渡,保留键盘焦点和 `/reset` 跳转。
- 共用副标题增加样式标识,颜色规则仅在 `.auth-login-page` 内生效;不修改注册及重置页的副标题表现。验收覆盖桌面/触屏、深浅主题、颜色一致、透明底色、悬停、复选框键盘操作、主按钮尺寸一致与切换回退。
最终 Chrome 有头验收 26/26 通过(`logs/login-refinement/playwright-followup.log`),单元测试 247/247 通过,构建通过并保留既有大 chunk 告警。改动的 JSX 为 0 错误、4 条既有 Hook 警告,改动源码格式检查及 `git diff --check` 通过;全量 ESLint 保持基线 10 错误、171 警告,全量 Prettier 剩余 694 个既有格式差异文件。截图保存在 `logs/login-refinement/browser/followup-*`,其中企业第二步使用模拟数据。真实后端仅覆盖公开登录页,未验证真实账号鉴权成功。两份入口规范同步记录本轮辅助文字及按钮要求。
## 登录页校验与布局稳定性(2026-11-03)
- 副标题、“记住登录名”、企业管理员重置提示及“忘记密码”通过局部变量将原语义次文字色与黑色按 80:20 混合,实现本轮要求的加深 20%;忘记密码悬停改为 60:40 混色,通过 160ms 颜色过渡提供更明显反馈,底色仍透明。
- 个人登录用户名/邮箱、密码增加 Ant Form 必填规则,空提交在对应字段显示红框和错误提示。提交统一由 Form 校验成功后调用原 `handleSubmit`,移除按钮的重复调用入口;登录请求、载荷、协议、Turnstile、两步验证及加载禁用沿用原处理函数。
- 登录卡片上下内边距从 20px 增至 28px。个人和企业第二步的两个凭据字段预留 24px 提示空间,字段使用 padding 保持间距,避免 Ant Form 错误挂载时的 margin 补偿造成重新居中。提示保留正常文档流,较长翻译可以自然换行,不裁剪错误信息。
- 使用 Chrome 桌面/触屏与双主题逐帧采样,检查错误出现、仅修正一个字段及全部修正后卡片与输入框的位置和高度。首次最小高度方案仍出现 16px 波动,失败记录保存在 `logs/login-refinement/playwright-stability.log`,后续结果以最终验收日志为准。接口交互使用模拟数据,真实后端检查仅覆盖公开登录页。
最终有头 Chrome 34/34 通过:`logs/login-refinement/playwright-validation-final.log`。其中 8 项布局稳定性用例覆盖个人/企业、桌面/触屏、深浅主题,逐帧变化均不超过 1px;个人空提交不发登录请求,输入修正后仅提交一次。单元测试 247/247 通过,最终构建通过(既有大 chunk 告警保留),改动 JSX ESLint 为 0 错误、2 条既有警告,改动源码格式检查与差异检查通过。全量 ESLint 保持 10 错误、171 警告,全量 Prettier 保持 694 个格式差异文件。错误态截图及帧测量保存在 `logs/login-refinement/browser/validation-*`,未进行真实账号鉴权。
## 登录卡片装饰与字段间距精简(2026-11-03)
- 用户最新两张标注图的范围为企业与个人登录:移除卡片顶端黄色品牌装饰线及伴随反光,保留卡片本身的轮廓;通过 `.auth-login-page` 限定,不影响共用 GlassCard 的注册与密码重置页。
- 两个凭据字段取消额外的 16px 下内边距,合计减少 32px 冗余高度;保留 34px 输入框和一行 24px 校验提示预留空间。正常态、两个字段报错、仅修正一个字段及全部修正使用同一布局,长提示仍可自然换行。
- 本轮仅修改共享卡片的样式标识和登录页局部 CSS,表单规则、登录请求、载荷及切换流程沿用已有实现。
验收结果:Chrome 有头模式 34/34 通过(桌面/移动端、深浅主题),包含装饰线隐藏、字段无额外下内边距、空提交不请求、错误修正、重复提交保护及公开登录页真实后端检查。8 项校验稳定性测试逐帧位置和高度变化均不超过 1px;已人工复核桌面正常/错误态和移动端截图。登录请求交互使用模拟接口,未验证真实账号鉴权。记录:`logs/login-refinement/playwright-compact.log`,截图:`logs/login-refinement/browser/compact-*`、`validation-*`。单元测试 247/247 通过,构建通过并保留既有大 chunk 告警;本轮改动 JSX 的 ESLint、源码格式及 `git diff --check` 通过。全量 ESLint 仍为既有 10 错误、171 警告,全量格式检查仍为既有 694 个差异文件;首次局部格式检查发现 GlassCard 格式问题,格式化后复查通过。
## 阶段一:企业端
- 原型 15 个菜单、深浅主题共 30 张截图:`logs/ui-migration/prototype-enterprise/`。
- 原型“我的 AI 能力”菜单不能切换到独立页面;该菜单不能作为该页面的有效视觉基准。
- 企业端共享页面标题、卡片、侧栏、表格、表单、弹窗迁至 Ant Design 视图适配层;侧栏 216px、顶栏 72px、公告 35px;减少渐变、光晕和装饰动画。
- 企业端最终覆盖 32 个路由入口、17 个实际落点,桌面/移动、深浅主题共 128 次页面截图,另采集指引抽屉。截图与实际落点清单:`logs/ui-migration/enterprise-mock/chrome/`、`mobile-chrome/`。重定向不算对应隐藏功能页完成验收。`toHaveScreenshot()` 建立的是本地回归基线,不能据此认定与原型逐像素一致。
- 阶段构建通过。企业端桌面/移动双主题 4 个截图用例建立基线后无更新复跑通过;真实企业登录未通过。
- 真实登录阻塞:当前联调后端要求企业标识;提供的账号在该流程返回“企业不存在或不可登录”。没有通过接口登录或修改鉴权绕过。
### 企业端剩余差异
- 原型的“在职/已离职”“角色管理”等结构与现有“员工权限/员工账号”等业务页面不一致;不为追逐截图新增业务字段、入口或触发条件。
- 品牌名称、Logo、公告、可见菜单、权限与实际数据由后端配置决定,模拟数据与原型数据不同。
- 真实账户登录、退出及带真实业务数据的逐页比对仍需可用后端验证。
## 阶段二:个人端
- 通过 `/login` 的用户名、密码和协议复选框完成真实浏览器登录;登录、退出均由界面触发,没有使用 API 登录或注入真实账户会话。
- 原型 5 个菜单、深浅主题共 10 张截图:`logs/ui-migration/prototype-personal/`。桌面视口为 1440 × 1000,移动视口为 393 × 851。
- 实际可达页面为数据看板、密钥管理、使用记录、在线充值、个人设置、服务监控和用户中心钱包。桌面截图及绑定、安全、通知页签截图保存在 `logs/ui-migration/personal-real/`。
- 个人设置调整为个人资料卡、页签和头像编辑区;保留头像类型、预设、图片 URL 和原有保存回调。看板使用 4 个指标卡、Token/速率明细卡和双图布局,仍由原有 hooks 提供数据与图表配置。
- 密钥列表改为 Ant Design Table;复制、显隐、启禁用、模型列表、编辑、删除仍使用原有处理函数。没有为原型增建新搜索提交、重置、导出或排序行为。
- 桌面与移动最终复核采用每页就地切换双主题,减少重复请求。`logs/ui-migration/personal-final-desktop/review.json` 与 `personal-final-mobile/review.json` 各记录 9 个入口、18 次主题截图,实际落点为 7 个页面;均无页面异常、失败 API 响应和页面/看板内部横向溢出,最后通过 UI 退出到 `/org/login`。邀请、发票的截图记录的是其原有重定向落点。
- 触屏 Dropdown 修复后使用新 Context、`isMobile: true`、`hasTouch: true` 再次真实巡检全部 9 个入口,18 次主题截图均无页面异常、失败 API 或横向溢出,并由 UI 退出。证据:`logs/ui-migration/personal-final-touch/review.json`。图表透明底色的最后调整另以桌面/触屏真实登录复核,截图与记录在 `dashboard-final-desktop/`、`dashboard-final-touch/`;原有完整巡检证据保留。
- 中间连续采集曾触发后端 429,另一次采集受开发服务重启影响;失败记录保留在 `personal-real/review-final.json`、`personal-final-mobile/failure.png` 和相关日志中。成功复核与失败批次分别记录,不以失败页面的空态代替真实数据验收。
- 邀请有奖、发票入口在正常配置下重定向至数据看板;这些重定向不能算作独立页面验收。
### 个人端剩余差异
| 位置 | 已对齐 | 剩余差异 / 边界 |
| ----------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| 顶栏与导航 | 高度、底色、分隔、Ant 菜单及双主题 | 品牌、公告、可见入口和账户名由真实配置控制;密钥独立路由的宿主布局与原型侧栏不同 |
| 数据看板 | 主色、背景、原型 SVG、指标图标与四色卡、明细卡、图表容器、窄屏换行 | 图表实际系列和数据量不同,原有图表内部标题/图例仍有视觉差异;时间按既有选项显示中文标签,原型的时间下拉不新增为业务触发器 |
| 密钥管理 | Ant 表格、操作按钮、分组标签、过期时间、深浅状态 | 原有状态文案、搜索触发和操作条件保留;不增建原型按钮、列配置或新的分页数据流 |
| 使用记录 | 控件、页签、操作栏、表格、弹层主题 | 列和数据权限沿用真实账户;不展示原型中账户无权查看的字段 |
| 充值 / 钱包 | Ant 控件、卡片、布局约束、双主题 | 当前后端在线支付未启用,不能验证真实支付;页面组合与原型仍有结构差异,不启用支付或新增订单逻辑 |
| 个人设置 | 资料卡、页签、头像编辑布局、窄屏及双主题 | 账户权限、绑定与安全可用项取自真实后端;未在真实账户上执行改密、解绑、注销等写操作 |
## 阶段三:全局改造与验收
### 实现记录
1. 全仓通用 UI 引用统一转入 `src/components/ui` 的 Ant Design 适配层,删除旧组件库、旧图标包、Vite 插件、旧图表皮肤及 Toastify 依赖和运行时引用。图表、流程图、富文本等既有专用渲染器继续使用原实现,未改数据协议。
2. 通过唯一 `UiThemeProvider` 提供 Ant Design ConfigProvider、语言、深浅算法、静态弹层主题和旧页面语义变量。保留管理员品牌配置、主题预设 key、持久化和系统主题逻辑。
3. 清除旧库选择器和变量,页面视觉放入 `src/styles/prototype.css`;后台样式与 WeyAI 外部页分作用域。数据看板插画直接提取参考页面 SVG,来源为原型,没有重新生成插画。
4. 修正迁移边界中的值/事件转换、Form API、手动上传和文件实例、分页通知顺序、Tabs 保留 DOM、Modal 自定义标题、Drawer 卸载,以及 Ant Layout 自动 hasSider 引起的内容宽度问题。修正只发生在视图适配层。
5. 更新受 Git 跟踪的既有测试以适配 Ant DOM;新增本地验收脚本、截图、trace、报告仍按项目要求忽略,不提交会话或凭据。ESLint/Prettier 排除生成的浏览器报告及日志,不排除源代码或既有测试。
6. 依据原型实测补齐个人看板的四色图标、半透明指标卡、189px 明细卡、图表标题与间距;顶栏教程/推广采用 Ant Design 默认按钮,下载与充值沿用原型普通按钮表现,移除胶囊、渐变、浮起与发光效果。可见条件、跳转和操作回调不变。
7. 开发服务忽略验收日志、HTML 报告和截图目录,避免报告生成触发 Vite 整页热重载。企业截图等待 React 路由完成渲染;调用质量页固定“已看过指引”的页面态,并单独打开、截图及关闭指引抽屉。截图前移开悬停,确保参考状态一致。这些调整不改变产品的首次指引逻辑。
8. Dropdown 默认触发适配为桌面悬停、无悬停触屏点击,显式 trigger 优先;Card 的 bordered 映射为 Ant Design variant。修正表格卡片的标题区 flex 收缩和单行截断,正文独立滚动,解决移动筛选按钮被顶栏遮挡与表单/正文重叠。修复前后截图:`logs/ui-migration/card-before.png`、`card-after.png`。未改查询、重置、分页回调及提交条件。
9. 看板图表画布使用透明底色,呈现原型卡片自身的深浅背景;保留原有系列、排序、图例、tooltip 与数据计算。原型与实际模型系列颜色、图表内部标题和图例结构的剩余差异继续单列。
### 零业务侵入审计
- 对 456 个改动源码文件做 AST 对比,共核对 809 处 API 调用;API 调用及参数、`useState` 初始值、业务 Hook 依赖数组和 Route 属性未发现未解释差异。唯一已审阅的 UI 依赖差异为 `src/index.jsx` 移除旧语言包装的 `[i18n.language]` useMemo,由 `UiThemeProvider` 接管组件库语言。证据:`logs/ui-business-audit.json`。
- `src/App.jsx` 未修改;企业与个人路由定义保留。hook 中的修改限于 UI 导入、CSS 变量、图表主题入口和迁移后的 DOM 选择器。
- 此静态检查与模拟回归共同降低迁移风险,但不证明所有真实业务操作已验收。未在真实账号上执行删除、扣费、支付、密码修改等写操作。
### 验收证据索引
| 证据 | 位置 | 证明范围 |
| ---------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| 原型企业端 | `logs/ui-migration/prototype-enterprise/` | 15 个菜单的深浅参考图,含不可激活菜单记录 |
| 原型个人端 | `logs/ui-migration/prototype-personal/` | 5 个菜单的深浅参考图 |
| 企业端模拟 | `logs/ui-migration/enterprise-mock/chrome/`、`mobile-chrome/` | 路由请求、实际落点、空数据渲染和双主题截图;重定向不算对应功能页已渲染 |
| 个人桌面真实 | `logs/ui-migration/personal-real/` | 真实登录、页面与设置页签截图;各批次状态以 manifest 为准 |
| 个人桌面最终真实 | `logs/ui-migration/personal-final-desktop/` | 7 个实际页面双主题、错误响应、溢出记录和 UI 退出 |
| 个人移动最终真实 | `logs/ui-migration/personal-final-mobile/` | 逐页双主题、错误响应、溢出记录和 UI 退出 |
| 个人触屏最终真实 | `logs/ui-migration/personal-final-touch/` | 新触屏 Context、9 入口/7 实际页面双主题及 UI 退出 |
| 看板最后视觉复核 | `logs/ui-migration/dashboard-final-desktop/`、`dashboard-final-touch/` | 透明画布修改后的桌面/触屏真实双主题截图及 UI 退出 |
| 平台管理模拟 | `logs/ui-migration/admin-mock/` | `/console/*` 页面桌面/移动、深浅主题空数据巡检;非真实管理员联调 |
| 组件契约 | `logs/ui-contracts*.log`、`logs/ui-interactions*.log` | 表单、单选值、Select 关闭、日期、手动上传、分页、弹层、聊天输入 |
| 原有功能回归 | `logs/ui-regression-final.log`、`logs/ui-website-recheck.log` | 模拟设置保存载荷、字符串开关、失败提示、上传和重复提交 |
| 全量浏览器回归 | `logs/ui-e2e-delivery.log`、`logs/pw-delivery/` | 94 项回归、真实 Chrome 有头、桌面/移动、无截图更新 |
| 移动筛选复测 | `logs/ui-card-verified.log`、`logs/pw-card-verified/` | 三条件查询/重置、分页、空态/失败、迟到响应 4/4 通过 |
| 静态检查 | `logs/ui-unit-delivery.log`、`ui-build-delivery.log`、`ui-eslint-delivery-full.log`、`ui-prettier-delivery-full.log` | 实际命令结果与历史基线,见测试结论 |
`toHaveScreenshot()` 使用的是本地回归基线。先生成再无更新复跑用于检测本地渲染变化;参考站与当前后端的账户、数据、菜单和功能结构不同,不能把本地基线通过解释为与原型逐像素一致。
### 最终检查结果
| 检查 | 结果 | 说明 |
| --------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------- |
| `npm test` | 247/247 通过 | 无失败、跳过或取消 |
| `npm run build` | 通过 | 保留既有大 chunk 体积告警,未扩展为性能改造 |
| Playwright Chrome 有头 | 94/94 通过 | 桌面与移动,包含企业双主题本地截图回归;`logs/ui-e2e-delivery.log` |
| 核心迁移文件 ESLint | 0 错误、1 条既有 Hook 依赖警告 | Ant Design 适配层、顶栏、看板与构建配置;`logs/ui-eslint-delivery.log` |
| `npm run eslint` | 未全量通过:10 错误、171 警告 | 与改造前数量一致,保留原有问题;`logs/ui-eslint-delivery-full.log` |
| `npm run lint` | 未全量通过:697 个文件有格式差异 | 改造前为 717 个,不批量重排无关文件;`logs/ui-prettier-delivery-full.log` |
| 旧库残留扫描 | 源码、依赖清单和锁文件无旧库导入、旧库样式选择器或变量 | 包括旧图标、图表主题、构建插件与 Toastify |
| API / 状态 / Hook 依赖 / Route 静态对照 | 456 个源码文件、809 处 API 调用,无未解释差异 | 已审阅旧 locale wrapper 的 UI 依赖迁移;不等同于所有真实业务操作验收通过 |
| 真实个人端 | 桌面、移动/触屏各 7 个实际页面双主题通过巡检 | 无页面异常、失败 API 响应或横向溢出;均完成 UI 退出 |
| 企业真实账户 | 未通过 | 企业标识校验阻塞,不绕过登录 |
企业端基线生成记录为 `logs/ui-enterprise-final-baseline.log`;最终全量无更新复跑为 `logs/ui-e2e-delivery.log`,94/94 通过(7.1 分钟)。早期失败批次 `ui-e2e-global-final.log`、`ui-e2e-global-verified.log` 及报告保留,用于追踪适配与定位问题;移动卡片布局修复的最终专项结果为 `ui-card-verified.log`,4/4 通过。图表最后一处透明底色调整由后续真实桌面/触屏截图复核覆盖。
## 组件映射
| 原组件 | Ant Design 目标 | 保留契约的位置 |
| --------------------------------------- | ------------------------------------ | ------------------------------------------------------ |
| Button、SplitButtonGroup | Button、Space.Compact | `src/components/ui/controls.jsx`、`index.jsx` |
| Input、TextArea、InputNumber | Input、Input.TextArea、InputNumber | `controls.jsx`,将事件转为原有值回调 |
| Select、AutoComplete、TagInput | Select、AutoComplete、Select tags | `controls.jsx` |
| Radio、RadioGroup、Checkbox、Switch | Radio、Radio.Group、Checkbox、Switch | `controls.jsx`、`index.jsx` |
| Form、withField | Form、Form.Item、useForm | `form.jsx`,保留 field、校验、getFormApi 和既有回调 |
| DatePicker、TimePicker | DatePicker、RangePicker、TimePicker | `controls.jsx`,界面边界转换日期对象 |
| TreeSelect、Cascader | TreeSelect、Cascader | `controls.jsx` |
| Table、Pagination | Table、Pagination | `index.jsx`,映射原有分页和展开参数 |
| Modal、SideSheet | Modal、Drawer | `index.jsx`,保留 visible、取消与确认回调 |
| Toast、Notification | message、notification | `index.jsx`,共享 ConfigProvider 主题 |
| Banner、Alert、Empty、Spin | Alert、Empty、Spin | `index.jsx` |
| Dropdown、Nav | Dropdown、Menu | `index.jsx`,保留原有点击回调与路由链接 |
| Tabs、Collapse、Collapsible | Tabs、Collapse、可见性容器 | `index.jsx` |
| Card、Typography、Space、Divider | 同名 Ant Design 组件 | `index.jsx` |
| Layout、Row、Col、Grid、List | 同名 Ant Design 组件 | `index.jsx` |
| Tag、Avatar、Badge、Progress | 同名 Ant Design 组件 | `index.jsx`;Tag 的旧 white/grey 使用 default 中性样式 |
| Skeleton、Timeline、Steps、Descriptions | 同名 Ant Design 组件 | `index.jsx` |
| Image、ImagePreview、Upload | Image preview、Upload/Dragger | `index.jsx`、`controls.jsx` |
| Chat | List、Avatar、Input.TextArea、Button | `chat.jsx`;页面继续处理消息和请求 |
| 旧图标 | lucide-react 对应图标 | `icons.jsx`,仅视图映射 |
### 交接入口
- Codex 默认入口:根目录 `AGENTS.md`。
- Claude Code 默认入口:根目录 `CLAUDE.md`,明确先读 `AGENTS.md` 和本记录。
- 两份规范均包含目录职责、Ant Design 写法、主题映射、适配契约、禁止事项与分阶段验收清单。后续新增页面采用 Ant Design 原生 API,既有页面继续保留适配契约。
## 基线问题
- 改造前 `npm test`:247/247 通过。
- 改造前 ESLint:10 个错误、171 个警告。
- 改造前 Prettier:717 个文件存在格式差异。
- 上述非 UI 阻塞项不在本次顺带修复。
## 风险与后续建议
- 历史企业登录曾因错误企业标识阻塞;本轮已按 A/B 页面状态通过真实登录、测试令牌增删改查和 UI 退出。真实上传、未开放模块及其他敏感写操作仍未验证,详见开头的本轮覆盖清单。
- 构建开关或权限关闭的企业页面只验证现有重定向行为,不能宣称对应隐藏功能通过。原型存在而项目没有的页面不新增业务。
- 原型与真实配置、数据和页面结构存在差异,已列出剩余视觉差异;当前结果不能标记为全站像素级对齐或全部真实业务验收完成。
- 真实后台存在请求频率限制;后续采集优先 SPA 导航并在同一页面切换主题,出现 429 时记录并降低采集频率,不能改服务端限流或把错误页当作空数据通过。
- 全量 lint 的原有错误与格式差异继续单列;不得为交付绿灯顺带调整业务 Hook 或批量重排不相关文件。构建的既有大 chunk 告警记录为后续独立性能任务。
+114
View File
@@ -0,0 +1,114 @@
# 模型超市(/market)单页 UI 规范
本规范约束个人端模型超市页 `/market` 及其详情抽屉。`AGENTS.md`(Codex 入口)与 `CLAUDE.md`(Claude Code 入口)的“模型超市单页约定”一节保存精简规则并指向本文;三者同步维护。
- 视觉基准:原型 `http://192.168.0.161:8888`,顶栏“模型超市”(SPA 内部切换,URL 保持 `/`)。原型只作视觉 / 视觉交互基准,不作业务、数据、状态、接口、路由依据。原型有深浅双主题,两套都以原型实测值为准。
- 系统地址:`${BASE_URL}/market`。`${BASE_URL}` 必须取自 `dev.log` 最后一个 `Local:`(服务命令 `nohup npm run dev > dev.log 2>&1 &`),禁止在脚本、文档、报告中写死 IP / 端口。候选地址只作参考,实际与候选不同时在报告中记录。
- 范围:仅个人端;企业端、企业登录、企业名称流程不在本页验收范围。WeyAI 外部页、第三方客服浮钮只检查宿主遮挡关系,不重做内部视觉。
## 1. 目录与职责
| 文件 | 职责 |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| `src/pages/Pricing/index.jsx` → `layout/PricingPage.jsx` | 路由入口(不改) |
| `market/ModelMarketPage.jsx` | 页面编排:调用原 `useModelPricingData`、`usePricingFilterCounts`,组合 Hero、侧栏、目录、详情抽屉 |
| `market/MarketHero.jsx` | 标题、副标题、搜索条(原 300ms 防抖;搜索按钮 / 回车立即写入;重置)、原型线路背景 |
| `market/MarketFilterSidebar.jsx`、`market/MarketFilterGroup.jsx` | 筛选侧栏与 Ant Design Button 组;窄屏由结果栏“筛选 / 收起筛选”展开 |
| `filter/Pricing{Groups,Vendors,QuotaTypes,Tags,EndpointTypes}.jsx` | 各筛选组的选项、计数与禁用规则(沿用原实现;厂商沿用原吸顶栏规则) |
| `market/MarketCatalog.jsx`、`market/MarketModelCard.jsx` | 结果栏、按厂商分区、懒渲染、卡片、空态、加载骨架、底部说明、企业作用域提示 |
| `market/MarketLogo.jsx` | 原型 `.mm-logo` 图标框(模型图标 → 厂商图标 → 名称缩写) |
| `modal/ModelDetailSideSheet.jsx`、`modal/components/*` | 详情 Drawer:头部、基本信息、API 端点、分组价格 Table |
| `market/market.css`、`market/marketTheme.js` | 页面作用域样式与 `--mm-*` 变量;`useMarketThemeStyle()` 注入 `--mm-brand / --mm-text / --mm-border` token |
| `src/assets/prototype/market-hero-art.svg` | 原型 Hero 线路 SVG(原样提取,文件头注明来源) |
| `src/hooks/model-pricing/*`、`src/helpers/*`、`src/App.jsx` | 数据、计价、路由:纯 UI 任务禁止改动 |
## 2. 旧组件 → Ant Design 映射
| 旧写法(Bento 版) | Ant Design / 原型结构 |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `BentoHero` 原生 input + 徽章 + 渐变标题 + 光斑 | `Input`(`allowClear`、prefix)+ `Button`(重置 / 搜索 primary);原型 SVG 线路背景与 `.mm-core` |
| `FilterBar` 吸顶供应商 pill + 分组 `Select` + “更多” | 侧栏 `MarketFilterGroup`(`Button`,`aria-pressed`),厂商 / 分组 / 计费 / 标签 / 端点五组 |
| `FilterDrawer`(`SideSheet`) | 并入侧栏;窄屏由 `showSettings`(原抽屉开关)控制侧栏展开 |
| `SelectableButtonGroup`(Row/Col/Tag/Collapsible) | `MarketFilterGroup`:可换行 `Button` 组,不显示计数,禁用规则不变 |
| `BentoGrid` 分区头(渐变图标 + 计数胶囊) | `.mm-section-title`:`.mm-logo` + h2 + “N 款模型” |
| `BentoCard`(`app-card` + 点阵 / 水印 / 色条) | `Card`(`role=button`、Enter/Space 打开)+ 原型价格格、缓存行、页脚分组与折扣 `Tag`、复制 `Button` + `Tooltip` |
| 骨架 div + `animate-pulse` | `Card loading` |
| 插画 `Empty` | 原型 `.mm-empty`:标题 + 说明 + `Button`“重置筛选” |
| 企业作用域琥珀色提示条 | `Alert type="warning"` |
| `ModelDetailSideSheet`(适配 `Modal`) | `Drawer`(820px,窄屏 100%,标题“模型详情”,页脚 primary“关闭”) |
| `ModelHeader` `Paragraph copyable` + `Toast` | `Typography.Title copyable` + 原 `showSuccess('已复制模型名称')` |
| `ModelEndpoints` 自定义方法色块 | `.mm-detail-endpoint` + `Tag` |
| `ModelPricingTable` CSS grid | `Table size="small"`、`pagination={false}`、`scroll={{ x: 'max-content' }}`,列宽 180 / 135 |
| `ImagePreview`(适配层) | `Image` 受控预览(保留 `modalImageUrl` / `isModalOpenurl`) |
## 3. 主题与 token
- 不新增 ConfigProvider、主题状态或存储 key。Ant Design 组件直接继承 `UiThemeProvider`;页面局部 CSS 只通过 `useMarketThemeStyle()` 读取 `colorPrimary`、`colorText`、`colorBorderSecondary`,抽屉 Portal 通过 `rootClassName='mm-detail-drawer mm-theme'` + `rootStyle` 使用同一组变量。
- `--mm-*` 只在 `.mm-theme`(浅色)与 `html.dark .mm-theme`(深色)定义,取原型实测值;样式规则只引用变量。
| 变量 | 浅色 | 深色 | 用途 |
| ------------------- | --------------------------- | ----------------- | -------------------- |
| `--mm-page-bg` | `#f4f6f9` | `#111720` | 页面底色 |
| `--mm-surface` | `#ffffff` | `#1b232e` | 侧栏、卡片、空态 |
| `--mm-muted` | `#616e80` | `#acb6c5` | 次要文字 |
| `--mm-tint` | `#fff3dc` | `#3c2e1d` | 选中筛选、折扣标签底 |
| `--mm-soft` | `#fafbfc` | `#202732` | 端点卡底 |
| `--mm-title` | `#302c24` | `#f3e6ce` | Hero 标题 |
| `--mm-subtitle` | `#68685f` | `#beb7ac` | Hero 副标题 |
| `--mm-art` | `#a7722d` | `#deb572` | 线路背景网格色 |
| `--mm-card-hover-*` | 边框 `#cb923b` + 暖色阴影 | 同边框 + 深色阴影 | 卡片悬停 / 聚焦 |
| `--mm-price-extra` | `#3778b8` | `#8cb9e6` | 详情表缓存类价格 |
| `--mm-mask` | `rgba(0,0,0,.3)` + 4px 模糊 | 同 | 详情抽屉遮罩 |
## 4. 背景、布局与尺寸(原型实测,1920×1000 / 393×851)
- 页面为整屏应用壳:`.mm-page` 高 `100vh − 公告占位`,顶部内边距 = 顶栏高度(`--app-header-height − --content-top-offset`);外层不滚动,卡片列表 `.mm-scroll` 与侧栏各自滚动(原型 `.market-shell`)。
- Hero:最小高 235px(≤1180 为 215,≤600 为 193),内边距 28px 32px,间距 24px;背景为原型径向 + 线性渐变,底部 `::after` 渐隐到页面底色;线路 SVG + `.mm-core` 闪电装饰均为原型元素。标题 34px / 650 / 字距 1px(≤850 30px,≤600 24px);副标题 14px。
- 搜索条:宽 `min(720px, 100%)`,内边距 8px、圆角 12px、半透明底 + 16px 背景模糊;输入框与按钮高 40px(≤600 36px),按钮横向内边距 18px。
- 工作区:内边距 20px 28px 24px、间距 22px、最大宽 1920px;侧栏宽 264px(≤1540 248,≤1180 230,≤850 205),≤600 单列、默认收起、展开后最大高 40%。
- 筛选组:上分隔线、上下 16px;组标题 15px / 600;按钮最小高 30px(≤600 36px)、内边距 4px 9px、13px、圆角 6px、间距 7px;选中为主色边框 + `--mm-tint` 底 + 600 字重。
- 结果栏:最小高 45px,标题 18px,计数 / 价格单位 13px 次要色;≤850 隐藏价格单位,≤600 显示“筛选 / 收起筛选”按钮。
- 网格:4 列(≤1540 3 列,≤1180 2 列,≤600 1 列),间距 16px(≤850 12px,≤600 14px);分区标题 20px / 650,分区间距 25px。
- 卡片:圆角 12px、内边距 18px 18px 0;头部图标框 36px、模型名 16px / 600;价格 Bahnschrift 21px(≤850 19,≤600 24),删除线官方价 12px;缓存区最小高 57px;页脚上分隔线、12px、折扣 `Tag` 主色字 + `--mm-tint` 底。
- 详情抽屉:宽 820px(≤600 100%)、正文内边距 24px、行高 1.5714;模型头图标 46px、名称 21px;分区上分隔线、上下 24px;端点卡内边距 14px 16px;表格单元 13px 12px。
## 5. 视觉交互(原型定义,已复现)
- 卡片:悬停 / 聚焦时上浮 3px、暖色阴影、边框 `#cb923b`,指针位置光晕(`--pointer-x/y`),悬停扫光一次;`:focus-visible` 2px 主色内描边。`prefers-reduced-motion: reduce` 时取消上浮、动画与信号线流动(信号线降为 25% 静态)。
- Hero 信号线 14s 流动、`.mm-core` 8s 呼吸;均受减少动态效果规则约束。
- 侧栏滚动条默认透明,悬停 / 聚焦时显示;卡片列表隐藏滚动条。
- 窄屏筛选按钮 `aria-expanded` 同步,展开时文案为“收起筛选”。
## 6. 原型未定义项的统一规则
1. 有 Ant Design 组件:直接使用当前版本默认样式 + 全局 token(加载 `Card loading`、失败提示 `message`、企业作用域 `Alert warning`、详情标签 `Tag`、端点空态 / 价格空态 `Empty.PRESENTED_IMAGE_SIMPLE`、仅可见 `Tag` + `Tooltip`)。
2. 无对应组件:语义变量、无新增装饰 / 阴影 / 动画,间距取 8 / 16 / 24px,页面字体,窄屏单列。
3. 无数据源的原型元素不虚构:详情表“操作”列(原型仅显示 `-`)不渲染;原型示例中的额外分组行、未上架厂商不补造。
4. Ant Design 控件正文色沿用全局 token `colorText`(`#263247` / `#e6ebf3`),不在单页覆盖为原型 Ant Design 默认 `rgba(0,0,0,.88)`;图标沿用 `lucide-react`(原型为自绘线性图标)。二者记为保留差异。
5. Ant Design CSS-in-JS 不在 `@layer` 内,局部覆盖按选择器优先级竞争;只在原型同样使用 `!important` 的规则中保留(选中筛选项、搜索框阴影、卡片悬停边框、详情表格内边距)。
## 7. 禁止事项
- 不改 `/api/pricing` 请求、载荷、筛选与计价逻辑、懒渲染策略、详情开关回调、复制提示、路由与权限;不改 hooks / helpers / App。
- 不新增原型业务(详情“操作”列、未上架厂商、排序 / 分页 / 导出);不恢复 Bento 版渐变标题、光斑、点阵、水印、色条、玻璃吸顶栏。
- 不在 JSX 写颜色字面量;不新增主题 Provider / 存储 key;不用全局 `!important`。
- 不写死 `${BASE_URL}`;不提交截图、trace、video、storageState、报告。
## 8. 自动采集、对比与验收流程
1. 服务:`nohup npm run dev > dev.log 2>&1 &`,从 `dev.log` 取最后一个 `Local:` 作为 `${BASE_URL}`(端口被占用时 Vite 自动顺延,以日志为准)。
2. 个人端登录(`e2e/market/login.mjs`):新 Context + 清 Cookies → `${BASE_URL}/login` → `networkidle` → 判定“2 个可见输入(用户名或邮箱 / 密码)+ 登录按钮”,不符即停止 → 环境变量传入 `test_222 / 12345678` → 登录接口成功且顶栏“模型超市”与主体渲染 → storageState 存 `logs/market/auth/`(Git 忽略)→ 打开 `${BASE_URL}/market` 校验 URL、标题、导航、主体。失败时截图 + `dev.log` 尾部 + 脱敏 payload,不盲试。全部验收结束后 UI 退出。
3. 原型采集(`e2e/market/capture.mjs`):有头 Chrome(`channel:'chrome'`、离屏窗口、不置顶 / 不聚焦)、`networkidle`;深色通过原型“切换至暗色主题”;窄屏经“打开导航”进入模型超市。
4. 同脚本双侧采集:同视口(1920×1000、393×851)、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce`、同主题、同交互序列:默认 → 悬停卡片 → Tab 聚焦卡片 → 搜索 claude → 厂商 Anthropic → 搜索栏重置 → 空结果 → 用户分组(桌面)→ 滚动到底 → 窄屏展开筛选 → 详情抽屉。系统侧对比数据为按原型目录构造的 `/api/pricing` 模拟(`e2e/market/mock-catalog.mjs`,报告标注 mock);真实后端另采 `market-real`;加载 / 失败 / 空目录 / 隐藏价格 / 企业作用域为系统独有状态(原型未定义)。
5. 串行单浏览器、每次一个 Context / Page,采集前检查内存(物理 ≥ 2GB、提交 ≥ 2.5GB);trace 只保留 `prototype|actual-light-desktop` 与失败批次,video 只录浅色桌面两侧。
6. 对比(`e2e/market/compare.mjs`):pixelmatch 等价算法(YIQ 色差阈值 0.1、抗锯齿不计)、SSIM(8×8 窗)、pHash(64 位 DCT)、组件 bbox 与裁剪差异、computed style 逐属性、CDP 实际渲染字体。输出 diff 热区、三联并排图、overlay、热区坐标与疑似组件、pass / fail 与阻塞等级。
7. 遮罩 / 归一化:顶栏(品牌、账户、导航由配置决定)、第三方客服浮钮(外扩 24px)两侧取并集;动画以 `reducedMotion` + `animations:'disabled'` 归一化;等待 `document.fonts.ready`、`networkidle`、无骨架。宿主顶栏高度不同(原型窄屏顶栏更高)时按 `.mm-hero` 顶部对齐,“滚动到底”按底边对齐,详情抽屉按视口对齐且顶栏遮罩只保留抽屉左侧可见部分。另给“数据规则归一化”诊断指标:侧栏厂商组至侧栏底部两侧同时遮罩。
8. 阈值:整页差异 ≤ 0.5%、关键组件 ≤ 0.2% 为 pass;≤ 2% 为 P3、≤ 10% 为 P2、> 10% 或组件缺失为 P1;组件 bbox 容差 ±2px。严格指标与归一化指标分开报告,阈值例外写入风险项。
9. 目录(`logs/market/`,Git 忽略):`prototype/personal/market/{theme}/{viewport}/{state}.png`、`actual/personal/market/...`、`actual/personal/market-real/...`、`diff/personal/market/...`(`-side`、`-overlay`、`--{组件}`)、`report/visual-regression-market.html`、`report/summary.json`、`trace/`、`video/`、`dom/`(ARIA / DOM 快照)、`capture/`(bbox、样式、字体、遮罩、错误与非 GET 请求)。
10. 回归:`e2e/market-ui.spec.js` 以 `toHaveScreenshot()` 建立本地基线(先 `--update-snapshots`,再不带 update 复跑),并断言搜索、筛选、禁用、空态、悬停 / 焦点、复制、详情开关(键盘 / Esc / 遮罩 / 按钮)、窄屏筛选、加载 / 失败 / 隐藏价格 / 企业提示、主题刷新保持,所有用例要求非 GET `/api/` 请求为 0。本地基线不等于原型像素一致。
11. 全局检查:`npm test -- --test-concurrency=1`、`npm run eslint`、`npm run lint`、构建(临时输出目录)、`git diff --check`、旧库残留扫描、`e2e/market/business-audit.mjs` 业务契约 AST 对照。
## 9. 原型不可达 / 未定义处理
- 原型不可达、需登录无权限或页面缺失:截图 + 记录 Network 失败,不自创视觉;像素依赖项标记阻塞,继续系统侧盘点与规范整理。
- 原型未定义状态(加载、失败、空目录、隐藏价格、企业作用域、等级锁定):按第 6 节规则实现,只出系统侧截图并在报告中标注“原型未定义”。
+205
View File
@@ -0,0 +1,205 @@
# 个人端后台 UI 规范(ui-optimization)
本规范约束个人登录后的用户中心页面(`/user-center/*`)及其弹窗。`AGENTS.md`(Codex 默认入口)与 `CLAUDE.md`(Claude Code 默认入口)保存精简规则并指向本文;三者冲突时以入口文件中最新一节为准,并同步修订本文。
- 视觉唯一真源:`原型图.zip`(`C:\Users\Win10\Desktop\原型图.zip`,16 张浅色截图)。`现有图.zip`(`C:\Users\Win10\Desktop\现有图.zip`)只作改造前基线,不能作为目标。
- 原型没有深色截图:深色主题由 Ant Design `darkAlgorithm` 与既有主题变量推导,不得宣称深色原型像素验收通过。
- 只覆盖个人端。企业端(`/org/*`)、平台管理(`/console/*`)、认证页、WeyAI 外部页、第三方客服/广告 SDK、体验中心、模型超市、公开页不在本规范的改造范围内。
## 1. 目录与 UI 边界
后续用户标注补充:`/key-management` 保留原 URL 和鉴权,由 `UserCenter keyManagementMode` 提供侧栏外壳,密钥页 `embedded` 分支仅适配背景、边距与面包屑;入口移至“使用记录”之后,顶栏移除该主导航项,头像菜单保持相同地址。此项按用户明确要求允许 App 中原密钥路由的视图包装调整,不改业务 API 或路由权限。
| 文件 | 职责 | 边界 |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `src/components/ui/UiThemeProvider.jsx` | 唯一 ConfigProvider、深浅算法、`--ui-*` 兼容变量(TokenBridge) | 不新增 Provider、主题状态或存储 key |
| `src/styles/user-center.css` | 个人端外壳:页面底色、内容边距、页头(面包屑/标题/副标题)、移动底部导航 | 只写外壳;页面内部样式放各自 CSS |
| `src/components/common/UserCenterPageHeader.jsx` | 页头组合:`UserCenterBreadcrumb` + `h1.uc-page-title` + 副标题 + `extra` | 只接收 `title`、`subtitle`、`extra` |
| `src/pages/UserCenter/UsageRecord.jsx`、`UsageRecord.css` | 使用记录页签宿主与 `--ur-*` 变量 | 页签切换沿用 `handleTabChange` 与懒挂载 |
| `src/components/table/usage-logs/*`、`task-logs/*` | 记录表格、筛选、列定义、弹窗 | 个人端走 `usageRecordMode` 分支;管理员 `/console/log`、`/console/task` 分支保持原样 |
| `src/pages/Recharge/*`(`recharge.css`、`WalletCard.jsx`) | 在线充值三栏布局、金额/支付/订单/会员/记录 | 只消费原有状态与处理函数(`preTopUp`、`topUp`、`handlePlanClick` 等) |
| `src/components/membership/MembershipHistoryModal.jsx` | `MembershipHistoryContent`(内嵌页签)+ `MembershipHistoryModal`(弹窗包装) | 同一请求、分页与列 |
| `src/components/topup/modals/PaymentConfirmModal.jsx` | 充值确认弹窗(Ant Design 默认 Modal) | `onOk`、禁用条件、确认文案不变 |
| `src/components/settings/PersonalSetting.jsx`、`personal/personal-settings.css`、`personal/components/SectionHeader.jsx`、`personal/sections/*` | 个人设置资料头、页签、四个设置区块 | 表单 `getFormApi`、rules、提交与保存条件不变 |
| `src/pages/UserCenter/UserDashboard.jsx` | 数据看板(上一轮已对齐),本轮只改会员权益块 | 图表数据与刷新逻辑不变 |
| `src/styles/prototype.css` | 其余原型页面作用域样式 | 本轮删除被新文件取代的个人端旧规则 |
| `src/hooks`、`src/context`、`src/helpers/api*`、`src/services`、`src/App.jsx` | 业务、状态、接口、路由 | 纯 UI 任务禁止改动 |
## 2. Ant Design 使用规范
- 新写的视图直接使用 `antd` 原生组件(本轮:`Tabs`、`Card`、`Segmented`、`Tag`、`Empty`、`Alert`、`Input`)。旧页面已有的适配组件(`@/components/ui` 的 `Button`、`Input`、`Form`、`Modal`、`Pagination`、`Table`、`Typography`、`Tooltip`、`Skeleton`、`Spin`)继续使用,以保留值回调、Form API 与分页回调契约。
- 契约差异必须逐个核对:适配 `Input` 的 `onChange(value)`,原生 `Input` 的 `onChange(event)`;`Segmented` 的 `onChange(value)` 直接接原 `RadioGroup` 的值处理函数;适配 `Button` 的 `theme='solid'` → `primary`,`theme='light'/'outline'` → 默认按钮,`type='danger'` → `danger`。
- 分页沿用适配 `Pagination`:`onPageChange(page)`、`onPageSizeChange(size)`,`pageSizeOpts`、`showSizeChanger` 与原值一致,`showTotal` 使用 `t('共 {{total}} 条')`。
- 表格:`scroll={{ x: 'max-content' }}` 保证窄屏在容器内横向滚动;空态使用 `Empty.PRESENTED_IMAGE_SIMPLE`。不为对齐原型增加排序、列或请求。
- 状态标签用 `Tag` 语义色:成功 `success`、失败 `error`、进行中 `processing`、排队/待处理 `warning`、中性 `default`(`bordered={false}` 仅在原型为无边框标签时使用)。
- 弹窗使用 Ant Design 默认 Modal 外观:标题、正文、`取消/确认` 页脚、遮罩与键盘关闭沿用原逻辑;不叠加玻璃、渐变或自定义图标头。
## 3. Token 映射与 ConfigProvider 写法
全局 token(`prototypeTheme(dark)`,唯一定义处 `UiThemeProvider.jsx`):
| 项 | 浅色 | 深色 | 读取方式 |
| ---------------------------- | --------- | --------- | ----------------------------------------------------- |
| colorPrimary / colorInfo | `#b96508` | `#d1963a` | `token.colorPrimary` / `var(--ui-color-primary)` |
| colorBgLayout | `#f4f6f9` | `#11151c` | `token.colorBgLayout` / `var(--surface-bg-base)` |
| colorBgContainer | `#ffffff` | `#1b212b` | `token.colorBgContainer` / `var(--surface-card)` |
| colorText | `#263247` | `#e6ebf3` | `token.colorText` / `var(--text-primary)` |
| colorTextSecondary | `#7e8998` | `#8e9aaa` | `token.colorTextSecondary` / `var(--text-secondary)` |
| colorBorderSecondary | `#e9edf2` | `#2b333f` | `token.colorBorderSecondary` / `var(--border-subtle)` |
| borderRadius / controlHeight | 8 / 34 | 8 / 34 | Ant Design 组件自动使用 |
```jsx
// 唯一 Provider(已存在,禁止再包一层 ConfigProvider)
<ConfigProvider theme={prototypeTheme(dark)} locale={locale}>
<App>
<TokenBridge />
{children}
</App>
</ConfigProvider>;
// 新组件读取 token;需要传给局部 CSS 时用 CSS 变量
const { token } = theme.useToken();
<div className='my-panel' style={{ '--my-surface': token.colorBgContainer }} />;
```
页面级视觉变量(原型有、Ant Design token 无对应值时)只允许这样写:浅色值取自原型实测,深色值由 token/主题变量推导,规则中只引用变量。
```css
.ui-recharge-page {
--rc-border: #e4e9ee; /* 浅色:原型 在线充值1 实测 */
}
html.dark .ui-recharge-page {
--rc-border: var(--border-subtle); /* 深色:主题变量推导 */
}
.ui-recharge-page .rc-card {
border: 1px solid var(--rc-border);
}
```
| 变量族 | 作用域 | 文件 |
| ---------------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `--uc-*`(页面底色、标题/副标题色、内容边距) | `body[data-ui-scope='admin']`、`.user-center` | `src/styles/user-center.css` |
| `--ur-*`(使用记录卡片、筛选、表头、统计卡) | `.usage-record-page` | `src/pages/UserCenter/UsageRecord.css` |
| `--rc-*`(钱包、金额、支付、订单、会员、记录) | `.ui-recharge-page` | `src/pages/Recharge/recharge.css` |
| `--ps-*`(资料头、页签、头像、绑定、安全、通知) | `.ui-personal-settings` | `src/components/settings/personal/personal-settings.css` |
| `--km-*`(密钥页卡片、表头、密钥框、模型抽屉、过期快捷项) | `.km-page`、`.km-models-drawer`、`.km-edit-drawer` | `src/pages/KeyManagement/key-management.css`(依据 密钥管理页面.zip,见入口文件“密钥管理单页约定”) |
深色推导规则:边框 → `--border-subtle`;卡片 → `--surface-card`;正文/标题 → `--text-primary` / Ant Design 深色默认;次文字 → `--text-secondary`;主色强调 → `--ui-color-primary`;选中底 → `color-mix(in srgb, var(--ui-color-primary) 10%~16%, var(--surface-card))`;语义色 → `--ui-color-success/danger/warning` 混合卡片色;装饰阴影在深色下为 `none`。
## 4. 组件写法与旧组件 → Ant Design 映射
```jsx
// 页头:所有有原型的个人端子页面使用同一组合
<UserCenterPageHeader title={t('在线充值')} subtitle={t('管理账户余额,让每一次模型调用从容开始。')} />
// 分段控件直接复用原值处理函数
<Segmented block value={avatarType} options={options}
onChange={(value) => handleAvatarSettingChange('avatarType', value)} />
// 记录卡:Card 标题 + extra,原导出/列设置回调不变
<Card className='usage-record-card usage-record-table-card' title={t('调用明细')}
extra={<Button onClick={() => setShowExportModal(true)}>{t('导出')}</Button>} />
```
| 旧写法(改造前) | 新写法 | 保持不变的契约 |
| ------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
| 使用记录自绘按钮页签(图标 + 渐变) | `antd Tabs`(`activeKey`、`onChange={handleTabChange}`) | URL `?tab=` 同步、懒挂载 |
| `CardPro`(筛选/表格同卡,玻璃样式) | 两张 `antd Card`:筛选卡 + 记录卡(标题、`extra`) | 筛选字段、值、`refresh`、导出、列设置回调;移动端“显示/隐藏操作项”沿用 CardPro 同一开关语义 |
| 无标签紧凑筛选 | 带字段标签的栅格表单 + 右下 `重置` / `搜索`(`htmlType='submit'`) | 表单 API、日期预设、数字输入过滤 |
| 自绘状态胶囊 / 彩色 Tag | `antd Tag` 语义色 | 状态值与判定 |
| 插画空态 | `Empty.PRESENTED_IMAGE_SIMPLE` | 空数据条件 |
| 头像类型 `RadioGroup type='button'` | `antd Segmented block` | `handleAvatarSettingChange('avatarType', value)` |
| 充值页自绘页签 | `Segmented`(余额充值/会员订阅)+ 记录区 `Tabs` | `activeTab` / `setActiveTab` |
| 会员购买记录仅弹窗 | `MembershipHistoryContent`(内嵌页签与弹窗共用) | 请求、分页、列 |
| 支付方式彩色大按钮 | 选择块(适配 `Button`,选中描边 + 勾) | `preTopUp(method.type)`、禁用与最低金额提示 |
| 订单区仅弹窗确认 | 订单卡 + `立即充值`(`preTopUp(payWay)`) | 同一校验与 `PaymentConfirmModal` |
| `CodeViewer`(Webhook 示例) | `<pre class='ui-notify-code'>` + “复制”链接 | 复制内容、`copy` 助手与 `已复制到剪贴板`/`复制失败` 提示 |
| 玻璃 / 渐变弹窗头 | Ant Design 默认 Modal | `visible`、`onOk`、`onCancel`、`confirmLoading`、禁用条件 |
| 旧 Tag `white` / `grey` | `Tag` `default` | 选中条件 |
| 移动底部导航渐变胶囊 | `.uc-mobile-nav` 语义按钮(`aria-current`) | 菜单项、过滤条件、`navigate` |
## 5. 背景与布局规则
外壳(`user-center.css`,原型 1920 宽视口实测):
| 项 | 值 |
| ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| 子页面底色 | 浅色 `#f8fafc`(`--uc-page-bg`);数据看板 `--surface-bg-base`;深色统一 `--surface-bg-base` |
| 内容边距 | 桌面统一上 30px;使用记录 / 在线充值 / 个人设置左右 36px、下 36px;数据看板、服务监控横向 30px;移动统一 16px(下 24px) |
| 面包屑 | 12px / 18px,与下一标题区间距统一 24px,分隔符左右 10px;父级次文字色、当前项主文字色(按用户后续数据看板附件覆盖旧值) |
| 标题 | 28px / 32px,650,字距 -0.6px,浅色 `rgba(0,0,0,.88)`(Ant Design colorTextHeading) |
| 副标题 | 14px / 22px,上间距 6px,Ant Design 次文字色;页头与首卡间距 18px |
页面要点(全部来自原型实测,详细数值见各 CSS 文件注释):
- 使用记录:页签下间距 20px、页签间距 28px;卡片圆角 10px、内边距 24px;筛选卡为原型可见的浅暖色横向渐变(仅 `.usage-record-page` 作用域);筛选 5 列栅格(时间范围占 2 列),列距/行距 16px,标签 13px;表头 46px;时间两行(日期 11px、时间 15px/600);绘图与视频统计卡高 70px、三列、间距 15px。
- 在线充值:左栏钱包 230px + 主区,间距 22px;金额 4 列、间距 12px×13px;支付选择块高 42px、最小宽 133px;订单卡右侧应付区 240px、主按钮高 44px;记录区页签间距 32px。原型可见的钱包暖色渐变、右下圆环和订单卡暖色渐变是本页唯一允许的装饰背景,只在 `.ui-recharge-page` 作用域。
- 个人设置:资料头 21px 26px 23px 内边距;设置卡最小高 480px;区块头下分隔线(间距 20/22px);头像区 215px 预览 + 表单,输入宽 600px;行卡内边距 22px、圆角 10px;通知面板内边距 20px、代码块 12px/21.5px。资料头浅色渐变与头像预览渐变为原型可见视觉,限定在 `.ui-personal-settings`。
- 数据看板:上一轮已对齐,本轮只把会员权益块改为语义卡片,不改图表。
## 6. 原型未定义项的统一规则
1. Ant Design 有对应组件:直接使用当前版本默认样式 + 全局 token(弹窗、下拉、日期面板、提示、消息、分页、加载、空态、校验)。
2. 无对应组件:语义背景/文字/边框变量;无装饰背景、无阴影、无动画;间距取 8/16/24px;页面字体;窄屏单列堆叠,操作保持可达。
3. 深色:一律由 token/主题变量推导,禁止只改页面底色。
4. 移动端(≤768px):内容边距 16px;筛选默认收起,用“显示/隐藏操作项”展开;表格在卡片内横向滚动;钱包、订单、方案卡单列;底部导航使用 `.uc-mobile-nav`。
5. 加载/空/错误:Skeleton/Spin、`Empty.PRESENTED_IMAGE_SIMPLE`、`Alert`/`message`,文案沿用原有。
6. 无数据源的原型元素(如 PayPal 说明行、“查看 10 元示例”、头像“显示文字”的独立字段):不虚构数据或字段;只读占位或不渲染,并写入风险清单。
## 7. 禁止事项
- 禁止修改接口、请求参数/载荷、状态管理、路由、权限、计费、登录方式和业务触发条件;禁止新增功能。非 UI 阻塞问题只记入“风险与后续建议”。
- 禁止在 JSX/规则中硬编码颜色;颜色只出现在 token 或页面变量定义中(浅色原型实测值 + 深色推导值)。第三方品牌标识色(支付宝、微信、Stripe、PayPal 图标)除外。
- 禁止无原型依据的渐变、玻璃、发光、浮起、序号角标和装饰动效;禁止用 AI 生成插画或自创背景。
- 禁止引入旧 UI 库、插件、私有内部模块或新的图标库;图标只用 `lucide-react`。
- 禁止用 Playwright 遍历页面去“猜测”原型;禁止把 `现有图.zip` 当作目标;禁止为截图伪造线上数据(模拟数据只用于暴露状态,并在报告中标注 mock)。
- 禁止点击真实的 `确认支付`、`确认购买`、`确认升级`、`删除账户` 等写操作确认按钮;写操作只用可清理测试数据。
- 禁止输出或提交密码、Cookie、令牌、storageState、截图与测试报告。
## 8. 测试清单
1. 登录关卡(第 10 节)通过并保存 storageState 后才开始改造或截图。
2. 每个页面/状态采集浅色与深色、桌面(1920×1000)与移动(393×851,触屏)截图;等待懒加载、骨架屏与提交中状态结束。
3. 交互:悬停、焦点、禁用、加载、弹窗打开/取消、日期面板、校验失败、复制反馈、主题切换并刷新保持;记录所有非 GET `/api/` 请求(只读验收应为 0)。
4. 模拟状态(有数据、分页、PayPal 报价/不支持、会员方案、空态)只拦截列表/报价接口,并按接口真实对象/数组契约提供。
5. 全局:`npm test`、`npm run eslint`、`npm run lint`、`npm run build`、`git diff --check`、旧库扫描、业务契约 AST 对照(API 调用、useState 初值、Hook 依赖、Route、rules、存储、导航、dispatch、提示)。全量 lint 有历史问题时记录基线并只对本次文件给出结论。
6. 文案新增 key 必须补齐全部 locales(`src/i18n/locales/*.json`)。
7. 结束时通过 UI 退出登录,并确认受保护路由不再渲染用户中心。
## 9. 截图与映射流程
| 步骤 | 产物 |
| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| 解压两个 zip 到本地临时目录(`/tmp/ui-ref/prototype`、`/tmp/ui-ref/current`),不进仓库 | 原图 |
| 清点原型与现有图 | `/tmp/ui-ref/manifest-prototype.md`、`/tmp/ui-ref/manifest-current.md` |
| 按文件名、标题、面包屑、页签、路由建立映射与覆盖清单(已覆盖/原型有现有缺失/原型未覆盖/排除) | `/tmp/ui-ref/page-mapping.md` |
| 改造前基线截图 | `/tmp/ui-ref/baseline/user/{light | dark}/{pageId}/{state}.png` |
| 改造后截图 | `/tmp/ui-ref/shots/user/{light | dark}/{pageId}/{state}.png`;移动端 `/tmp/ui-ref/shots-mobile/...` |
| 差异图 | `/tmp/ui-ref/diff/user/{light | dark}/{pageId}/{state}.png`(`-side.png` 为 原型/实现/差异 三联图);`diff/summary.json` |
- 原型截图起点不同:比较时以页头区域对齐(使用记录、在线充值约 +19px,绘图与视频 +15px,Webhook 滚动截图 +44px);`在线充值3/4` 为约 90% 缩放截图,只做结构核对。
- 原型含 15px 经典滚动条,右侧元素约有 15px 渲染位移,不据此改布局。
- 深色只有“改造前 → 改造后”对比,没有原型对比。
### 9.1 二次回归增量(2026-11-04)
- 第一次的 `/tmp/ui-ref`(实际为 `C:/Users/Win10/AppData/Local/Temp/ui-ref`)与 `原型图.zip` 已不存在。二次回归改以在线原型 `http://192.168.0.161:8888` 补采 1920×1000 浅 / 深色为基准,产物写入 Git 忽略的 `report/regression/`(`shots/{proto|system}/{theme}/{vp}/{page}.png`、`probe/*.json`、`diff/{theme}/{page}{-head,}-side.png`、`diff/summary.json`、`trace/system-*.zip`、`visual-regression.html`、`regression-list.md`)。
- 判定区域改为“页头带”(内容区顶部 170px,±8px 对齐,遮罩右侧操作区与客服悬浮钮);整幅视口因原型数据与真实账户不同只记信息值。阈值、视口、DPR、语言、动效与例外清单见入口文件“用户中心二次回归约定”。
- 在线原型与本规范的已知不一致(不据此改代码):面包屑距顶 26px / 行高 20px、标题 600 / 35.5px / -0.7px、正文色 `rgba(0,0,0,.88)`、表头计算字重 500、暗色主色 `#d1963a`。本规范的 30px / 18px、650 / 32px / -0.6px、`#263247`、400 分别来自用户附件指令或第一次 zip 实测,维持不变;暗色主色已按用户决定跟随在线原型(`#d1963a`,见入口文件第 7 条),本句旧待决事项待用户决定。
## 10. 个人端登录流程与容错
- Base URL:每次从 `dev.log` 最后一个 `Local:` 提取(去除 ANSI 色码),禁止写死 IP 与端口。服务启动:`nohup npm run dev > dev.log 2>&1 &`;Windows 可用隐藏窗口的 `Start-Process` 启动同一命令。
- 入口 `{Base URL}/login`,个人端账号 `test_222`,密码 `12345678`(用户指定的测试账号;脚本从环境变量 `UI_PERSONAL_USER` / `UI_PERSONAL_PASS` 读取,不写入脚本、日志、截图注释或提交)。
- 新建 Browser Context(清空 Cookies/Storage)→ `goto('/login')` → `waitForLoadState('networkidle')` → 检查可见非隐藏、非复选框输入框数量、placeholder/标签和按钮 → 打印不含输入值的判定并截图 → 按页面原有协议勾选与登录 → 确认用户中心侧栏与主体已渲染(仅接口成功或 URL 变化不算)→ 立即保存 storageState 到 Git 忽略的本地目录(`/tmp/ui-ref/auth/`)。
- 禁止 API 登录或注入伪造鉴权;登录阶段不录 trace/HAR。
- 容错:登录失败或接口报错时,截图 + 保存 `dev.log` 尾部 + 失败请求 payload(密码、Cookie、token、ticket 脱敏)写入“风险与后续建议”;不得反复盲试,不得为登录修改业务代码。
- 浏览器:本机 Google Chrome,`channel: 'chrome'`,有头模式;窗口放在屏幕外(`--window-position=-32000,-32000`,或 `UI_VISUAL_OFFSCREEN=1`),不抢占前台鼠标键盘焦点。后端限流(429)时用侧栏 SPA 导航并放慢节奏,不并发多页。
- 结束:悬停顶栏用户菜单 →“退出登录”→ 确认跳转登录页(当前实现落到 `/org/login`)且受保护路由不再渲染。
## 11. 资源与并发控制
- 启动浏览器、构建前检查空闲物理内存与提交内存(本轮门槛:物理 ≥ 2GB、提交 ≥ 2.5GB);浏览器同一时间只开一个,截图串行并加锁。
- `npm test -- --test-concurrency=1`;ESLint/Prettier 逐个运行并设置 `NODE_OPTIONS=--max-old-space-size=2048`。
- 构建:输出到临时目录,不覆盖已有 `dist/`;Node 堆 2048MB 时 Rollup 渲染阶段会堆溢出,需约 2.9GB 堆(`--max-old-space-size=2900`)并关闭 gzip 体积统计;构建期间监控提交内存,低于 700MB 立即中止。内存紧张时先停止自己启动的 dev server,结束后再按原方式启动。
- esbuild(dev 预构建)内存不足时设置 `GOMAXPROCS=2`、`GOGC=25`、`GOMEMLIMIT=1200MiB`。不要结束他人进程(其他 vite、原型服务、IDE 测试服务)。
+25 -1002
View File
File diff suppressed because it is too large Load Diff
+1 -11
View File
@@ -5,12 +5,9 @@
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@dagrejs/dagre": "^1.1.4", "@dagrejs/dagre": "^1.1.4",
"@douyinfe/semi-icons": "^2.63.1",
"@douyinfe/semi-ui": "^2.69.1",
"@lobehub/icons": "1.97.2", "@lobehub/icons": "1.97.2",
"@visactor/react-vchart": "~1.8.8", "@visactor/react-vchart": "~1.8.8",
"@visactor/vchart": "~1.8.8", "@visactor/vchart": "~1.8.8",
"@visactor/vchart-semi-theme": "~1.8.8",
"@xyflow/react": "^12.6.0", "@xyflow/react": "^12.6.0",
"antd": "^5.23.0", "antd": "^5.23.0",
"axios": "^1.19.0", "axios": "^1.19.0",
@@ -39,7 +36,6 @@
"react-markdown": "^10.1.0", "react-markdown": "^10.1.0",
"react-router-dom": "^6.3.0", "react-router-dom": "^6.3.0",
"react-telegram-login": "^1.1.2", "react-telegram-login": "^1.1.2",
"react-toastify": "^9.0.8",
"react-turnstile": "^1.0.5", "react-turnstile": "^1.0.5",
"rehype-highlight": "^7.0.2", "rehype-highlight": "^7.0.2",
"rehype-katex": "^7.0.1", "rehype-katex": "^7.0.1",
@@ -82,7 +78,6 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@douyinfe/vite-plugin-semi": "^2.74.0-alpha.6",
"@playwright/test": "^1.64.1", "@playwright/test": "^1.64.1",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
@@ -102,10 +97,5 @@
"node": ">=22.13.0", "node": ">=22.13.0",
"npm": ">=10" "npm": ">=10"
}, },
"packageManager": "npm@10.9.9", "packageManager": "npm@10.9.9"
"overrides": {
"@douyinfe/vite-plugin-semi": {
"vite": "$vite"
}
}
} }
+9
View File
@@ -37,6 +37,15 @@ export default defineConfig({
outputDir: 'test-results', outputDir: 'test-results',
use: { use: {
baseURL, baseURL,
launchOptions:
process.env.UI_VISUAL_OFFSCREEN === '1'
? {
args: [
'--window-position=-32000,-32000',
'--disable-backgrounding-occluded-windows',
],
}
: {},
locale: 'zh-CN', locale: 'zh-CN',
timezoneId: 'Asia/Shanghai', timezoneId: 'Asia/Shanghai',
trace: 'retain-on-failure', trace: 'retain-on-failure',
+8 -4
View File
@@ -45,7 +45,6 @@ const About = lazy(() => import('./pages/About'));
const UserAgreement = lazy(() => import('./pages/UserAgreement')); const UserAgreement = lazy(() => import('./pages/UserAgreement'));
const PrivacyPolicy = lazy(() => import('./pages/PrivacyPolicy')); const PrivacyPolicy = lazy(() => import('./pages/PrivacyPolicy'));
const ExperienceCenter = lazy(() => import('./pages/ExperienceCenter')); const ExperienceCenter = lazy(() => import('./pages/ExperienceCenter'));
const KeyManagement = lazy(() => import('./pages/KeyManagement'));
const UserCenter = lazy(() => import('./pages/UserCenter')); const UserCenter = lazy(() => import('./pages/UserCenter'));
const Recharge = lazy(() => import('./pages/Recharge')); const Recharge = lazy(() => import('./pages/Recharge'));
const Tutorial = lazy(() => import('./pages/Tutorial')); const Tutorial = lazy(() => import('./pages/Tutorial'));
@@ -126,7 +125,7 @@ const ORG_USER_NAV_PATHS = {
skillMarket: ['/skill-market'], skillMarket: ['/skill-market'],
docs: ['/docs'], docs: ['/docs'],
experienceCenter: ['/experience-center'], experienceCenter: ['/experience-center'],
keyManagement: ['/key-management'], keyManagement: ['/key-management', '/user-center/key-management'],
userCenter: ['/user-center'], userCenter: ['/user-center'],
}; };
const isOrgAllowedPath = (pathname, extraPrefixes = []) => const isOrgAllowedPath = (pathname, extraPrefixes = []) =>
@@ -730,8 +729,13 @@ function App() {
) )
} }
/> />
{/* 密钥管理归入用户中心路径;旧地址保留为重定向(旧链接、登录回跳、书签) */}
<Route <Route
path='/key-management' path='/key-management'
element={<Navigate to='/user-center/key-management' replace />}
/>
<Route
path='/user-center/key-management'
element={ element={
moduleAuthConfig.keyManagement ? ( moduleAuthConfig.keyManagement ? (
<PrivateRoute> <PrivateRoute>
@@ -739,12 +743,12 @@ function App() {
fallback={<Loading></Loading>} fallback={<Loading></Loading>}
key={location.pathname} key={location.pathname}
> >
<KeyManagement /> <UserCenter keyManagementMode />
</Suspense> </Suspense>
</PrivateRoute> </PrivateRoute>
) : ( ) : (
<Suspense fallback={<Loading></Loading>} key={location.pathname}> <Suspense fallback={<Loading></Loading>} key={location.pathname}>
<KeyManagement /> <UserCenter keyManagementMode />
</Suspense> </Suspense>
) )
} }
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 310" fill="none" aria-hidden="true"><defs><linearGradient id="platform-top" x1="180" y1="80" x2="550" y2="300" gradientUnits="userSpaceOnUse"><stop stop-color="#fff9e8"></stop><stop offset="1" stop-color="#e8b363"></stop></linearGradient><linearGradient id="chip-top" x1="290" y1="55" x2="420" y2="210" gradientUnits="userSpaceOnUse"><stop stop-color="#fffdf5"></stop><stop offset="1" stop-color="#f5cb80"></stop></linearGradient><linearGradient id="chip-front" x1="310" y1="140" x2="420" y2="230"><stop stop-color="#eaa849"></stop><stop offset="1" stop-color="#ba6b1b"></stop></linearGradient><linearGradient id="glass" x1="150" y1="55" x2="290" y2="215"><stop stop-color="#fff" stop-opacity=".92"></stop><stop offset="1" stop-color="#fff4db" stop-opacity=".6"></stop></linearGradient><radialGradient id="aura"><stop stop-color="#ffd997" stop-opacity=".65"></stop><stop offset="1" stop-color="#ffd997" stop-opacity="0"></stop></radialGradient><filter id="shadow" x="-40%" y="-40%" width="180%" height="200%"><feGaussianBlur stdDeviation="10"></feGaussianBlur></filter></defs><ellipse cx="404" cy="220" rx="245" ry="78" fill="url(#aura)"></ellipse><ellipse cx="392" cy="244" rx="176" ry="30" fill="#b47536" opacity=".14" filter="url(#shadow)"></ellipse><path d="M172 210L382 91L610 210L395 295Z" fill="#dd9b47" opacity=".17"></path><path d="M172 194L382 75L610 194L395 279Z" fill="url(#platform-top)" stroke="#fff5dd" stroke-width="2"></path><path d="M172 194v16l223 85v-16z" fill="#dbac65" opacity=".7"></path><path d="M395 279l215-85v16l-215 85z" fill="#c99148" opacity=".6"></path><path d="M226 206l89-48 124 49 104-55 M254 232l95-53 119 49 70-34 M394 253v-22" stroke="#c89550" stroke-width="1.5" opacity=".65"></path><g fill="#fff8e4" stroke="#d09b51"><circle cx="226" cy="206" r="4"></circle><circle cx="254" cy="232" r="4"></circle><circle cx="543" cy="152" r="4"></circle><circle cx="538" cy="194" r="4"></circle><circle cx="394" cy="253" r="4"></circle></g><g><path d="M314 151l89-49 108 51-90 49z" fill="url(#chip-top)" stroke="#fff7e6" stroke-width="2"></path><path d="M314 151v23l107 52v-24z" fill="url(#chip-front)"></path><path d="M421 202l90-49v23l-90 50z" fill="#d99c45"></path><path d="M314 121l89-49 108 51-90 49z" fill="url(#chip-top)" stroke="#fff9ea" stroke-width="2"></path><path d="M314 121v20l107 51v-20z" fill="url(#chip-front)"></path><path d="M421 172l90-49v20l-90 49z" fill="#e0aa58"></path><path d="M314 91l89-49 108 51-90 49z" fill="url(#chip-top)" stroke="#fffdf5" stroke-width="2"></path><path d="M314 91v20l107 51v-20z" fill="url(#chip-front)"></path><path d="M421 142l90-49v20l-90 49z" fill="#e5b369"></path><path d="M365 89l36-20 48 23-36 20z" fill="#fff8e7" stroke="#d99d49"></path><path d="M385 88l15-8 25 12-15 8z" fill="#d49338"></path><g stroke="#fff3cc" stroke-width="3" stroke-linecap="round"><path d="M331 113l9 4 M350 122l9 4 M369 131l9 4 M331 143l9 4 M350 152l9 4 M369 161l9 4 M331 175l9 4 M350 184l9 4 M369 193l9 4"></path></g></g><g><path d="M164 85l127 26v112l-127-28z" fill="url(#glass)" stroke="#fff" stroke-width="2"></path><path d="M174 98l106 22v85l-106-23z" fill="#f5d59c" fill-opacity=".42"></path><path d="M187 174v-21 M206 178v-37 M225 182v-27 M244 186v-54 M263 190v-40" stroke="#cc8f39" stroke-width="8"></path><path d="M184 132l24-9 22 14 31-11" stroke="#dda74e" stroke-width="2"></path><circle cx="184" cy="132" r="3" fill="#c48730"></circle></g><g stroke="#f0c47a" stroke-width="1.4"><path d="M503 58l32-18 31 17-32 19z" fill="#fff1d6"></path><path d="M503 58v28l31 18V76z" fill="#e9b66a"></path><path d="M534 76l32-19v29l-32 18z" fill="#f5d59b"></path><path d="M571 139l20-12 22 12-21 12z" fill="#fff6e3"></path><path d="M571 139v20l21 12v-20z" fill="#dfab60"></path><path d="M592 151l21-12v20l-21 12z" fill="#f2ce8f"></path></g><path d="M282 74l13-8 14 8-13 8z M222 64l8-5 9 5-8 5z M548 235l10-6 10 6-10 6z" fill="#ecc589"></path><path d="M479 28v14 M472 35h14 M607 88v10 M602 93h10" stroke="#dfb66d" stroke-width="2" stroke-linecap="round"></path><ellipse cx="391" cy="185" rx="235" ry="91" stroke="#d7a558" stroke-opacity=".28" stroke-width="1.5" stroke-dasharray="4 8"></ellipse></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

+2
View File
@@ -0,0 +1,2 @@
<!-- 来源:原型 http://192.168.0.161:8888 模型超市 .mm-hero .mm-art 内联 SVG(2026-11-04 采集,原样保留路径与配色;动画与深浅主题颜色由 market.css 控制) -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 250" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="mm-trace"><stop stop-color="#c78426" stop-opacity="0"></stop><stop offset=".55" stop-color="#e3ad53"></stop><stop offset="1" stop-color="#ce8729" stop-opacity="0"></stop></linearGradient><radialGradient id="mm-halo"><stop stop-color="#f3bc59" stop-opacity=".35"></stop><stop offset="1" stop-color="#f3bc59" stop-opacity="0"></stop></radialGradient><pattern id="mm-grid" width="44" height="44" patternUnits="userSpaceOnUse"><path d="M44 0H0V44" fill="none" stroke="currentColor" stroke-opacity=".08"></path></pattern></defs><rect width="1440" height="250" fill="url(#mm-grid)"></rect><ellipse cx="1170" cy="135" rx="400" ry="240" fill="url(#mm-halo)"></ellipse><g fill="none" stroke="url(#mm-trace)" stroke-width="1"><path d="M-100 220 180 60h230l110 65h360l120-70h320"></path><path d="M-100 240 180 80h230l110 65h360l120-70h320"></path><path d="M0 200h190l120-70h160M880 180h200l160-95h200"></path><path d="M0 60h200l140 80M1040 250l160-95h240"></path><ellipse cx="1170" cy="133" rx="190" ry="75" transform="rotate(-20 1170 133)"></ellipse><ellipse cx="1170" cy="133" rx="220" ry="90" transform="rotate(-20 1170 133)"></ellipse></g><g class="mm-signals" fill="none" stroke="#e8b04e" stroke-width="2"><path d="M-100 220 180 60h230l110 65h360l120-70h320"></path><path d="M0 200h190l120-70h160M880 180h200l160-95h200"></path></g><g fill="#c5852c"><circle cx="180" cy="60" r="3"></circle><circle cx="410" cy="60" r="3"></circle><circle cx="1000" cy="55" r="3"></circle><circle cx="1080" cy="180" r="3"></circle></g></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Card, Table, Progress } from '@douyinfe/semi-ui'; import { Card, Table, Progress } from '@/components/ui';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const ChannelConsumption = ({ data, title, icon, t }) => { const ChannelConsumption = ({ data, title, icon, t }) => {
+2 -2
View File
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Table, Button } from '@douyinfe/semi-ui'; import { Card, Table, Button } from '@/components/ui';
import { IconDownload } from '@douyinfe/semi-icons'; import { IconDownload } from '@/components/ui/icons';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const DailyStatsTable = ({ data, title, icon, t }) => { const DailyStatsTable = ({ data, title, icon, t }) => {
@@ -29,12 +29,12 @@ import {
Modal, Modal,
Input, Input,
Typography, Typography,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { import {
IconRefresh, IconRefresh,
IconAlertTriangle, IconAlertTriangle,
IconShieldStroked, IconShieldStroked,
} from '@douyinfe/semi-icons'; } from '@/components/ui/icons';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const { Text } = Typography; const { Text } = Typography;
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Card } from '@douyinfe/semi-ui'; import { Card } from '@/components/ui';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card } from '@douyinfe/semi-ui'; import { Card } from '@/components/ui';
import { import {
Users, Users,
UserPlus, UserPlus,
@@ -27,8 +27,8 @@ import {
Typography, Typography,
Space, Space,
Select, Select,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { IconRefresh } from '@douyinfe/semi-icons'; import { IconRefresh } from '@/components/ui/icons';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const { Text } = Typography; const { Text } = Typography;
@@ -28,7 +28,7 @@ import {
Banner, Banner,
Button, Button,
Space, Space,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const { Text } = Typography; const { Text } = Typography;
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Card } from '@douyinfe/semi-ui'; import { Card } from '@/components/ui';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
// 支付渠道颜色映射:支付宝蓝色、微信绿色 // 支付渠道颜色映射:支付宝蓝色、微信绿色
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Card } from '@douyinfe/semi-ui'; import { Card } from '@/components/ui';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
const TrendCharts = ({ title, icon, data, type, t }) => { const TrendCharts = ({ title, icon, data, type, t }) => {
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Avatar, Progress } from '@douyinfe/semi-ui'; import { Card, Avatar, Progress } from '@/components/ui';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const UserRanking = ({ data, title, icon, t }) => { const UserRanking = ({ data, title, icon, t }) => {
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo, useState, useEffect, useCallback } from 'react'; import React, { useMemo, useState, useEffect, useCallback } from 'react';
import { Card, Spin, Tag, Progress, Empty } from '@douyinfe/semi-ui'; import { Card, Spin, Tag, Progress, Empty } from '@/components/ui';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
import { API, showError } from '../../helpers'; import { API, showError } from '../../helpers';
import { import {
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Table } from '@douyinfe/semi-ui'; import { Card, Table } from '@/components/ui';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const UserTopupRanking = ({ data, title, icon, t }) => { const UserTopupRanking = ({ data, title, icon, t }) => {
@@ -26,7 +26,7 @@ import {
Tabs, Tabs,
Tag, Tag,
Typography, Typography,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { ClipboardList, Download } from 'lucide-react'; import { ClipboardList, Download } from 'lucide-react';
import { ChangeText, OrgNameCell, ReasonTags, SectionCard } from './shared'; import { ChangeText, OrgNameCell, ReasonTags, SectionCard } from './shared';
import { import {
@@ -154,8 +154,8 @@ const columnsFor = (tab, cny, t, atRisk) => {
style={{ style={{
color: color:
v <= 3 v <= 3
? 'var(--semi-color-danger)' ? 'var(--ui-color-danger)'
: 'var(--semi-color-warning)', : 'var(--ui-color-warning)',
}} }}
> >
{v < 1 ? t('不足 1 天') : `${v.toFixed(1)} ${t('天')}`} {v < 1 ? t('不足 1 天') : `${v.toFixed(1)} ${t('天')}`}
Binary file not shown.
+13 -13
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Banner, Button, Card, Tag, Tooltip } from '@douyinfe/semi-ui'; import { Banner, Button, Card, Tag, Tooltip } from '@/components/ui';
import { import {
AlertOctagon, AlertOctagon,
AlertTriangle, AlertTriangle,
@@ -124,10 +124,10 @@ export const ReportHeader = ({ report, onExport, t }) => {
// ─── 本期要点 ───────────────────────────────────────────────────── // ─── 本期要点 ─────────────────────────────────────────────────────
const FINDING_STYLE = { const FINDING_STYLE = {
danger: { icon: AlertOctagon, color: 'var(--semi-color-danger)' }, danger: { icon: AlertOctagon, color: 'var(--ui-color-danger)' },
warning: { icon: AlertTriangle, color: 'var(--semi-color-warning)' }, warning: { icon: AlertTriangle, color: 'var(--ui-color-warning)' },
success: { icon: CheckCircle2, color: 'var(--semi-color-success)' }, success: { icon: CheckCircle2, color: 'var(--ui-color-success)' },
info: { icon: Info, color: 'var(--semi-color-primary)' }, info: { icon: Info, color: 'var(--ui-color-primary)' },
}; };
export const KeyFindings = ({ findings, onJump, t }) => ( export const KeyFindings = ({ findings, onJump, t }) => (
@@ -237,7 +237,7 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
</Tooltip> </Tooltip>
), ),
tip: t('本月至今 + 近 7 个完整日的日均消耗 × 本月剩余天数;对比上月全月'), tip: t('本月至今 + 近 7 个完整日的日均消耗 × 本月剩余天数;对比上月全月'),
accent: 'var(--semi-color-tertiary)', accent: 'var(--ui-color-tertiary)',
}, },
{ {
title: t('未来 30 天充值缺口'), title: t('未来 30 天充值缺口'),
@@ -246,8 +246,8 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
tip: t('按各企业近 7 日日均消耗覆盖 30 天所需金额,减去当前余额后累加'), tip: t('按各企业近 7 日日均消耗覆盖 30 天所需金额,减去当前余额后累加'),
accent: accent:
k.topup_gap_30d > 0 k.topup_gap_30d > 0
? 'var(--semi-color-danger)' ? 'var(--ui-color-danger)'
: 'var(--semi-color-success)', : 'var(--ui-color-success)',
onClick: () => onJump('renewal'), onClick: () => onJump('renewal'),
}, },
{ {
@@ -258,7 +258,7 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
? t('近 7 日无消耗') ? t('近 7 日无消耗')
: t('按当前速度可支撑 {{days}} 天', { days: coverDays.toFixed(0) }), : t('按当前速度可支撑 {{days}} 天', { days: coverDays.toFixed(0) }),
tip: t('全部企业主余额 + 赠送余额'), tip: t('全部企业主余额 + 赠送余额'),
accent: 'var(--semi-color-success)', accent: 'var(--ui-color-success)',
}, },
{ {
title: t('企业消耗占平台'), title: t('企业消耗占平台'),
@@ -271,8 +271,8 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
style={{ style={{
color: color:
shareDelta >= 0 shareDelta >= 0
? 'var(--semi-color-success)' ? 'var(--ui-color-success)'
: 'var(--semi-color-danger)', : 'var(--ui-color-danger)',
}} }}
> >
{shareDelta >= 0 ? '+' : ''} {shareDelta >= 0 ? '+' : ''}
@@ -342,8 +342,8 @@ export const HealthSegments = ({ report, cny, activeSegment, onSelect, t }) => {
style={{ style={{
color: color:
delta > 0 delta > 0
? 'var(--semi-color-success)' ? 'var(--ui-color-success)'
: 'var(--semi-color-danger)', : 'var(--ui-color-danger)',
}} }}
> >
{delta > 0 ? '+' : '-'} {delta > 0 ? '+' : '-'}
@@ -26,7 +26,7 @@ import {
Table, Table,
Tag, Tag,
Typography, Typography,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { Download, Search, Table2, UserCog } from 'lucide-react'; import { Download, Search, Table2, UserCog } from 'lucide-react';
import { ChangeText, OrgNameCell, SectionCard } from './shared'; import { ChangeText, OrgNameCell, SectionCard } from './shared';
import { import {
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { Button, Card, Typography } from '@douyinfe/semi-ui'; import { Button, Card, Typography } from '@/components/ui';
import { ActionCenter, ACTION_TABS } from './ActionCenter'; import { ActionCenter, ACTION_TABS } from './ActionCenter';
import { import {
ChangeAttribution, ChangeAttribution,
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Tag, Tooltip } from '@douyinfe/semi-ui'; import { Card, Tag, Tooltip } from '@/components/ui';
import { TrendingDown, TrendingUp } from 'lucide-react'; import { TrendingDown, TrendingUp } from 'lucide-react';
import { changeRate, ORG_STATUS, orgDisplayName, REASONS } from './utils'; import { changeRate, ORG_STATUS, orgDisplayName, REASONS } from './utils';
@@ -81,7 +81,7 @@ export const ChangeText = ({ cur, prev, t, size = 'xs', showNew = true }) => {
<span <span
className={`inline-flex items-center gap-0.5 ${sizeClass} font-medium tabular-nums`} className={`inline-flex items-center gap-0.5 ${sizeClass} font-medium tabular-nums`}
style={{ style={{
color: up ? 'var(--semi-color-success)' : 'var(--semi-color-danger)', color: up ? 'var(--ui-color-success)' : 'var(--ui-color-danger)',
}} }}
> >
{up ? ( {up ? (
@@ -109,7 +109,7 @@ export const KpiCard = ({
bodyStyle={{ padding: '14px 16px' }} bodyStyle={{ padding: '14px 16px' }}
onClick={onClick} onClick={onClick}
style={{ style={{
borderLeft: `3px solid ${accent || 'var(--semi-color-primary)'}`, borderLeft: `3px solid ${accent || 'var(--ui-color-primary)'}`,
}} }}
> >
<div className='flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400 mb-1'> <div className='flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400 mb-1'>
+3 -1
View File
@@ -61,7 +61,9 @@ const AuthCardHeader = ({
<h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'> <h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
{title} {title}
</h4> </h4>
<p className='text-gray-500 dark:text-gray-400 text-xs'>{subtitle}</p> <p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
{subtitle}
</p>
</div> </div>
); );
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Avatar } from '@douyinfe/semi-ui'; import { Avatar } from '@/components/ui';
import { MessageCircle, ScanLine } from 'lucide-react'; import { MessageCircle, ScanLine } from 'lucide-react';
import { API } from '../../helpers'; import { API } from '../../helpers';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
+7 -10
View File
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button } from 'antd';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -28,7 +29,7 @@ import { useTranslation } from 'react-i18next';
* active:当前页归属('personal' | 'enterprise'),高亮且不重复跳转。 * active:当前页归属('personal' | 'enterprise'),高亮且不重复跳转。
* *
* 浮于玻璃卡片之外、之上:自带玻璃壳(backdrop-blur + 半透白底 + ring/border), * 浮于玻璃卡片之外、之上:自带玻璃壳(backdrop-blur + 半透白底 + ring/border),
* 在背景上保持可读并与下方卡片呼应;激活态用品牌渐变强化「当前入口」的辨识度。 * 在背景上保持可读并与下方卡片呼应;激活态沿用 Ant Design 主题主色。
*/ */
const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => { const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -47,25 +48,21 @@ const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => {
]; ];
return ( return (
<div className='relative z-20 flex p-1 gap-1 rounded-2xl backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05] shadow-[0_12px_32px_-16px_rgb(var(--brand-primary-rgb)/0.45)]'> <div className='auth-login-tabs relative z-20 flex p-1 gap-1 rounded-xl backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05]'>
{tabs.map((tab) => { {tabs.map((tab) => {
const isActive = tab.key === active; const isActive = tab.key === active;
return ( return (
<button <Button
key={tab.key} key={tab.key}
type='button' type={isActive ? 'primary' : 'text'}
aria-pressed={isActive} aria-pressed={isActive}
onClick={() => { onClick={() => {
if (!isActive) navigate(tab.to); if (!isActive) navigate(tab.to);
}} }}
className={`flex-1 h-10 rounded-xl text-sm font-medium transition-all duration-200 ${ className='flex-1 font-medium'
isActive
? 'bg-gradient-to-r from-brand-from to-brand-to text-white shadow-md shadow-brand/25'
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/40 dark:hover:bg-white/[0.05]'
}`}
> >
{tab.label} {tab.label}
</button> </Button>
); );
})} })}
</div> </div>
+26 -26
View File
@@ -82,7 +82,7 @@ export const GlassCardStyles = () => (
/* 认证页 Semi 输入框玻璃风格:容器挂 .auth-glass-form 后,四个认证页 /* 认证页 Semi 输入框玻璃风格:容器挂 .auth-glass-form 后,四个认证页
(登录/注册/企业登录/企业注册)的输入框共享同一套观感 —— (登录/注册/企业登录/企业注册)的输入框共享同一套观感 ——
半透白玻璃底 + 圆角、hover 提亮、聚焦品牌色边框 + 柔和光环、错误态沿用语义色 */ 半透白玻璃底 + 圆角、hover 提亮、聚焦品牌色边框 + 柔和光环、错误态沿用语义色 */
.auth-glass-form .semi-input-wrapper { .auth-glass-form .ant-input-affix-wrapper {
background: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.6);
border: 1px solid rgba(229, 231, 235, 0.8); border: 1px solid rgba(229, 231, 235, 0.8);
border-radius: 0.75rem; border-radius: 0.75rem;
@@ -93,64 +93,64 @@ export const GlassCardStyles = () => (
background-color 0.2s ease, background-color 0.2s ease,
box-shadow 0.2s ease; box-shadow 0.2s ease;
} }
.auth-glass-form .semi-input-wrapper:hover { .auth-glass-form .ant-input-affix-wrapper:hover {
background: rgba(255, 255, 255, 0.78); background: rgba(255, 255, 255, 0.78);
border-color: rgba(209, 213, 219, 1); border-color: rgba(209, 213, 219, 1);
} }
.auth-glass-form .semi-input-wrapper-focus, .auth-glass-form .ant-input-affix-wrapper-focus,
.auth-glass-form .semi-input-wrapper-focus:hover { .auth-glass-form .ant-input-affix-wrapper-focus:hover {
background: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.9);
border-color: rgb(var(--brand-primary-rgb)); border-color: rgb(var(--brand-primary-rgb));
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.14); box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.14);
} }
.dark .auth-glass-form .semi-input-wrapper { .dark .auth-glass-form .ant-input-affix-wrapper {
background: rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.06);
border-color: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.12);
} }
.dark .auth-glass-form .semi-input-wrapper:hover { .dark .auth-glass-form .ant-input-affix-wrapper:hover {
background: rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.09);
border-color: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.2);
} }
.dark .auth-glass-form .semi-input-wrapper-focus, .dark .auth-glass-form .ant-input-affix-wrapper-focus,
.dark .auth-glass-form .semi-input-wrapper-focus:hover { .dark .auth-glass-form .ant-input-affix-wrapper-focus:hover {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border-color: rgb(var(--brand-primary-rgb)); border-color: rgb(var(--brand-primary-rgb));
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.22); box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.22);
} }
/* 校验失败:边框与光环改用语义 danger 色,保持玻璃底不变 */ /* 校验失败:边框与光环改用语义 danger 色,保持玻璃底不变 */
.auth-glass-form .semi-input-wrapper-error, .auth-glass-form .ant-input-affix-wrapper-error,
.auth-glass-form .semi-input-wrapper-error:hover, .auth-glass-form .ant-input-affix-wrapper-error:hover,
.auth-glass-form .semi-input-wrapper-error.semi-input-wrapper-focus { .auth-glass-form .ant-input-affix-wrapper-error.ant-input-affix-wrapper-focus {
border-color: var(--semi-color-danger); border-color: var(--ui-color-danger);
box-shadow: none; box-shadow: none;
} }
/* 前缀图标与内建功能钮(密码眼睛/清除)默认弱化; /* 前缀图标与内建功能钮(密码眼睛/清除)默认弱化;
只针对这三处染色,避免误染 suffix 里自定义按钮(如「获取验证码」)的 loading 图标 */ 只针对这三处染色,避免误染 suffix 里自定义按钮(如「获取验证码」)的 loading 图标 */
.auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon, .auth-glass-form .ant-input-affix-wrapper .ant-input-prefix .anticon,
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon, .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn .anticon,
.auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon { .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn .anticon {
color: rgba(156, 163, 175, 1); color: rgba(156, 163, 175, 1);
transition: color 0.2s ease; transition: color 0.2s ease;
} }
.dark .auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon, .dark .auth-glass-form .ant-input-affix-wrapper .ant-input-prefix .anticon,
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon, .dark .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn .anticon,
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon { .dark .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn .anticon {
color: rgba(107, 114, 128, 1); color: rgba(107, 114, 128, 1);
} }
/* 密码眼睛/清除按钮 hover 加深,给出可点击反馈 */ /* 密码眼睛/清除按钮 hover 加深,给出可点击反馈 */
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon, .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn:hover .anticon,
.auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon { .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn:hover .anticon {
color: rgba(75, 85, 99, 1); color: rgba(75, 85, 99, 1);
} }
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon, .dark .auth-glass-form .ant-input-affix-wrapper .ant-input-clearbtn:hover .anticon,
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon { .dark .auth-glass-form .ant-input-affix-wrapper .ant-input-modebtn:hover .anticon {
color: rgba(209, 213, 219, 1); color: rgba(209, 213, 219, 1);
} }
/* 聚焦时前缀图标点亮为品牌色,给出清晰的焦点反馈 */ /* 聚焦时前缀图标点亮为品牌色,给出清晰的焦点反馈 */
.auth-glass-form .semi-input-wrapper-focus .semi-input-prefix .semi-icon { .auth-glass-form .ant-input-affix-wrapper-focus .ant-input-prefix .anticon {
color: rgb(var(--brand-primary-rgb)); color: rgb(var(--brand-primary-rgb));
} }
.dark .auth-glass-form .semi-input::placeholder { .dark .auth-glass-form .ant-input::placeholder {
color: rgba(255, 255, 255, 0.35); color: rgba(255, 255, 255, 0.35);
} }
/* 移动端降级 backdrop-filter,减轻 GPU 负担 */ /* 移动端降级 backdrop-filter,减轻 GPU 负担 */
@@ -220,10 +220,10 @@ const GlassCard = ({
)} )}
{/* 顶部品牌渐变线 */} {/* 顶部品牌渐变线 */}
<div className='absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-brand-from via-brand-via to-brand-to opacity-90' /> <div className='login-card-top-accent absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-brand-from via-brand-via to-brand-to opacity-90' />
{/* 顶部 1px 白色反光 - 紧贴品牌线下方 */} {/* 顶部 1px 白色反光 - 紧贴品牌线下方 */}
<div className='absolute top-0.5 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/90 dark:via-white/40 to-transparent pointer-events-none' /> <div className='login-card-top-reflection absolute top-0.5 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/90 dark:via-white/40 to-transparent pointer-events-none' />
{children} {children}
</div> </div>
+27 -37
View File
@@ -48,16 +48,16 @@ import {
isPasskeySupported, isPasskeySupported,
} from '../../helpers'; } from '../../helpers';
import Turnstile from 'react-turnstile'; import Turnstile from 'react-turnstile';
import { Button, Checkbox, Form, Icon, Modal } from '@douyinfe/semi-ui'; import { Button, Checkbox, Form, Icon, Modal } from '@/components/ui';
import Text from '@douyinfe/semi-ui/lib/es/typography/text'; import { Text } from '@/components/ui';
import { import {
IconGithubLogo, IconGithubLogo,
IconMail, IconMail,
IconLock, IconLock,
IconKey, IconKey,
} from '@douyinfe/semi-icons'; } from '@/components/ui/icons';
import OIDCIcon from '../common/logo/OIDCIcon'; import OIDCIcon from '../common/logo/OIDCIcon';
import WeChatIcon from '../common/logo/WeChatIcon'; import WeChatIcon from '../common/logo/WeChatIcon';
import LinuxDoIcon from '../common/logo/LinuxDoIcon'; import LinuxDoIcon from '../common/logo/LinuxDoIcon';
@@ -846,15 +846,13 @@ const LoginForm = () => {
</div> </div>
)} )}
<style>{` <Form className='auth-login-form' onSubmit={handleSubmit}>
.login-compact-form .semi-form-field { margin-bottom: 0; }
.login-compact-form .semi-form-field-username { padding-bottom: 4px; }
.login-compact-form .semi-form-field-password { padding-top: 4px; }
`}</style>
<Form className='login-compact-form auth-glass-form'>
{/* 用户名输入框 —— 玻璃观感统一由 .auth-glass-form(GlassCard 内置样式)驱动 */}
<Form.Input <Form.Input
field='username' field='username'
className='auth-login-required-field'
rules={[{ required: true, message: t('请输入用户名或邮箱') }]}
required
aria-required='true'
label={ label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'> <span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('用户名/邮箱')} {t('用户名/邮箱')}
@@ -862,7 +860,7 @@ const LoginForm = () => {
} }
placeholder={t('请输入用户名或邮箱')} placeholder={t('请输入用户名或邮箱')}
name='username' name='username'
size='large' size='default'
autoComplete='username' autoComplete='username'
onChange={(value) => handleChange('username', value)} onChange={(value) => handleChange('username', value)}
prefix={<IconMail size='small' />} prefix={<IconMail size='small' />}
@@ -871,6 +869,10 @@ const LoginForm = () => {
{/* 密码输入框 */} {/* 密码输入框 */}
<Form.Input <Form.Input
field='password' field='password'
className='auth-login-required-field'
rules={[{ required: true, message: t('请输入密码') }]}
required
aria-required='true'
label={ label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'> <span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('密码')} {t('密码')}
@@ -879,7 +881,7 @@ const LoginForm = () => {
placeholder={t('请输入密码')} placeholder={t('请输入密码')}
name='password' name='password'
mode='password' mode='password'
size='large' size='default'
autoComplete='current-password' autoComplete='current-password'
onChange={(value) => handleChange('password', value)} onChange={(value) => handleChange('password', value)}
prefix={<IconLock size='small' />} prefix={<IconLock size='small' />}
@@ -921,40 +923,28 @@ const LoginForm = () => {
</div> </div>
)} )}
<div className='space-y-1.5 pt-3'> <div className='auth-login-actions'>
{/* 登录按钮 */} {/* 登录按钮 */}
<button <Button
type='submit' theme='solid'
onClick={handleSubmit} htmlType='submit'
loading={loginLoading}
block
disabled={ disabled={
loginLoading || loginLoading ||
((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms) ((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms)
} }
className='group relative w-full h-10 flex items-center justify-center gap-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to disabled:from-gray-400 disabled:to-gray-500 text-white rounded-xl shadow-md shadow-brand/25 dark:shadow-brand/15 hover:shadow-lg hover:shadow-brand/30 hover:-translate-y-0.5 active:translate-y-0 transition-all duration-200 disabled:cursor-not-allowed disabled:hover:translate-y-0 overflow-hidden' className='auth-login-submit'
> >
{/* 闪光效果 */} <span className='font-semibold'>{t('登 录')}</span>
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' /> <ArrowRight size={16} />
</Button>
{loginLoading ? (
<div className='w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin' />
) : (
<>
<span className='relative z-10 font-semibold'>
{t('登 录')}
</span>
<ArrowRight
size={16}
className='relative z-10 group-hover:translate-x-1 transition-transform'
/>
</>
)}
</button>
<Button <Button
theme='borderless' theme='borderless'
type='tertiary' type='tertiary'
size='small' size='small'
className='w-full !text-gray-500 hover:!text-brand-deep dark:!text-gray-500 dark:hover:!text-brand-from !text-xs' className='auth-login-forgot'
onClick={handleResetPasswordClick} onClick={handleResetPasswordClick}
> >
{t('忘记密码?')} {t('忘记密码?')}
@@ -991,7 +981,7 @@ const LoginForm = () => {
)} )}
{!status.self_use_mode_enabled && ( {!status.self_use_mode_enabled && (
<div className='mt-3 text-center'> <div className='auth-login-register text-center'>
<Text className='text-gray-500 dark:text-gray-400 text-xs'> <Text className='text-gray-500 dark:text-gray-400 text-xs'>
{t('没有账户?')}{' '} {t('没有账户?')}{' '}
<Link <Link
@@ -1234,7 +1224,7 @@ const LoginForm = () => {
return ( return (
<div <div
className='relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8' className='auth-login-page relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'
// 抵扣 PageLayout 跑马灯占位高度,保证占位+容器恰为一屏,避免幽灵滚动 // 抵扣 PageLayout 跑马灯占位高度,保证占位+容器恰为一屏,避免幽灵滚动
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }} style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
> >
+1 -1
View File
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Button, Toast, Banner } from '@douyinfe/semi-ui'; import { Button, Toast, Banner } from '@/components/ui';
import { Copy } from 'lucide-react'; import { Copy } from 'lucide-react';
import { copy as copyText } from '../../helpers/utils'; import { copy as copyText } from '../../helpers/utils';
+2 -2
View File
@@ -27,8 +27,8 @@ import {
getSystemName, getSystemName,
} from '../../helpers'; } from '../../helpers';
import { useSearchParams, Link } from 'react-router-dom'; import { useSearchParams, Link } from 'react-router-dom';
import { Button, Card, Form, Typography, Banner } from '@douyinfe/semi-ui'; import { Button, Card, Form, Typography, Banner } from '@/components/ui';
import { IconMail, IconLock, IconCopy } from '@douyinfe/semi-icons'; import { IconMail, IconLock, IconCopy } from '@/components/ui/icons';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Text, Title } = Typography; const { Text, Title } = Typography;
+2 -2
View File
@@ -27,8 +27,8 @@ import {
getSystemName, getSystemName,
} from '../../helpers'; } from '../../helpers';
import Turnstile from 'react-turnstile'; import Turnstile from 'react-turnstile';
import { Button, Card, Form, Typography } from '@douyinfe/semi-ui'; import { Button, Card, Form, Typography } from '@/components/ui';
import { IconMail } from '@douyinfe/semi-icons'; import { IconMail } from '@/components/ui/icons';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
+3 -3
View File
@@ -42,16 +42,16 @@ import {
onWeChatOpenOAuthClicked, onWeChatOpenOAuthClicked,
} from '../../helpers'; } from '../../helpers';
import Turnstile from 'react-turnstile'; import Turnstile from 'react-turnstile';
import { Button, Checkbox, Form, Icon, Modal } from '@douyinfe/semi-ui'; import { Button, Checkbox, Form, Icon, Modal } from '@/components/ui';
import Text from '@douyinfe/semi-ui/lib/es/typography/text'; import { Text } from '@/components/ui';
import { import {
IconGithubLogo, IconGithubLogo,
IconMail, IconMail,
IconUser, IconUser,
IconLock, IconLock,
IconKey, IconKey,
} from '@douyinfe/semi-icons'; } from '@/components/ui/icons';
import OIDCIcon from '../common/logo/OIDCIcon'; import OIDCIcon from '../common/logo/OIDCIcon';
import LinuxDoIcon from '../common/logo/LinuxDoIcon'; import LinuxDoIcon from '../common/logo/LinuxDoIcon';
import WeChatIcon from '../common/logo/WeChatIcon'; import WeChatIcon from '../common/logo/WeChatIcon';
+1 -1
View File
@@ -23,7 +23,7 @@ import {
Divider, Divider,
Form, Form,
Typography, Typography,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useState, useCallback } from 'react'; import React, { useState, useCallback } from 'react';
import { Modal } from '@douyinfe/semi-ui'; import { Modal } from '@/components/ui';
import { X, Shield, Scale, ScrollText, ExternalLink } from 'lucide-react'; import { X, Shield, Scale, ScrollText, ExternalLink } from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import DocumentRenderer from './index'; import DocumentRenderer from './index';
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Avatar } from '@douyinfe/semi-ui'; import { Avatar } from '@/components/ui';
import { Bot as FastGPT, Image as Jimeng } from 'lucide-react'; import { Bot as FastGPT, Image as Jimeng } from 'lucide-react';
import OpenAI from '@lobehub/icons/es/OpenAI'; import OpenAI from '@lobehub/icons/es/OpenAI';
import Claude from '@lobehub/icons/es/Claude'; import Claude from '@lobehub/icons/es/Claude';
+1 -1
View File
@@ -39,7 +39,7 @@ runInNewContext(code, {
exports: module.exports, exports: module.exports,
require(name) { require(name) {
if (name === 'react') return React; if (name === 'react') return React;
if (name === '@douyinfe/semi-ui') return { Avatar: 'avatar' }; if (name === '@/components/ui') return { Avatar: 'avatar' };
if (name === 'lucide-react') return { Bot: Mono, Image: Mono }; if (name === 'lucide-react') return { Bot: Mono, Image: Mono };
assert.ok(name.startsWith('@lobehub/icons/es/'), name); assert.ok(name.startsWith('@lobehub/icons/es/'), name);
return Object.assign(Mono, { Color, Avatar }); return Object.assign(Mono, { Color, Avatar });
+1 -1
View File
@@ -25,7 +25,7 @@ import {
Empty, Empty,
Tag, Tag,
Tooltip, Tooltip,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { Lock } from 'lucide-react'; import { Lock } from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useModelSelector } from '../../hooks/models/useModelSelector'; import { useModelSelector } from '../../hooks/models/useModelSelector';
+1
View File
@@ -51,6 +51,7 @@ export default function PageBackground({
const pulse = animate ? 'animate-pulse motion-reduce:animate-none' : ''; const pulse = animate ? 'animate-pulse motion-reduce:animate-none' : '';
return ( return (
<div <div
data-page-background
className={`absolute inset-0 overflow-hidden pointer-events-none ${className}`} className={`absolute inset-0 overflow-hidden pointer-events-none ${className}`}
aria-hidden='true' aria-hidden='true'
> >
+1 -1
View File
@@ -31,7 +31,7 @@ For commercial licensing, please contact support@quantumnous.com
* steps[].done 传布尔值即启用进度跟踪,不传则渲染为纯阅读步骤。 * steps[].done 传布尔值即启用进度跟踪,不传则渲染为纯阅读步骤。
*/ */
import React, { useCallback, useEffect, useMemo, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Button, SideSheet } from '@douyinfe/semi-ui'; import { Button, SideSheet } from '@/components/ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
BookOpenText, BookOpenText,
+12 -32
View File
@@ -6,21 +6,21 @@
--pg-ink: var(--text-primary); --pg-ink: var(--text-primary);
--pg-muted: var(--text-secondary); --pg-muted: var(--text-secondary);
--pg-line: var(--border-subtle); --pg-line: var(--border-subtle);
--pg-accent: var(--semi-color-primary); --pg-accent: var(--ui-color-primary);
--pg-accent-deep: var(--semi-color-primary-active, var(--semi-color-primary)); --pg-accent-deep: var(--ui-color-primary-active, var(--ui-color-primary));
--pg-tint: color-mix(in srgb, var(--semi-color-primary) 8%, transparent); --pg-tint: color-mix(in srgb, var(--ui-color-primary) 8%, transparent);
--pg-tint-strong: color-mix( --pg-tint-strong: color-mix(
in srgb, in srgb,
var(--semi-color-primary) 14%, var(--ui-color-primary) 14%,
transparent transparent
); );
--pg-tint-line: color-mix( --pg-tint-line: color-mix(
in srgb, in srgb,
var(--semi-color-primary) 28%, var(--ui-color-primary) 28%,
transparent transparent
); );
--pg-ok: var(--semi-color-success); --pg-ok: var(--ui-color-success);
--pg-ok-tint: color-mix(in srgb, var(--semi-color-success) 14%, transparent); --pg-ok-tint: color-mix(in srgb, var(--ui-color-success) 14%, transparent);
} }
/* ===== 进度胶囊 ===== */ /* ===== 进度胶囊 ===== */
@@ -34,7 +34,7 @@
border-radius: 999px; border-radius: 999px;
background: color-mix( background: color-mix(
in srgb, in srgb,
var(--semi-color-primary) 4%, var(--ui-color-primary) 4%,
var(--surface-card) var(--surface-card)
); );
color: var(--pg-ink); color: var(--pg-ink);
@@ -56,7 +56,7 @@
.page-guide-step-head:focus-visible, .page-guide-step-head:focus-visible,
.page-guide-step-cta:focus-visible { .page-guide-step-cta:focus-visible {
outline: 2px solid outline: 2px solid
color-mix(in srgb, var(--semi-color-primary) 55%, transparent); color-mix(in srgb, var(--ui-color-primary) 55%, transparent);
outline-offset: 2px; outline-offset: 2px;
} }
@@ -109,28 +109,8 @@
} }
/* ===== 抽屉 ===== */ /* ===== 抽屉 ===== */
.page-guide-drawer .semi-sidesheet-inner {
max-width: 100%;
}
.page-guide-drawer .semi-sidesheet-body {
padding: 14px 22px 20px;
overflow-y: auto;
}
/* 抽屉滚动条:复用品牌滚动条 token(同 app-scrollbar 的取色来源) */ /* 抽屉滚动条:复用品牌滚动条 token(同 app-scrollbar 的取色来源) */
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar {
width: 6px;
}
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar-thumb {
border-radius: 999px;
background: var(--brand-scroll);
}
.page-guide-drawer .semi-sidesheet-body::-webkit-scrollbar-thumb:hover {
background: var(--brand-scroll-hover);
}
.page-guide-head { .page-guide-head {
display: flex; display: flex;
@@ -184,7 +164,7 @@
border-color: var(--pg-tint-line); border-color: var(--pg-tint-line);
background: color-mix( background: color-mix(
in srgb, in srgb,
var(--semi-color-primary) 5%, var(--ui-color-primary) 5%,
var(--surface-card) var(--surface-card)
); );
} }
@@ -226,7 +206,7 @@
.page-guide-step.is-next .page-guide-step-ic { .page-guide-step.is-next .page-guide-step-ic {
border-color: transparent; border-color: transparent;
background: var(--pg-accent); background: var(--pg-accent);
color: var(--semi-color-white, var(--surface-card)); color: var(--ui-color-white, var(--surface-card));
font-weight: 600; font-weight: 600;
} }
@@ -368,7 +348,7 @@
} }
30% { 30% {
box-shadow: 0 0 0 4px box-shadow: 0 0 0 4px
color-mix(in srgb, var(--semi-color-primary) 45%, transparent); color-mix(in srgb, var(--ui-color-primary) 45%, transparent);
} }
} }
@@ -0,0 +1,48 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { Breadcrumb } from 'antd';
import { useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
const pageTitles = {
'/user-center/key-management': '密钥管理',
'/user-center/dashboard': '数据看板',
'/user-center/usage-record': '使用记录',
'/user-center/service-dashboard': '服务监控',
'/user-center/topup': '在线充值',
'/user-center/settings': '个人设置',
'/user-center/invite': '邀请有奖',
'/user-center/invoice': '发票管理',
'/user-center/weyai-download': '下载 WeyAi 桌面端',
};
export default function UserCenterBreadcrumb() {
const { pathname } = useLocation();
const { t } = useTranslation();
const title = pageTitles[pathname.replace(/\/$/, '')];
if (!title) return null;
return (
<Breadcrumb
className='ui-dashboard-breadcrumb ui-user-center-breadcrumb'
items={[{ title: t('用户中心') }, { title: t(title) }]}
/>
);
}
@@ -0,0 +1,47 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import UserCenterBreadcrumb from './UserCenterBreadcrumb';
/**
* 个人端子页面统一标题区:面包屑 + 28px 标题 + 14px 副标题(+ 可选右侧操作)。
* 几何与配色见 src/styles/user-center.css,来源为原型图.zip 中的
* 使用记录、在线充值、个人设置截图。只负责呈现,不承载业务状态。
*/
export default function UserCenterPageHeader({
title,
subtitle,
extra,
breadcrumb,
className = '',
}) {
return (
<header className={`uc-page-header ${className}`.trim()}>
{breadcrumb === undefined ? <UserCenterBreadcrumb /> : breadcrumb}
<div className='uc-page-header-main'>
<div className='uc-page-header-text'>
<h1 className='uc-page-title'>{title}</h1>
{subtitle ? <p className='uc-page-subtitle'>{subtitle}</p> : null}
</div>
{extra ? <div className='uc-page-header-extra'>{extra}</div> : null}
</div>
</header>
);
}
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Button, Modal } from '@douyinfe/semi-ui'; import { Button, Modal } from '@/components/ui';
import { useSecureVerification } from '../../../hooks/common/useSecureVerification'; import { useSecureVerification } from '../../../hooks/common/useSecureVerification';
import { createApiCalls } from '../../../services/secureVerification'; import { createApiCalls } from '../../../services/secureVerification';
import SecureVerificationModal from '../modals/SecureVerificationModal'; import SecureVerificationModal from '../modals/SecureVerificationModal';
+27 -27
View File
@@ -76,7 +76,7 @@ export const IllustrationNoResult = ({ style = {} }) => (
y1='70' y1='70'
x2='105' x2='105'
y2='100' y2='100'
stroke='var(--semi-color-danger)' stroke='var(--ui-color-danger)'
strokeWidth='4' strokeWidth='4'
strokeLinecap='round' strokeLinecap='round'
/> />
@@ -85,7 +85,7 @@ export const IllustrationNoResult = ({ style = {} }) => (
y1='70' y1='70'
x2='75' x2='75'
y2='100' y2='100'
stroke='var(--semi-color-danger)' stroke='var(--ui-color-danger)'
strokeWidth='4' strokeWidth='4'
strokeLinecap='round' strokeLinecap='round'
/> />
@@ -186,7 +186,7 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
y1='70' y1='70'
x2='105' x2='105'
y2='100' y2='100'
stroke='var(--semi-color-danger)' stroke='var(--ui-color-danger)'
strokeWidth='4' strokeWidth='4'
strokeLinecap='round' strokeLinecap='round'
/> />
@@ -195,7 +195,7 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
y1='70' y1='70'
x2='75' x2='75'
y2='100' y2='100'
stroke='var(--semi-color-danger)' stroke='var(--ui-color-danger)'
strokeWidth='4' strokeWidth='4'
strokeLinecap='round' strokeLinecap='round'
/> />
@@ -237,12 +237,12 @@ export const IllustrationNotFound = ({ style = {} }) => (
> >
<defs> <defs>
<linearGradient id='notFoundGrad1' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='notFoundGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stopColor='var(--semi-color-warning)' /> <stop offset='0%' stopColor='var(--ui-color-warning)' />
<stop offset='100%' stopColor='var(--semi-color-danger)' /> <stop offset='100%' stopColor='var(--ui-color-danger)' />
</linearGradient> </linearGradient>
<linearGradient id='notFoundGrad2' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='notFoundGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-warning) 15%, #fff)' /> <stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 15%, #fff)' />
<stop offset='100%' stopColor='color-mix(in srgb, var(--semi-color-danger) 25%, #fff)' /> <stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 25%, #fff)' />
</linearGradient> </linearGradient>
</defs> </defs>
{/* 背景 */} {/* 背景 */}
@@ -280,7 +280,7 @@ export const IllustrationNotFound = ({ style = {} }) => (
{/* 装饰星星 */} {/* 装饰星星 */}
<path <path
d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z' d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z'
fill='var(--semi-color-warning)' fill='var(--ui-color-warning)'
opacity='0.6' opacity='0.6'
> >
<animate <animate
@@ -292,7 +292,7 @@ export const IllustrationNotFound = ({ style = {} }) => (
</path> </path>
<path <path
d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z' d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z'
fill='var(--semi-color-danger)' fill='var(--ui-color-danger)'
opacity='0.5' opacity='0.5'
> >
<animate <animate
@@ -320,8 +320,8 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='var(--semi-color-warning)' /> <stop offset='0%' stopColor='var(--ui-color-warning)' />
<stop offset='100%' stopColor='var(--semi-color-danger)' /> <stop offset='100%' stopColor='var(--ui-color-danger)' />
</linearGradient> </linearGradient>
<linearGradient <linearGradient
id='notFoundGradDark2' id='notFoundGradDark2'
@@ -330,8 +330,8 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-warning) 30%, #000)' /> <stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 30%, #000)' />
<stop offset='100%' stopColor='color-mix(in srgb, var(--semi-color-danger) 30%, #000)' /> <stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
</linearGradient> </linearGradient>
</defs> </defs>
<circle <circle
@@ -370,7 +370,7 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
</text> </text>
<path <path
d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z' d='M40 40 L42 48 L50 50 L42 52 L40 60 L38 52 L30 50 L38 48 Z'
fill='var(--semi-color-warning)' fill='var(--ui-color-warning)'
opacity='0.7' opacity='0.7'
> >
<animate <animate
@@ -382,7 +382,7 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
</path> </path>
<path <path
d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z' d='M160 60 L161.5 66 L168 68 L161.5 70 L160 76 L158.5 70 L152 68 L158.5 66 Z'
fill='var(--semi-color-danger)' fill='var(--ui-color-danger)'
opacity='0.6' opacity='0.6'
> >
<animate <animate
@@ -405,7 +405,7 @@ export const IllustrationNoAccess = ({ style = {} }) => (
> >
<defs> <defs>
<linearGradient id='noAccessGrad1' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='noAccessGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stopColor='var(--semi-color-danger)' /> <stop offset='0%' stopColor='var(--ui-color-danger)' />
<stop offset='100%' stopColor='var(--brand-gradient-via)' /> <stop offset='100%' stopColor='var(--brand-gradient-via)' />
</linearGradient> </linearGradient>
<linearGradient id='noAccessGrad2' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='noAccessGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
@@ -436,7 +436,7 @@ export const IllustrationNoAccess = ({ style = {} }) => (
strokeLinecap='round' strokeLinecap='round'
/> />
{/* 装饰 */} {/* 装饰 */}
<circle cx='45' cy='70' r='4' fill='var(--semi-color-danger)' opacity='0.4'> <circle cx='45' cy='70' r='4' fill='var(--ui-color-danger)' opacity='0.4'>
<animate <animate
attributeName='r' attributeName='r'
values='4;6;4' values='4;6;4'
@@ -470,7 +470,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='var(--semi-color-danger)' /> <stop offset='0%' stopColor='var(--ui-color-danger)' />
<stop offset='100%' stopColor='var(--brand-gradient-to)' /> <stop offset='100%' stopColor='var(--brand-gradient-to)' />
</linearGradient> </linearGradient>
<linearGradient <linearGradient
@@ -480,7 +480,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-danger) 30%, #000)' /> <stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' /> <stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' />
</linearGradient> </linearGradient>
</defs> </defs>
@@ -508,7 +508,7 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
fill='none' fill='none'
strokeLinecap='round' strokeLinecap='round'
/> />
<circle cx='45' cy='70' r='4' fill='var(--semi-color-danger)' opacity='0.5'> <circle cx='45' cy='70' r='4' fill='var(--ui-color-danger)' opacity='0.5'>
<animate <animate
attributeName='r' attributeName='r'
values='4;6;4' values='4;6;4'
@@ -537,11 +537,11 @@ export const IllustrationConstruction = ({ style = {} }) => (
> >
<defs> <defs>
<linearGradient id='constructGrad1' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='constructGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stopColor='var(--semi-color-success)' /> <stop offset='0%' stopColor='var(--ui-color-success)' />
<stop offset='100%' stopColor='var(--accent-teal)' /> <stop offset='100%' stopColor='var(--accent-teal)' />
</linearGradient> </linearGradient>
<linearGradient id='constructGrad2' x1='0%' y1='0%' x2='100%' y2='100%'> <linearGradient id='constructGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-success) 15%, #fff)' /> <stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 15%, #fff)' />
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 15%, #fff)' /> <stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 15%, #fff)' />
</linearGradient> </linearGradient>
</defs> </defs>
@@ -626,7 +626,7 @@ export const IllustrationConstruction = ({ style = {} }) => (
opacity='0.7' opacity='0.7'
/> />
{/* 装饰 */} {/* 装饰 */}
<circle cx='150' cy='50' r='4' fill='var(--semi-color-success)' opacity='0.5'> <circle cx='150' cy='50' r='4' fill='var(--ui-color-success)' opacity='0.5'>
<animate <animate
attributeName='opacity' attributeName='opacity'
values='0.5;1;0.5' values='0.5;1;0.5'
@@ -660,7 +660,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='var(--semi-color-success)' /> <stop offset='0%' stopColor='var(--ui-color-success)' />
<stop offset='100%' stopColor='var(--accent-teal)' /> <stop offset='100%' stopColor='var(--accent-teal)' />
</linearGradient> </linearGradient>
<linearGradient <linearGradient
@@ -670,7 +670,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
x2='100%' x2='100%'
y2='100%' y2='100%'
> >
<stop offset='0%' stopColor='color-mix(in srgb, var(--semi-color-success) 25%, #000)' /> <stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 25%, #000)' />
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 25%, #000)' /> <stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 25%, #000)' />
</linearGradient> </linearGradient>
</defs> </defs>
@@ -750,7 +750,7 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
fill='url(#constructGradDark1)' fill='url(#constructGradDark1)'
opacity='0.7' opacity='0.7'
/> />
<circle cx='150' cy='50' r='4' fill='var(--semi-color-success)' opacity='0.6'> <circle cx='150' cy='50' r='4' fill='var(--ui-color-success)' opacity='0.6'>
<animate <animate
attributeName='opacity' attributeName='opacity'
values='0.6;1;0.6' values='0.6;1;0.6'
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Icon } from '@douyinfe/semi-ui'; import { Icon } from '@/components/ui';
const LinuxDoIcon = (props) => { const LinuxDoIcon = (props) => {
function CustomIcon() { function CustomIcon() {
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Icon } from '@douyinfe/semi-ui'; import { Icon } from '@/components/ui';
const OIDCIcon = (props) => { const OIDCIcon = (props) => {
function CustomIcon() { function CustomIcon() {
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Icon } from '@douyinfe/semi-ui'; import { Icon } from '@/components/ui';
const WeChatIcon = () => { const WeChatIcon = () => {
function CustomIcon() { function CustomIcon() {
@@ -36,9 +36,9 @@ import {
import React from 'react'; import React from 'react';
import { useDebouncedCallback } from 'use-debounce'; import { useDebouncedCallback } from 'use-debounce';
import clsx from 'clsx'; import clsx from 'clsx';
import { Button, Tooltip, Toast } from '@douyinfe/semi-ui'; import { Button, Tooltip, Toast } from '@/components/ui';
import { copy, rehypeSplitWordsIntoSpans } from '../../../helpers'; import { copy, rehypeSplitWordsIntoSpans } from '../../../helpers';
import { IconCopy } from '@douyinfe/semi-icons'; import { IconCopy } from '@/components/ui/icons';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import ImagePreviewModal from '../../playground/ImagePreviewModal'; import ImagePreviewModal from '../../playground/ImagePreviewModal';
@@ -131,9 +131,9 @@ export function Mermaid(props) {
cursor: 'pointer', cursor: 'pointer',
overflow: 'auto', overflow: 'auto',
padding: '12px', padding: '12px',
border: '1px solid var(--semi-color-border)', border: '1px solid var(--ui-color-border)',
borderRadius: '8px', borderRadius: '8px',
backgroundColor: 'var(--semi-color-bg-1)', backgroundColor: 'var(--ui-color-bg-1)',
margin: '12px 0', margin: '12px 0',
position: 'relative', position: 'relative',
minHeight: isLoading ? '100px' : 'auto', minHeight: isLoading ? '100px' : 'auto',
@@ -150,7 +150,7 @@ export function Mermaid(props) {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: '8px', gap: '8px',
color: 'var(--semi-color-text-2)', color: 'var(--ui-color-text-2)',
fontSize: '12px', fontSize: '12px',
}} }}
> >
@@ -158,8 +158,8 @@ export function Mermaid(props) {
style={{ style={{
width: '14px', width: '14px',
height: '14px', height: '14px',
border: '2px solid var(--semi-color-border)', border: '2px solid var(--ui-color-border)',
borderTop: '2px solid var(--semi-color-primary)', borderTop: '2px solid var(--ui-color-primary)',
borderRadius: '50%', borderRadius: '50%',
animation: 'spin 1s linear infinite', animation: 'spin 1s linear infinite',
}} }}
@@ -229,8 +229,8 @@ export function PreCode(props) {
ref={ref} ref={ref}
style={{ style={{
position: 'relative', position: 'relative',
backgroundColor: 'var(--semi-color-fill-0)', backgroundColor: 'var(--ui-color-fill-0)',
border: '1px solid var(--semi-color-border)', border: '1px solid var(--ui-color-border)',
borderRadius: '6px', borderRadius: '6px',
padding: '12px', padding: '12px',
margin: '12px 0', margin: '12px 0',
@@ -274,10 +274,10 @@ export function PreCode(props) {
}} }}
style={{ style={{
padding: '4px', padding: '4px',
backgroundColor: 'var(--semi-color-bg-2)', backgroundColor: 'var(--ui-color-bg-2)',
borderRadius: '4px', borderRadius: '4px',
cursor: 'pointer', cursor: 'pointer',
border: '1px solid var(--semi-color-border)', border: '1px solid var(--ui-color-border)',
boxShadow: '0 1px 2px rgba(0, 0, 0, 0.1)', boxShadow: '0 1px 2px rgba(0, 0, 0, 0.1)',
}} }}
/> />
@@ -291,18 +291,18 @@ export function PreCode(props) {
{htmlCode.length > 0 && ( {htmlCode.length > 0 && (
<div <div
style={{ style={{
border: '1px solid var(--semi-color-border)', border: '1px solid var(--ui-color-border)',
borderRadius: '8px', borderRadius: '8px',
padding: '16px', padding: '16px',
margin: '12px 0', margin: '12px 0',
backgroundColor: 'var(--semi-color-bg-1)', backgroundColor: 'var(--ui-color-bg-1)',
}} }}
> >
<div <div
style={{ style={{
marginBottom: '8px', marginBottom: '8px',
fontSize: '12px', fontSize: '12px',
color: 'var(--semi-color-text-2)', color: 'var(--ui-color-text-2)',
}} }}
> >
HTML预览: HTML预览:
@@ -380,7 +380,7 @@ function CustomCode(props) {
overflowY: 'hidden', overflowY: 'hidden',
display: 'block', display: 'block',
padding: '8px 12px', padding: '8px 12px',
backgroundColor: 'var(--semi-color-fill-0)', backgroundColor: 'var(--ui-color-fill-0)',
borderRadius: '4px', borderRadius: '4px',
fontSize: '13px', fontSize: '13px',
lineHeight: '1.4', lineHeight: '1.4',
@@ -511,7 +511,7 @@ function MarkdownContentImpl(props) {
style={{ style={{
color: isUserMessage color: isUserMessage
? '#87CEEB' ? '#87CEEB'
: 'var(--semi-color-primary)', : 'var(--ui-color-primary)',
textDecoration: 'none', textDecoration: 'none',
}} }}
onMouseEnter={(e) => { onMouseEnter={(e) => {
@@ -530,7 +530,7 @@ function MarkdownContentImpl(props) {
fontSize: '24px', fontSize: '24px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '20px 0 12px 0', margin: '20px 0 12px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -541,7 +541,7 @@ function MarkdownContentImpl(props) {
fontSize: '20px', fontSize: '20px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '18px 0 10px 0', margin: '18px 0 10px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -552,7 +552,7 @@ function MarkdownContentImpl(props) {
fontSize: '18px', fontSize: '18px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '16px 0 8px 0', margin: '16px 0 8px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -563,7 +563,7 @@ function MarkdownContentImpl(props) {
fontSize: '16px', fontSize: '16px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '14px 0 6px 0', margin: '14px 0 6px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -574,7 +574,7 @@ function MarkdownContentImpl(props) {
fontSize: '14px', fontSize: '14px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '12px 0 4px 0', margin: '12px 0 4px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -585,7 +585,7 @@ function MarkdownContentImpl(props) {
fontSize: '13px', fontSize: '13px',
fontWeight: 'bold', fontWeight: 'bold',
margin: '10px 0 4px 0', margin: '10px 0 4px 0',
color: isUserMessage ? 'white' : 'var(--semi-color-text-0)', color: isUserMessage ? 'white' : 'var(--ui-color-text-0)',
}} }}
/> />
), ),
@@ -595,12 +595,12 @@ function MarkdownContentImpl(props) {
style={{ style={{
borderLeft: isUserMessage borderLeft: isUserMessage
? '4px solid rgba(255, 255, 255, 0.5)' ? '4px solid rgba(255, 255, 255, 0.5)'
: '4px solid var(--semi-color-primary)', : '4px solid var(--ui-color-primary)',
paddingLeft: '16px', paddingLeft: '16px',
margin: '12px 0', margin: '12px 0',
backgroundColor: isUserMessage backgroundColor: isUserMessage
? 'rgba(255, 255, 255, 0.1)' ? 'rgba(255, 255, 255, 0.1)'
: 'var(--semi-color-fill-0)', : 'var(--ui-color-fill-0)',
padding: '8px 16px', padding: '8px 16px',
borderRadius: '0 4px 4px 0', borderRadius: '0 4px 4px 0',
fontStyle: 'italic', fontStyle: 'italic',
@@ -647,7 +647,7 @@ function MarkdownContentImpl(props) {
borderCollapse: 'collapse', borderCollapse: 'collapse',
border: isUserMessage border: isUserMessage
? '1px solid rgba(255, 255, 255, 0.3)' ? '1px solid rgba(255, 255, 255, 0.3)'
: '1px solid var(--semi-color-border)', : '1px solid var(--ui-color-border)',
borderRadius: '6px', borderRadius: '6px',
overflow: 'hidden', overflow: 'hidden',
}} }}
@@ -661,10 +661,10 @@ function MarkdownContentImpl(props) {
padding: '8px 12px', padding: '8px 12px',
backgroundColor: isUserMessage backgroundColor: isUserMessage
? 'rgba(255, 255, 255, 0.2)' ? 'rgba(255, 255, 255, 0.2)'
: 'var(--semi-color-fill-1)', : 'var(--ui-color-fill-1)',
border: isUserMessage border: isUserMessage
? '1px solid rgba(255, 255, 255, 0.3)' ? '1px solid rgba(255, 255, 255, 0.3)'
: '1px solid var(--semi-color-border)', : '1px solid var(--ui-color-border)',
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'left', textAlign: 'left',
color: isUserMessage ? 'white' : 'inherit', color: isUserMessage ? 'white' : 'inherit',
@@ -678,7 +678,7 @@ function MarkdownContentImpl(props) {
padding: '8px 12px', padding: '8px 12px',
border: isUserMessage border: isUserMessage
? '1px solid rgba(255, 255, 255, 0.3)' ? '1px solid rgba(255, 255, 255, 0.3)'
: '1px solid var(--semi-color-border)', : '1px solid var(--ui-color-border)',
color: isUserMessage ? 'white' : 'inherit', color: isUserMessage ? 'white' : 'inherit',
}} }}
/> />
@@ -727,7 +727,7 @@ export function MarkdownRenderer(props) {
fontSize: `${fontSize}px`, fontSize: `${fontSize}px`,
fontFamily: fontFamily, fontFamily: fontFamily,
lineHeight: '1.6', lineHeight: '1.6',
color: 'var(--semi-color-text-0)', color: 'var(--ui-color-text-0)',
...style, ...style,
}} }}
dir='auto' dir='auto'
@@ -740,15 +740,15 @@ export function MarkdownRenderer(props) {
alignItems: 'center', alignItems: 'center',
gap: '8px', gap: '8px',
padding: '16px', padding: '16px',
color: 'var(--semi-color-text-2)', color: 'var(--ui-color-text-2)',
}} }}
> >
<div <div
style={{ style={{
width: '16px', width: '16px',
height: '16px', height: '16px',
border: '2px solid var(--semi-color-border)', border: '2px solid var(--ui-color-border)',
borderTop: '2px solid var(--semi-color-primary)', borderTop: '2px solid var(--ui-color-primary)',
borderRadius: '50%', borderRadius: '50%',
animation: 'spin 1s linear infinite', animation: 'spin 1s linear infinite',
}} }}
+39 -52
View File
@@ -2,7 +2,7 @@
.markdown-body { .markdown-body {
font-family: inherit; font-family: inherit;
line-height: 1.6; line-height: 1.6;
color: var(--semi-color-text-0); color: var(--ui-color-text-0);
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
word-break: break-word; word-break: break-word;
@@ -92,26 +92,24 @@
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
/* 代码高亮主题 - 适配Semi Design */
.hljs { .hljs {
display: block; display: block;
overflow-x: auto; overflow-x: auto;
padding: 0; padding: 0;
background: transparent; background: transparent;
color: var(--semi-color-text-0); color: var(--ui-color-text-0);
} }
.hljs-comment, .hljs-comment,
.hljs-quote { .hljs-quote {
color: var(--semi-color-text-2); color: var(--ui-color-text-2);
font-style: italic; font-style: italic;
} }
.hljs-keyword, .hljs-keyword,
.hljs-selector-tag, .hljs-selector-tag,
.hljs-subst { .hljs-subst {
color: var(--semi-color-primary); color: var(--ui-color-primary);
font-weight: bold; font-weight: bold;
} }
@@ -120,18 +118,18 @@
.hljs-variable, .hljs-variable,
.hljs-template-variable, .hljs-template-variable,
.hljs-tag .hljs-attr { .hljs-tag .hljs-attr {
color: var(--semi-color-warning); color: var(--ui-color-warning);
} }
.hljs-string, .hljs-string,
.hljs-doctag { .hljs-doctag {
color: var(--semi-color-success); color: var(--ui-color-success);
} }
.hljs-title, .hljs-title,
.hljs-section, .hljs-section,
.hljs-selector-id { .hljs-selector-id {
color: var(--semi-color-primary); color: var(--ui-color-primary);
font-weight: bold; font-weight: bold;
} }
@@ -141,42 +139,42 @@
.hljs-type, .hljs-type,
.hljs-class .hljs-title { .hljs-class .hljs-title {
color: var(--semi-color-info); color: var(--ui-color-info);
font-weight: bold; font-weight: bold;
} }
.hljs-tag, .hljs-tag,
.hljs-name, .hljs-name,
.hljs-attribute { .hljs-attribute {
color: var(--semi-color-primary); color: var(--ui-color-primary);
font-weight: normal; font-weight: normal;
} }
.hljs-regexp, .hljs-regexp,
.hljs-link { .hljs-link {
color: var(--semi-color-tertiary); color: var(--ui-color-tertiary);
} }
.hljs-symbol, .hljs-symbol,
.hljs-bullet { .hljs-bullet {
color: var(--semi-color-warning); color: var(--ui-color-warning);
} }
.hljs-built_in, .hljs-built_in,
.hljs-builtin-name { .hljs-builtin-name {
color: var(--semi-color-info); color: var(--ui-color-info);
} }
.hljs-meta { .hljs-meta {
color: var(--semi-color-text-2); color: var(--ui-color-text-2);
} }
.hljs-deletion { .hljs-deletion {
background: var(--semi-color-danger-light-default); background: var(--ui-color-danger-light-default);
} }
.hljs-addition { .hljs-addition {
background: var(--semi-color-success-light-default); background: var(--ui-color-success-light-default);
} }
.hljs-emphasis { .hljs-emphasis {
@@ -205,7 +203,7 @@ pre {
} }
pre:hover { pre:hover {
border-color: var(--semi-color-primary) !important; border-color: var(--ui-color-primary) !important;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} }
@@ -230,17 +228,6 @@ pre:hover .copy-code-button {
} }
/* 确保按钮可点击 */ /* 确保按钮可点击 */
.copy-code-button .semi-button {
pointer-events: auto !important;
cursor: pointer !important;
transition: all 0.2s ease;
}
.copy-code-button .semi-button:hover {
background-color: var(--semi-color-fill-1) !important;
border-color: var(--semi-color-primary) !important;
transform: scale(1.05);
}
/* ===== 服务大盘描述区域表格增强样式 ===== */ /* ===== 服务大盘描述区域表格增强样式 ===== */
.service-dashboard-description .markdown-body table { .service-dashboard-description .markdown-body table {
@@ -438,17 +425,17 @@ pre:hover .copy-code-button {
left: -8px; left: -8px;
top: -8px; top: -8px;
font-size: 24px; font-size: 24px;
color: var(--semi-color-primary); color: var(--ui-color-primary);
opacity: 0.3; opacity: 0.3;
} }
/* 列表样式增强 */ /* 列表样式增强 */
.markdown-body ul li::marker { .markdown-body ul li::marker {
color: var(--semi-color-primary); color: var(--ui-color-primary);
} }
.markdown-body ol li::marker { .markdown-body ol li::marker {
color: var(--semi-color-primary); color: var(--ui-color-primary);
font-weight: bold; font-weight: bold;
} }
@@ -459,7 +446,7 @@ pre:hover .copy-code-button {
background: linear-gradient( background: linear-gradient(
to right, to right,
transparent, transparent,
var(--semi-color-border), var(--ui-color-border),
transparent transparent
); );
margin: 24px 0; margin: 24px 0;
@@ -476,12 +463,12 @@ pre:hover .copy-code-button {
/* 内联代码样式 */ /* 内联代码样式 */
.markdown-body code:not(pre code) { .markdown-body code:not(pre code) {
background-color: var(--semi-color-fill-1); background-color: var(--ui-color-fill-1);
padding: 2px 6px; padding: 2px 6px;
border-radius: 4px; border-radius: 4px;
font-size: 0.9em; font-size: 0.9em;
color: var(--semi-color-primary); color: var(--ui-color-primary);
border: 1px solid var(--semi-color-border); border: 1px solid var(--ui-color-border);
} }
/* 标题锚点样式 */ /* 标题锚点样式 */
@@ -507,11 +494,11 @@ pre:hover .copy-code-button {
/* 键盘按键样式 */ /* 键盘按键样式 */
.markdown-body kbd { .markdown-body kbd {
background-color: var(--semi-color-fill-0); background-color: var(--ui-color-fill-0);
border: 1px solid var(--semi-color-border); border: 1px solid var(--ui-color-border);
border-radius: 3px; border-radius: 3px;
box-shadow: 0 1px 0 var(--semi-color-border); box-shadow: 0 1px 0 var(--ui-color-border);
color: var(--semi-color-text-0); color: var(--ui-color-text-0);
display: inline-block; display: inline-block;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 0.85em; font-size: 0.85em;
@@ -523,7 +510,7 @@ pre:hover .copy-code-button {
/* 详情折叠样式 */ /* 详情折叠样式 */
.markdown-body details { .markdown-body details {
border: 1px solid var(--semi-color-border); border: 1px solid var(--ui-color-border);
border-radius: 6px; border-radius: 6px;
padding: 12px; padding: 12px;
margin: 12px 0; margin: 12px 0;
@@ -532,17 +519,17 @@ pre:hover .copy-code-button {
.markdown-body summary { .markdown-body summary {
cursor: pointer; cursor: pointer;
font-weight: bold; font-weight: bold;
color: var(--semi-color-primary); color: var(--ui-color-primary);
margin-bottom: 8px; margin-bottom: 8px;
} }
.markdown-body summary:hover { .markdown-body summary:hover {
color: var(--semi-color-primary-hover); color: var(--ui-color-primary-hover);
} }
/* 脚注样式 */ /* 脚注样式 */
.markdown-body .footnote-ref { .markdown-body .footnote-ref {
color: var(--semi-color-primary); color: var(--ui-color-primary);
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
} }
@@ -553,32 +540,32 @@ pre:hover .copy-code-button {
/* 警告块样式 */ /* 警告块样式 */
.markdown-body .warning { .markdown-body .warning {
background-color: var(--semi-color-warning-light-default); background-color: var(--ui-color-warning-light-default);
border-left: 4px solid var(--semi-color-warning); border-left: 4px solid var(--ui-color-warning);
padding: 12px 16px; padding: 12px 16px;
margin: 12px 0; margin: 12px 0;
border-radius: 0 6px 6px 0; border-radius: 0 6px 6px 0;
} }
.markdown-body .info { .markdown-body .info {
background-color: var(--semi-color-info-light-default); background-color: var(--ui-color-info-light-default);
border-left: 4px solid var(--semi-color-info); border-left: 4px solid var(--ui-color-info);
padding: 12px 16px; padding: 12px 16px;
margin: 12px 0; margin: 12px 0;
border-radius: 0 6px 6px 0; border-radius: 0 6px 6px 0;
} }
.markdown-body .success { .markdown-body .success {
background-color: var(--semi-color-success-light-default); background-color: var(--ui-color-success-light-default);
border-left: 4px solid var(--semi-color-success); border-left: 4px solid var(--ui-color-success);
padding: 12px 16px; padding: 12px 16px;
margin: 12px 0; margin: 12px 0;
border-radius: 0 6px 6px 0; border-radius: 0 6px 6px 0;
} }
.markdown-body .danger { .markdown-body .danger {
background-color: var(--semi-color-danger-light-default); background-color: var(--ui-color-danger-light-default);
border-left: 4px solid var(--semi-color-danger); border-left: 4px solid var(--ui-color-danger);
padding: 12px 16px; padding: 12px 16px;
margin: 12px 0; margin: 12px 0;
border-radius: 0 6px 6px 0; border-radius: 0 6px 6px 0;
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Modal, Button, Typography } from '@douyinfe/semi-ui'; import { Modal, Button, Typography } from '@/components/ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
Gift, Gift,
@@ -168,12 +168,12 @@ const NewUserGiftModal = ({ visible, onClose, quota }) => {
</div> </div>
<style jsx='true'>{` <style jsx='true'>{`
.new-user-gift-modal .semi-modal-content { .new-user-gift-modal .ant-modal-content {
border-radius: 20px; border-radius: 20px;
overflow: hidden; overflow: hidden;
padding: 0; padding: 0;
} }
.new-user-gift-modal .semi-modal-body { .new-user-gift-modal .ant-modal-body {
padding: 0; padding: 0;
} }
`}</style> `}</style>
@@ -26,7 +26,7 @@ import {
Typography, Typography,
Tabs, Tabs,
TabPane, TabPane,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
/** /**
* 通用安全验证模态框组件 * 通用安全验证模态框组件
@@ -249,14 +249,14 @@ const SecureVerificationModal = ({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: '50%', borderRadius: '50%',
background: 'var(--semi-color-primary-light-default)', background: 'var(--ui-color-primary-light-default)',
}} }}
> >
<svg <svg
style={{ style={{
width: 28, width: 28,
height: 28, height: 28,
color: 'var(--semi-color-primary)', color: 'var(--ui-color-primary)',
}} }}
fill='currentColor' fill='currentColor'
viewBox='0 0 20 20' viewBox='0 0 20 20'
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Modal, Button, Input, Typography } from '@douyinfe/semi-ui'; import { Modal, Button, Input, Typography } from '@/components/ui';
/** /**
* 可复用的两步验证模态框组件 * 可复用的两步验证模态框组件
@@ -24,7 +24,7 @@ import {
Radio, Radio,
Button, Button,
Typography, Typography,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { import {
@@ -337,65 +337,6 @@ const UserSurveyModal = ({ visible, onClose, onSuccess }) => {
</Button> </Button>
</div> </div>
</div> </div>
<style jsx='true'>{`
.user-survey-modal .semi-modal-content {
border-radius: 20px;
overflow: hidden;
}
.survey-radio-group .semi-radio {
margin-bottom: 8px;
padding: 12px 16px;
border-radius: 12px;
border: 2px solid transparent;
background: rgba(249, 250, 251, 0.8);
transition: all 0.2s ease;
}
.dark .survey-radio-group .semi-radio {
background: rgba(31, 41, 55, 0.5);
}
.survey-radio-group .semi-radio:hover {
background: rgba(243, 244, 246, 1);
border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
}
.dark .survey-radio-group .semi-radio:hover {
background: rgba(55, 65, 81, 0.8);
border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
}
.survey-radio-group .semi-radio.semi-radio-checked {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 10%, transparent) 0%,
color-mix(in srgb, var(--brand-gradient-via) 10%, transparent) 100%
);
border-color: color-mix(in srgb, var(--brand-primary) 50%, transparent);
}
.dark .survey-radio-group .semi-radio.semi-radio-checked {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 20%, transparent) 0%,
color-mix(in srgb, var(--brand-gradient-via) 20%, transparent) 100%
);
border-color: color-mix(in srgb, var(--brand-primary) 60%, transparent);
}
.survey-radio-group .semi-radio .semi-radio-inner-display {
border-color: #d1d5db;
}
.survey-radio-group
.semi-radio.semi-radio-checked
.semi-radio-inner-display {
border-color: var(--brand-primary);
background: var(--brand-primary);
}
`}</style>
</Modal> </Modal>
); );
}; };
+3 -3
View File
@@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Card, Divider, Button } from '@douyinfe/semi-ui'; import { Card, Divider, Button } from '@/components/ui';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useIsMobile } from '../../../hooks/common/useIsMobile'; import { useIsMobile } from '../../../hooks/common/useIsMobile';
import { IconEyeOpened, IconEyeClosed } from '@douyinfe/semi-icons'; import { IconEyeOpened, IconEyeClosed } from '@/components/ui/icons';
/** /**
* CardPro 高级卡片组件 * CardPro 高级卡片组件
@@ -147,7 +147,7 @@ const CardPro = ({
return ( return (
<div <div
className={`flex w-full pt-4 border-t ${isMobile ? 'justify-center' : 'justify-between items-center'}`} className={`flex w-full pt-4 border-t ${isMobile ? 'justify-center' : 'justify-between items-center'}`}
style={{ borderColor: 'var(--semi-color-border)' }} style={{ borderColor: 'var(--ui-color-border)' }}
> >
{paginationArea} {paginationArea}
</div> </div>
+7 -7
View File
@@ -28,8 +28,8 @@ import {
Empty, Empty,
Button, Button,
Collapsible, Collapsible,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons'; import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useIsMobile } from '../../../hooks/common/useIsMobile'; import { useIsMobile } from '../../../hooks/common/useIsMobile';
import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTime'; import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTime';
@@ -37,7 +37,7 @@ import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTi
/** /**
* CardTable 响应式表格组件 * CardTable 响应式表格组件
* *
* 在桌面端渲染 Semi-UI 的 Table 组件,在移动端则将每一行数据渲染成 Card 形式。 * 在桌面端渲染 Ant Design Table,在移动端则将每一行数据渲染成 Card 形式。
* 该组件与 Table 组件的大部分 API 保持一致,只需将原 Table 换成 CardTable 即可。 * 该组件与 Table 组件的大部分 API 保持一致,只需将原 Table 换成 CardTable 即可。
*/ */
const CardTable = ({ const CardTable = ({
@@ -143,7 +143,7 @@ const CardTable = ({
<div <div
key={idx} key={idx}
className='flex justify-between items-center py-1 border-b last:border-b-0 border-dashed' className='flex justify-between items-center py-1 border-b last:border-b-0 border-dashed'
style={{ borderColor: 'var(--semi-color-border)' }} style={{ borderColor: 'var(--ui-color-border)' }}
> >
<Skeleton.Title style={{ width: 80, height: 14 }} /> <Skeleton.Title style={{ width: 80, height: 14 }} />
<Skeleton.Title <Skeleton.Title
@@ -197,7 +197,7 @@ const CardTable = ({
{selectionEnabled && ( {selectionEnabled && (
<div <div
className='flex items-center pb-1 mb-1 border-b border-dashed' className='flex items-center pb-1 mb-1 border-b border-dashed'
style={{ borderColor: 'var(--semi-color-border)' }} style={{ borderColor: 'var(--ui-color-border)' }}
> >
<Checkbox <Checkbox
checked={selectedKeys.includes(rowKeyVal)} checked={selectedKeys.includes(rowKeyVal)}
@@ -237,7 +237,7 @@ const CardTable = ({
<div <div
key={col.key || colIdx} key={col.key || colIdx}
className='flex justify-between items-start py-1 border-b last:border-b-0 border-dashed' className='flex justify-between items-start py-1 border-b last:border-b-0 border-dashed'
style={{ borderColor: 'var(--semi-color-border)' }} style={{ borderColor: 'var(--ui-color-border)' }}
> >
<span className='font-medium text-gray-600 mr-2 whitespace-nowrap select-none'> <span className='font-medium text-gray-600 mr-2 whitespace-nowrap select-none'>
{title} {title}
@@ -288,7 +288,7 @@ const CardTable = ({
return ( return (
<div className='flex flex-col gap-2'> <div className='flex flex-col gap-2'>
{selectionEnabled && selectableKeys.length > 0 && ( {selectionEnabled && selectableKeys.length > 0 && (
<div className='flex items-center justify-between px-3 py-2 rounded-xl bg-semi-color-fill-0'> <div className='flex items-center justify-between px-3 py-2 rounded-xl bg-ui-color-fill-0'>
<Checkbox <Checkbox
checked={allSelected} checked={allSelected}
indeterminate={!allSelected && selectedKeys.length > 0} indeterminate={!allSelected && selectedKeys.length > 0}
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Card, Button, Typography, Tag } from '@douyinfe/semi-ui'; import { Card, Button, Typography, Tag } from '@/components/ui';
import { copy, showSuccess } from '../../../helpers'; import { copy, showSuccess } from '../../../helpers';
/** /**
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button } from '@douyinfe/semi-ui'; import { Button } from '@/components/ui';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useIsMobile } from '../../../hooks/common/useIsMobile'; import { useIsMobile } from '../../../hooks/common/useIsMobile';
+5 -5
View File
@@ -35,8 +35,8 @@ import {
Col, Col,
Divider, Divider,
Tooltip, Tooltip,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { IconPlus, IconDelete, IconAlertTriangle } from '@douyinfe/semi-icons'; import { IconPlus, IconDelete, IconAlertTriangle } from '@/components/ui/icons';
const { Text } = Typography; const { Text } = Typography;
@@ -463,8 +463,8 @@ const JSONEditor = ({
className='absolute right-2 top-1/2 transform -translate-y-1/2' className='absolute right-2 top-1/2 transform -translate-y-1/2'
style={{ style={{
color: isLastDuplicate color: isLastDuplicate
? 'var(--semi-color-danger)' ? 'var(--ui-color-danger)'
: 'var(--semi-color-warning)', : 'var(--ui-color-warning)',
fontSize: '14px', fontSize: '14px',
}} }}
/> />
@@ -568,7 +568,7 @@ const JSONEditor = ({
<Tooltip content={t('重复的键名')}> <Tooltip content={t('重复的键名')}>
<IconAlertTriangle <IconAlertTriangle
className='absolute right-2 top-1/2 transform -translate-y-1/2' className='absolute right-2 top-1/2 transform -translate-y-1/2'
style={{ color: 'var(--semi-color-warning)', fontSize: '14px' }} style={{ color: 'var(--ui-color-warning)', fontSize: '14px' }}
/> />
</Tooltip> </Tooltip>
)} )}
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { InputNumber, withField } from '@douyinfe/semi-ui'; import { InputNumber, withField } from '@/components/ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { getQuotaPerUnit } from '../../../helpers'; import { getQuotaPerUnit } from '../../../helpers';
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Space, Tag, Typography, Popover } from '@douyinfe/semi-ui'; import { Space, Tag, Typography, Popover } from '@/components/ui';
const { Text } = Typography; const { Text } = Typography;
+21 -21
View File
@@ -1,14 +1,14 @@
.rich-text-editor { .rich-text-editor {
border: 1px solid var(--semi-color-border); border: 1px solid var(--ui-color-border);
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
background: var(--semi-color-bg-2); background: var(--ui-color-bg-2);
} }
.rich-text-editor.is-invalid { .rich-text-editor.is-invalid {
border-color: var(--semi-color-danger); border-color: var(--ui-color-danger);
} }
.rich-text-editor:focus-within { .rich-text-editor:focus-within {
border-color: var(--semi-color-primary); border-color: var(--ui-color-primary);
} }
.rich-text-toolbar { .rich-text-toolbar {
display: flex; display: flex;
@@ -16,8 +16,8 @@
align-items: center; align-items: center;
gap: 4px; gap: 4px;
padding: 8px; padding: 8px;
border-bottom: 1px solid var(--semi-color-border); border-bottom: 1px solid var(--ui-color-border);
background: var(--semi-color-fill-0); background: var(--ui-color-fill-0);
} }
.rich-text-toolbar button, .rich-text-toolbar button,
.rich-text-toolbar select { .rich-text-toolbar select {
@@ -30,7 +30,7 @@
border: 0; border: 0;
border-radius: 4px; border-radius: 4px;
background: transparent; background: transparent;
color: var(--semi-color-text-1); color: var(--ui-color-text-1);
cursor: pointer; cursor: pointer;
} }
.rich-text-toolbar select { .rich-text-toolbar select {
@@ -39,12 +39,12 @@
} }
.rich-text-toolbar button:hover, .rich-text-toolbar button:hover,
.rich-text-toolbar button[aria-pressed='true'] { .rich-text-toolbar button[aria-pressed='true'] {
background: var(--semi-color-primary-light-default); background: var(--ui-color-primary-light-default);
color: var(--semi-color-primary); color: var(--ui-color-primary);
} }
.rich-text-toolbar button:focus-visible, .rich-text-toolbar button:focus-visible,
.rich-text-toolbar select:focus-visible { .rich-text-toolbar select:focus-visible {
outline: 2px solid var(--semi-color-primary); outline: 2px solid var(--ui-color-primary);
outline-offset: 1px; outline-offset: 1px;
} }
.rich-text-toolbar button:disabled { .rich-text-toolbar button:disabled {
@@ -56,14 +56,14 @@
padding: 16px; padding: 16px;
outline: none; outline: none;
line-height: 1.9; line-height: 1.9;
color: var(--semi-color-text-0); color: var(--ui-color-text-0);
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.rich-text-content .ql-editor > * + * { .rich-text-content .ql-editor > * + * {
margin-top: 12px; margin-top: 12px;
} }
.rich-text-content .ql-editor.ql-blank::before { .rich-text-content .ql-editor.ql-blank::before {
color: var(--semi-color-text-2); color: var(--ui-color-text-2);
font-style: normal; font-style: normal;
pointer-events: none; pointer-events: none;
white-space: pre-wrap; white-space: pre-wrap;
@@ -84,20 +84,20 @@
padding-left: 0; padding-left: 0;
} }
.rich-text-content blockquote { .rich-text-content blockquote {
border-left: 3px solid var(--semi-color-border); border-left: 3px solid var(--ui-color-border);
padding-left: 16px; padding-left: 16px;
color: var(--semi-color-text-2); color: var(--ui-color-text-2);
} }
.rich-text-content img { .rich-text-content img {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
.rich-text-count { .rich-text-count {
border-top: 1px solid var(--semi-color-border); border-top: 1px solid var(--ui-color-border);
padding: 4px 12px; padding: 4px 12px;
text-align: right; text-align: right;
font-size: 12px; font-size: 12px;
color: var(--semi-color-text-2); color: var(--ui-color-text-2);
} }
.rich-text-content.ql-container, .rich-text-content.ql-container,
@@ -106,11 +106,11 @@
font-size: 14px; font-size: 14px;
} }
.rich-text-editor.is-invalid:focus-within { .rich-text-editor.is-invalid:focus-within {
border-color: var(--semi-color-danger); border-color: var(--ui-color-danger);
} }
.rich-text-toolbar select option { .rich-text-toolbar select option {
background: var(--semi-color-bg-2); background: var(--ui-color-bg-2);
color: var(--semi-color-text-0); color: var(--ui-color-text-0);
} }
.rich-text-content .ql-editor img { .rich-text-content .ql-editor img {
display: inline-block; display: inline-block;
@@ -119,7 +119,7 @@
.rich-text-image-error { .rich-text-image-error {
padding: 8px 12px; padding: 8px 12px;
font-size: 12px; font-size: 12px;
color: var(--semi-color-danger); color: var(--ui-color-danger);
border-top: 1px solid var(--semi-color-border); border-top: 1px solid var(--ui-color-border);
line-height: 1.6; line-height: 1.6;
} }
@@ -30,8 +30,8 @@ import {
Checkbox, Checkbox,
Skeleton, Skeleton,
Tooltip, Tooltip,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons'; import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
/** /**
* 通用可选择按钮组组件 * 通用可选择按钮组组件
@@ -127,7 +127,7 @@ const SelectableButtonGroup = ({
fontWeight: 400, fontWeight: 400,
cursor: 'pointer', cursor: 'pointer',
fontSize: '12px', fontSize: '12px',
color: 'var(--semi-color-text-2)', color: 'var(--ui-color-text-2)',
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
@@ -146,8 +146,8 @@ const SelectableButtonGroup = ({
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'flex-start', justifyContent: 'flex-start',
border: '1px solid var(--semi-color-border)', border: '1px solid var(--ui-color-border)',
borderRadius: 'var(--semi-border-radius-medium)', borderRadius: 'var(--ui-border-radius-medium)',
padding: '0 12px', padding: '0 12px',
gap: '6px', gap: '6px',
}} }}
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Avatar, Button } from '@douyinfe/semi-ui'; import { Avatar, Button } from '@/components/ui';
import { import {
MessageCircle, MessageCircle,
Sparkles, Sparkles,
+83 -178
View File
@@ -23,39 +23,26 @@ import {
Spin, Spin,
Empty, Empty,
Button, Button,
Typography,
Tooltip, Tooltip,
} from '@douyinfe/semi-ui'; Divider,
import { theme,
MessageCircle, } from 'antd';
X, import { X, RefreshCw, Headphones } from 'lucide-react';
ChevronRight,
Users,
RefreshCw,
Headphones,
QrCode,
Sparkles,
MessageSquareMore,
} from 'lucide-react';
import { API } from '../../helpers'; import { API } from '../../helpers';
import { getServerURL } from '../../helpers/config'; import { getServerURL } from '../../helpers/config';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import './styles.css'; import './styles.css';
const { Text } = Typography;
// 本地存储 key
const COLLAPSED_STORAGE_KEY = 'cs-collapsed';
// 在线客服列表停留时的轮询间隔 // 在线客服列表停留时的轮询间隔
const ONLINE_POLL_INTERVAL = 15000; const ONLINE_POLL_INTERVAL = 15000;
// 页面内“联系客服”入口派发的可取消事件;客服启用时由本组件 preventDefault 并打开面板。
export const CUSTOMER_SERVICE_OPEN_EVENT = 'customer-service:open';
const CustomerServiceFloat = () => { const CustomerServiceFloat = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { token } = theme.useToken();
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [isCollapsed, setIsCollapsed] = useState(() => {
// 从本地存储读取收起状态
return localStorage.getItem(COLLAPSED_STORAGE_KEY) === 'true';
});
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [currentAgent, setCurrentAgent] = useState(null); const [currentAgent, setCurrentAgent] = useState(null);
const [agentList, setAgentList] = useState([]); const [agentList, setAgentList] = useState([]);
@@ -91,20 +78,8 @@ const CustomerServiceFloat = () => {
API.post(path).catch(() => {}); API.post(path).catch(() => {});
}, []); }, []);
// 切换收起状态 // 打开客服面板;不再读取或提供边缘收起状态。
const toggleCollapse = (e) => {
e.stopPropagation();
const newState = !isCollapsed;
setIsCollapsed(newState);
localStorage.setItem(COLLAPSED_STORAGE_KEY, String(newState));
};
// 展开并打开面板
const handleExpand = () => { const handleExpand = () => {
if (isCollapsed) {
setIsCollapsed(false);
localStorage.setItem(COLLAPSED_STORAGE_KEY, 'false');
}
setIsOpen(true); setIsOpen(true);
}; };
@@ -124,6 +99,18 @@ const CustomerServiceFloat = () => {
fetchConfig(); fetchConfig();
}, [fetchConfig]); }, [fetchConfig]);
// 页面内入口(如密钥管理“联系客服”)与悬浮按钮共用同一打开逻辑。
useEffect(() => {
if (!config.enabled) return undefined;
const onOpenRequest = (event) => {
event.preventDefault();
setIsOpen(true);
};
window.addEventListener(CUSTOMER_SERVICE_OPEN_EVENT, onOpenRequest);
return () =>
window.removeEventListener(CUSTOMER_SERVICE_OPEN_EVENT, onOpenRequest);
}, [config.enabled]);
// 获取分配的客服(会让后端 current_sessions +1) // 获取分配的客服(会让后端 current_sessions +1)
const fetchAllocatedAgent = useCallback(async () => { const fetchAllocatedAgent = useCallback(async () => {
setLoading(true); setLoading(true);
@@ -249,14 +236,10 @@ const CustomerServiceFloat = () => {
const statusMap = { const statusMap = {
1: { text: t('在线'), color: 'green' }, 1: { text: t('在线'), color: 'green' },
2: { text: t('忙碌'), color: 'orange' }, 2: { text: t('忙碌'), color: 'orange' },
0: { text: t('离线'), color: 'grey' }, 0: { text: t('离线'), color: 'default' },
}; };
const s = statusMap[status] || statusMap[0]; const s = statusMap[status] || statusMap[0];
return ( return <Tag color={s.color}>{s.text}</Tag>;
<Tag color={s.color} size='small'>
{s.text}
</Tag>
);
}; };
// 如果没有启用客服,不显示 // 如果没有启用客服,不显示
@@ -268,194 +251,130 @@ const CustomerServiceFloat = () => {
const hasContact = hasQrcode || currentAgent?.wecom_url; const hasContact = hasQrcode || currentAgent?.wecom_url;
return ( return (
<div className='customer-service-container' ref={containerRef}> <div
{/* 移动端遮罩:点击关闭(桌面端通过点击外部关闭,遮罩隐藏不挡操作) */} className='customer-service-container'
ref={containerRef}
style={{
'--cs-surface': token.colorBgContainer,
'--cs-text': token.colorText,
'--cs-muted': token.colorTextSecondary,
'--cs-border': token.colorBorderSecondary,
'--cs-fill': token.colorFillQuaternary,
'--cs-hover': token.colorFillTertiary,
'--cs-primary': token.colorPrimary,
'--cs-primary-bg': token.colorPrimaryBg,
'--cs-primary-border': token.colorPrimaryBorder,
'--cs-primary-text': token.colorPrimaryText,
'--cs-mask': token.colorBgMask,
'--cs-shadow': token.boxShadowSecondary,
}}
>
{isOpen && ( {isOpen && (
<div className='cs-backdrop' onClick={handleClose} aria-hidden='true' /> <div className='cs-backdrop' onClick={handleClose} aria-hidden='true' />
)} )}
{/* 收起状态 - 边缘小标签 */}
{!isOpen && isCollapsed && (
<Tooltip content={t('联系客服')} position='left'>
<button
className='cs-collapsed-tab'
onClick={handleExpand}
ref={triggerRef}
aria-label={t('联系客服')}
>
<div className='cs-collapsed-icon'>
<MessageSquareMore size={18} strokeWidth={2.5} />
</div>
<div className='cs-collapsed-indicator' />
</button>
</Tooltip>
)}
{/* 展开状态的浮动按钮 - 精美客服图标 */}
{!isOpen && !isCollapsed && (
<div className='cs-float-wrapper'> <div className='cs-float-wrapper'>
<button <Tooltip title={isOpen ? t('关闭客服') : t('联系客服')}>
className='cs-float-button cs-has-pulse' <Button
onClick={handleExpand} type='primary'
shape='circle'
className='cs-float-button'
onClick={isOpen ? handleClose : handleExpand}
ref={triggerRef} ref={triggerRef}
aria-label={t('联系客服')} aria-label={isOpen ? t('关闭客服') : t('联系客服')}
> icon={
{/* 装饰性光环 */} isOpen ? (
<div className='cs-glow-ring' /> <X size={22} strokeWidth={1.5} />
<div className='cs-glow-ring cs-glow-ring-2' /> ) : (
<Headphones size={22} strokeWidth={1.5} />
{/* 主图标 */} )
<div className='cs-icon-wrapper'> }
<Headphones size={26} strokeWidth={2} /> />
</Tooltip>
</div> </div>
{/* 在线状态指示器 */}
<div className='cs-online-indicator'>
<div className='cs-online-dot' />
</div>
{/* 悬浮文字提示 */}
<div className='cs-float-label'>
<span>{t('在线客服')}</span>
</div>
</button>
{/* 收起按钮 */}
<button
className='cs-collapse-btn'
onClick={toggleCollapse}
title={t('收起')}
aria-label={t('收起')}
>
<ChevronRight size={14} />
</button>
</div>
)}
{/* 展开的客服面板 */}
<div <div
className={`cs-panel ${isOpen ? 'cs-panel-open' : ''}`} className={`cs-panel ${isOpen ? 'cs-panel-open' : ''}`}
role='dialog' role='dialog'
aria-label={t('在线客服')} aria-label={t('在线客服')}
aria-hidden={!isOpen} aria-hidden={!isOpen}
/* 关闭时让面板内子元素(关闭按钮等)从 Tab 序列与可达性树中移除,
避免键盘焦点跑进屏幕外的隐藏面板(也消除 aria-hidden 含焦点元素的告警) */
inert={!isOpen ? '' : undefined} inert={!isOpen ? '' : undefined}
tabIndex={-1} tabIndex={-1}
ref={panelRef} ref={panelRef}
> >
{/* 头部 - 渐变背景 */}
<div className='cs-panel-header'> <div className='cs-panel-header'>
<div className='cs-header-content'>
<div className='cs-header-icon'>
<Headphones size={20} />
</div>
<div className='cs-header-text'>
<span className='cs-header-title'>{t('在线客服')}</span> <span className='cs-header-title'>{t('在线客服')}</span>
<span className='cs-header-subtitle'>{t('随时为您服务')}</span>
</div>
</div>
<div className='cs-panel-actions'> <div className='cs-panel-actions'>
{currentAgent && ( {currentAgent && !showAgentList && (
<Button <Button type='text' size='small' onClick={switchAgent}>
size='small'
theme='borderless'
icon={<Users size={14} />}
onClick={switchAgent}
style={{
color: 'white',
background: 'rgba(255,255,255,0.2)',
borderRadius: '10px',
}}
>
{t('切换')} {t('切换')}
</Button> </Button>
)} )}
<button <Button
type='text'
className='cs-close-btn' className='cs-close-btn'
onClick={handleClose} onClick={handleClose}
aria-label={t('关闭')} aria-label={t('关闭')}
> icon={<X size={16} strokeWidth={1.5} />}
<X size={18} /> />
</button>
</div> </div>
</div> </div>
{/* 内容区 */}
<div className='cs-panel-content'> <div className='cs-panel-content'>
{loading ? ( {loading ? (
<div className='cs-loading'> <div className='cs-loading'>
<Spin size='large' /> <Spin size='large' />
<p className='cs-loading-text'>{t('正在为您分配客服...')}</p> <p>{t('正在为您分配客服...')}</p>
</div> </div>
) : error ? ( ) : error ? (
<div className='cs-error'> <div className='cs-error'>
<Empty title={t('暂无可用客服')} description={error} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={error} />
<Button <Button
icon={<RefreshCw size={14} />} icon={<RefreshCw size={14} />}
onClick={fetchAllocatedAgent} onClick={fetchAllocatedAgent}
style={{ marginTop: 16 }}
> >
{t('重新获取')} {t('重新获取')}
</Button> </Button>
</div> </div>
) : showAgentList ? ( ) : showAgentList ? (
/* 客服选择列表 */
<div className='cs-agent-list'> <div className='cs-agent-list'>
<p className='cs-list-title'>{t('请选择客服')}</p> <p className='cs-list-title'>{t('请选择客服')}</p>
{agentList.length === 0 ? ( {agentList.length === 0 ? (
<Empty description={t('暂无在线客服')} /> <Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('暂无在线客服')}
/>
) : ( ) : (
agentList.map((agent) => ( agentList.map((agent) => (
<div <Button
key={agent.id} key={agent.id}
className='cs-agent-item' className='cs-agent-item'
onClick={() => selectAgent(agent)} onClick={() => selectAgent(agent)}
> >
<Avatar <Avatar src={agent.avatar} size={32}>
src={agent.avatar}
size='small'
style={{ marginRight: 12, backgroundColor: '#87d068' }}
>
{agent.name?.[0]} {agent.name?.[0]}
</Avatar> </Avatar>
<div className='cs-agent-info'>
<span className='cs-agent-name'>{agent.name}</span> <span className='cs-agent-name'>{agent.name}</span>
{getStatusTag(agent.status)} {getStatusTag(agent.status)}
</div>
<span className='cs-agent-busy'> <span className='cs-agent-busy'>
{agent.current_sessions}/{agent.max_sessions} {agent.current_sessions}/{agent.max_sessions}
</span> </span>
</div> </Button>
)) ))
)} )}
</div> </div>
) : currentAgent ? ( ) : currentAgent ? (
/* 客服聊天界面 */
<div className='cs-chat-container'> <div className='cs-chat-container'>
{/* 当前客服信息 */}
<div className='cs-current-agent'> <div className='cs-current-agent'>
<Avatar <Avatar src={currentAgent.avatar} size={32}>
src={currentAgent.avatar}
size='small'
style={{ backgroundColor: '#87d068' }}
>
{currentAgent.name?.[0]} {currentAgent.name?.[0]}
</Avatar> </Avatar>
<span style={{ marginLeft: 8 }}>{currentAgent.name}</span> <span className='cs-agent-name'>{currentAgent.name}</span>
{getStatusTag(currentAgent.status)} {getStatusTag(currentAgent.status)}
</div> </div>
{/* 客服内容 */}
{hasContact ? ( {hasContact ? (
<div className='cs-contact-container'> <div className='cs-contact-container'>
{/* 二维码区域 */}
{hasQrcode && ( {hasQrcode && (
<div className='cs-qrcode'> <div className='cs-qrcode'>
<div className='cs-qrcode-label'> <p className='cs-qrcode-label'>{t('扫码联系客服')}</p>
<QrCode size={16} /> <div className='cs-qrcode-frame'>
<span>{t('扫码联系客服')}</span>
</div>
<img <img
src={currentAgent.qrcode_url} src={currentAgent.qrcode_url}
alt={t('客服二维码')} alt={t('客服二维码')}
@@ -463,46 +382,32 @@ const CustomerServiceFloat = () => {
onError={() => setQrcodeError(true)} onError={() => setQrcodeError(true)}
/> />
</div> </div>
)}
{/* 跳转按钮区域 */}
{currentAgent.wecom_url && (
<div className='cs-wecom-link'>
{hasQrcode && (
<div className='cs-divider'>
<span>{t('或')}</span>
</div> </div>
)} )}
<button {currentAgent.wecom_url && (
<div className='cs-wecom-link'>
{hasQrcode && <Divider plain>{t('或')}</Divider>}
<Button
type='primary'
className='cs-wecom-btn' className='cs-wecom-btn'
onClick={() => onClick={() =>
window.open(currentAgent.wecom_url, '_blank') window.open(currentAgent.wecom_url, '_blank')
} }
> >
<MessageCircle size={18} />
{t('打开微信客服')} {t('打开微信客服')}
<Sparkles size={14} /> </Button>
</button>
<Text
type='tertiary'
size='small'
style={{ marginTop: 12, opacity: 0.7 }}
>
{t('点击后将跳转至微信')}
</Text>
</div> </div>
)} )}
</div> </div>
) : ( ) : (
<div className='cs-no-contact'>
<Empty <Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={ description={
qrcodeError qrcodeError
? t('二维码加载失败,请稍后重试') ? t('二维码加载失败,请稍后重试')
: t('客服信息配置不完整') : t('客服信息配置不完整')
} }
/> />
</div>
)} )}
</div> </div>
) : null} ) : null}
File diff suppressed because it is too large Load Diff
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Tag, Timeline, Empty } from '@douyinfe/semi-ui'; import { Card, Tag, Timeline, Empty } from '@/components/ui';
import { Bell } from 'lucide-react'; import { Bell } from 'lucide-react';
import { marked } from 'marked'; import { marked } from 'marked';
import { import {
+2 -2
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Avatar, Tag, Divider, Empty } from '@douyinfe/semi-ui'; import { Card, Avatar, Tag, Divider, Empty } from '@/components/ui';
import { Server, Gauge, ExternalLink } from 'lucide-react'; import { Server, Gauge, ExternalLink } from 'lucide-react';
import { import {
IllustrationConstruction, IllustrationConstruction,
@@ -88,7 +88,7 @@ const ApiInfoPanel = ({
</div> </div>
</div> </div>
<div <div
className='!text-semi-color-primary break-all cursor-pointer hover:underline mb-1' className='!text-ui-color-primary break-all cursor-pointer hover:underline mb-1'
onClick={() => handleCopyUrl(api.url)} onClick={() => handleCopyUrl(api.url)}
> >
{api.url} {api.url}
+25 -74
View File
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Card } from 'antd';
import { AreaChart, Trophy } from 'lucide-react'; import { AreaChart, Trophy } from 'lucide-react';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
import { useIsMobile } from '../../hooks/common/useIsMobile'; import { useIsMobile } from '../../hooks/common/useIsMobile';
@@ -48,6 +49,7 @@ const toMobileSpec = (spec) => {
const next = { const next = {
...spec, ...spec,
background: 'transparent',
// 图内标题在手机端隐藏,信息由卡片头部承担 // 图内标题在手机端隐藏,信息由卡片头部承担
title: { ...(spec.title || {}), visible: false }, title: { ...(spec.title || {}), visible: false },
padding: { top: 4, right: 8, bottom: 4, left: 4 }, padding: { top: 4, right: 8, bottom: 4, left: 4 },
@@ -222,7 +224,10 @@ const ChartsPanel = ({
const specs = useMemo(() => { const specs = useMemo(() => {
if (!isMobile) { if (!isMobile) {
return { consume: spec_line, pie: spec_pie }; return {
consume: { ...spec_line, background: 'transparent' },
pie: { ...spec_pie, background: 'transparent' },
};
} }
return { return {
consume: toMobileSpec( consume: toMobileSpec(
@@ -256,82 +261,28 @@ const ChartsPanel = ({
const chartOption = isMobile ? MOBILE_CHART_CONFIG : CHART_CONFIG; const chartOption = isMobile ? MOBILE_CHART_CONFIG : CHART_CONFIG;
return ( return (
<div <div className='ui-dashboard-charts'>
className={`flex flex-col flex-1 min-h-0 ${hasApiInfoPanel ? 'lg:col-span-3' : ''}`} {CHARTS.map((chart) => (
> <Card
<div className='grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0'> key={chart.key}
{CHARTS.map((chart) => { title={
const Icon = chart.icon; <span className='ui-chart-title'>
return ( <span className='ui-chart-icon' aria-hidden='true'>
<div key={chart.key} className='relative flex flex-col min-h-0'> <AreaChart size={17} />
{/* 装饰渐变光晕 */}
<div
className={`pointer-events-none absolute -inset-1 bg-gradient-to-br ${chart.glow} rounded-3xl blur-xl opacity-60`}
/>
<div
className={`relative flex-1 flex flex-col min-h-0 bg-white dark:bg-neutral-900/90 backdrop-blur-sm rounded-2xl border border-gray-100 dark:border-neutral-800 shadow-[0_2px_12px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_12px_-2px_rgba(0,0,0,0.4)] overflow-hidden`}
>
{/* 顶部高光条 */}
<div
className={`pointer-events-none absolute top-0 left-0 right-0 h-px bg-gradient-to-r ${chart.gradient} opacity-60`}
/>
{/* 图表标题 + 副标题 + 类型徽章 */}
<div className='relative flex items-center justify-between gap-3 px-4 pt-3.5 pb-2.5 shrink-0'>
<div className='flex items-center gap-2.5 min-w-0'>
<div
className={`w-8 h-8 shrink-0 rounded-lg bg-gradient-to-br ${chart.gradient} flex items-center justify-center shadow-md`}
>
<Icon size={14} className='text-white' />
</div>
<div className='min-w-0'>
<h3 className='font-semibold text-gray-900 dark:text-white text-[13px] tracking-wide leading-tight'>
{t(chart.label)}
</h3>
{/* 手机端图内标题被隐藏,这里改显示「总计」,其余尺寸仍显示副标题 */}
<p className='text-[10px] text-gray-400 dark:text-gray-500 leading-tight mt-0.5 truncate'>
{isMobile && totals[chart.key]
? totals[chart.key]
: t(chart.sublabel)}
</p>
</div>
</div>
<span
className={`shrink-0 inline-flex items-center px-2 py-0.5 rounded-md text-[10px] font-semibold border ${chart.badge}`}
>
{t(chart.badgeText)}
</span> </span>
</div> {t(chart.label)}
</span>
{/* 分隔线 */} }
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 to-transparent dark:via-gray-700/40 shrink-0' /> extra={<span className='ui-field-help'>{t(chart.badgeText)}</span>}
>
{/* 图表区域 - flex-1 撑满剩余高度,min-h 兜底防止过矮 */} {isMobile && totals[chart.key] && (
<div className='relative flex-1 min-h-[300px] sm:min-h-[320px] p-1.5 sm:p-3 overflow-hidden'> <p className='ui-field-help'>{totals[chart.key]}</p>
{/* 网格装饰 */} )}
<div <div className='ui-chart-canvas'>
className='pointer-events-none absolute inset-0 opacity-[0.025] dark:opacity-[0.05]'
style={{
backgroundImage: `
linear-gradient(rgba(100, 100, 100, 0.5) 1px, transparent 1px),
linear-gradient(90deg, rgba(100, 100, 100, 0.5) 1px, transparent 1px)
`,
backgroundSize: '36px 36px',
}}
/>
<div className='relative h-full'>
{/* 注意是 options 复数:react-vchart 的 notSpecKeys 里只认 'options',
写成 option 会被当成普通 prop 丢弃(原来的 option={CHART_CONFIG}
一直是失效的),移动端 mobile-browser 触屏 tooltip 也就一直没生效 */}
<VChart spec={specs[chart.key]} options={chartOption} /> <VChart spec={specs[chart.key]} options={chartOption} />
</div> </div>
</div> </Card>
</div> ))}
</div>
);
})}
</div>
</div> </div>
); );
}; };
+1 -1
View File
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button } from '@douyinfe/semi-ui'; import { Button } from '@/components/ui';
import { RefreshCw, Search } from 'lucide-react'; import { RefreshCw, Search } from 'lucide-react';
const DashboardHeader = ({ const DashboardHeader = ({
+2 -2
View File
@@ -18,9 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Card, Collapse, Empty } from '@douyinfe/semi-ui'; import { Card, Collapse, Empty } from '@/components/ui';
import { HelpCircle } from 'lucide-react'; import { HelpCircle } from 'lucide-react';
import { IconPlus, IconMinus } from '@douyinfe/semi-icons'; import { IconPlus, IconMinus } from '@/components/ui/icons';
import { marked } from 'marked'; import { marked } from 'marked';
import { import {
IllustrationConstruction, IllustrationConstruction,
+48 -214
View File
@@ -18,251 +18,85 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Skeleton } from '@douyinfe/semi-ui'; import { Card, Skeleton } from 'antd';
import { VChart } from '@visactor/react-vchart'; import { VChart } from '@visactor/react-vchart';
import { useNavigate } from 'react-router-dom'; import {
import { useTranslation } from 'react-i18next'; Wallet,
import { ArrowUpRight, Wallet, TrendingUp, Zap, Clock } from 'lucide-react'; ChartColumnIncreasing,
Activity,
NotebookText,
} from 'lucide-react';
// 卡片调色板 —— 4 张指标卡用同一蓝色家族的冷色渐进(青→天蓝→蓝→靛), const metricIcons = [Wallet, ChartColumnIncreasing, Activity, NotebookText];
// 贴合云平台克制专业的观感;既能区分 4 张卡,又不像四色那样"花"。
// 卡片本体为实底白(dark 实底深灰),强调色仅用于图标 / 顶部高光条 / 角落光斑 / 角标,
// 既不透出页面 bg-glow 背景(解决"发灰"),又靠冷蓝 accent 提供层次。
const CARD_PALETTES = [
{
// 账户 / 钱包 —— 青(cyan)
iconBg: 'from-cyan-500 to-sky-600',
iconShadow: 'shadow-cyan-500/25',
glow: 'from-cyan-400/25 to-sky-300/5',
bar: 'from-cyan-400 to-sky-500',
badge: 'bg-cyan-50 text-cyan-600 dark:bg-cyan-500/15 dark:text-cyan-400',
},
{
// 使用统计 —— 天蓝(sky)
iconBg: 'from-sky-500 to-blue-600',
iconShadow: 'shadow-sky-500/25',
glow: 'from-sky-400/25 to-blue-300/5',
bar: 'from-sky-400 to-blue-500',
badge: 'bg-sky-50 text-sky-600 dark:bg-sky-500/15 dark:text-sky-400',
},
{
// Token 消耗 —— 蓝(blue)
iconBg: 'from-blue-500 to-indigo-600',
iconShadow: 'shadow-blue-500/25',
glow: 'from-blue-400/25 to-indigo-300/5',
bar: 'from-blue-400 to-indigo-500',
badge: 'bg-blue-50 text-blue-600 dark:bg-blue-500/15 dark:text-blue-400',
},
{
// 性能指标 —— 靛(indigo)
iconBg: 'from-indigo-500 to-violet-600',
iconShadow: 'shadow-indigo-500/25',
glow: 'from-indigo-400/25 to-violet-300/5',
bar: 'from-indigo-400 to-violet-500',
badge:
'bg-indigo-50 text-indigo-600 dark:bg-indigo-500/15 dark:text-indigo-400',
},
];
// 分组图标映射
const GROUP_ICONS = {
0: Wallet, // 账户数据
1: TrendingUp, // 使用统计
2: Zap, // Token 消耗
3: Clock, // 性能指标
};
const StatsCards = ({ const StatsCards = ({
groupedStatsData, groupedStatsData,
loading, loading,
getTrendSpec, getTrendSpec,
CARD_PROPS,
CHART_CONFIG, CHART_CONFIG,
}) => { }) => {
const _navigate = useNavigate(); const renderValue = (item) => (
const { t: _t } = useTranslation();
const gridColsClass =
groupedStatsData.length >= 4 ? 'xl:grid-cols-4' : 'xl:grid-cols-3';
return (
<div className={`grid grid-cols-1 md:grid-cols-2 ${gridColsClass} gap-4`}>
{groupedStatsData.map((group, idx) => {
const palette = CARD_PALETTES[idx % CARD_PALETTES.length];
const GroupIcon = GROUP_ICONS[idx] || Wallet;
const isTwoColumnLayout = group.layout === 'two-column';
return (
<div
key={idx}
className={`group/card relative overflow-hidden rounded-2xl bg-white dark:bg-neutral-900/90 border border-gray-100 dark:border-neutral-800 shadow-[0_2px_12px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_12px_-2px_rgba(0,0,0,0.4)] hover:shadow-[0_12px_28px_-6px_rgba(0,0,0,0.12)] hover:-translate-y-0.5 transition-all duration-300 ease-out`}
>
{/* 装饰性渐变光斑 */}
<div
className={`pointer-events-none absolute -top-12 -right-12 w-36 h-36 bg-gradient-to-br ${palette.glow} rounded-full blur-2xl group-hover/card:scale-110 transition-transform duration-500`}
/>
{/* 顶部高光条 */}
<div
className={`pointer-events-none absolute top-0 left-0 right-0 h-px bg-gradient-to-r ${palette.bar} opacity-60`}
/>
{/* 微点阵纹理 - 强化卡片质感 */}
<div
className='pointer-events-none absolute inset-0 opacity-[0.025] dark:opacity-[0.04]'
style={{
backgroundImage:
'radial-gradient(circle, currentColor 0.5px, transparent 0.5px)',
backgroundSize: '12px 12px',
}}
/>
{/* 卡片头部 - 标题 + 角标编号 */}
<div className='relative px-4 pt-3.5 pb-2.5 flex items-center justify-between'>
<div className='flex items-center gap-2.5'>
<div
className={`relative w-9 h-9 rounded-xl bg-gradient-to-br ${palette.iconBg} flex items-center justify-center shadow-md ${palette.iconShadow} group-hover/card:scale-105 transition-transform duration-300`}
>
<GroupIcon size={16} className='text-white' />
<div className='absolute inset-0 rounded-xl bg-gradient-to-t from-white/0 via-white/0 to-white/30' />
</div>
<h3 className='font-semibold text-gray-900 dark:text-white text-[13px] tracking-wide'>
{group.title}
</h3>
</div>
{/* 序号角标 - 弱化的装饰编号 */}
<span
className={`text-[10px] font-bold tracking-widest tabular-nums ${palette.badge} px-1.5 py-0.5 rounded-md opacity-70`}
>
{String(idx + 1).padStart(2, '0')}
</span>
</div>
{/* 分隔线 - 渐变细线 */}
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 to-transparent dark:via-gray-700/40' />
{/* 卡片内容 - 紧凑布局
- two-column 模式:4 项 2×2 紧凑网格(Token 消耗)
- 默认模式:2 项 左标题 + 右大数字 的两端对齐,把右侧留白用数值填满 */}
<div
className={`relative px-3 py-2.5 ${
isTwoColumnLayout ? 'grid grid-cols-2 gap-2' : 'space-y-1'
}`}
>
{group.items.map((item, itemIdx) => {
// 趋势图仅在 item 显式提供 trendData 且非空时渲染
const hasTrend =
Array.isArray(item.trendData) && item.trendData.length > 0;
if (isTwoColumnLayout) {
// ========== Token 消耗 - 紧凑卡片样式 ==========
return (
<div
key={itemIdx}
className={`group relative flex min-w-0 items-center gap-2.5 px-2 py-2 rounded-xl transition-all ${
item.onClick ? 'cursor-pointer' : ''
} hover:bg-white/60 dark:hover:bg-white/[0.04]`}
onClick={item.onClick}
>
<div
className='w-8 h-8 shrink-0 rounded-lg flex items-center justify-center text-[13px]'
style={{
backgroundColor: `var(--semi-color-${item.avatarColor}-light-default)`,
color: `var(--semi-color-${item.avatarColor})`,
}}
>
{item.icon}
</div>
<div className='min-w-0'>
<div className='truncate text-[11px] text-gray-500 dark:text-gray-400 leading-tight mb-0.5'>
{item.title}
</div>
<div className='truncate text-[15px] font-extrabold text-gray-900 dark:text-white leading-tight tabular-nums tracking-tight'>
<Skeleton <Skeleton
loading={loading} loading={!!loading}
active active
placeholder={ paragraph={false}
<Skeleton.Paragraph title={{ width: 80 }}
active
rows={1}
style={{ width: '60px', height: '18px' }}
/>
}
> >
{item.value} {item.value}
</Skeleton> </Skeleton>
</div>
</div>
</div>
); );
}
// ========== 账户/使用统计/性能指标 - 单列 hero 行 ==========
// 左:小图标 + 小标题;右:大数字(吃掉之前的留白)
return ( return (
<div <div className='ui-dashboard-stats'>
key={itemIdx} <div className='ui-dashboard-metrics'>
className={`group relative flex items-center justify-between gap-3 px-2.5 py-2.5 rounded-xl transition-all ${ {groupedStatsData
item.onClick ? 'cursor-pointer' : '' .slice(0, 2)
} hover:bg-white/60 dark:hover:bg-white/[0.04]`} .flatMap((group) => group.items)
.map((item, index) => (
<Card
key={index}
className='ui-metric'
onClick={item.onClick} onClick={item.onClick}
hoverable={!!item.onClick}
> >
{/* 左侧:图标 + 标题 */} <span className='ui-metric-icon' aria-hidden='true'>
<div className='flex min-w-0 items-center gap-2.5'> {React.createElement(metricIcons[index] || Activity, {
<div size: 22,
className='w-7 h-7 shrink-0 rounded-lg flex items-center justify-center text-[12px]' })}
style={{
backgroundColor: `var(--semi-color-${item.avatarColor}-light-default)`,
color: `var(--semi-color-${item.avatarColor})`,
}}
>
{item.icon}
</div>
<span className='truncate text-[12px] text-gray-500 dark:text-gray-400'>
{item.title}
</span> </span>
<div className='min-w-0'>
<div className='ui-metric-label'>{item.title}</div>
<div className='ui-metric-value'>{renderValue(item)}</div>
</div> </div>
{Array.isArray(item.trendData) && item.trendData.length > 0 && (
{/* 右侧:大数字 + 可选趋势图(仅当显式提供) */} <div className='ui-metric-trend'>
<div className='flex items-center gap-3 min-w-0'>
{hasTrend && (
<div className='w-14 h-6 opacity-70 group-hover:opacity-100 transition-opacity'>
<VChart <VChart
spec={getTrendSpec(item.trendData, item.trendColor)} spec={getTrendSpec(item.trendData, item.trendColor)}
option={CHART_CONFIG} option={CHART_CONFIG}
/> />
</div> </div>
)} )}
<div className='truncate text-right text-lg font-extrabold text-gray-900 dark:text-white leading-none tabular-nums tracking-tight'> </Card>
<Skeleton ))}
loading={loading} </div>
active <div className='ui-dashboard-details'>
placeholder={ {groupedStatsData.slice(2).map((group, index) => (
<Skeleton.Paragraph <Card key={index} title={group.title}>
active <div className='ui-dashboard-detail-items'>
rows={1} {group.items.map((item, itemIndex) => (
style={{ width: '80px', height: '20px' }} <div
/> key={itemIndex}
} onClick={item.onClick}
className={item.onClick ? 'cursor-pointer' : ''}
> >
{item.value} <div className='ui-metric-label'>{item.title}</div>
</Skeleton> <div className='ui-detail-value'>{renderValue(item)}</div>
</div> </div>
))}
</div> </div>
</Card>
{/* 悬停箭头 */} ))}
{item.onClick && (
<ArrowUpRight
size={12}
className='absolute right-1.5 top-1.5 text-gray-300 dark:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity'
/>
)}
</div> </div>
);
})}
</div>
</div>
);
})}
</div> </div>
); );
}; };
export default StatsCards; export default StatsCards;
+1 -1
View File
@@ -26,7 +26,7 @@ import {
TabPane, TabPane,
Tag, Tag,
Empty, Empty,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { Gauge, RefreshCw } from 'lucide-react'; import { Gauge, RefreshCw } from 'lucide-react';
import { import {
IllustrationConstruction, IllustrationConstruction,
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import { Modal, Form, Button } from '@douyinfe/semi-ui'; import { Modal, Form, Button } from '@/components/ui';
import { Filter, Calendar, Clock, User, Search, X } from 'lucide-react'; import { Filter, Calendar, Clock, User, Search, X } from 'lucide-react';
const SearchModal = ({ const SearchModal = ({
@@ -138,7 +138,7 @@ const SearchModal = ({
name='start_timestamp' name='start_timestamp'
onChange={(value) => handleInputChange(value, 'start_timestamp')} onChange={(value) => handleInputChange(value, 'start_timestamp')}
style={{ width: '100%' }} style={{ width: '100%' }}
className='[&_.semi-input-wrapper]:!rounded-lg [&_.semi-input]:!text-sm' className='[&_.ant-input-affix-wrapper]:!rounded-lg [&_.ant-input]:!text-sm'
/> />
</FormFieldWrapper> </FormFieldWrapper>
@@ -156,7 +156,7 @@ const SearchModal = ({
name='end_timestamp' name='end_timestamp'
onChange={(value) => handleInputChange(value, 'end_timestamp')} onChange={(value) => handleInputChange(value, 'end_timestamp')}
style={{ width: '100%' }} style={{ width: '100%' }}
className='[&_.semi-input-wrapper]:!rounded-lg [&_.semi-input]:!text-sm' className='[&_.ant-input-affix-wrapper]:!rounded-lg [&_.ant-input]:!text-sm'
/> />
</FormFieldWrapper> </FormFieldWrapper>
</div> </div>
@@ -186,7 +186,7 @@ const SearchModal = ({
handleInputChange(value, 'data_export_default_time') handleInputChange(value, 'data_export_default_time')
} }
style={{ width: '100%' }} style={{ width: '100%' }}
className='[&_.semi-select]:!rounded-lg' className='[&_.ant-select]:!rounded-lg'
/> />
</FormFieldWrapper> </FormFieldWrapper>
@@ -204,7 +204,7 @@ const SearchModal = ({
name='username' name='username'
onChange={(value) => handleInputChange(value, 'username')} onChange={(value) => handleInputChange(value, 'username')}
style={{ width: '100%' }} style={{ width: '100%' }}
className='[&_.semi-input-wrapper]:!rounded-lg' className='[&_.ant-input-affix-wrapper]:!rounded-lg'
/> />
</FormFieldWrapper> </FormFieldWrapper>
)} )}
@@ -32,7 +32,7 @@ import {
Switch, Switch,
Typography, Typography,
Alert, Alert,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { import {
PlusCircle, PlusCircle,
Zap, Zap,
+1 -1
View File
@@ -34,7 +34,7 @@ import {
Popconfirm, Popconfirm,
Dropdown, Dropdown,
Badge, Badge,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { import {
History, History,
Search, Search,
+1 -1
View File
@@ -28,7 +28,7 @@ import {
Card, Card,
Empty, Empty,
Space, Space,
} from '@douyinfe/semi-ui'; } from '@/components/ui';
import { import {
Loading3, Loading3,
AlertCircle, AlertCircle,
+18 -9
View File
@@ -18,12 +18,15 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useContext, useMemo, useRef, useState, useEffect } from 'react'; import React, { useContext, useMemo, useRef, useState, useEffect } from 'react';
import { StatusContext } from '../../context/Status'; import { StatusContext } from '../../context/Status';
import { Megaphone } from 'lucide-react'; import { Megaphone, X } from 'lucide-react';
import { Button } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useMarquee } from '../../hooks/common/useMarquee';
const Marquee = () => { const Marquee = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const [statusState] = useContext(StatusContext); const [statusState] = useContext(StatusContext);
const { visible, dismiss } = useMarquee();
const marqueeContent = statusState?.status?.marquee_content || ''; const marqueeContent = statusState?.status?.marquee_content || '';
const containerRef = useRef(null); const containerRef = useRef(null);
const measureRef = useRef(null); const measureRef = useRef(null);
@@ -80,7 +83,7 @@ const Marquee = () => {
}; };
}, [displayText]); }, [displayText]);
if (!displayText) return null; if (!displayText || !visible) return null;
return ( return (
<div className='marquee-bar relative w-full overflow-hidden z-[99]'> <div className='marquee-bar relative w-full overflow-hidden z-[99]'>
@@ -90,13 +93,10 @@ const Marquee = () => {
<div className='flex items-center h-10 px-5'> <div className='flex items-center h-10 px-5'>
{/* 左侧图标 - 固定不动 */} {/* 左侧图标 - 固定不动 */}
<div className='flex-shrink-0 flex items-center gap-2 mr-4 z-10'> <div className='flex-shrink-0 flex items-center gap-2 mr-4 z-10'>
<div <div className='marquee-icon flex items-center justify-center w-6 h-6'>
className='flex items-center justify-center w-6 h-6 rounded-full bg-white/20 dark:bg-white/10 backdrop-blur-sm' <Megaphone size={13} />
style={{ boxShadow: '0 0 8px rgba(255,255,255,0.2)' }}
>
<Megaphone size={13} className='text-white drop-shadow-sm' />
</div> </div>
<span className='text-[13px] font-semibold text-white hidden sm:inline tracking-wider drop-shadow-sm'> <span className='text-[13px] font-semibold hidden sm:inline'>
{t('公告')} {t('公告')}
</span> </span>
</div> </div>
@@ -106,7 +106,7 @@ const Marquee = () => {
{/* 隐藏的测量元素 - 用于获取文本自然宽度,不受动态 padding 影响 */} {/* 隐藏的测量元素 - 用于获取文本自然宽度,不受动态 padding 影响 */}
<span <span
ref={measureRef} ref={measureRef}
className='invisible absolute whitespace-nowrap text-[14px] font-medium tracking-wide' className='marquee-measure invisible absolute whitespace-nowrap text-[14px] font-medium tracking-wide'
style={{ top: -9999, left: -9999 }} style={{ top: -9999, left: -9999 }}
aria-hidden='true' aria-hidden='true'
> >
@@ -139,6 +139,15 @@ const Marquee = () => {
</div> </div>
)} )}
</div> </div>
<Button
type='text'
size='small'
className='marquee-close flex-shrink-0 ml-4 z-10'
aria-label={t('关闭')}
icon={<X size={14} aria-hidden />}
onClick={dismiss}
/>
</div> </div>
{/* 底部发光线 */} {/* 底部发光线 */}
+137 -312
View File
@@ -19,23 +19,24 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useEffect, useState, useContext, useMemo } from 'react'; import React, { useEffect, useState, useContext, useMemo } from 'react';
import { import {
Badge,
Button,
Card,
Checkbox,
Modal, Modal,
} from '@douyinfe/semi-ui'; Segmented,
Spin,
Tag,
theme,
} from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { API, showError, getRelativeTime } from '../../helpers'; import { API, showError, getRelativeTime } from '../../helpers';
import { marked } from 'marked'; import { marked } from 'marked';
import { StatusContext } from '../../context/Status'; import { StatusContext } from '../../context/Status';
import { import { Bell, Volume1 } from 'lucide-react';
Bell, import './notice-modal.css';
Megaphone,
Sparkles, const EMPTY_ANNOUNCEMENTS = [];
X,
CalendarClock,
Volume2,
Clock,
ChevronRight,
} from 'lucide-react';
const NoticeModal = ({ const NoticeModal = ({
visible, visible,
@@ -45,14 +46,14 @@ const NoticeModal = ({
unreadKeys = [], unreadKeys = [],
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { token } = theme.useToken();
const [noticeContent, setNoticeContent] = useState(''); const [noticeContent, setNoticeContent] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [activeTab, setActiveTab] = useState(defaultTab); const [activeTab, setActiveTab] = useState(defaultTab);
const [dismissToday, setDismissToday] = useState(true);
const [statusState] = useContext(StatusContext); const [statusState] = useContext(StatusContext);
const announcements =
const announcements = statusState?.status?.announcements || []; statusState?.status?.announcements || EMPTY_ANNOUNCEMENTS;
const unreadSet = useMemo(() => new Set(unreadKeys), [unreadKeys]); const unreadSet = useMemo(() => new Set(unreadKeys), [unreadKeys]);
const getKeyForItem = (item) => const getKeyForItem = (item) =>
@@ -114,321 +115,145 @@ const NoticeModal = ({
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
setActiveTab(defaultTab); setActiveTab(defaultTab);
setDismissToday(true);
} }
}, [defaultTab, visible]); }, [defaultTab, visible]);
const renderMarkdownNotice = () => { const unreadCount = processedAnnouncements.filter(
if (loading) { (item) => item.isUnread,
return ( ).length;
<div className='py-20 flex flex-col items-center justify-center'> const typeColors = {
<div className='relative'> success: 'success',
<div className='w-16 h-16 border-4 border-brand/10 dark:border-brand-deep rounded-full' /> warning: 'warning',
<div className='absolute inset-0 w-16 h-16 border-4 border-transparent border-t-brand rounded-full animate-spin' /> error: 'error',
<div ongoing: 'processing',
className='absolute inset-2 w-12 h-12 border-4 border-transparent border-t-brand-via rounded-full animate-spin' default: 'default',
style={{
animationDirection: 'reverse',
animationDuration: '0.8s',
}}
/>
</div>
<span className='mt-4 text-gray-500 dark:text-gray-400 font-medium'>
{t('加载中...')}
</span>
</div>
);
}
if (!noticeContent) {
return (
<div className='py-16 flex flex-col items-center justify-center'>
<div className='relative'>
<div className='w-24 h-24 bg-gradient-to-br from-brand-from/5 to-brand-to/5 dark:from-brand-from/30 dark:to-brand-to/30 rounded-3xl flex items-center justify-center shadow-inner'>
<Bell
size={40}
className='text-brand-from dark:text-brand-deep'
/>
</div>
<div className='absolute -bottom-1 -right-1 w-8 h-8 bg-gradient-to-br from-emerald-400 to-teal-500 rounded-xl flex items-center justify-center shadow-lg'>
<Sparkles size={16} className='text-white' />
</div>
</div>
<span className='mt-5 text-gray-700 dark:text-gray-300 text-lg font-semibold'>
{t('暂无公告')}
</span>
<span className='text-gray-400 dark:text-gray-500 text-sm mt-1'>
{t('一切正常,稍后再来看看吧')}
</span>
</div>
);
}
return (
<div className='notice-content-scroll max-h-[50vh] overflow-y-auto pr-2 custom-scrollbar'>
<div className='p-4 bg-gray-50/80 dark:bg-gray-800/60 rounded-xl border border-gray-200/60 dark:border-gray-700/40'>
<div
dangerouslySetInnerHTML={{ __html: noticeContent }}
className='prose prose-sm dark:prose-invert max-w-none
prose-headings:text-gray-900 dark:prose-headings:text-gray-50 prose-headings:font-bold
prose-h1:text-xl prose-h2:text-lg prose-h3:text-base
prose-p:text-gray-600 dark:prose-p:text-gray-300 prose-p:leading-relaxed
prose-a:text-brand-deep dark:prose-a:text-brand-from prose-a:no-underline hover:prose-a:underline prose-a:font-medium
prose-strong:text-gray-800 dark:prose-strong:text-gray-100
prose-code:bg-gray-100 dark:prose-code:bg-gray-800 prose-code:text-gray-700 dark:prose-code:text-gray-300 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:text-xs
prose-pre:bg-gray-900 dark:prose-pre:bg-gray-950 prose-pre:text-gray-100 prose-pre:rounded-xl
prose-img:rounded-xl
prose-ul:space-y-1 prose-ol:space-y-1
prose-li:text-gray-600 dark:prose-li:text-gray-300'
/>
</div>
</div>
);
};
const getTypeConfig = (type) => {
const configs = {
success: {
bg: 'bg-emerald-50 dark:bg-emerald-900/20',
border: 'border-emerald-200 dark:border-emerald-800',
dot: 'bg-emerald-500',
tag: 'green',
},
warning: {
bg: 'bg-amber-50 dark:bg-amber-900/20',
border: 'border-amber-200 dark:border-amber-800',
dot: 'bg-amber-500',
tag: 'orange',
},
error: {
bg: 'bg-red-50 dark:bg-red-900/20',
border: 'border-red-200 dark:border-red-800',
dot: 'bg-red-500',
tag: 'red',
},
ongoing: {
bg: 'bg-blue-50 dark:bg-blue-900/20',
border: 'border-blue-200 dark:border-blue-800',
dot: 'bg-blue-500',
tag: 'blue',
},
default: {
bg: 'bg-gray-50 dark:bg-gray-800/50',
border: 'border-gray-200 dark:border-gray-700',
dot: 'bg-brand',
tag: 'violet',
},
};
return configs[type] || configs.default;
};
const renderAnnouncementTimeline = () => {
if (processedAnnouncements.length === 0) {
return (
<div className='py-16 flex flex-col items-center justify-center'>
<div className='relative'>
<div className='w-24 h-24 bg-gradient-to-br from-emerald-50 to-teal-50 dark:from-emerald-900/30 dark:to-teal-900/30 rounded-3xl flex items-center justify-center shadow-inner'>
<Megaphone
size={40}
className='text-emerald-300 dark:text-emerald-600'
/>
</div>
<div className='absolute -bottom-1 -right-1 w-8 h-8 bg-gradient-to-br from-emerald-400 to-teal-500 rounded-xl flex items-center justify-center shadow-lg'>
<Sparkles size={16} className='text-white' />
</div>
</div>
<span className='mt-5 text-gray-700 dark:text-gray-300 text-lg font-semibold'>
{t('暂无系统公告')}
</span>
<span className='text-gray-400 dark:text-gray-500 text-sm mt-1'>
{t('一切正常运行中')}
</span>
</div>
);
}
return (
<div className='max-h-[50vh] overflow-y-auto pr-2 custom-scrollbar space-y-3'>
{processedAnnouncements.map((item, idx) => {
const htmlContent = marked.parse(item.content || '');
const htmlExtra = item.extra ? marked.parse(item.extra) : '';
const typeConfig = getTypeConfig(item.type);
return (
<div
key={idx}
className={`group relative rounded-xl border ${typeConfig.bg} ${typeConfig.border} p-4 transition-all duration-200 hover:shadow-md ${item.isUnread ? 'ring-1 ring-brand/30 ring-offset-1 ring-offset-white dark:ring-offset-gray-900' : ''}`}
>
{/* 未读标记 */}
{item.isUnread && (
<div className='absolute -top-1.5 -right-1.5'>
<span className='relative flex h-4 w-4'>
<span className='animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-from opacity-60'></span>
<span className='relative inline-flex rounded-full h-4 w-4 bg-gradient-to-r from-brand-from to-brand-to items-center justify-center'>
<span className='text-[8px] text-white font-bold'>N</span>
</span>
</span>
</div>
)}
{/* 时间和类型标签 */}
<div className='flex items-center justify-between mb-2.5'>
<div className='flex items-center gap-2'>
<div
className={`w-2 h-2 rounded-full ${typeConfig.dot} flex-shrink-0`}
/>
<div className='flex items-center gap-1.5 text-xs'>
<span className='font-medium text-gray-700 dark:text-gray-300'>
{item.relative}
</span>
<span className='text-gray-300 dark:text-gray-600'>·</span>
<span className='text-gray-400 dark:text-gray-500 flex items-center gap-1'>
<CalendarClock size={10} />
{item.time}
</span>
</div>
</div>
{item.isUnread && (
<span className='px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider rounded-md bg-brand/10 dark:bg-brand/20 text-brand-deep dark:text-brand-from'>
NEW
</span>
)}
</div>
{/* 公告内容 */}
<div
className='prose prose-sm dark:prose-invert max-w-none
prose-p:text-gray-600 dark:prose-p:text-gray-300 prose-p:my-1 prose-p:leading-relaxed
prose-a:text-brand-deep dark:prose-a:text-brand-from prose-a:font-medium prose-a:no-underline hover:prose-a:underline
prose-strong:text-gray-800 dark:prose-strong:text-gray-100
prose-code:bg-gray-100 dark:prose-code:bg-gray-800 prose-code:text-gray-700 dark:prose-code:text-gray-300 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded prose-code:text-xs'
dangerouslySetInnerHTML={{ __html: htmlContent }}
/>
{/* 额外信息 */}
{item.extra && (
<div
className='mt-2.5 pt-2.5 border-t border-gray-200/60 dark:border-gray-700/40 text-xs text-gray-500 dark:text-gray-400'
dangerouslySetInnerHTML={{ __html: htmlExtra }}
/>
)}
</div>
);
})}
</div>
);
}; };
const renderBody = () => { const renderBody = () => {
if (activeTab === 'inApp') { if (activeTab === 'inApp') {
return renderMarkdownNotice(); if (loading) {
return (
<div className='nm-empty'>
<Spin tip={t('加载中...')}>
<div className='nm-spin-placeholder' />
</Spin>
</div>
);
} }
return renderAnnouncementTimeline(); if (!noticeContent) {
return <div className='nm-empty'>{t('暂无公告')}</div>;
}
return (
<div className='nm-notice-scroll' tabIndex={0} aria-label={t('通知')}>
<div
className='nm-markdown'
dangerouslySetInnerHTML={{ __html: noticeContent }}
/>
</div>
);
}
if (processedAnnouncements.length === 0) {
return <div className='nm-empty'>{t('暂无系统公告')}</div>;
}
return (
<div
className='nm-announcement-scroll'
tabIndex={0}
aria-label={t('系统公告')}
>
{processedAnnouncements.map((item, idx) => (
<Card key={idx} size='small'>
<div className='nm-announcement-meta'>
<span>
<Badge status={typeColors[item.type] || 'default'} />{' '}
{item.relative} · {item.time}
</span>
{item.isUnread && (
<Tag color={typeColors[item.type] || 'default'}>NEW</Tag>
)}
</div>
<div
className='nm-markdown'
dangerouslySetInnerHTML={{
__html: marked.parse(item.content || ''),
}}
/>
{item.extra && (
<div
className='nm-announcement-extra nm-markdown'
dangerouslySetInnerHTML={{ __html: marked.parse(item.extra) }}
/>
)}
</Card>
))}
</div>
);
}; };
return ( return (
<Modal <Modal
title={null} title={t('系统公告')}
visible={visible} open={visible}
onCancel={onClose} onCancel={onClose}
footer={null} width={isMobile ? 'calc(100% - 32px)' : 860}
closable={false} className='notice-modal'
size={isMobile ? 'full-width' : 'large'} rootClassName='notice-modal-root'
className='notice-modal-enhanced' styles={{
bodyStyle={{ padding: 0 }} mask: {
background: `color-mix(in srgb, ${token.colorBgMask} 70%, transparent)`,
},
}}
style={{
'--nm-surface': token.colorBgContainer,
'--nm-text': token.colorText,
'--nm-muted': token.colorTextSecondary,
'--nm-border': token.colorBorderSecondary,
'--nm-fill': token.colorFillQuaternary,
'--nm-tab-bg': token.colorBgLayout,
'--nm-primary': token.colorPrimary,
}}
maskClosable={true} maskClosable={true}
footer={
<div className='nm-footer'>
<Checkbox
checked={dismissToday}
onChange={(event) => setDismissToday(event.target.checked)}
> >
<div className='relative overflow-hidden'>
{/* 背景装饰 */}
<div className='absolute inset-0 pointer-events-none overflow-hidden'>
<div className='absolute -top-24 -right-24 w-48 h-48 bg-gradient-to-br from-brand-from/[0.08] to-brand-to/[0.08] dark:from-brand-from/15 dark:to-brand-to/15 rounded-full blur-3xl' />
<div className='absolute -bottom-24 -left-24 w-48 h-48 bg-gradient-to-br from-pink-500/[0.08] to-rose-500/[0.08] dark:from-pink-500/15 dark:to-rose-500/15 rounded-full blur-3xl' />
</div>
{/* 头部区域 */}
<div className='relative px-6 pt-6 pb-4'>
{/* 关闭按钮 */}
<button
onClick={onClose}
className='absolute top-4 right-4 p-2 rounded-full bg-gray-100/80 dark:bg-gray-700/80 hover:bg-gray-200 dark:hover:bg-gray-600 transition-all duration-200 z-10 backdrop-blur-sm hover:scale-105 active:scale-95'
aria-label='Close'
>
<X size={16} className='text-gray-500 dark:text-gray-400' />
</button>
{/* 标题 */}
<div className='flex items-center gap-3 mb-5'>
<div className='relative'>
<div className='p-2.5 bg-gradient-to-br from-brand-from to-brand-to rounded-xl shadow-lg shadow-brand/20 dark:shadow-brand/30'>
<Volume2 size={22} className='text-white' />
</div>
<div className='absolute -top-1 -right-1 w-2.5 h-2.5 bg-rose-500 rounded-full animate-pulse ring-2 ring-white dark:ring-gray-900' />
</div>
<div>
<h2 className='text-lg font-bold text-gray-900 dark:text-gray-50 flex items-center gap-2'>
{t('系统公告')}
<Sparkles size={14} className='text-amber-500' />
</h2>
<p className='text-xs text-gray-500 dark:text-gray-400 mt-0.5'>
{t('了解最新动态和通知')}
</p>
</div>
</div>
{/* Tab 切换器 */}
<div className='flex gap-1.5 p-1 bg-gray-100/80 dark:bg-gray-800/80 rounded-xl backdrop-blur-sm'>
<button
onClick={() => setActiveTab('inApp')}
className={`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${
activeTab === 'inApp'
? 'bg-white dark:bg-gray-700 text-brand-deep dark:text-brand-from shadow-sm ring-1 ring-black/5 dark:ring-white/10'
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/50 dark:hover:bg-gray-700/50'
}`}
>
<Bell size={15} />
{t('通知')}
</button>
<button
onClick={() => setActiveTab('system')}
className={`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${
activeTab === 'system'
? 'bg-white dark:bg-gray-700 text-brand-deep dark:text-brand-from shadow-sm ring-1 ring-black/5 dark:ring-white/10'
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/50 dark:hover:bg-gray-700/50'
}`}
>
<Megaphone size={15} />
{t('系统公告')}
{processedAnnouncements.filter((a) => a.isUnread).length > 0 && (
<span className='px-1.5 py-0.5 text-[10px] font-semibold bg-rose-500 text-white rounded-full min-w-[18px] text-center leading-tight'>
{processedAnnouncements.filter((a) => a.isUnread).length}
</span>
)}
</button>
</div>
</div>
{/* 内容区域 */}
<div className='relative px-6 pb-2'>{renderBody()}</div>
{/* 底部按钮区域 */}
<div className='relative px-6 py-4 border-t border-gray-200/60 dark:border-gray-700/60'>
<div className='flex items-center justify-between'>
<button
onClick={handleCloseTodayNotice}
className='flex items-center gap-1.5 px-3 py-2 text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800'
>
<Clock size={13} />
{t('今日不再提示')} {t('今日不再提示')}
</button> </Checkbox>
<button <Button
onClick={onClose} type='primary'
className='flex items-center gap-1.5 px-5 py-2 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to text-white text-sm font-medium rounded-xl shadow-md shadow-brand/20 dark:shadow-brand/30 transition-all duration-200 hover:shadow-lg hover:shadow-brand/25 hover:-translate-y-0.5 active:translate-y-0' onClick={dismissToday ? handleCloseTodayNotice : onClose}
> >
{t('我知道了')} {t('我知道了')}
<ChevronRight size={14} /> </Button>
</button>
</div>
</div>
</div> </div>
}
>
<Segmented
block
value={activeTab}
onChange={setActiveTab}
options={[
{
value: 'inApp',
label: t('通知'),
icon: <Bell size={14} strokeWidth={1.5} aria-hidden />,
},
{
value: 'system',
label: (
<span className='nm-system-label'>
{t('系统公告')}
<Badge count={unreadCount} size='small' />
</span>
),
icon: <Volume1 size={14} strokeWidth={1.5} aria-hidden />,
},
]}
/>
<div className='nm-body'>{renderBody()}</div>
</Modal> </Modal>
); );
}; };
+16 -12
View File
@@ -17,9 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import { Layout } from '@douyinfe/semi-ui'; import { Layout } from '@/components/ui';
import App from '../../App'; import App from '../../App';
import { ToastContainer } from 'react-toastify';
import React, { import React, {
useContext, useContext,
useEffect, useEffect,
@@ -58,6 +57,7 @@ const CustomerServiceFloat = lazy(() => import('../customer-service'));
// 跑马灯公告组件 // 跑马灯公告组件
import Marquee from './Marquee'; import Marquee from './Marquee';
import { useMarquee } from '../../hooks/common/useMarquee';
const { Sider, Content, Header } = Layout; const { Sider, Content, Header } = Layout;
@@ -78,7 +78,7 @@ const printConsoleWelcome = (status) => {
const PageLayout = () => { const PageLayout = () => {
const [userState, userDispatch] = useContext(UserContext); const [userState, userDispatch] = useContext(UserContext);
const [statusState, statusDispatch] = useContext(StatusContext); const [, statusDispatch] = useContext(StatusContext);
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const [drawerOpen, setDrawerOpen] = useState(false); const [drawerOpen, setDrawerOpen] = useState(false);
const { i18n } = useTranslation(); const { i18n } = useTranslation();
@@ -127,19 +127,17 @@ const PageLayout = () => {
const disableOuterScroll = const disableOuterScroll =
isExperienceCenter || isUserCenter || isHomePage || isOrgPage; isExperienceCenter || isUserCenter || isHomePage || isOrgPage;
// 需要显示可见滚动条的页面(覆盖 semi-layout 默认隐藏滚动条的行为)。 // 需要显示可见滚动条的页面(覆盖 ant-layout 默认隐藏滚动条的行为)。
// 认证页也纳入:内容确实超出视口时(小屏/长表单)用主题色滚动条明示,而不是隐形滚动导致卡片"莫名移动"。 // 认证页也纳入:内容确实超出视口时(小屏/长表单)用主题色滚动条明示,而不是隐形滚动导致卡片"莫名移动"。
const isKeyManagement = location.pathname === '/key-management'; const isKeyManagement = location.pathname === '/user-center/key-management';
const showVisibleScrollbar = isKeyManagement || isAuthPage; const showVisibleScrollbar = isKeyManagement || isAuthPage;
// 跑马灯公告是否存在(用于动态计算头部总高度)。 // 跑马灯公告是否存在(用于动态计算头部总高度)。
// 认证页(登录/注册/企业登录/企业注册)不展示:用户尚未进入平台,公告是面向平台内用户的信息。 // 认证页(登录/注册/企业登录/企业注册)不展示:用户尚未进入平台,公告是面向平台内用户的信息。
const hasMarquee = const { visible: marqueeVisible } = useMarquee();
!hideHeader && const hasMarquee = !hideHeader && !isAuthPage && marqueeVisible;
!isAuthPage && const marqueeHeight = hasMarquee ? 35 : 0;
!!statusState?.status?.marquee_content?.trim(); const headerBarHeight = isMobile ? 56 : 72;
const marqueeHeight = hasMarquee ? 40 : 0; // h-10 = 40px
const headerBarHeight = isMobile ? 56 : 64; // h-14(56px) on mobile, h-16(64px) on desktop
const totalHeaderHeight = headerBarHeight + marqueeHeight; const totalHeaderHeight = headerBarHeight + marqueeHeight;
// 滚动容器引用 // 滚动容器引用
@@ -344,6 +342,13 @@ const PageLayout = () => {
> >
{!hideHeader && ( {!hideHeader && (
<Header <Header
className={
isAuthPage
? ['/org/login', '/login'].includes(location.pathname)
? 'login-layout-header'
: 'auth-layout-header'
: undefined
}
style={{ style={{
padding: 0, padding: 0,
height: 'auto', height: 'auto',
@@ -460,7 +465,6 @@ const PageLayout = () => {
</Content> </Content>
</Layout> </Layout>
</Layout> </Layout>
<ToastContainer />
<Suspense fallback={null}> <Suspense fallback={null}>
<CustomerServiceFloat /> <CustomerServiceFloat />
</Suspense> </Suspense>
+4 -4
View File
@@ -35,7 +35,7 @@ import {
import SkeletonWrapper from './components/SkeletonWrapper'; import SkeletonWrapper from './components/SkeletonWrapper';
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi'; import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
import { Nav, Divider, Button } from '@douyinfe/semi-ui'; import { Nav, Divider, Button } from '@/components/ui';
const routerMap = { const routerMap = {
home: '/', home: '/',
@@ -457,7 +457,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
}, [persistedCollapsed, forceExpanded]); }, [persistedCollapsed, forceExpanded]);
// 选中高亮颜色(统一) // 选中高亮颜色(统一)
const SELECTED_COLOR = 'var(--semi-color-primary)'; const SELECTED_COLOR = 'var(--ui-color-primary)';
// 渲染自定义菜单项 // 渲染自定义菜单项
const renderNavItem = (item) => { const renderNavItem = (item) => {
@@ -546,7 +546,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
width: forceExpanded width: forceExpanded
? 'var(--sidebar-width)' ? 'var(--sidebar-width)'
: 'var(--sidebar-current-width)', : 'var(--sidebar-current-width)',
background: 'var(--semi-color-bg-0)', background: 'var(--ui-color-bg-0)',
}} }}
> >
<SkeletonWrapper <SkeletonWrapper
@@ -664,7 +664,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
<ChevronLeft <ChevronLeft
size={16} size={16}
strokeWidth={2.5} strokeWidth={2.5}
color='var(--semi-color-text-2)' color='var(--ui-color-text-2)'
style={{ style={{
transform: collapsed ? 'rotate(180deg)' : 'rotate(0deg)', transform: collapsed ? 'rotate(180deg)' : 'rotate(0deg)',
}} }}
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Skeleton } from '@douyinfe/semi-ui'; import { Skeleton } from '@/components/ui';
const SkeletonWrapper = ({ const SkeletonWrapper = ({
loading = false, loading = false,
@@ -64,7 +64,7 @@ const SkeletonWrapper = ({
const renderUserAreaSkeleton = () => { const renderUserAreaSkeleton = () => {
return ( return (
<div <div
className={`flex items-center p-1 rounded-full bg-semi-color-fill-0 dark:bg-semi-color-fill-1 ${className}`} className={`flex items-center p-1 rounded-full bg-ui-color-fill-0 dark:bg-ui-color-fill-1 ${className}`}
> >
<Skeleton <Skeleton
loading={true} loading={true}
@@ -19,9 +19,8 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useState, useContext } from 'react'; import React, { useState, useContext } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Button } from '@douyinfe/semi-ui'; import { Button as AntButton, Divider, Tooltip } from 'antd';
import { IconCreditCard } from '@douyinfe/semi-icons'; import { Share2, BookOpen, Download, Wallet } from 'lucide-react';
import { Share2, BookOpen, MonitorDown } from 'lucide-react';
import NewYearButton from './NewYearButton'; import NewYearButton from './NewYearButton';
import NotificationButton from './NotificationButton'; import NotificationButton from './NotificationButton';
import ThemeToggle from './ThemeToggle'; import ThemeToggle from './ThemeToggle';
@@ -141,72 +140,58 @@ const ActionButtons = ({
isActionVisible('theme') || isActionVisible('theme') ||
languageSwitchEnabled; languageSwitchEnabled;
// 进入用户区前是否需要分隔线(任一侧有按钮即显示) const actionIcon = (Icon) => <Icon size={16} strokeWidth={1.5} aria-hidden />;
const hasHeaderActions = hasPrimaryActions || hasUtilityActions;
return ( return (
<div className='flex items-center shrink-0 gap-0.5 sm:gap-2 md:gap-3'> <div className='ui-header-actions flex items-center shrink-0'>
{/* Tutorial Button - 新手教程按钮 (桌面端显示) */} {/* Tutorial Button - 新手教程按钮 (桌面端显示) */}
{isLoggedIn && isButtonVisible('tutorial') && ( {isLoggedIn && isButtonVisible('tutorial') && (
<Link to='/tutorial' className='hidden sm:block'> <Link to='/tutorial' className='hidden sm:block'>
<Button <AntButton icon={actionIcon(BookOpen)}>
theme='light' {!isMobile && t('新手教程')}
type='primary' </AntButton>
icon={<BookOpen size={15} />}
className='group/btn hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
style={{ background: 'var(--semi-color-primary-light-default)' }}
>
{!isMobile && <span className='font-medium'>{t('新手教程')}</span>}
</Button>
</Link> </Link>
)} )}
{/* Promotion Button - 推广按钮 (桌面端显示) */} {/* Promotion Button - 推广按钮 (桌面端显示) */}
{isLoggedIn && isButtonVisible('pricing') && ( {isLoggedIn && isButtonVisible('pricing') && (
<Button <AntButton
theme='light' icon={actionIcon(Share2)}
type='primary' className='hidden sm:!inline-flex'
icon={<Share2 size={15} />}
className='hidden sm:!inline-flex hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
style={{ background: 'var(--semi-color-primary-light-default)' }}
onClick={() => setPromotionVisible(true)} onClick={() => setPromotionVisible(true)}
> >
{!isMobile && <span className='font-medium'>{t('推广')}</span>} {!isMobile && t('推广')}
</Button> </AntButton>
)} )}
{/* WeyAi 桌面端下载 - 有 WeyAi 访问权限且下载页已开放时显示 (桌面端显示) */} {/* WeyAi 桌面端下载 - 有 WeyAi 访问权限且下载页已开放时显示 (桌面端显示) */}
{showWeyAiDownload && ( {showWeyAiDownload && (
<Tooltip title={t('下载 WeyAi')}>
<Link <Link
to='/weyai/download' to='/weyai/download'
className='hidden sm:block' className='hidden sm:block'
aria-label={t('下载 WeyAi 桌面端')} aria-label={t('下载 WeyAi 桌面端')}
> >
<Button <AntButton
theme='light' type='text'
type='primary' className='ui-header-download'
icon={<MonitorDown size={15} />} icon={actionIcon(Download)}
className='group/btn hover:!bg-brand/10 dark:hover:!bg-brand/20 !text-brand-deep dark:!text-brand-from !border !border-brand/30 dark:!border-brand/25 hover:!border-brand/50 !rounded-full !px-3.5 !h-8 !transition-all !duration-200 !shadow-sm hover:!shadow-md hover:!shadow-brand/20 hover:!-translate-y-0.5 active:!translate-y-0'
style={{ background: 'var(--semi-color-primary-light-default)' }}
> >
{!isMobile && ( {!isMobile && t('下载 WeyAi')}
<span className='font-medium'>{t('下载 WeyAi')}</span> </AntButton>
)}
</Button>
</Link> </Link>
</Tooltip>
)} )}
{/* Recharge Button - 充值按钮 (primary CTA) */} {/* Recharge Button - 充值按钮 */}
{isButtonVisible('recharge') && ( {isButtonVisible('recharge') && (
<Link to='/recharge'> <Link to='/recharge'>
<Button <AntButton
theme='solid' icon={actionIcon(Wallet)}
type='primary' aria-label={isMobile ? t('充值') : undefined}
icon={<IconCreditCard />}
className='!bg-gradient-to-r !from-brand !to-brand-deep dark:!from-brand dark:!to-brand-deep !text-white !border-none !rounded-full !px-3 sm:!px-4 !h-7 sm:!h-8 !font-semibold !transition-all !duration-200 !shadow-md !shadow-brand/30 hover:!shadow-lg hover:!shadow-brand/45 hover:!-translate-y-0.5 active:!translate-y-0 active:!scale-[0.98]'
> >
{!isMobile && <span className='font-medium'>{t('充值')}</span>} {!isMobile && t('充值')}
</Button> </AntButton>
</Link> </Link>
)} )}
@@ -215,15 +200,20 @@ const ActionButtons = ({
onClose={() => setPromotionVisible(false)} onClose={() => setPromotionVisible(false)}
/> />
{/* Divider */} {/* Divider:原型仅在主操作与工具按钮之间保留一条竖线 */}
{hasPrimaryActions && hasUtilityActions && ( {hasPrimaryActions && hasUtilityActions && (
<div className='hidden md:block w-px h-6 bg-gradient-to-b from-transparent via-gray-300 dark:via-neutral-600 to-transparent mx-1' /> <Divider type='vertical' className='ui-header-actions-divider' />
)} )}
{isActionVisible('newYear') && ( {isActionVisible('newYear') && (
<NewYearButton isNewYear={isNewYear} t={t} /> <NewYearButton isNewYear={isNewYear} t={t} />
)} )}
{isActionVisible('theme') && (
<ThemeToggle theme={theme} onThemeToggle={onThemeToggle} t={t} />
)}
{/* 系统公告:原型位于主题与语言之间 */}
{isActionVisible('notifications') && ( {isActionVisible('notifications') && (
<NotificationButton <NotificationButton
unreadCount={unreadCount} unreadCount={unreadCount}
@@ -232,10 +222,6 @@ const ActionButtons = ({
/> />
)} )}
{isActionVisible('theme') && (
<ThemeToggle theme={theme} onThemeToggle={onThemeToggle} t={t} />
)}
{languageSwitchEnabled && ( {languageSwitchEnabled && (
<LanguageSelector <LanguageSelector
currentLang={currentLang} currentLang={currentLang}
@@ -244,11 +230,6 @@ const ActionButtons = ({
/> />
)} )}
{/* Divider before user area(认证页 UserArea 通常为空,不渲染悬空分隔线) */}
{hasHeaderActions && !isAuthPage && (
<div className='hidden md:block w-px h-6 bg-gradient-to-b from-transparent via-gray-300 dark:via-neutral-600 to-transparent mx-1' />
)}
<UserArea <UserArea
userState={userState} userState={userState}
isLoading={isLoading} isLoading={isLoading}
@@ -257,6 +238,7 @@ const ActionButtons = ({
headerNavModules={headerNavModules} headerNavModules={headerNavModules}
rightActions={headerNavModules?.rightActions} rightActions={headerNavModules?.rightActions}
sidebarModulesAdmin={sidebarModulesAdmin} sidebarModulesAdmin={sidebarModulesAdmin}
isOrgUser={isOrgUser}
logout={logout} logout={logout}
navigate={navigate} navigate={navigate}
t={t} t={t}
+6 -13
View File
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Typography, Tag } from '@douyinfe/semi-ui'; import { Tag } from '@/components/ui';
import SkeletonWrapper from '../components/SkeletonWrapper'; import SkeletonWrapper from '../components/SkeletonWrapper';
const HeaderLogo = ({ const HeaderLogo = ({
@@ -38,29 +38,23 @@ const HeaderLogo = ({
} }
return ( return (
<Link to='/' className='group flex items-center gap-2'> <Link to='/' className='ui-header-logo group flex items-center'>
<div className='relative w-8 h-8 md:w-8 md:h-8'> <div className='ui-header-logo-mark relative'>
<SkeletonWrapper loading={isLoading || !logoLoaded} type='image' /> <SkeletonWrapper loading={isLoading || !logoLoaded} type='image' />
<img <img
src={logo} src={logo}
alt='logo' alt='logo'
className={`absolute inset-0 w-full h-full transition-all duration-200 group-hover:scale-110 rounded-full ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`} className={`absolute inset-0 w-full h-full object-contain ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`}
/> />
</div> </div>
<div className='hidden md:flex items-center gap-2'> <div className='hidden md:flex items-center gap-2 min-w-0'>
<div className='flex items-center gap-2'>
<SkeletonWrapper <SkeletonWrapper
loading={isLoading} loading={isLoading}
type='title' type='title'
width={120} width={120}
height={24} height={24}
> >
<Typography.Title <span className='ui-header-brand-name'>{systemName}</span>
heading={4}
className='!text-lg !font-semibold !mb-0'
>
{systemName}
</Typography.Title>
</SkeletonWrapper> </SkeletonWrapper>
{(isSelfUseMode || isDemoSiteMode) && !isLoading && ( {(isSelfUseMode || isDemoSiteMode) && !isLoading && (
<Tag <Tag
@@ -73,7 +67,6 @@ const HeaderLogo = ({
</Tag> </Tag>
)} )}
</div> </div>
</div>
</Link> </Link>
); );
}; };
@@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Dropdown } from '@douyinfe/semi-ui'; import { Button as AntButton } from 'antd';
import { Dropdown } from '@/components/ui';
import { Globe } from 'lucide-react'; import { Globe } from 'lucide-react';
import { CN, GB, JP, KR, TH, VN } from 'country-flag-icons/react/3x2'; import { CN, GB, JP, KR, TH, VN } from 'country-flag-icons/react/3x2';
import { useActualTheme } from '../../../context/Theme';
import { normalizeLanguage } from '../../../i18n/language'; import { normalizeLanguage } from '../../../i18n/language';
import { orderEnabledLanguages } from '../../../i18n/catalog'; import { orderEnabledLanguages } from '../../../i18n/catalog';
import { import {
@@ -36,10 +36,6 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
// i18n.language 可能带地区码(如 zh-CN / en-US),高亮判断先归一化; // i18n.language 可能带地区码(如 zh-CN / en-US),高亮判断先归一化;
// 繁体靠地区码区分,不能简单取主语言 // 繁体靠地区码区分,不能简单取主语言
const lang = normalizeLanguage(currentLang); const lang = normalizeLanguage(currentLang);
// 与 ThemeToggle 同规范:图标颜色随实际主题动态取色(Semi 暗色由
// body[theme-mode] 驱动,Tailwind dark: 类在此不可靠),菜单样式走
// semi-color token 天然亮暗自适应
const actualTheme = useActualTheme();
// 首访时后台判定可能晚于顶栏首次渲染:结果写入缓存后重新读取启用语言, // 首访时后台判定可能晚于顶栏首次渲染:结果写入缓存后重新读取启用语言,
// 避免列出后台已停用的语言 // 避免列出后台已停用的语言
@@ -54,8 +50,8 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
const getItemClassName = (isSelected) => const getItemClassName = (isSelected) =>
`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm ${ `!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm ${
isSelected isSelected
? '!bg-semi-color-primary-light-default !font-semibold' ? '!bg-ui-color-primary-light-default !font-semibold'
: 'hover:!bg-semi-color-fill-1' : 'hover:!bg-ui-color-fill-1'
}`; }`;
// 展示哪些语言、按什么顺序由后台「语言与地区」配置决定(经 /api/i18n/locale 缓存下发) // 展示哪些语言、按什么顺序由后台「语言与地区」配置决定(经 /api/i18n/locale 缓存下发)
@@ -82,21 +78,12 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
</Dropdown.Menu> </Dropdown.Menu>
} }
> >
<span className='inline-flex'> <AntButton
<Button type='text'
icon={<Globe size={20} />} icon={<Globe size={16} strokeWidth={1.5} aria-hidden />}
aria-label={t('common.changeLanguage')} aria-label={t('common.changeLanguage')}
theme='borderless' className='ui-header-icon-action'
type='tertiary'
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
style={{
color:
actualTheme === 'dark'
? 'rgba(243,244,246,0.9)'
: 'rgba(75,85,99,1)',
}}
/> />
</span>
</Dropdown> </Dropdown>
); );
}; };
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button } from '@douyinfe/semi-ui'; import { Button } from '@/components/ui';
import { IconClose, IconMenu } from '@douyinfe/semi-icons'; import { IconClose, IconMenu } from '@/components/ui/icons';
const MobileMenuButton = ({ const MobileMenuButton = ({
isConsoleRoute, isConsoleRoute,
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import { Button, Dropdown } from '@douyinfe/semi-ui'; import { Button, Dropdown } from '@/components/ui';
import { Compass, ExternalLink } from 'lucide-react'; import { Compass, ExternalLink } from 'lucide-react';
/** /**
@@ -141,7 +141,7 @@ const MobileNavMenu = ({ mainNavLinks, userState, t }) => {
aria-haspopup='menu' aria-haspopup='menu'
aria-expanded={visible} aria-expanded={visible}
icon={<Compass size={16} />} icon={<Compass size={16} />}
className='!ml-1 !px-2 !h-8 max-w-[9rem] !rounded-xl !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !transition-all !duration-200 active:!scale-95 [&_.semi-button-content]:min-w-0' className='!ml-1 !px-2 !h-8 max-w-[9rem] !rounded-xl !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !transition-all !duration-200 active:!scale-95 [&_.ant-btn-content]:min-w-0'
> >
<span className='ml-1 text-[13px] font-semibold truncate'> <span className='ml-1 text-[13px] font-semibold truncate'>
{activeItem ? activeItem.text : t('导航')} {activeItem ? activeItem.text : t('导航')}
+6 -18
View File
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react'; import React from 'react';
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { Dropdown } from '@douyinfe/semi-ui'; import { Dropdown } from '@/components/ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import SkeletonWrapper from '../components/SkeletonWrapper'; import SkeletonWrapper from '../components/SkeletonWrapper';
@@ -29,11 +29,10 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
const renderNavLinks = () => { const renderNavLinks = () => {
const baseClasses = const baseClasses =
'nav-item-enhanced flex-shrink-0 flex items-center gap-1.5 font-semibold rounded-xl transition-all duration-300 ease-out relative overflow-hidden group'; 'ui-header-nav-item flex-shrink-0 flex items-center gap-1.5 font-medium relative';
const defaultClasses = 'text-gray-600 dark:text-neutral-300'; const defaultClasses = 'text-gray-600 dark:text-neutral-300';
const hoverClasses = 'hover:text-brand-deep dark:hover:text-brand-from'; const hoverClasses = 'hover:text-brand-deep dark:hover:text-brand-from';
const activeClasses = const activeClasses = 'text-brand-deep dark:text-brand-from';
'text-brand-deep dark:text-brand-from bg-brand/5 dark:bg-brand-deep/30';
const spacingClasses = isMobile ? 'px-2 py-1 text-sm' : 'px-4 py-2'; const spacingClasses = isMobile ? 'px-2 py-1 text-sm' : 'px-4 py-2';
// Match on full path segments so /market doesn't light up on /market-detail // Match on full path segments so /market doesn't light up on /market-detail
@@ -65,11 +64,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
isActive = isPathActive(link.activePrefix || targetPath); isActive = isPathActive(link.activePrefix || targetPath);
} }
// Hover background effect component
const hoverBg = (
<span className='absolute inset-0 bg-gradient-to-r from-brand-from/10 via-brand-via/5 to-brand-to/10 dark:from-brand-from/40 dark:via-brand-via/30 dark:to-brand-to/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 rounded-xl' />
);
const finalClasses = `${baseClasses} ${spacingClasses} ${isActive ? `nav-item-active ${activeClasses}` : `${defaultClasses} ${hoverClasses}`}`; const finalClasses = `${baseClasses} ${spacingClasses} ${isActive ? `nav-item-active ${activeClasses}` : `${defaultClasses} ${hoverClasses}`}`;
if (link.items && link.items.length > 0) { if (link.items && link.items.length > 0) {
@@ -79,12 +73,9 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
trigger={'hover'} trigger={'hover'}
position={'bottomLeft'} position={'bottomLeft'}
render={ render={
<Dropdown.Menu className='!rounded-xl !border !border-gray-100 dark:!border-neutral-800 !shadow-xl !shadow-gray-200/50 dark:!shadow-black/30 !backdrop-blur-xl !bg-white/95 dark:!bg-neutral-900/95'> <Dropdown.Menu>
{link.items.map((subItem) => ( {link.items.map((subItem) => (
<Dropdown.Item <Dropdown.Item key={subItem.itemKey}>
key={subItem.itemKey}
className='!rounded-lg !mx-1 !my-0.5 hover:!bg-brand/5 dark:hover:!bg-brand-deep/30 transition-colors'
>
<Link <Link
to={subItem.to} to={subItem.to}
className='block w-full py-0.5 text-gray-700 dark:text-neutral-200 hover:text-brand-deep dark:hover:text-brand-from transition-colors' className='block w-full py-0.5 text-gray-700 dark:text-neutral-200 hover:text-brand-deep dark:hover:text-brand-from transition-colors'
@@ -98,7 +89,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
} }
> >
<div className={`${finalClasses} cursor-pointer`}> <div className={`${finalClasses} cursor-pointer`}>
{hoverBg}
{linkContent} {linkContent}
{/* Dropdown arrow */} {/* Dropdown arrow */}
<svg <svg
@@ -128,7 +118,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
rel='noopener noreferrer' rel='noopener noreferrer'
className={`${baseClasses} ${spacingClasses} ${defaultClasses} ${hoverClasses}`} className={`${baseClasses} ${spacingClasses} ${defaultClasses} ${hoverClasses}`}
> >
{hoverBg}
{linkContent} {linkContent}
{/* External link icon */} {/* External link icon */}
<svg <svg
@@ -155,7 +144,6 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
className={finalClasses} className={finalClasses}
aria-current={isActive ? 'page' : undefined} aria-current={isActive ? 'page' : undefined}
> >
{hoverBg}
{linkContent} {linkContent}
</Link> </Link>
); );
@@ -165,7 +153,7 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
return ( return (
<nav <nav
aria-label={t('主导航')} aria-label={t('主导航')}
className='flex flex-1 items-center gap-1 lg:gap-2 mx-1 sm:mx-3 md:mx-6 overflow-x-auto whitespace-nowrap scrollbar-hide min-w-0' className='ui-header-navigation flex flex-1 items-center gap-1 lg:gap-2 mx-1 sm:mx-3 md:mx-6 overflow-x-auto whitespace-nowrap scrollbar-hide min-w-0'
> >
<SkeletonWrapper <SkeletonWrapper
loading={isLoading} loading={isLoading}
@@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button, Dropdown } from '@douyinfe/semi-ui'; import { Button as AntButton } from 'antd';
import { Dropdown } from '@/components/ui';
import fireworks from 'react-fireworks'; import fireworks from 'react-fireworks';
const NewYearButton = ({ isNewYear, t }) => { const NewYearButton = ({ isNewYear, t }) => {
@@ -38,22 +39,21 @@ const NewYearButton = ({ isNewYear, t }) => {
<Dropdown <Dropdown
position='bottomRight' position='bottomRight'
render={ render={
<Dropdown.Menu className='!bg-semi-color-bg-overlay !border-semi-color-border !shadow-lg !rounded-lg dark:!bg-gray-700 dark:!border-gray-600'> <Dropdown.Menu className='!bg-ui-color-bg-overlay !border-ui-color-border !shadow-lg !rounded-lg dark:!bg-gray-700 dark:!border-gray-600'>
<Dropdown.Item <Dropdown.Item
onClick={handleNewYearClick} onClick={handleNewYearClick}
className='!text-semi-color-text-0 hover:!bg-semi-color-fill-1 dark:!text-gray-200 dark:hover:!bg-gray-600' className='!text-ui-color-text-0 hover:!bg-ui-color-fill-1 dark:!text-gray-200 dark:hover:!bg-gray-600'
> >
{t('新年快乐')} 🎉 {t('新年快乐')} 🎉
</Dropdown.Item> </Dropdown.Item>
</Dropdown.Menu> </Dropdown.Menu>
} }
> >
<Button <AntButton
theme='borderless' type='text'
type='tertiary'
icon={<span className='text-xl'>🎉</span>} icon={<span className='text-xl'>🎉</span>}
aria-label={t('新年快乐')} aria-label={t('新年快乐')}
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center !text-current hover:!bg-brand/10 dark:hover:!bg-brand/15 !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95' className='ui-header-icon-action'
/> />
</Dropdown> </Dropdown>
); );
@@ -18,64 +18,23 @@ For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React from 'react';
import { Button, Badge } from '@douyinfe/semi-ui'; import { Badge, Button, Tooltip } from 'antd';
import { useActualTheme } from '../../../context/Theme'; import { Volume1 } from 'lucide-react';
// 自定义通知图标 — 圆角方形气泡 + 圆点指示 // 系统公告入口:34px text 按钮、16px 喇叭图标。
const NoticeIcon = ({ size = 19, color = 'currentColor' }) => ( // 显隐(rightActions.notifications)、点击(打开 NoticeModal)与未读数均沿用原逻辑。
<svg const NotificationButton = ({ unreadCount, onNoticeOpen, t }) => (
width={size} <Tooltip title={t('系统公告')}>
height={size} <Badge count={unreadCount} overflowCount={99} size='small'>
viewBox='0 0 24 24' <Button
fill='none' type='text'
xmlns='http://www.w3.org/2000/svg' className='ui-header-icon-action'
> aria-label={t('系统公告')}
<rect icon={<Volume1 size={16} strokeWidth={1.5} aria-hidden />}
x='3' onClick={onNoticeOpen}
y='4'
width='18'
height='14'
rx='4'
stroke={color}
strokeWidth='1.7'
/> />
<circle cx='8.5' cy='11' r='1.25' fill={color} />
<circle cx='12' cy='11' r='1.25' fill={color} />
<circle cx='15.5' cy='11' r='1.25' fill={color} />
<path
d='M8 18l2.5-3h3L16 18'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
strokeLinejoin='round'
/>
</svg>
);
const NotificationButton = ({ unreadCount, onNoticeOpen, t }) => {
const actualTheme = useActualTheme();
const isDark = actualTheme === 'dark';
const buttonProps = {
icon: <NoticeIcon size={19} />,
'aria-label': t('系统公告'),
onClick: onNoticeOpen,
theme: 'borderless',
type: 'tertiary',
className:
'!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95',
style: { color: isDark ? 'rgba(243,244,246,0.9)' : 'rgba(75,85,99,1)' },
};
if (unreadCount > 0) {
return (
<Badge count={unreadCount} type='danger' overflowCount={99}>
<Button {...buttonProps} />
</Badge> </Badge>
</Tooltip>
); );
}
return <Button {...buttonProps} />;
};
export default NotificationButton; export default NotificationButton;
+13 -244
View File
@@ -17,257 +17,26 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import React, { useMemo } from 'react'; import React from 'react';
import { Button, Dropdown } from '@douyinfe/semi-ui'; import { Button, Tooltip } from 'antd';
import { Moon, Sun } from 'lucide-react';
import { useActualTheme } from '../../../context/Theme'; import { useActualTheme } from '../../../context/Theme';
// 自定义浅色图标 — 带光芒的太阳 const ThemeToggle = ({ onThemeToggle, t }) => {
const LightIcon = ({ size = 18, color = 'currentColor' }) => ( const isDark = useActualTheme() === 'dark';
<svg const label = isDark ? t('切换至亮色主题') : t('切换至暗色主题');
width={size} const Icon = isDark ? Sun : Moon;
height={size}
viewBox='0 0 24 24'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<circle cx='12' cy='12' r='4.5' stroke={color} strokeWidth='1.7' />
<line
x1='12'
y1='2.5'
x2='12'
y2='5'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='12'
y1='19'
x2='12'
y2='21.5'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='21.5'
y1='12'
x2='19'
y2='12'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='5'
y1='12'
x2='2.5'
y2='12'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='18.7'
y1='5.3'
x2='16.9'
y2='7.1'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='7.1'
y1='16.9'
x2='5.3'
y2='18.7'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='18.7'
y1='18.7'
x2='16.9'
y2='16.9'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='7.1'
y1='7.1'
x2='5.3'
y2='5.3'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
</svg>
);
// 自定义深色图标 — 带星星的弯月
const DarkIcon = ({ size = 18, color = 'currentColor' }) => (
<svg
width={size}
height={size}
viewBox='0 0 24 24'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<path
d='M20.5 13.5a8.5 8.5 0 01-10-10A8.5 8.5 0 1020.5 13.5z'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
strokeLinejoin='round'
/>
<circle cx='18' cy='5' r='0.8' fill={color} />
<circle cx='20.5' cy='8' r='0.6' fill={color} />
<circle cx='16' cy='3' r='0.5' fill={color} />
</svg>
);
// 自定义自动模式图标 — 半日半月
const AutoIcon = ({ size = 18, color = 'currentColor' }) => (
<svg
width={size}
height={size}
viewBox='0 0 24 24'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<circle cx='12' cy='12' r='8.5' stroke={color} strokeWidth='1.7' />
<path d='M12 3.5v17a8.5 8.5 0 000-17z' fill={color} fillOpacity='0.2' />
<line
x1='12'
y1='1.5'
x2='12'
y2='3.5'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='12'
y1='20.5'
x2='12'
y2='22.5'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='22.5'
y1='12'
x2='20.5'
y2='12'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
<line
x1='3.5'
y1='12'
x2='1.5'
y2='12'
stroke={color}
strokeWidth='1.7'
strokeLinecap='round'
/>
</svg>
);
const ThemeToggle = ({ theme, onThemeToggle, t }) => {
const actualTheme = useActualTheme();
const themeOptions = useMemo(
() => [
{
key: 'light',
icon: <LightIcon />,
buttonIcon: <LightIcon />,
label: t('浅色模式'),
description: t('始终使用浅色主题'),
},
{
key: 'dark',
icon: <DarkIcon />,
buttonIcon: <DarkIcon />,
label: t('深色模式'),
description: t('始终使用深色主题'),
},
{
key: 'auto',
icon: <AutoIcon />,
buttonIcon: <AutoIcon />,
label: t('自动模式'),
description: t('跟随系统主题设置'),
},
],
[t],
);
const getItemClassName = (isSelected) =>
isSelected
? '!bg-semi-color-primary-light-default !font-semibold'
: 'hover:!bg-semi-color-fill-1';
const currentButtonIcon = useMemo(() => {
const currentOption = themeOptions.find((option) => option.key === theme);
return currentOption?.buttonIcon || themeOptions[2].buttonIcon;
}, [theme, themeOptions]);
return ( return (
<Dropdown <Tooltip title={label}>
position='bottomRight'
render={
<Dropdown.Menu>
{themeOptions.map((option) => (
<Dropdown.Item
key={option.key}
icon={option.icon}
onClick={() => onThemeToggle(option.key)}
className={getItemClassName(theme === option.key)}
>
<div className='flex flex-col'>
<span>{option.label}</span>
<span className='text-xs text-semi-color-text-2'>
{option.description}
</span>
</div>
</Dropdown.Item>
))}
{theme === 'auto' && (
<>
<Dropdown.Divider />
<div className='px-3 py-2 text-xs text-semi-color-text-2'>
{t('当前跟随系统')}:
{actualTheme === 'dark' ? t('深色') : t('浅色')}
</div>
</>
)}
</Dropdown.Menu>
}
>
{/* Semi can resolve a DOM trigger directly without findDOMNode. */}
<span className='inline-flex'>
<Button <Button
icon={currentButtonIcon} type='text'
icon={<Icon size={16} strokeWidth={1.5} aria-hidden />}
aria-label={t('切换主题')} aria-label={t('切换主题')}
theme='borderless' className='ui-header-icon-action'
type='tertiary' onClick={() => onThemeToggle(isDark ? 'light' : 'dark')}
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
style={{
color:
actualTheme === 'dark'
? 'rgba(243,244,246,0.9)'
: 'rgba(75,85,99,1)',
}}
/> />
</span> </Tooltip>
</Dropdown>
); );
}; };
+124 -271
View File
@@ -17,19 +17,30 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import React from 'react'; import React, { useState } from 'react';
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { Avatar, Button, Dropdown, Typography } from '@douyinfe/semi-ui'; import { Avatar, Button as AntButton, Dropdown as AntDropdown } from 'antd';
import { ChevronDown, User, Key, LogOut } from 'lucide-react'; import { Button } from '@/components/ui';
import { import { ChevronDown, UserRound, KeyRound, LogOut } from 'lucide-react';
getUserAvatarUrl, import { getUserAvatarUrl, isAuthPagePath } from '../../../helpers';
stringToColor,
isAuthPagePath,
} from '../../../helpers';
import SkeletonWrapper from '../components/SkeletonWrapper'; import SkeletonWrapper from '../components/SkeletonWrapper';
import { useActualTheme } from '../../../context/Theme';
import { isHeaderModuleEnabled } from '../../../constants/headerNavModules'; import { isHeaderModuleEnabled } from '../../../constants/headerNavModules';
// 头像菜单项:图标框 + 标题 + 说明(原型 account-menu-label)
const AccountMenuLabel = ({ icon, tone, title, description }) => (
<div className='ui-account-menu-label'>
<span className={`ui-account-menu-icon ui-account-menu-icon-${tone}`}>
{icon}
</span>
<span>
{title}
<small>{description}</small>
</span>
</div>
);
const MENU_ICON_PROPS = { size: 18, strokeWidth: 1.65, 'aria-hidden': true };
const UserArea = ({ const UserArea = ({
userState, userState,
isLoading, isLoading,
@@ -38,13 +49,13 @@ const UserArea = ({
headerNavModules, headerNavModules,
rightActions = {}, rightActions = {},
sidebarModulesAdmin = {}, sidebarModulesAdmin = {},
isOrgUser = false,
logout, logout,
navigate, navigate,
t, t,
}) => { }) => {
const location = useLocation(); const location = useLocation();
const actualTheme = useActualTheme(); const [open, setOpen] = useState(false);
const isDark = actualTheme === 'dark';
const isActionVisible = (key) => rightActions?.[key] !== false; const isActionVisible = (key) => rightActions?.[key] !== false;
const hasHeaderModuleConfig = const hasHeaderModuleConfig =
headerNavModules && Object.keys(headerNavModules).length > 0; headerNavModules && Object.keys(headerNavModules).length > 0;
@@ -73,271 +84,113 @@ const UserArea = ({
if (userState.user) { if (userState.user) {
const displayName = userState.user.display_name || userState.user.username; const displayName = userState.user.display_name || userState.user.username;
const avatarUrl = getUserAvatarUrl(userState.user); const avatarUrl = getUserAvatarUrl(userState.user);
return ( const avatarInitial = displayName[0].toUpperCase();
<Dropdown
trigger='hover'
position='bottomRight'
showTick
render={
<Dropdown.Menu
className='!min-w-[180px] !p-2 !backdrop-blur-xl !border !shadow-xl !rounded-xl'
style={{
backgroundColor: isDark
? 'rgba(31,41,55,0.95)'
: 'rgba(255,255,255,0.95)',
borderColor: isDark ? 'rgba(55,65,81,1)' : 'rgba(243,244,246,1)',
boxShadow: isDark
? '0 20px 25px -5px rgba(0,0,0,0.3)'
: '0 20px 25px -5px rgba(0,0,0,0.05)',
}}
>
{/* 用户信息头部 */}
<div
className='px-3 py-2 mb-2 border-b'
style={{
borderColor: isDark
? 'rgba(55,65,81,1)'
: 'rgba(243,244,246,1)',
}}
>
<div className='flex items-center gap-3'>
<Avatar
size='small'
src={avatarUrl}
color={stringToColor(displayName)}
className='!w-8 !h-8 !text-xs'
>
{displayName[0].toUpperCase()}
</Avatar>
<div>
<div
className='text-sm font-semibold'
style={{
color: isDark
? 'rgba(243,244,246,0.9)'
: 'rgba(31,41,55,1)',
}}
>
{displayName}
</div>
<div
className='text-xs'
style={{
color: isDark
? 'rgba(107,114,128,1)'
: 'rgba(156,163,175,1)',
}}
>
{userState.user.email || t('已登录')}
</div>
</div>
</div>
</div>
{isActionVisible('userSettings') && const showSettings =
isActionVisible('userSettings') &&
isTopNavModuleVisible('userCenter') && isTopNavModuleVisible('userCenter') &&
isSidebarModuleVisible('userCenter', 'settings') && ( isSidebarModuleVisible('userCenter', 'settings');
<Dropdown.Item // 「秘钥管理快捷入口」由 rightActions.keyManagement 单独控制(运营设置→顶栏管理)。
onClick={() => { // 个人用户的 /user-center/key-management 路由不依赖顶栏模块是否显示,故顶栏导航隐藏该模块时
navigate('/user-center/settings'); // 头像菜单仍保留入口;企业员工只有在其顶栏模块放开时路由才被放行,继续联动判断。
}} const showKeyManagement =
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200' isActionVisible('keyManagement') &&
style={{ (!isOrgUser || isTopNavModuleVisible('keyManagement'));
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)',
}}
>
<div className='flex items-center gap-3'>
<div
className='w-8 h-8 rounded-lg flex items-center justify-center'
style={{
background: isDark
? 'rgba(30,58,138,0.5)'
: 'linear-gradient(to bottom right, rgba(219,234,254,1), rgba(224,231,255,1))',
}}
>
<User
size={16}
style={{
color: isDark
? 'rgba(96,165,250,1)'
: 'rgba(37,99,235,1)',
}}
/>
</div>
<div>
<div
className='font-medium'
style={{
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
}}
>
{t('个人设置')}
</div>
<div
className='text-xs'
style={{
color: isDark
? 'rgba(107,114,128,1)'
: 'rgba(156,163,175,1)',
}}
>
{t('管理账户信息')}
</div>
</div>
</div>
</Dropdown.Item>
)}
{isActionVisible('keyManagement') && const items = [];
isTopNavModuleVisible('keyManagement') && ( if (showSettings) {
<Dropdown.Item items.push({
onClick={() => { key: 'settings',
navigate('/key-management'); label: (
}} <AccountMenuLabel
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200' tone='user'
style={{ icon={<UserRound {...MENU_ICON_PROPS} />}
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)', title={t('个人设置')}
}} description={t('管理账户信息')}
>
<div className='flex items-center gap-3'>
<div
className='w-8 h-8 rounded-lg flex items-center justify-center'
style={{
background: isDark
? 'rgba(120,53,15,0.5)'
: 'linear-gradient(to bottom right, rgba(254,243,199,1), rgba(255,237,213,1))',
}}
>
<Key
size={16}
style={{
color: isDark
? 'rgba(251,191,36,1)'
: 'rgba(217,119,6,1)',
}}
/> />
</div> ),
<div> onClick: () => navigate('/user-center/settings'),
<div });
className='font-medium'
style={{
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
}}
>
{t('秘钥管理')}
</div>
<div
className='text-xs'
style={{
color: isDark
? 'rgba(107,114,128,1)'
: 'rgba(156,163,175,1)',
}}
>
{t('查看和管理API秘钥')}
</div>
</div>
</div>
</Dropdown.Item>
)}
<div
className='my-2 border-t'
style={{
borderColor: isDark
? 'rgba(55,65,81,1)'
: 'rgba(243,244,246,1)',
}}
/>
<Dropdown.Item
onClick={logout}
className='!px-3 !py-2.5 !rounded-lg !text-sm !transition-all !duration-200'
style={{
color: isDark ? 'rgba(229,231,235,1)' : 'rgba(55,65,81,1)',
}}
>
<div className='flex items-center gap-3'>
<div
className='w-8 h-8 rounded-lg flex items-center justify-center'
style={{
background: isDark
? 'rgba(127,29,29,0.5)'
: 'linear-gradient(to bottom right, rgba(254,226,226,1), rgba(255,228,230,1))',
}}
>
<LogOut
size={16}
style={{
color: isDark
? 'rgba(248,113,113,1)'
: 'rgba(220,38,38,1)',
}}
/>
</div>
<div>
<div
className='font-medium'
style={{
color: isDark ? 'rgba(243,244,246,0.9)' : undefined,
}}
>
{t('退出登录')}
</div>
<div
className='text-xs'
style={{
color: isDark
? 'rgba(107,114,128,1)'
: 'rgba(156,163,175,1)',
}}
>
{t('安全退出账户')}
</div>
</div>
</div>
</Dropdown.Item>
</Dropdown.Menu>
} }
> if (showKeyManagement) {
<span className='inline-flex'> items.push({
<Button key: 'keys',
theme='borderless' label: (
type='tertiary' <AccountMenuLabel
className='flex items-center gap-2 !pl-1.5 !pr-2.5 !py-1.5 !h-10 !rounded-full hover:!bg-brand/10 dark:hover:!bg-brand/15 !bg-transparent !transition-all !duration-200 hover:!-translate-y-0.5 group' tone='key'
> icon={<KeyRound {...MENU_ICON_PROPS} />}
<div className='relative'> title={t('密钥管理')}
<Avatar description={t('查看和管理 API 密钥')}
size='small'
src={avatarUrl}
color={stringToColor(displayName)}
className='!w-7 !h-7 !text-xs ring-2 ring-white dark:ring-gray-800 group-hover:!ring-brand/40 dark:group-hover:!ring-brand/50 transition-all'
>
{displayName[0].toUpperCase()}
</Avatar>
{/* 在线状态点 */}
<span className='absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 bg-emerald-500 border-2 border-white dark:border-gray-800 rounded-full' />
</div>
<span className='hidden md:flex flex-col items-start'>
<Typography.Text
className='!text-sm !font-medium !leading-none'
style={{
color: isDark ? 'rgba(243,244,246,0.9)' : 'rgba(55,65,81,1)',
}}
>
{displayName}
</Typography.Text>
</span>
<ChevronDown
size={14}
style={{
color: isDark ? 'rgba(209,213,219,1)' : 'rgba(156,163,175,1)',
}}
className='group-hover:!opacity-80 transition-colors'
/> />
</Button> ),
</span> onClick: () => navigate('/user-center/key-management'),
</Dropdown> });
}
items.push({ key: 'account-divider', type: 'divider' });
items.push({
key: 'logout',
label: (
<AccountMenuLabel
tone='logout'
icon={<LogOut {...MENU_ICON_PROPS} />}
title={t('退出登录')}
description={t('安全退出账户')}
/>
),
onClick: logout,
});
return (
<AntDropdown
trigger={['hover']}
placement='bottomRight'
open={open}
onOpenChange={setOpen}
overlayClassName='ui-account-dropdown'
menu={{ items, onClick: () => setOpen(false) }}
popupRender={(menu) => (
<div className='ui-account-panel'>
<div className='ui-account-summary'>
<Avatar
shape='square'
size={40}
src={avatarUrl}
className='ui-account-avatar'
>
{avatarInitial}
</Avatar>
<div>
<strong>{displayName}</strong>
<span>{userState.user.email || t('已登录')}</span>
</div>
</div>
{menu}
</div>
)}
>
<AntButton
type='text'
className='ui-header-account'
aria-haspopup='menu'
aria-expanded={open}
>
<Avatar
shape='square'
size={38}
src={avatarUrl}
className='ui-account-avatar'
>
{avatarInitial}
</Avatar>
<span className='ui-header-account-name'>{displayName}</span>
<ChevronDown
size={10}
strokeWidth={1.5}
aria-hidden
className={`ui-header-account-chevron${open ? ' is-open' : ''}`}
/>
</AntButton>
</AntDropdown>
); );
} else { } else {
if (isAuthPage) { if (isAuthPage) {
@@ -356,7 +209,7 @@ const UserArea = ({
let registerButtonClasses = `${commonSizingAndLayoutClass}`; let registerButtonClasses = `${commonSizingAndLayoutClass}`;
const loginButtonTextSpanClass = const loginButtonTextSpanClass =
'!text-xs !text-semi-color-text-1 dark:!text-gray-300 !p-1.5'; '!text-xs !text-ui-color-text-1 dark:!text-gray-300 !p-1.5';
const registerButtonTextSpanClass = '!text-xs !text-white !p-1.5'; const registerButtonTextSpanClass = '!text-xs !text-white !p-1.5';
if (showRegisterButton) { if (showRegisterButton) {

Some files were not shown because too many files have changed in this diff Show More