Compare commits

...

6 Commits

Author SHA1 Message Date
zhanjunhao daf20157ce feat: 恢复服务监控菜单入口 2026-11-19 10:59:02 +08:00
zhanjunhao 001fbac538 fix(ui): 完善界面交互与开发配置 2026-11-19 10:48:17 +08:00
zhanjunhao b9eae439ba fix(channel): 修复模型填入与检查问题 2026-11-19 10:48:17 +08:00
zhanjunhao d076fb5325 fix(ui): 统一下载页主题与智能路由页签间距 2026-11-19 10:48:17 +08:00
zhanjunhao 4c6e9acb6e fix(ui): 修复档位回填与筛选布局 2026-11-19 10:48:16 +08:00
zhanjunhao dbdfed378e fix(ui): 统一认证页输入框 36px 与视觉样式 2026-11-19 10:48:16 +08:00
113 changed files with 3516 additions and 3690 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
{
"permissions": {
"allow": ["Bash(go build:*)"]
}
}
},
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"promptCacheTtl": "1h"
}
+1 -1
View File
@@ -1,7 +1,7 @@
# Loaded by npm run dev. Override locally in .env.development.local.
# Public configuration only; VITE_* values are exposed to the browser.
VITE_REACT_APP_SERVER_URL=
VITE_CLOUD_BRAIN_UI_ENABLED=false
VITE_CLOUD_BRAIN_UI_ENABLED=true
# Vite development proxy only. Keep the browser URL empty to use this proxy.
DEV_PROXY_TARGET=http://134.175.227.134:13000
+8
View File
@@ -0,0 +1,8 @@
UI_ORG_NAME=测试企业1
UI_ORG_USER=test111
UI_ORG_PASS=2uT7anlhzR5w
UI_PERSONAL_USER=test222
UI_PERSONAL_PASS=12345678
UI_VISUAL_OFFSCREEN=1
UI_ADMIN_USER=ltadmin
UI_ADMIN_PASS=DoWtIMTli7njHYQeCNaR
+2 -4
View File
@@ -62,9 +62,7 @@ yarn-debug.log*
yarn-error.log*
.idea
yarn.lock
# i18n 批次中间产物(可由 scripts/i18n_kt_batches.cjs 重新生成,勿入库)
scripts/kt_batches/
scripts/kt_out/
# 本地 Playwright 登录凭据(GLOBAL_UI_BASELINE §6:未跟踪且已忽略,禁止提交)
/.env.playwright.local
scripts/kt_out/
+4 -4
View File
@@ -28,7 +28,7 @@
- **技术栈**:React 18.3、react-router-dom 6.30、Vite 5.4,JS / JSX(未启用 TypeScript);antd 6.7.0 + @ant-design/icons 6.3.4(精确锁定);axios、i18next、Tailwind 3、lucide-react;专用组件 VChart、XYFlow、Quill、Joyride。
- **环境**:`package.json` 要求 Node ≥ 22.13.0、npm ≥ 10,`packageManager` 指定 npm 10.9.9;依赖范围以 `package.json`、解析版本以 `package-lock.json` 为准,安装使用 `npm ci`,升级依赖时同步 lock。
- **入口与别名**:`@` → `src`;`index.html` → `src/index.jsx` → `src/components/layout/PageLayout.jsx` → `src/App.jsx`(路由、懒加载、守卫)。开发地址以 `dev.log` 最后一个 `Local:` 为准。
- **入口与别名**:`@` → `src`;`index.html` → `src/index.jsx` → `src/components/layout/PageLayout.jsx` → `src/App.jsx`(路由、懒加载、守卫)。开发服务按全局基线第 7.1 节结合项目目录、启动日志和监听进程发现,优先复用已有服务。
- **三个中心**:控制台 `/console/*`;企业中心 `/org/*`(子路由在 `src/pages/Organization/index.jsx`);用户中心 `/user-center/*`。
- **请求**:`src/helpers/api.js` 的 `API`(统一报错、GET 去重、`/api/org/*` 自动带 `X-Org-Id`),响应 `{ success, message, data }`。
- **状态**:页面状态放模块 hook;全局只用 `src/context/{User,Status,Theme,Org,Playground}`。
@@ -102,7 +102,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
## 7. 开发、验收与交付
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。
2. **服务与浏览器**:复用已运行服务,Base URL 只取 `dev.log` 最后一个 `Local:`;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。
2. **服务与浏览器**:优先通过项目目录、启动日志和监听进程查找并验证用户已运行的开发服务;仅确认不存在时才启动新服务,细节见全局基线第 7.1 节;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。
3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851;正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。
4. **检查**:`npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`,涉及依赖或图标时加 `npm run check:ui`;纯文档改动只需 `npx prettier --check <文件>` 与 `git diff --check`。构建须先经用户同意,输出到系统临时目录(如 `npx vite build --outDir <临时目录> --emptyOutDir`),不覆盖 `dist/`。
5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。
@@ -113,7 +113,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 无设计依据的渐变、玻璃、发光、浮起与动效;生成插画。
- 伪造线上数据、开放隐藏菜单、绕过真实 UI 登录;点击真实支付、购买、升级、删除账户的确认按钮。
- 删除或跳过已受跟踪的测试;隐藏失败;把模拟结果或本地截图基线写成真实通过或像素一致。
- 对外输出凭据值,或将凭据、storageState、截图与报告提交到 Git;本地脱敏报告按第 7 节交付。
- 对外输出凭据值,或将凭据、storageState、截图与报告提交到 Git(仅 `.env.playwright.local` 中的测试账号按用户约定允许入库);本地脱敏报告按第 7 节交付。
## 9. 维护
@@ -122,7 +122,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
> 规范版本:v3.4 · 更新:2026-11-17
> 规范版本:v3.5 · 更新:2026-11-18
## 10. 工具差异(本节允许不同)
+4 -4
View File
@@ -28,7 +28,7 @@
- **技术栈**:React 18.3、react-router-dom 6.30、Vite 5.4,JS / JSX(未启用 TypeScript);antd 6.7.0 + @ant-design/icons 6.3.4(精确锁定);axios、i18next、Tailwind 3、lucide-react;专用组件 VChart、XYFlow、Quill、Joyride。
- **环境**:`package.json` 要求 Node ≥ 22.13.0、npm ≥ 10,`packageManager` 指定 npm 10.9.9;依赖范围以 `package.json`、解析版本以 `package-lock.json` 为准,安装使用 `npm ci`,升级依赖时同步 lock。
- **入口与别名**:`@` → `src`;`index.html` → `src/index.jsx` → `src/components/layout/PageLayout.jsx` → `src/App.jsx`(路由、懒加载、守卫)。开发地址以 `dev.log` 最后一个 `Local:` 为准。
- **入口与别名**:`@` → `src`;`index.html` → `src/index.jsx` → `src/components/layout/PageLayout.jsx` → `src/App.jsx`(路由、懒加载、守卫)。开发服务按全局基线第 7.1 节结合项目目录、启动日志和监听进程发现,优先复用已有服务。
- **三个中心**:控制台 `/console/*`;企业中心 `/org/*`(子路由在 `src/pages/Organization/index.jsx`);用户中心 `/user-center/*`。
- **请求**:`src/helpers/api.js` 的 `API`(统一报错、GET 去重、`/api/org/*` 自动带 `X-Org-Id`),响应 `{ success, message, data }`。
- **状态**:页面状态放模块 hook;全局只用 `src/context/{User,Status,Theme,Org,Playground}`。
@@ -102,7 +102,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
## 7. 开发、验收与交付
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。
2. **服务与浏览器**:复用已运行服务,Base URL 只取 `dev.log` 最后一个 `Local:`;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。
2. **服务与浏览器**:优先通过项目目录、启动日志和监听进程查找并验证用户已运行的开发服务;仅确认不存在时才启动新服务,细节见全局基线第 7.1 节;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。
3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851;正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。
4. **检查**:`npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`,涉及依赖或图标时加 `npm run check:ui`;纯文档改动只需 `npx prettier --check <文件>` 与 `git diff --check`。构建须先经用户同意,输出到系统临时目录(如 `npx vite build --outDir <临时目录> --emptyOutDir`),不覆盖 `dist/`。
5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。
@@ -113,7 +113,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 无设计依据的渐变、玻璃、发光、浮起与动效;生成插画。
- 伪造线上数据、开放隐藏菜单、绕过真实 UI 登录;点击真实支付、购买、升级、删除账户的确认按钮。
- 删除或跳过已受跟踪的测试;隐藏失败;把模拟结果或本地截图基线写成真实通过或像素一致。
- 对外输出凭据值,或将凭据、storageState、截图与报告提交到 Git;本地脱敏报告按第 7 节交付。
- 对外输出凭据值,或将凭据、storageState、截图与报告提交到 Git(仅 `.env.playwright.local` 中的测试账号按用户约定允许入库);本地脱敏报告按第 7 节交付。
## 9. 维护
@@ -122,7 +122,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
> 规范版本:v3.4 · 更新:2026-11-17
> 规范版本:v3.5 · 更新:2026-11-18
## 10. 工具差异(本节允许不同)
+8 -5
View File
@@ -26,6 +26,8 @@ Monkey AI Web 是从总仓库 `weiyuan` 分支独立出来的前端工程,包
环境要求:Node.js ≥ 22.13.0,npm ≥ 10(`packageManager` 为 npm 10.9.9)。统一使用 npm,不要用 Bun 或 Yarn 生成其他锁文件。
仓库仅维护 `package-lock.json`,已移除 `bun.lock`,并忽略 `bun.lock` / `bun.lockb`。本地与 CI 使用 `npm ci` 安装依赖、`npm run dev` 启动开发服务、`npm run build` 构建;Vercel 已显式配置 npm 安装与构建命令。
```bash
git clone --branch weiyuan https://git.weytoken.com/qiubs/monkey-ai-web.git
cd monkey-ai-web
@@ -65,7 +67,7 @@ npm run dev
| --- | --- |
| `DEV_PROXY_TARGET` | 开发代理的后端地址(仅 Vite 使用) |
| `VITE_REACT_APP_SERVER_URL` | 浏览器直连的后端根地址,留空为同源 |
| `VITE_CLOUD_BRAIN_UI_ENABLED` | 云脑入口与路由开关,默认关闭 |
| `VITE_CLOUD_BRAIN_UI_ENABLED` | 云脑入口与路由开关,开发环境默认开启,生产环境默认关闭 |
| `VITE_SKILL_MARKET_MOCK` | 设为 `true` 时技能超市进入本地演示模式;默认不设置 |
| `VITE_UMAMI_WEBSITE_ID`、`VITE_UMAMI_SCRIPT_URL` | Umami 统计,ID 留空则不注入脚本 |
| `VITE_GOOGLE_ANALYTICS_ID` | Google Analytics,留空则不注入 |
@@ -79,6 +81,7 @@ monkey-ai-web/
├── docs/ # 开发与组件规范、页面 UI 规范、变更记录(入口 docs/README.md)
├── public/ # 原样复制到产物的静态资源
├── scripts/ # 开发启动、单测发现、UI 依赖审计、品牌图标生成、i18n 辅助脚本
│ └── vite/ # 自定义 Vite 插件:legacy-css-layers.js 提供旧浏览器 @layer 样式兜底
├── src/
│ ├── index.jsx # React 挂载、语言初始化、全局 Provider
│ ├── App.jsx # 路由、懒加载、访问守卫
@@ -156,7 +159,7 @@ monkey-ai-web/
### 本地 Playwright 登录配置
本机自动化登录入口为 `e2e/auth-login/run.mjs`(本地验收脚本,Git 忽略)。在 `.env.playwright.local` 中配置 `UI_ORG_NAME`、`UI_ORG_USER`、`UI_ORG_PASS`、`UI_PERSONAL_USER`、`UI_PERSONAL_PASS`;写入真实凭据前,用 `git ls-files -- .env.playwright.local` 确认未跟踪(应无输出),再用 `git check-ignore -- .env.playwright.local` 确认已忽略(应输出路径)。已跟踪文件不会因新增忽略规则而解除跟踪;检查不满足时先记录风险,跟踪与历史处置另行授权,不向该文件写入真实凭据。账号密码不写入脚本或提交。运行时由 Node 加载到环境变量:
本机自动化登录入口为 `e2e/auth-login/run.mjs`(本地验收脚本,Git 忽略)。在 `.env.playwright.local` 中配置 `UI_ORG_NAME`、`UI_ORG_USER`、`UI_ORG_PASS`、`UI_PERSONAL_USER`、`UI_PERSONAL_PASS`。该文件只保存测试账号,按用户约定不作 Git 忽略,允许提交;不得把值写入脚本、日志、截图注释或报告。其他凭据与 storageState 仍不入库。运行时由 Node 加载到环境变量:
```powershell
node --env-file=.env.playwright.local e2e/auth-login/run.mjs
@@ -164,9 +167,9 @@ node --env-file=.env.playwright.local e2e/auth-login/run.mjs
收到通用测试指令时,代理按 `docs/ui/GLOBAL_UI_BASELINE.md` 第 6 节自动判断受影响页面与账号类型,选择登录流程和脚本参数,无需用户重复说明个人或企业登录。手工运行脚本时,超管个人登录单独使用 `UI_ADMIN_USER` / `UI_ADMIN_PASS`,添加 `--admin` 选择超管账号,默认使用普通个人账号。仅执行个人端阶段可添加 `--personal-only`,例如 `node --env-file=.env.playwright.local e2e/auth-login/run.mjs --personal-only --admin`。超管同样通过 `/login` 的真实 UI 登录,不绕过权限校验。
脚本从 `dev.log` 最后一个 `Local:` 提取并验证系统地址,使用本机 Chrome 离屏串行执行企业 A/B 状态判定、真实 UI 登录、后台主体断言、个人端全新 Context 登录和 UI 退出。企业 A 路径先填写企业名称并点击“下一步”,B 路径直接填写登录名和密码;不可覆盖的路径单独记录。后续搜索按钮验收拦截非 GET 写请求;截图、脱敏失败记录与供后续用例复用的 storageState 保存在 `report/auth-login-<时间>/`,均为本地忽略产物。storageState 含会话凭据,不上传、不提交;登录规则见 `docs/ui/GLOBAL_UI_BASELINE.md` 第 6 节。
测试先通过项目目录、启动日志与监听进程查找并验证已有开发服务;历史日志中的失效地址不能作为新启服务的依据。仅确认本项目服务不存在时才启动,结束时只清理本次启动的进程。项目 Playwright 配置和专项验收通过 `scripts/dev-service.mjs` 自动发现并复用服务(验证 Vite 源码映射属于当前项目,兼容 UTF-8 / UTF-16LE 日志);显式目标仍按调用方配置执行。本地登录脚本同样先发现已有服务,使用本机 Chrome 离屏串行执行企业 A/B 状态判定、真实 UI 登录、后台主体断言、个人端全新 Context 登录和 UI 退出。企业 A 路径先填写企业名称并点击“下一步”,B 路径直接填写登录名和密码;不可覆盖的路径单独记录。后续搜索按钮验收拦截非 GET 写请求;截图、脱敏失败记录与供后续用例复用的 storageState 保存在 `report/auth-login-<时间>/`,均为本地忽略产物。storageState 含会话凭据,不上传、不提交;登录规则见 `docs/ui/GLOBAL_UI_BASELINE.md` 第 6 节。
Playwright 与 weelink 共用设备环境约定,依赖精确锁定 1.64.1;本项目 runner 默认端口为 4176,避免与 weelink 的 4175 冲突。配置读取 `scripts/ui-review/config.json`,用例通过 `scripts/playwright-test.mjs` 的公共 fixture 后台建页并守护焦点。独立脚本使用 `scripts/playwright-focus-guard.mjs` 的 `launchFocusSafe()`,两类流程保留各自执行策略。前台激活或探测失败会记录并停止,离屏不保证绝无瞬时激活。环境变量和截图口径见 [全局基线第 7.1 节](docs/ui/GLOBAL_UI_BASELINE.md#71-工具)。
Playwright 与 weelink 共用设备环境约定,依赖精确锁定 1.64.1;本项目 runner 优先复用已核验的现有开发服务,仅确认不存在时才使用 4176,避免与 weelink 的 4175 冲突。配置读取 `scripts/ui-review/config.json`,用例通过 `scripts/playwright-test.mjs` 的公共 fixture 后台建页并守护焦点。独立脚本使用 `scripts/playwright-focus-guard.mjs` 的 `launchFocusSafe()`,两类流程保留各自执行策略。前台激活或探测失败会记录并停止,离屏不保证绝无瞬时激活。环境变量和截图口径见 [全局基线第 7.1 节](docs/ui/GLOBAL_UI_BASELINE.md#71-工具)。
| 命令 / 参数 | 用途与默认值 |
| --- | --- |
@@ -177,7 +180,7 @@ Playwright 与 weelink 共用设备环境约定,依赖精确锁定 1.64.1;
| `npm run test:e2e:environment` | 隔离验证 8 视口、手机 UA/触摸/DPR、CSS 截图;不代表业务验收 |
| `npm run test:e2e:report` | 打开最新完整 HTML 报告;仅人工使用 |
| `PW_WORKERS` | 默认 1,只接受正安全整数;保留串行优先策略 |
| `PW_TARGET` / `PW_BASE_URL` | 默认 local-dev / `http://127.0.0.1:4176/`;remote 必填 URL |
| `PW_TARGET` / `PW_BASE_URL` | 未指定时优先自动发现并复用开发服务,确认不存在后默认 local-dev / `http://127.0.0.1:4176/`;remote 必填 URL |
| `PW_VIDEO` / `PW_REQUIRE_ALL` | 默认 0;开启失败保留视频 / 全部通过约束 |
`UI_VISUAL_OFFSCREEN=0` 仅限人工本地可视化调试时临时使用。Agent、CI、无头/自动化环境禁止设置该值,必须保持默认离屏模式(或 `UI_VISUAL_OFFSCREEN=1`),避免弹出 UI 或依赖显示环境。配置会拦截 CI、无头及已识别的 Codex/Claude Agent 标记;其他自动化调用方也必须遵守此约定。
-1930
View File
File diff suppressed because it is too large Load Diff
+203 -1
View File
@@ -1,6 +1,6 @@
# 变更记录(CHANGELOG)
> 状态:有效(持续追加) · 更新:2026-11-18 · 版本:v3.3
> 状态:有效(持续追加) · 更新:2026-11-19 · 版本:v3.6
对现状仍有影响的功能与修复记录,按日期倒序。改造、迁移、优化等一次性过程不在此记录。
@@ -8,8 +8,210 @@
**记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `git revert <提交>`,提交含多项改动时按文件还原(`git checkout <提交>^ -- <文件>`),不整仓 reset。本文不作为规则依据。
## 2026-11-19
### 功能 · 恢复服务监控入口并接入超管开关
- **范围**:用户中心桌面侧栏、移动底栏、服务监控路由与面包屑。
- **变更**:恢复服务监控菜单和页面,复用超管运营设置中的 `SidebarModulesAdmin.userCenter.serviceDashboard` 开关;桌面、移动和路由统一判断区域开关、功能开关及可见分组。
- **影响**:未配置时默认开启;关闭或分组不允许时不挂载监控页面、不请求监控数据,直接访问新旧地址均回到首个可见页面,无可见页面时回到首页;服务监控接口与刷新逻辑保持原有行为。
- **回滚**:通过超管开关关闭入口;需要代码回滚时还原本条相关导航、路由与可见性判断。
- **关联**:`docs/ui/SERVICE_DASHBOARD_SPEC.md`、`src/helpers/navigationVisibility.js`、`src/pages/UserCenter/`。
## 2026-11-18
### 调整 · 认证页表单必填标识、就地校验与间距统一
- **范围**:`/login`、`/org/login`(第 1–3 步)、`/register`、`/org/register`、`/reset` 及微信验证码、两步验证弹窗。
- **变更**:必填项统一显示 `*`,为空时就地提示“请输入 + label”;注册密码 8-20 位、确认密码一致、邮箱格式沿用原判断就地提示;注册、找回密码改为前端校验通过后再调用原提交函数;获取验证码、微信验证码确定前先校验;企业登录第 1 步失焦为空时提示;label 与输入框间距 7px,表单项无下边距并预留 22px 报错位;新增 8 条提示文案并补齐 9 个语言包。
- **影响**:请求地址、载荷、原处理函数内判断与按钮禁用条件不变;非法输入改为就地提示后不再发出请求。
- **回滚**:按文件还原本条涉及的 `src/components/auth/`、`src/pages/OrgLogin/index.jsx`、`src/pages/OrgRegister/index.jsx`、`src/styles/prototype.css` 表单项段落与 `src/i18n/locales/` 新增键。
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 4.5 节。
### 调整 · 开发环境默认开启云脑入口
- **范围**:开发环境配置、环境回归测试与 README。
- **变更**:开发环境默认开启云脑入口,测试分别校验开发开启与生产关闭。
- **影响**:生产默认值保持关闭,入口仍受后台模块开关与账号权限约束。
- **回滚**:将开发环境开关与测试预期恢复为关闭,并还原本条文档差异。
- **关联**:`.env.development`、`tests/environment.test.js`、`README.md`。
### 修复 · 控制台侧栏自动定位当前菜单
- **范围**:控制台侧栏与移动端导航抽屉。
- **变更**:菜单完成加载、当前菜单变化、侧栏展开或尺寸变化时,自动滚动菜单区域,使超出视口的选中项完整可见;已可见时保留当前位置。
- **影响**:不滚动正文、不抢焦点、不改变权限和路由,不强制展开手动收起的分组;异步菜单变化后重新检查,卸载时回收观察器和动画帧。
- **回滚**:仅还原 `SiderBar.jsx` 的定位逻辑与 `helpers/sidebarScroll.js`、对应测试和本条规范变更。
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 4.3 节。
### 修复 · 平台 Skill 审核抽屉滚动与固定操作栏
- **范围**:`/console/skill-platform` 技能详情审核工作台。
- **变更**:技能原文随抽屉正文统一滚动,长文本自动换行;审核按钮移入固定页脚并靠右排列,版本页签隐藏审核操作,每次打开详情回到审核页签。
- **影响**:保留扫描、模型实测、审核、发布的原有条件、请求与回调;窄屏按钮按原行为换行。
- **回滚**:仅还原 `SkillPlatform/index.jsx`、`skill-platform.css`、`components/skill/index.jsx` 的样式类透传与控制台规范中本条相关差异。
- **关联**:`docs/standards/UI_COMPONENT_STANDARDS.md` 第 9 节。
### 修复 · 复制回归测试与 Hook 依赖检查
- **范围**:企业密钥复制回归用例、伙伴工作台入口与企业中心请求清理。
- **变更**:复制测试按当前公共复制函数及密钥、模型回调验证成功和失败反馈,同时校验成功标记与定时器;用例纳入 `test/unit/`;伙伴作用域按用户与企业身份保持稳定,企业请求清理捕获本次使用的引用。
- **影响**:修复过期测试及两处 Hook 检查警告,保留现有复制、权限探测与过期请求失效逻辑。
- **回滚**:仅还原本条相关 Hook 差异、复制测试与本记录,保留其他工作区修改。
- **关联**:`test/unit/clipboard.test.js`、`src/hooks/common/usePartnerWorkspaceEntry.js`、`src/pages/Organization/index.jsx`。
### 修复 · 技能许可证徽标兼容深浅主题
- **范围**:技能超市卡片与详情,以及复用 `LicenseBadge` 的技能平台、企业技能库。
- **变更**:许可证待审核状态由非 antd 预设色名 `amber` 改为 `gold`,统一由现有主题算法生成背景与描边,文字使用对应调色板第 9 档 token 提高可读性;通过与阻止保留绿色、红色。
- **影响**:修复暗色主题的浅底浅字问题,支持运行时主题切换;保留许可证表达式、审核决策及权限、接口逻辑。
- **回滚**:仅还原 `src/components/skill/` 中的待审核颜色映射、许可证文字 token 与局部样式,以及相关规范差异。
- **关联**:`src/components/skill/tokens.js`、`docs/ui/SKILL_MARKET_SPEC.md` 第 4 节。
### 调整 · 认证页输入框 36px 与视觉统一
- **范围**:`/login`、`/org/login`、`/org/:slug/login`、`/register`、`/org/register`、`/reset`、`/user/reset`,以及两步验证、微信验证码弹窗。
- **变更**:输入框、下拉、整行按钮统一 36px / 8px 圆角,字段节奏 24px;隐藏卡片外发光、角落光晕、漂移光斑与 Logo 光环 / 星标;第三方登录与注册提交按钮去掉渐变、扫光和上浮动效;新增 `AuthDivider` 统一分隔线;找回密码两页改用登录页同款背景、卡片与头部;六个认证页统一使用登录顶栏;两步验证链接色改用品牌色。
- **影响**:仅视图层,保留请求、载荷、校验规则、提交触发与禁用条件;`OrgCredentialResult` 和 `/client/authorize` 不变。
- **回滚**:按文件还原 `src/components/auth/`(含删除新增的 `AuthDivider.jsx`)、`src/pages/OrgLogin/index.jsx`、`src/pages/OrgRegister/index.jsx`、`src/components/layout/PageLayout.jsx`、`src/styles/prototype.css` 中的 `.auth-login-page` 段及 `GLOBAL_UI_BASELINE.md` 第 4.5 节。
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 4.5 节。
### 修复 · 平台 Skill 分类标签与搜索栏左对齐
- **范围**:`/console/skill-platform` 分类速览标签区域。
- **变更**:将分类区域纳入控制台全宽布局规则,移除其独立最大宽度与水平自动居中,使首个标签与上方搜索框左边缘对齐。
- **影响**:仅调整控制台样式,保留标签间距、自然换行、分类选择、请求和业务回调。
- **回滚**:移除 `console.css` 全宽规则中的 `.skill-platform-tag-chips` 选择器,按本条差异还原控制台规范。
- **关联**:`src/components/console/console.css`、`docs/ui/CONSOLE_SPEC.md` 第 3 节。
### 调整 · 移除全站顶栏登录注册按钮
- **范围**:共享顶部导航的桌面与移动端未登录状态。
- **变更**:移除 `UserArea` 的登录 / 注册按钮分支、专用样式拼接及无用依赖,并清理该分支专用参数传递。
- **影响**:已登录头像菜单、主题等工具、登录 / 注册页面和受保护导航的鉴权跳转保持原有行为。
- **回滚**:仅还原本条涉及 `UserArea.jsx`、`ActionButtons.jsx`、`headerbar/index.jsx` 与顶栏规范的差异,保留工作区其他修改。
- **关联**:`src/components/layout/headerbar/`、`docs/ui/GLOBAL_UI_BASELINE.md` 第 4.1 节。
### 调整 · 模型超市隐藏分组与标签筛选
- **范围**:`/market` 顶部模型筛选卡。
- **变更**:隐藏“用户分组”和“模型标签”两行筛选项,保留厂商、计费类型与端点类型;卡头说明同步列出当前可见的筛选维度,复用已有翻译。
- **影响**:仅调整筛选入口展示,保留原有请求、筛选状态、重置、计价、模型卡片与详情中的分组信息。
- **回滚**:仅还原 `MarketFilterSidebar.jsx`、`ModelMarketPage.jsx` 与模型超市规范中本条对应差异,保留其他工作区修改。
- **关联**:`docs/ui/MODEL_MARKET_SPEC.md` 第 3、8 节。
### 修复 · 等级弹窗模型数量入口使用操作主色
- **范围**:`/console/setting?tab=level_policy` 的个人与企业等级弹窗。
- **变更**:分组策略中模型数量大于 0 时,数量入口改用与表格操作列一致的 `link` 按钮,仅数量文字使用橙色主色,展开箭头保留中性文字色,自动适配浅深主题。
- **影响**:无模型时保留“配置”的原有样式;展开、收起、模型折扣、接口与保存逻辑不变。
- **回滚**:仅还原本条在 `LevelPolicySetting.jsx` 中的按钮属性与 `LevelPolicySetting.css` 中的图标样式差异。
- **关联**:`src/components/settings/LevelPolicySetting.jsx`。
### 修复 · 渠道自定义模型填入后清空
- **范围**:`/console/channel` 创建渠道与更新渠道信息表单。
- **变更**:点击自定义模型名称的“填入”后,同步清空组件状态与表单字段值,避免输入框保留已处理的名称。
- **影响**:保留模型合并、逗号分隔、去重、提示与原有渠道保存逻辑。
- **回滚**:仅还原 `EditChannelModal.jsx` 中本条新增的字段清空调用与本记录。
- **关联**:`src/components/table/channels/modals/EditChannelModal.jsx`。
### 修复 · 充值档位编辑弹窗回填当前行
- **范围**:`/console/setting?tab=amount-options`、`/console/setting?tab=org-amount-options`。
- **变更**:编辑与新增弹窗关闭后销毁内部表单,确保每次打开按当前档位初始化;移除未使用的表单 API 状态。
- **影响**:切换编辑行、取消后重开及编辑与新增切换时,不再保留首次打开或未保存的表单数据;保留原有接口、载荷与保存逻辑。
- **回滚**:仅还原 `AmountOptionsManager.jsx` 本条相关差异与本记录,保留其他工作区修改。
- **关联**:`src/pages/Setting/AmountOptionsManager.jsx`。
### 调整 · 消费记录耗时分档标签
- **范围**:`/user-center/usage-record` 消费记录的“用时 / 首字”列。
- **变更**:总用时与首字耗时按阈值分别呈现 antd 带描边彩色标签,流式状态使用蓝色标签,非流式使用中性标签;加宽该列,支持深浅主题,零值正常展示,缺失与无效耗时显示破折号。
- **影响**:仅调整用户中心表格展示;首字耗时先保留一位小数再判色,保留接口、筛选、权限与控制台原有渲染。
- **回滚**:仅还原本条在列定义、使用记录 CSS 与页面规范中的差异,保留工作区其他修改。
- **关联**:`src/components/table/usage-logs/UsageLogsColumnDefs.jsx`、`src/pages/UserCenter/UsageRecord.css`、`docs/ui/USER_CENTER_SPEC.md` 第 4.2 节。
### 调整 · 分佣工作台对齐本地原型
- **范围**:`/console/commission?view=overview`。
- **变更**:参照本地原型的工作台视图,调整概览指标图标、数字与单位、卡片内边距、待办摘要和数据健康区块;待办标题优先展示已有伙伴与账期;趋势图补齐纵轴刻度、统一柱宽与悬浮 / 键盘提示,保留加载失败和重试反馈。
- **影响**:保留月份选择与刷新区域、真实数据计算、历史请求、权限、待办过滤及原有跳转目标;不引入原型的示例业务数据。
- **回滚**:仅还原本条在 `Dashboard.jsx` 与 `dashboard.css` 的差异,保留此前工作区修改。
- **关联**:`src/pages/CommissionV2/Dashboard.jsx`、`src/pages/CommissionV2/dashboard.css`。
### 调整 · 分佣与智能路由统一 UI
- **范围**:`/console/commission`、`/org/commission`、`/console/my-commission`、`/console/smart-router` 及复用的列表、账单、表单与浮层。
- **变更**:分佣颜色映射到主题语义 token,统一控件高度、圆角、卡片、筛选区、页签与金额对齐;表格接入三中心公共组件;企业分佣复用企业页头,补齐无权限态布局;智能路由移除重复标题,统一抽屉、提示、表单栅格和移动端布局;分页尊重调用方显式关闭容量选择的设置。
- **影响**:保留接口、权限、请求载荷与业务回调;固定接口分页容量的页面不开放无效的容量切换。
- **回滚**:按本条涉及文件的差异还原,保留工作区其他改动。
- **关联**:`src/pages/CommissionV2/`、`src/components/smart-router/`、`src/pages/SmartRouter/index.jsx`、`src/components/ui/index.jsx`。
### 工具 · 本地验收优先复用开发服务
- **范围**:项目 Playwright 配置、开发服务发现脚本、Agent 入口、README 与全局 UI 基线。
- **变更**:结合项目日志与 Node 监听端口查找开发服务,通过 Vite 源码映射验证当前项目;兼容 UTF-8 / UTF-16LE 日志,历史地址失效时继续发现,仅未找到服务时才允许新启。按用户约定允许测试账号文件 `.env.playwright.local` 入库。
- **影响**:未显式指定目标时自动复用已有服务;显式指定测试目标的行为保留。验收产物与 storageState 仍不入库。
- **回滚**:移除 `playwright.config.js` 的自动发现调用与 `scripts/dev-service.mjs`,按差异还原相关文档;测试账号文件的入库约定单独维护。
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 6、7.1 节,`test/unit/dev-service.test.js`。
### 调整 · 智能路由卡片首部页签间距
- **范围**:`/console/smart-router` 的选项卡卡片,以及 UI 公共规范第 10 节。
- **变更**:参照官网设置页,将页签卡片主体顶部内边距从 24px 调整为 8px,减少 16px 多余留白;规范明确卡片首部页签的顶部间距、默认高度与适用条件。
- **影响**:仅调整该卡片顶部间距,保留页签高度、文字、切换逻辑、权限、请求和其他方向内边距;企业中心的智能路由组件不受影响。
- **回滚**:移除 `SmartRouter/index.jsx` 的 `smart-router-tabs-card` 类及对应 CSS 规则,按差异还原规范条目。
- **关联**:`docs/standards/UI_COMPONENT_STANDARDS.md` 第 10 节。
### 工具 · 集中管理 Vite 样式兼容插件
- **范围**:旧浏览器 CSS 级联层兼容插件、Vite 配置、相关测试与 README。
- **变更**:将根目录 `vite-plugin-legacy-css-layers.js` 迁至 `scripts/vite/legacy-css-layers.js`;同步导入、测试夹具目录与错误提示路径。
- **影响**:仅调整文件组织,保留插件的构建期处理、能力检测与样式兜底行为。
- **回滚**:将插件移回原路径,同时恢复 Vite、测试引用与 README 目录说明,保留其他工作区修改。
- **关联**:`vite.config.js`、`tests/{legacy-css-layers,environment}.test.js`、`README.md`。
### 修复 · 控制台设置表单警告与重复布局测量
- **范围**:`/console/setting` 的共享表单、运营、支付、WeyAi、模型定价、系统与内容防护设置,以及共享表格宽度测量。
- **变更**:迁移 `labelAlign` 的旧值并保留适配映射;静态表单依靠字段订阅更新,减少整表刷新;单选组标签关联到真实输入框,补齐运营汇率组合控件的标签关联;WeyAi 密码框归入表单,设置页输入补齐稳定标识与自动填充用途;模型定价表格使用模型名称作为行键;系统说明改用原生 `title`;表格复用 ResizeObserver 的尺寸结果,避免重复读取操作按钮宽度。
- **影响**:保留设置项、权限、保存回调、请求与载荷;减少应用侧重复渲染及同步布局读取,开发模式下第三方组件首次测量仍可能触发浏览器性能提示。
- **回滚**:仅还原本条涉及的表单、控件、表格和设置页差异,保留工作区其他修改。
- **关联**:`src/components/ui/{form,controls,CenterActionTable}.jsx`、`src/components/console/ConsolePrimitives.jsx`、`test/unit/{form-labels,antd-v6-contracts}.test.js`。
### 调整 · 顶部企业中心与控制台互换位置
- **范围**:桌面顶部导航与移动端主导航菜单。
- **变更**:公共导航顺序由“用户中心 → 控制台 → WeyAi → 企业中心”调整为“用户中心 → 企业中心 → WeyAi → 控制台”;未显示的入口按原条件过滤。
- **影响**:只交换两项的位置,保留权限、企业归属、模块开关、目标链接与激活态规则。
- **回滚**:仅还原 `src/hooks/common/useNavigation.js` 中企业中心与控制台的数组位置。
- **关联**:`Navigation.jsx`、`MobileNavMenu.jsx` 共用 `mainNavLinks`。
### 工具 · 统一 npm 安装与构建
- **范围**:Bun 锁文件、锁文件忽略规则、Vercel 配置与 README。
- **变更**:移除 `bun.lock`,忽略 Bun 两种锁文件;Vercel 显式使用 `npm ci` 安装、`npm run build` 构建。
- **影响**:项目依赖与脚本已使用 Node.js + npm,无 Bun 专属依赖需要卸载;保留现有 `package-lock.json` 与依赖版本。
- **回滚**:从改动前版本恢复 `bun.lock`,并仅还原本条涉及的忽略规则、部署配置与 README 段落。
- **关联**:`package.json`、`package-lock.json`、`vercel.json`。
### 修复 · WeyAi 下载页与顶部菜单统一主题
- **范围**:`/weyai/download`、用户中心内嵌下载页,以及共享顶栏的账户、语言与主导航菜单。
- **变更**:本站下载页进入系统样式作用域,修复头像浮层缺少背景与颜色变量;下载页复用公共页头与原生 antd 按钮、标签、骨架,对齐浅深主题、卡片、间距、图标和响应式布局,移除旧装饰渐变与悬浮动效。顶部菜单使用原生 antd 菜单与可聚焦触发器,账户和语言菜单支持点击,下载页锚点跟随实际顶栏高度并遵守减少动态效果偏好。
- **影响**:仅调整展示与菜单操作方式,保留下载地址、开放范围、权限判断、请求、语言与主题持久化;其他 WeyAI 外部页仍使用原作用域。
- **回滚**:按本条涉及的下载页、`UiThemeProvider.jsx` 与顶栏菜单组件差异还原,保留其他工作区修改。
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 1、4 节;`docs/standards/UI_COMPONENT_STANDARDS.md`。
### 修复 · 企业员工顶栏提示栏上下间距
- **范围**:`/console/setting?tab=operation` 的“企业员工顶栏”说明提示栏。
- **变更**:上下外边距统一为 16px,避免提示栏紧贴上方说明文字;内边距、正文与图标继续使用控制台公共提示栏样式。
- **影响**:仅调整该提示栏的展示间距,配置开关、保存逻辑和请求保持原样。
- **回滚**:将 `SettingsOrgUserNavModules.jsx` 中该提示栏的 `marginBlock` 恢复为原 `marginBottom`。
- **关联**:`docs/ui/CONSOLE_SPEC.md` 第 3 节。
### 规范 · 适配层日期契约、标签写法与控制台页头
- **范围**:`src/components/ui/controls.jsx`;`docs/standards/{DEV_STANDARDS,UI_COMPONENT_STANDARDS}.md`、`docs/ui/{ORG_CENTER_SPEC,CONSOLE_SPEC}.md`。
+2 -1
View File
@@ -1,6 +1,6 @@
# UI 公共组件与样式规范
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.4
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.5
所有后台页面共用的主题与组件标准。页面规范只记录与本文不同的部分;编码约定见 `DEV_STANDARDS.md`,外壳与布局见 `GLOBAL_UI_BASELINE.md`。
@@ -208,6 +208,7 @@ html.dark .km-page {
| 类型 | 用法 |
| --- | --- |
| 列表页签 | antd `Tabs`;导航与下方内容间距 20px(控制台 16px);页签间距 28px;文字 14 / 22px;选中与悬停为品牌色,2px 下划线 |
| 卡片首部页签 | 控制台卡片主体以 `Tabs` 开始、页签上方没有标题或提示时,主体顶部内边距 8px,参考 `/console/website-setting`、`/console/smart-router`;保留页签默认上下内边距 12px、导航高 46px、与下方内容间距 16px,不叠加空白占位或顶部外边距。卡片其余内边距不变;页签前有错误提示或说明块时按对应容器规则处理。浅深主题、桌面与移动端一致。 |
| 筛选页签 | 只切换筛选条件时隐藏内容区(企业中心 `.oc-tabs-nav-only`),筛选结果由下方列表卡展示 |
| 分段控件 | 2–4 个互斥选项(如趋势维度、充值类型、头像类型)用 `Segmented`,`onChange(value)` 直接接值处理函数 |
| 预渲染 | 原先预渲染全部页签的页面保留 `forceRender`,不改变请求时机 |
+3 -1
View File
@@ -1,6 +1,6 @@
# 控制台 UI 规范(/console/\*)
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.3
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.4
管理控制台 `/console/*` 的规范:统一页头、控制台原语与差异样式。
@@ -58,6 +58,8 @@
- 提示栏:控制台内的 `Banner` / `Alert` 统一走 `ConsoleAlert`,内边距 12px 16px、正文 14 / 22px、图标 16px,颜色取对应语义 token。
- 系统设置(`page.key === 'setting'`):表单统一纵向布局、8px 标签间距、24px 栅格、控件等宽,校验信息预留高度;弹窗页脚按钮高 34px、间距 8px、右对齐。规则限定在 `.settings-page` / `.settings-form-dialog`。
- 控制台上下文中 `CompactModeToggle` 不渲染,表格密度状态保留;其他模块仍可使用紧凑模式。
- 平台 Skill 中心的分类标签区域与搜索工具栏同宽、左对齐,不保留独立的最大宽度和自动居中;窄屏按原间距自然换行。
- 平台 Skill 详情的审核工作台仅由抽屉正文纵向滚动,技能原文不设置独立滚动区;审核操作进入抽屉固定页脚,按钮右对齐、间距 8px,仅在审核页签展示。
- 官网文章抽屉允许点击遮罩关闭,X、取消、遮罩共用同一未保存内容确认流程。
## 4. 验收要点
+11 -9
View File
@@ -1,6 +1,6 @@
# 后台 UI 全局基线
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-17 · 版本:v3.6
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v3.11
后台外壳与布局基线:顶栏、侧栏、公告、页头与内容边距、登录页,以及原型未定义场景、登录关卡与验收流程。主题与组件样式见 `UI_COMPONENT_STANDARDS.md`。
@@ -24,7 +24,7 @@
- 原型定义的颜色、尺寸、样式、状态与视觉交互优先;原型只作视觉依据,不作业务、数据、状态、接口、路由依据。
- 专项规范见 `docs/README.md` 索引;专项未覆盖的部分按本文执行。
- 不重做:WeyAI 外部页与第三方 SDK 的内部视觉;体验中心只检查宿主布局。图表、流程画布、编辑器与新手引导保留专用组件。
- 不重做:WeyAI 外部页与第三方 SDK 的内部视觉;本站托管的 `/weyai/download` 属于系统页面,沿用统一主题、顶栏与浮层 token。体验中心只检查宿主布局。图表、流程画布、编辑器与新手引导保留专用组件。
- 改造前先列出已覆盖、未覆盖、排除的页面;配置隐藏、权限重定向和原型失效入口单独列出。
## 2. 目录职责
@@ -52,6 +52,7 @@
- 桌面高 72px、移动 56px,另含 1px 底部分隔线;背景、文字、分隔线跟随双主题变量。
- 主导航:导航项撑满顶栏,左右内边距 24px;2px 主色下划线两端内缩 16px;选中项主色文字,普通项悬停保留正常文字色,键盘焦点可见。不改链接与权限条件。
- 右侧按钮:主题、公告、语言等图标 16px,工具按钮点击区 34px,账户下拉箭头 10px;`.ui-header-actions` 内图标容器为 inline-flex,使图标与文字垂直居中。
- 全站共享顶栏不展示未登录用户的“登录 / 注册”按钮,桌面与移动端一致;已登录用户保留头像与账户菜单,登录 / 注册页面及受保护导航的原有鉴权跳转保持不变。
- 主题按钮为 `Button` + `Tooltip`,点击在浅色与深色之间直接切换,不提供下拉或“跟随系统”;沿用现有主题 setter 与持久化,覆盖 `/org/login`、`/login` 与共享顶栏。
- WeyAi 下载按钮复用现有下载配置与权限判定,跳转 `/weyai/download`;使用 antd text 按钮默认悬停背景与 `Tooltip`,不硬编码外部地址。
@@ -63,6 +64,7 @@
### 4.3 侧栏
- 控制台侧栏显示、路由选中项变化或滚动区尺寸变化后,当前菜单超出可视范围时,仅滚动菜单区域使其完整可见;已可见时不移动,不滚动正文、不抢焦点,也不强制展开用户手动收起的分组。
- 企业中心与用户中心共用 `src/styles/center-layout.css`:展开 216px、收起 64px;菜单行高 42px、行距 6px,图标 16px / 1.5px 线宽;折叠入口文案“收起导航”。
- 企业信息区为无底框网格图标(24px / 1.65 线宽),内边距 28px 16px 26px,图文间距 10px;企业名与身份 12px / 20px 行高,身份上距 2px。
- 个人侧栏只保留容器外侧分隔线,内层 Menu 不叠加 `border-inline-end`;企业侧栏不提供菜单搜索。
@@ -80,9 +82,9 @@
### 4.5 登录页与认证顶栏
- `/org/login` 与 `/login` 顶栏采用后台标准样式,无品牌条、玻璃渐变与反光层。登录页局部布局 `.auth-login-page`;其他认证顶栏 `.auth-layout-header` 透出既有背景;登录顶栏 `.login-layout-header`。
- 登录卡片无顶部装饰线与反光;企业 / 个人切换用 antd `Button`;输入框 34px 高、8px 圆角,必填标识经 `Form.Item` 呈现;凭据字段只预留必要的错误提示高度,正常、报错、修正三态布局稳定。
- 副标题、“记住登录名”、管理员重置提示与“忘记密码”使用加深 20% 的次文字色,无悬停底色,“忘记密码”悬停再加深;“切换企业”与“登录”同为主按钮样式。个人登录必填校验用 `rules`,通过后调用原登录处理函数。样式调整不得改变登录校验、回调与载荷。
- 认证页(`/login`、`/org/login`、`/org/:slug/login`、`/register`、`/org/register`、`/reset`、`/user/reset`)统一使用登录顶栏 `.login-layout-header` 与局部布局 `.auth-login-page`,顶栏采用后台标准样式,无品牌条、玻璃渐变与反光层;仅客户端授权页 `/client/authorize` 保留 `.auth-layout-header` 透出背景。
- 登录卡片无顶部装饰线、反光、外发光、角落光晕与 Logo 光环 / 星标;企业 / 个人切换用 antd `Button`;输入框、下拉、整行按钮与认证弹窗(`.auth-login-modal`)控件统一 36px 高、8px 圆角(`--auth-control-height`),必填标识经 `Form.Item` 呈现;表单项无下边距,label 12px、与输入框间距 7px,输入框下方固定预留 22px 报错位(`--auth-error-line`),必填与非必填项间距一致,正常、报错、修正三态布局稳定。第三方登录用描边整行按钮,无位移与扫光;分隔线用 `AuthDivider`。规则集中在 `src/styles/prototype.css` 的 `.auth-login-page` 段。
- 副标题、“记住登录名”、管理员重置提示与“忘记密码”使用加深 20% 的次文字色,无悬停底色,“忘记密码”悬停再加深;“切换企业”与“登录”同为主按钮样式。认证表单必填项显示 `*` 并就地提示:输入框“请输入 + label”,选择框“请选择 + label”;邮箱等格式校验沿用原判断与文案;校验用 `rules` / `validate`,通过后调用原处理函数,页面自管的受控输入(企业登录第 1 步)失焦为空时提示且不改按钮禁用条件。样式与校验调整不得改变登录校验、回调与载荷。
### 4.6 导航入口
@@ -106,12 +108,12 @@
- `/console/*` 控制台:超管账号,经 `/login` 登录;不先用普通账号试探控制台权限。
- 共享组件或跨中心改动:追踪实际引用,在受影响的中心分别验收;不同账号使用独立 Context,避免企业、个人与超管会话混用。不因一句泛化测试指令执行无关页面的全量验收。
- 执行前用简短进度说明告知已判断的范围与账号类型,直接继续。先使用现有本地配置;仅在范围经代码分析仍不明确、必要凭据缺失或实际权限不足时询问。用户明确“无需测试”“无需生产测试”等限制优先,普通测试指令不自动授权生产构建或生产环境操作。
2. Base URL 只取 `dev.log` 最后一个 `Local:`(去除 ANSI 色码),禁止写死 IP / 端口;服务可用即复用。Windows 用 `Start-Process -WindowStyle Hidden` 启动并写入 `dev.log`,支持 nohup 的 shell 用 `nohup npm run dev > dev.log 2>&1 &`。
2. Base URL 按第 7.1 节通过项目目录、启动日志与监听进程查找并核验,服务可用即复用;日志中的失效地址不能作为新启服务的依据。仅确认不存在时,Windows 用 `Start-Process -WindowStyle Hidden` 启动并写入 `dev.log`,支持 nohup 的 shell 用 `nohup npm run dev > dev.log 2>&1 &`。
3. 企业入口 `{Base URL}/org/login`,`waitForLoadState('networkidle')` 后检查可见非隐藏、非复选框输入框的数量、placeholder / 标签与按钮,打印不含输入值的判定并截图。
- 状态 A:一个企业输入框 +“下一步”。先填企业名称,点击“下一步”,等“企业内登录名”“密码”“登录”出现后再填凭据;不得把登录名当企业名,不得跳过企业查询。
- 状态 B:已出现登录名、密码与“登录”。直接填写凭据,保留已解析的企业上下文。
4. 个人端:新建无企业 Cookies / Storage 的 Context,进入 `{Base URL}/login`,按页面原有协议勾选与登录,确认用户中心侧栏与主体渲染后保存 storageState。
5. 凭据只经环境变量传入:企业 `UI_ORG_NAME` / `UI_ORG_USER` / `UI_ORG_PASS`,普通个人 `UI_PERSONAL_USER` / `UI_PERSONAL_PASS`,超管 `UI_ADMIN_USER` / `UI_ADMIN_PASS`。本机可通过确认未跟踪且已忽略的 `.env.playwright.local` 加载,不要求用户在每次任务中重新提供;不得输出其值,不写入脚本、日志、截图注释、报告或提交;登录阶段不录 trace / HAR。本地入口、跟踪 / 忽略检查和账号选择参数见 `README.md` 的“本地 Playwright 登录配置”。
5. 凭据只经环境变量传入:企业 `UI_ORG_NAME` / `UI_ORG_USER` / `UI_ORG_PASS`,普通个人 `UI_PERSONAL_USER` / `UI_PERSONAL_PASS`,超管 `UI_ADMIN_USER` / `UI_ADMIN_PASS`。本机通过 `.env.playwright.local` 加载,不要求用户每次重新提供;该文件仅保存测试账号,按用户约定不作 Git 忽略,允许入库。值仍不得回显或写入脚本、日志、截图注释、报告;登录阶段不录 trace / HAR,其他凭据与 storageState 不入库。本地入口和账号选择参数见 `README.md` 的“本地 Playwright 登录配置”。
6. 失败时截图,记录 `dev.log` 尾部与失败请求(密码、Cookie、token、ticket 脱敏),写入风险;不盲目重试,不改登录业务代码。
7. 结束时通过顶栏用户菜单“退出登录”,确认回到登录页(当前为 `/org/login`)且受保护路由不再渲染。
@@ -120,7 +122,7 @@
### 7.1 工具
- 优先使用项目 Playwright 配置(`playwright.config.js`:`testDir: ./e2e`、`workers` 默认 1,可由正整数 `PW_WORKERS` 覆盖)与本机 Chrome(`channel: 'chrome'`)。默认离屏,保留 `UI_VISUAL_OFFSCREEN=1`(只降低可见干扰,不保证没有瞬时焦点激活);要求不启动有头窗口时可用无头模式并在报告注明。
- 运行前从 `dev.log` 最后一个 `Local:` 提取地址;runner 复用服务时设 `PW_TARGET=remote` + `PW_BASE_URL`,不会启动或关闭已有服务。专项脚本是否接收 `PLAYWRIGHT_BASE_URL` 以其实现为准,不能用它替代 runner 的 `PW_BASE_URL`。Playwright 失败先排查服务地址、元素定位、等待条件、浏览器环境与登录状态。
- 测试优先复用用户已启动的本项目开发服务:结合项目目录、启动日志(优先 `dev.log`,兼容 UTF-8 / UTF-16LE)、进程和监听端口查找候选地址,验证响应属于当前项目。历史日志地址失效时继续查找,不得直接启动新服务;仅确认本项目服务不存在时才启动,并记录、清理本次进程,不结束用户进程。项目 Playwright 配置通过 `scripts/dev-service.mjs` 自动发现服务并以 `PW_TARGET=remote` + `PW_BASE_URL` 复用;显式指定目标时保留调用方配置。专项脚本是否接收 `PLAYWRIGHT_BASE_URL` 以其实现为准,不能用它替代 runner 的 `PW_BASE_URL`。Playwright 失败先排查服务地址、元素定位、等待条件、浏览器环境与登录状态。
- 默认 runner 为浅色、1920×1080 / 360×800,本地有头、CI 无头,`webServer.reuseExistingServer=false`;默认执行不等于完成第 7.3 节浅深主题与规范视口矩阵,须在用例或专项脚本补足。严格有头焦点约束见第 7.1.1 节。
- `e2e/` 为本地忽略目录,验收脚本不随仓库分发;新增脚本同样放在该目录。
@@ -150,7 +152,7 @@
| 设备源 | `scripts/ui-review/config.json` → `scripts/browser-environment.mjs`;与 weelink 的设备结构和 Playwright 1.64.1 保持一致,各项目独立保存 |
| 视口 | 默认 1920×1080、360×800;扩展增加 768×1024、1024×768、1366×768、1440×900、2560×1440、3840×2160 |
| 手机 | Pixel 5 UA、触摸、移动模式和 DPR 2.75;viewport 覆盖为 360×800,screen 沿用模板;平板仅为桌面设备的平板尺寸 |
| 本地目标 | `PW_TARGET=local-dev` 默认启动 `http://127.0.0.1:4176/`,weelink 使用 4175;开发和预览均严格占用指定端口,禁止静默回退 |
| 本地目标 | 未指定目标时自动发现并复用已有开发服务,确认不存在后才启动 `http://127.0.0.1:4176/`;开发和预览均严格占用指定端口,禁止静默回退 |
| 目标切换 | `local-dist` 先校验静态入口与引用资源,再启动 Vite preview;`remote` 必须提供 `PW_BASE_URL`,不启动服务 |
| 窗口 | 本地默认有头离屏;`PW_HEADLESS=1` 无头,CI 强制无头;隐藏滚动条并禁用后台降频 |
| 并发 | 默认单 worker、文件内不拆分;`PW_WORKERS` 只接受正安全整数,不代表动态内存调度 |
+3 -3
View File
@@ -1,6 +1,6 @@
# 模型超市 UI 规范(/market)
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-16 · 版本:v2.4
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.5
个人端模型超市 `/market` 的规范。本页为独立视觉页面,组件映射优先于公共规范。
@@ -47,7 +47,7 @@
| 区域 | 写法 |
| --- | --- |
| 搜索 | `Input`(`allowClear`、前缀图标)+ `Button`(重置 / 搜索 primary) |
| 筛选 | `Card` 位于结果栏下方、厂商分区上方;厂商、计费、分组、标签、端点五组可换行 `Button`(`aria-pressed`);不显示计数;“disabled 或计数为 0”时禁用 |
| 筛选 | `Card` 位于结果栏下方、厂商分区上方;仅展示厂商、计费、端点三组可换行 `Button`(`aria-pressed`),隐藏用户分组与模型标签筛选行;不显示计数;“disabled 或计数为 0”时禁用 |
| 筛选展开 | 默认仅显示厂商行;卡头保留重置与“展开更多 / 收起筛选”`Button`,同步 `aria-expanded` / `aria-controls`,收起不清空条件;装饰品牌图标设 `aria-hidden` |
| 分区标题 | `.mm-section-title`:图标框 + h2 + “N 款模型” |
| 卡片 | `Card`(`role=button`,Enter / Space 打开);价格格、缓存行、页脚分组与折扣 `Tag`、复制 `Button` + `Tooltip` |
@@ -110,7 +110,7 @@
## 8. 验收要点
- 搜索仅对 `model_name` 做不区分大小写的子串匹配,忽略关键词首尾空格;描述、标签、厂商名称不参与关键词匹配,其他筛选条件仍取交集;保留原前端防抖,不新增搜索请求。
- 视口 1920×1000 与 393×851,浅深主题;交互序列:默认厂商行 → 展开五组条件 → 选择分组 → 收起仍保持筛选与价格 → 重置 → 悬停卡片 → 键盘聚焦卡片 → 关键词搜索 → 选择厂商 → 空结果 → 整页滚动到底与厂商懒渲染 → 打开详情。
- 视口 1920×1000 与 393×851,浅深主题;交互序列:默认厂商行 → 展开三组条件,确认用户分组与模型标签不显示 → 选择计费或端点 → 收起仍保持筛选与价格 → 重置 → 悬停卡片 → 键盘聚焦卡片 → 关键词搜索 → 选择厂商 → 空结果 → 整页滚动到底与厂商懒渲染 → 打开详情。
- 响应式补充 3840×2160、2560×1440、1920×1080、中屏及断点两侧、360×800;检查两侧留白、卡片宽度、正文换行、无横向溢出,以及筛选展开和详情在窄屏上的可达性。
- 与原型比较时使用同构模拟目录并标注;真实后端另行验证;整页 ≤ 0.5%、组件 ≤ 0.2%。
- 本地截图回归断言非 GET `/api/` 请求为 0。
+2 -2
View File
@@ -1,6 +1,6 @@
# 服务监控 UI 规范(/user-center/service-dashboard)
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-11 · 版本:v2.1
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-19 · 版本:v2.3
服务监控页的规范:分组可用性、历史条与详情弹窗。
@@ -10,7 +10,7 @@
| 关注点 | 规则 |
| --- | --- |
| 路由 | `/user-center/service-dashboard`,旧 `/service-dashboard` 重定向 |
| 路由 | `/user-center/service-dashboard`,旧 `/service-dashboard` 重定向;桌面侧栏、移动底栏和页面访问统一受超管“运营设置 → 左侧边栏模块管理 → 用户中心 → 服务监控”开关(`SidebarModulesAdmin.userCenter.serviceDashboard`)及区域 / 功能可见分组控制;关闭或无分组权限时不挂载页面,回到首个可见页面,无可用页面时回到首页;未配置时沿用默认开启 |
| 组件 | `Card`、`Button`、详情 `Modal` + `Statistic` + `Table`、`Tooltip`、`Spin` / `Empty` |
| 主题 | `theme.useToken()` 注入 `--service-*`;正常态跟随 `colorPrimary`,告警 / 异常用 `colorWarning` / `colorError` |
| 业务 | 60 秒自动刷新、逐秒倒计时、分组权限、模型测试与请求不变 |
+2 -1
View File
@@ -1,6 +1,6 @@
# 技能超市 UI 规范(/skill-market)
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-13 · 版本:v2.2
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.3
个人端技能超市 `/skill-market` 的规范,含真实接口与本地演示两种数据模式。本页为独立视觉页面。
@@ -60,6 +60,7 @@
## 4. 主题与样式
- 不新增 ConfigProvider、主题状态或存储 key;`--sm-brand = colorPrimary`、`--sm-text = colorText`,页面根与详情 Portal(`rootStyle`)共用。
- 许可证徽标使用 antd 预设调色板色:待审核 / 未知决策用 `gold`、通过用 `green`、阻止用 `red`;背景与描边使用默认预设,文字取对应主题调色板第 9 档 token,提高小字号可读性;不使用非预设色名 `amber` 或固定浅色背景。卡片与详情复用同一 `LicenseBadge`。
- `.sm-theme` / `html.dark .sm-theme` 变量(浅 / 深):页面底 `#f4f6f9` / `#111720`,面板 `#fff` / `#1b232e`,次要字 `#626f80` / `#aab6c5`,边线 `#e0e5ec` / `#344151`,浅金底 `#fff2dc` / `#3c2f1f`,卡片悬停边 `#c39343`;深色文字型主色 `--sm-accent: #f2ad41`。样式规则只引用变量,无 `!important`。
- 侧栏滚动条 6px,悬停或聚焦时显示;卡片列表隐藏滚动条,不写 `scrollbar-width` / `scrollbar-color`。
- 动效:卡片悬停上浮 3px + 光晕;Hero 线路 15s 线性循环,模块 10s 漂浮 7px(延时 0 / -5 / -3 / -7s);仅精确指针设备悬停生效,`prefers-reduced-motion` 时全部停用。
+2 -1
View File
@@ -1,6 +1,6 @@
# 用户中心 UI 规范(/user-center/\*)
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-16 · 版本:v2.3
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.4
个人登录后用户中心页面的规范,只记录与公共规范不同的部分;密钥管理、服务监控见各自规范。
@@ -79,6 +79,7 @@
- 筛选卡:5 列栅格,时间范围跨 2 列;背景使用 `--surface-card` 纯色(浅色为白色、深色为主题卡片色);操作“重置 / 搜索”右下。
- 列表卡:标题 15px / 600,导出、列设置位于卡头右侧;表头字重 400(公共标准为 500,待收敛)。
- 消费记录调用明细为固定列宽宽表,时间分两行(日期 11px、时间 15px / 600),操作列文字“查看”,固定在右侧;横向滚动条保留 Ant Design 官方固定列表格行为,固定列兼容规则遵循公共规范第 5.2 节。
- 消费记录“用时 / 首字”列宽 190px,总用时、首字耗时与流式状态分别用 antd 默认带描边 `Tag` 展示,保留主题算法生成的浅底 / 文字 / 边框。总用时对 `use_time` 取整数秒,`<101s` 用 `green`、`101–299s` 用 `gold`、`≥300s` 用 `magenta`;首字耗时取 `other.frt / 1000`,先保留一位小数再判色,`<3s` 用 `cyan`、`3–<10s` 用 `orange`、`≥10s` 用 `red`。流式显示三枚标签(状态为蓝色“流”),非流式仅显示总用时与中性“非流”;零值正常展示,缺失、非数值或负耗时显示中性破折号。
- 绘图与视频:三张统计卡(高 70px、间距 15px)+ 任务记录表。
- Webhook 示例为 `<pre class='ui-notify-code'>` +“复制”链接,复制提示沿用原文案。
+13
View File
@@ -24,6 +24,19 @@ import {
projectViewports,
} from './scripts/browser-environment.mjs';
import { runtimeOptions } from './scripts/playwright-runtime.mjs';
import { findDevService } from './scripts/dev-service.mjs';
if (
!process.argv.includes('--list') &&
!process.env.PW_TARGET &&
!process.env.PW_BASE_URL
) {
const existing = await findDevService();
if (existing) {
process.env.PW_TARGET = 'remote';
process.env.PW_BASE_URL = existing;
}
}
const runtime = runtimeOptions({ defaultPort: 4176, defaultWorkers: 1 });
const { target, baseURL, isCI, headless, workers, outputDir, reportDir } =
+120
View File
@@ -0,0 +1,120 @@
/*
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 { readFile, readdir } from 'node:fs/promises';
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const exec = promisify(execFile);
const projectRoot = fileURLToPath(new URL('../', import.meta.url));
export function logAddresses(bytes, encoding) {
const text = bytes.toString(
encoding || (bytes[0] === 255 && bytes[1] === 254 ? 'utf16le' : 'utf8'),
);
return [
...text
.replace(/\x1b\[[0-9;]*m/g, '')
.matchAll(/(?:Local:|Network:)\s*(https?:\/\/[^\s]+)/g),
]
.map((match) => match[1])
.reverse();
}
async function matchesProject(address, root) {
try {
const url = new URL(address);
if (
!['http:', 'https:'].includes(url.protocol) ||
url.username ||
url.password
)
return false;
const source = await readFile(path.join(root, 'src/index.jsx'), 'utf8');
const response = await fetch(new URL('src/index.jsx', url), {
signal: AbortSignal.timeout(2500),
});
if (!response.ok) return false;
const text = await response.text();
const map = text.match(
/sourceMappingURL=data:application\/json;base64,([^\s]+)/,
);
return (
!!map &&
JSON.parse(
Buffer.from(map[1], 'base64').toString(),
).sourcesContent?.includes(source)
);
} catch {
return false;
}
}
async function nodePorts() {
if (process.platform !== 'win32') return [];
const command =
'[Console]::OutputEncoding=[Text.Encoding]::UTF8; $OutputEncoding=[Text.Encoding]::UTF8; ' +
'$ids = @(Get-CimInstance Win32_Process -Filter "Name=\'node.exe\'" | Select-Object -ExpandProperty ProcessId); ' +
'Get-NetTCPConnection -State Listen -ErrorAction Stop | Where-Object { $_.OwningProcess -in $ids } | Select-Object -ExpandProperty LocalPort -Unique | ConvertTo-Json -Compress';
const { stdout } = await exec(
'powershell.exe',
['-NoProfile', '-Command', command],
{ timeout: 15000, windowsHide: true },
);
const parsed = JSON.parse(stdout.trim() || '[]');
return [parsed].flat().filter((port) => Number.isInteger(port) && port > 0);
}
export async function findDevService({
root = projectRoot,
getPorts = nodePorts,
} = {}) {
const candidates = [];
const entries = await readdir(root, { withFileTypes: true });
const logs = entries.filter(
(entry) => entry.isFile() && /\.log$/i.test(entry.name),
);
logs.sort(
(a, b) => Number(b.name === 'dev.log') - Number(a.name === 'dev.log'),
);
for (const entry of logs.slice(0, 8)) {
const bytes = await readFile(path.join(root, entry.name));
candidates.push(
...logAddresses(
bytes.subarray(Math.max(0, bytes.length - 262144)),
bytes[0] === 255 && bytes[1] === 254 ? 'utf16le' : 'utf8',
),
);
}
// Only Node listeners are probed; the source map must match this checkout.
for (const address of new Set(candidates)) {
if (await matchesProject(address, root))
return new URL(address).origin + '/';
}
const ports = await getPorts();
for (const address of new Set(
ports.map((port) => 'http://127.0.0.1:' + port + '/'),
)) {
if (await matchesProject(address, root))
return new URL(address).origin + '/';
}
return null;
}
@@ -62,7 +62,7 @@ const assertSupportedShape = (root) => {
const reject = (what) => {
throw new Error(
`[legacy-css-layers] 入口样式表出现了 ${what},旧浏览器兜底尚不支持这种写法。` +
'请先扩展 web/vite-plugin-legacy-css-layers.js 的 flattenCssLayers 再构建。',
'请先扩展 scripts/vite/legacy-css-layers.js 的 flattenCssLayers 再构建。',
);
};
root.walkAtRules((rule) => {
+7 -7
View File
@@ -42,12 +42,12 @@ const AuthCardHeader = ({
const { t } = useTranslation();
return (
<div
className={`flex flex-col items-center justify-center ${wrapperClassName}`}
className={`auth-card-header flex flex-col items-center justify-center ${wrapperClassName}`}
>
<div className={`relative ${logoWrapperClassName}`}>
{/* Logo 光环 */}
<div className='absolute -inset-1.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-xl blur-md opacity-60' />
<div className='relative p-2 bg-white dark:bg-neutral-800 rounded-xl shadow-md'>
<div className={`auth-card-logo relative ${logoWrapperClassName}`}>
{/* Logo 光环(.auth-login-page 认证页内隐藏,保持克制) */}
<div className='auth-card-logo-halo absolute -inset-1.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-xl blur-md opacity-60' />
<div className='auth-card-logo-box relative p-2 bg-white dark:bg-neutral-800 rounded-xl shadow-md'>
{logoNode || (
<img
src={logo}
@@ -58,10 +58,10 @@ const AuthCardHeader = ({
</div>
<Sparkles
size={14}
className='absolute -top-0.5 -right-0.5 text-amber-400 motion-safe:animate-pulse'
className='auth-card-sparkle absolute -top-0.5 -right-0.5 text-amber-400 motion-safe:animate-pulse'
/>
</div>
<h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
<h4 className='auth-card-title text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
{title}
</h4>
<p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
+35
View File
@@ -0,0 +1,35 @@
/*
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';
/**
* 认证页统一的「— 文案 —」分隔线(如「或」「还没有企业?」)。
* 两侧细线 + 居中弱化文字,不依赖底色遮挡,玻璃卡片与深色模式下都干净。
* 样式见 src/styles/prototype.css 的 .auth-divider。
*/
const AuthDivider = ({ children, className = '' }) => (
<div className={`auth-divider ${className}`} role='separator'>
<span className='auth-divider-line' aria-hidden='true' />
<span className='auth-divider-text'>{children}</span>
<span className='auth-divider-line' aria-hidden='true' />
</div>
);
export default AuthDivider;
+4 -4
View File
@@ -201,14 +201,14 @@ const GlassCard = ({
return (
<div className={`w-full max-w-sm relative login-card-float ${className}`}>
<GlassCardStyles />
{/* 外环柔光晕 */}
<div className='absolute -inset-6 bg-gradient-to-br from-brand-from/15 via-brand-via/10 to-brand-to/15 rounded-[2rem] blur-2xl opacity-80 pointer-events-none' />
{/* 外环柔光晕(.auth-login-page 认证页内隐藏) */}
<div className='login-card-glow absolute -inset-6 bg-gradient-to-br from-brand-from/15 via-brand-via/10 to-brand-to/15 rounded-[2rem] blur-2xl opacity-80 pointer-events-none' />
{/* 左上 / 右下脉动光晕 */}
{withCornerHalos && (
<>
<div className='absolute -top-20 -left-20 w-44 h-44 bg-brand-from/25 dark:bg-brand-from/20 rounded-full blur-3xl pointer-events-none login-halo-pulse' />
<div className='absolute -bottom-20 -right-20 w-44 h-44 bg-brand-to/25 dark:bg-brand-to/15 rounded-full blur-3xl pointer-events-none login-halo-pulse-delayed' />
<div className='login-card-halo absolute -top-20 -left-20 w-44 h-44 bg-brand-from/25 dark:bg-brand-from/20 rounded-full blur-3xl pointer-events-none login-halo-pulse' />
<div className='login-card-halo absolute -bottom-20 -right-20 w-44 h-44 bg-brand-to/25 dark:bg-brand-to/15 rounded-full blur-3xl pointer-events-none login-halo-pulse-delayed' />
</>
)}
+60 -103
View File
@@ -71,6 +71,7 @@ import { Shield, Smartphone, QrCode } from 'lucide-react';
import GlassCard from './GlassCard';
import AuthCardHeader from './AuthCardHeader';
import AuthLoginTabs from './AuthLoginTabs';
import AuthDivider from './AuthDivider';
import AgreementModal from '../common/DocumentRenderer/AgreementModal';
import {
isMiniProgramWebView,
@@ -93,38 +94,26 @@ const IS_MOBILE_DEVICE =
);
// 提取OAuthButton到组件外部,避免每次渲染都重建
// 第三方登录按钮:统一为 36px 描边按钮,无位移 / 扫光动效(尺寸见 prototype.css .auth-login-page)
const OAuthButton = React.memo(
({ icon, children, onClick, loading, disabled, iconColor, t }) => (
<button
({ icon, children, onClick, loading, disabled, iconColor }) => (
<Button
block
className='auth-oauth-button'
onClick={onClick}
disabled={loading || disabled}
className={`
group relative w-full h-10 flex items-center justify-center gap-2
bg-white/80 dark:bg-white/[0.08] backdrop-blur-sm
border border-gray-200/80 dark:border-white/[0.12]
rounded-xl shadow-sm
hover:bg-white dark:hover:bg-white/[0.12]
hover:shadow-md hover:shadow-gray-200/50 dark:hover:shadow-black/30
hover:-translate-y-0.5 hover:border-gray-300 dark:hover:border-white/20
active:translate-y-0
transition-all duration-200 ease-out
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0
overflow-hidden
`}
loading={loading}
disabled={disabled}
icon={
<span
className='auth-oauth-icon'
style={iconColor ? { color: iconColor } : undefined}
>
{icon}
</span>
}
>
{/* 悬停光效 */}
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/30 dark:via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
<span
style={iconColor ? { color: iconColor } : undefined}
className='relative z-10 flex items-center justify-center w-4 h-4 text-gray-700 dark:text-gray-200'
>
{icon}
</span>
<span className='relative z-10 font-medium text-sm text-gray-700 dark:text-gray-200'>
{loading ? (t ? t('加载中...') : '加载中...') : children}
</span>
</button>
{children}
</Button>
),
);
@@ -177,6 +166,16 @@ const LoginForm = () => {
const [githubButtonText, setGithubButtonText] = useState('');
const [githubButtonDisabled, setGithubButtonDisabled] = useState(false);
const githubTimeoutRef = useRef(null);
// 微信验证码弹窗表单:确定前先做前端必填校验,通过后再走原提交逻辑
const wechatFormApi = useRef(null);
const submitWeChatCodeWithValidation = async () => {
try {
await wechatFormApi.current?.validate();
} catch {
return;
}
await onSubmitWeChatVerificationCode();
};
const logo = getLogo();
const systemName = getSystemName();
@@ -629,7 +628,7 @@ const LoginForm = () => {
subtitle={t('请选择登录方式')}
/>
<div className='space-y-2'>
<div className='auth-option-list'>
{status.wechat_login && (
<OAuthButton
icon={<Icon svg={<WeChatIcon />} />}
@@ -730,39 +729,22 @@ const LoginForm = () => {
</OAuthButton>
)}
{/* 分隔线 */}
<div className='relative py-3'>
<div className='absolute inset-0 flex items-center'>
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
</div>
<div className='relative flex justify-center'>
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
{t('或')}
</span>
</div>
</div>
<AuthDivider>{t('或')}</AuthDivider>
{/* 邮箱登录按钮 */}
<button
<Button
theme='solid'
block
className='auth-login-submit'
icon={<IconMail />}
onClick={handleEmailLoginClick}
className='app-action-button 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 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 overflow-hidden'
>
{/* 闪光效果 */}
<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' />
<IconMail className='relative z-10' />
<span className='relative z-10 font-medium text-sm'>
{t('邮箱/用户名 登录')}
</span>
<ActionArrowRight
size={16}
className='relative z-10 group-hover:translate-x-1 transition-transform'
/>
</button>
{t('邮箱/用户名 登录')}
</Button>
</div>
{(hasUserAgreement || hasPrivacyPolicy) && (
<div className='mt-4 flex justify-center'>
<div className='auth-login-agreement flex justify-center'>
<Checkbox
checked={agreedToTerms}
onChange={(e) => setAgreedToTerms(e.target.checked)}
@@ -801,7 +783,7 @@ const LoginForm = () => {
)}
{!status.self_use_mode_enabled && (
<div className='mt-4 text-center'>
<div className='auth-login-register text-center'>
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
{t('没有账户?')}{' '}
<Link
@@ -815,7 +797,7 @@ const LoginForm = () => {
)}
{/* 安全提示 */}
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
<div className='auth-login-security'>
<Shield size={12} />
<span>{t('安全登录')}</span>
</div>
@@ -847,30 +829,17 @@ const LoginForm = () => {
)}
{status.passkey_login && passkeySupported && (
<div className='relative py-2'>
<div className='absolute inset-0 flex items-center'>
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
</div>
<div className='relative flex justify-center'>
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
{t('或')}
</span>
</div>
</div>
<AuthDivider>{t('或')}</AuthDivider>
)}
<Form className='auth-login-form' onSubmit={handleSubmit}>
<Form.Input
field='username'
className='auth-login-required-field'
rules={[{ required: true, message: t('请输入用户名或邮箱') }]}
rules={[{ required: true, message: t('请输入用户名/邮箱') }]}
required
aria-required='true'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('用户名/邮箱')}
</span>
}
label={t('用户名/邮箱')}
placeholder={t('请输入用户名或邮箱')}
name='username'
size='default'
@@ -886,11 +855,7 @@ const LoginForm = () => {
rules={[{ required: true, message: t('请输入密码') }]}
required
aria-required='true'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('密码')}
</span>
}
label={t('密码')}
placeholder={t('请输入密码')}
name='password'
mode='password'
@@ -901,7 +866,7 @@ const LoginForm = () => {
/>
{(hasUserAgreement || hasPrivacyPolicy) && (
<div className='flex items-center'>
<div className='auth-login-agree-row flex items-center'>
<Checkbox
checked={agreedToTerms}
onChange={(e) => setAgreedToTerms(e.target.checked)}
@@ -972,24 +937,15 @@ const LoginForm = () => {
status.wechat_open_oauth ||
status.linuxdo_oauth ||
status.telegram_oauth) && (
<div className='mt-1'>
<div className='relative py-2'>
<div className='absolute inset-0 flex items-center'>
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
</div>
<div className='relative flex justify-center'>
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
{t('或')}
</span>
</div>
</div>
<button
<div>
<AuthDivider>{t('或')}</AuthDivider>
<Button
block
className='auth-oauth-button'
onClick={handleOtherLoginOptionsClick}
className='w-full h-9 flex items-center justify-center gap-2 text-sm text-gray-600 dark:text-gray-300 border border-gray-200/80 dark:border-white/[0.12] rounded-lg hover:bg-gray-50 dark:hover:bg-white/[0.06] hover:border-gray-300 dark:hover:border-white/20 transition-all'
>
{t('其他登录选项')}
</button>
</Button>
</div>
)}
@@ -1008,7 +964,7 @@ const LoginForm = () => {
)}
{/* 安全提示 */}
<div className='mt-3 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
<div className='auth-login-security'>
<Shield size={12} />
<span>{t('安全登录')}</span>
</div>
@@ -1033,14 +989,14 @@ const LoginForm = () => {
}
visible={showWeChatLoginModal}
maskClosable={true}
onOk={onSubmitWeChatVerificationCode}
onOk={submitWeChatCodeWithValidation}
onCancel={() => setShowWeChatLoginModal(false)}
okText={t('登录')}
centered={true}
okButtonProps={{
loading: wechatCodeSubmitLoading,
}}
className='wechat-login-modal'
className='wechat-login-modal auth-login-modal'
>
{/* 移动端提示 */}
{isMobileView && !isInWeChat && (
@@ -1094,16 +1050,16 @@ const LoginForm = () => {
</p>
</div>
<Form>
<Form getFormApi={(api) => (wechatFormApi.current = api)}>
<Form.Input
field='wechat_verification_code'
placeholder={t('请输入验证码')}
label={t('验证码')}
rules={[{ required: true, message: t('请输入验证码') }]}
value={inputs.wechat_verification_code}
onChange={(value) =>
handleChange('wechat_verification_code', value)
}
className='!rounded-xl'
/>
</Form>
</Modal>
@@ -1192,11 +1148,11 @@ const LoginForm = () => {
<Modal
title={
<div className='flex items-center gap-3'>
<div className='w-10 h-10 rounded-xl bg-gradient-to-br from-green-400 to-emerald-500 flex items-center justify-center shadow-lg shadow-green-500/30'>
<Shield size={20} className='text-white' />
<div className='auth-modal-title-icon'>
<Shield size={18} />
</div>
<div>
<div className='font-bold'>{t('两步验证')}</div>
<div className='font-semibold'>{t('两步验证')}</div>
<div className='text-xs text-gray-500 dark:text-gray-400 font-normal'>
{t('请输入验证码完成登录')}
</div>
@@ -1208,6 +1164,7 @@ const LoginForm = () => {
footer={null}
width={450}
centered
className='auth-login-modal'
>
<TwoFAVerification
onSuccess={handle2FASuccess}
+95 -113
View File
@@ -27,11 +27,14 @@ import {
getSystemName,
} from '../../helpers';
import { useSearchParams, Link } from 'react-router-dom';
import { Button, Card, Form, Typography, Banner } from '@/components/ui';
import { Button, Form, Typography, Banner } from '@/components/ui';
import { IconMail, IconLock, IconCopy } from '@/components/ui/icons';
import { useTranslation } from 'react-i18next';
import AuthBackground from '../common/AuthBackground';
import GlassCard from './GlassCard';
import AuthCardHeader from './AuthCardHeader';
const { Text, Title } = Typography;
const { Text } = Typography;
const PasswordResetConfirm = () => {
const { t } = useTranslation();
@@ -108,121 +111,100 @@ const PasswordResetConfirm = () => {
}
return (
<div className='relative overflow-hidden bg-gray-100 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'>
{/* 背景模糊晕染球 */}
<div
className='blur-ball blur-ball-indigo'
style={{ top: '-80px', right: '-80px', transform: 'none' }}
/>
<div
className='blur-ball blur-ball-teal'
style={{ top: '50%', left: '-120px' }}
/>
<div className='w-full max-w-sm mt-[60px]'>
<div className='flex flex-col items-center'>
<div className='w-full max-w-md'>
<div className='flex items-center justify-center mb-6 gap-2'>
<img
src={logo}
alt={t('网站标志')}
className='h-10 rounded-full'
<div
className='auth-login-page relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'
// 与登录页一致:抵扣 PageLayout 跑马灯占位高度,避免幽灵滚动
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
>
<AuthBackground />
<div className='w-full max-w-md z-10 flex flex-col items-center'>
<GlassCard>
<AuthCardHeader
logo={logo}
title={systemName}
subtitle={t('密码重置确认')}
/>
{!isValidResetLink && (
<Banner
type='danger'
description={t('无效的重置链接,请重新发起密码重置请求')}
className='auth-login-banner'
closeIcon={null}
/>
)}
<Form
className='auth-login-form'
getFormApi={(api) => setFormApi(api)}
initValues={{
email: email || '',
newPassword: newPassword || '',
}}
>
<Form.Input
field='email'
label={t('邮箱')}
name='email'
disabled={true}
prefix={<IconMail />}
placeholder={email ? '' : t('等待获取邮箱信息...')}
/>
{newPassword && (
<Form.Input
field='newPassword'
label={t('新密码')}
name='newPassword'
disabled={true}
prefix={<IconLock />}
suffix={
<Button
icon={<IconCopy />}
type='tertiary'
theme='borderless'
size='small'
onClick={async () => {
if (await copy(newPassword)) {
showNotice(
`${t('密码已复制到剪贴板:')} ${newPassword}`,
);
} else {
showError(t('复制失败,请手动复制'));
}
}}
>
{t('复制')}
</Button>
}
/>
<Title heading={3} className='!text-gray-800'>
{systemName}
</Title>
)}
<div className='auth-login-actions'>
<Button
theme='solid'
block
className='auth-login-submit'
htmlType='submit'
onClick={handleSubmit}
loading={loading}
disabled={disableButton || newPassword || !isValidResetLink}
>
{newPassword ? t('密码重置完成') : t('确认重置密码')}
</Button>
</div>
</Form>
<Card className='border-0 !rounded-2xl overflow-hidden'>
<div className='flex justify-center pt-6 pb-2'>
<Title heading={3} className='text-gray-800 dark:text-gray-200'>
{t('密码重置确认')}
</Title>
</div>
<div className='px-2 py-8'>
{!isValidResetLink && (
<Banner
type='danger'
description={t('无效的重置链接,请重新发起密码重置请求')}
className='mb-4 !rounded-lg'
closeIcon={null}
/>
)}
<Form
getFormApi={(api) => setFormApi(api)}
initValues={{
email: email || '',
newPassword: newPassword || '',
}}
className='space-y-4'
>
<Form.Input
field='email'
label={t('邮箱')}
name='email'
disabled={true}
prefix={<IconMail />}
placeholder={email ? '' : t('等待获取邮箱信息...')}
/>
{newPassword && (
<Form.Input
field='newPassword'
label={t('新密码')}
name='newPassword'
disabled={true}
prefix={<IconLock />}
suffix={
<Button
icon={<IconCopy />}
type='tertiary'
theme='borderless'
onClick={async () => {
if (await copy(newPassword)) {
showNotice(
`${t('密码已复制到剪贴板:')} ${newPassword}`,
);
} else {
showError(t('复制失败,请手动复制'));
}
}}
>
{t('复制')}
</Button>
}
/>
)}
<div className='space-y-2 pt-2'>
<Button
theme='solid'
className='w-full !rounded-full'
type='primary'
htmlType='submit'
onClick={handleSubmit}
loading={loading}
disabled={
disableButton || newPassword || !isValidResetLink
}
>
{newPassword ? t('密码重置完成') : t('确认重置密码')}
</Button>
</div>
</Form>
<div className='mt-6 text-center text-sm'>
<Text>
<Link
to='/login'
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-medium transition-colors'
>
{t('返回登录')}
</Link>
</Text>
</div>
</div>
</Card>
<div className='auth-login-register text-center'>
<Text className='text-xs'>
<Link
to='/login'
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
>
{t('返回登录')}
</Link>
</Text>
</div>
</div>
</GlassCard>
</div>
</div>
);
+74 -84
View File
@@ -27,12 +27,15 @@ import {
getSystemName,
} from '../../helpers';
import Turnstile from 'react-turnstile';
import { Button, Card, Form, Typography } from '@/components/ui';
import { Button, Form, Typography } from '@/components/ui';
import { IconMail } from '@/components/ui/icons';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import AuthBackground from '../common/AuthBackground';
import GlassCard from './GlassCard';
import AuthCardHeader from './AuthCardHeader';
const { Text, Title } = Typography;
const { Text } = Typography;
const PasswordResetForm = () => {
const { t } = useTranslation();
@@ -104,91 +107,78 @@ const PasswordResetForm = () => {
}
return (
<div className='relative overflow-hidden bg-gray-100 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'>
{/* 背景模糊晕染球 */}
<div
className='blur-ball blur-ball-indigo'
style={{ top: '-80px', right: '-80px', transform: 'none' }}
/>
<div
className='blur-ball blur-ball-teal'
style={{ top: '50%', left: '-120px' }}
/>
<div className='w-full max-w-sm mt-[60px]'>
<div className='flex flex-col items-center'>
<div className='w-full max-w-md'>
<div className='flex items-center justify-center mb-6 gap-2'>
<img
src={logo}
alt={t('网站标志')}
className='h-10 rounded-full'
/>
<Title heading={3} className='!text-gray-800'>
{systemName}
</Title>
<div
className='auth-login-page relative overflow-hidden flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8'
// 与登录页一致:抵扣 PageLayout 跑马灯占位高度,避免幽灵滚动
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
>
<AuthBackground />
<div className='w-full max-w-md z-10 flex flex-col items-center'>
<GlassCard>
<AuthCardHeader
logo={logo}
title={systemName}
subtitle={t('密码重置')}
/>
{/* 前端校验(必填 + 邮箱格式)通过后才调用原 handleSubmit */}
<Form className='auth-login-form' onSubmit={() => handleSubmit()}>
<Form.Input
field='email'
label={t('邮箱')}
rules={[
{ required: true, message: t('请输入邮箱') },
{
type: 'email',
transform: (v) => v?.trim(),
message: t('邮箱格式不正确'),
},
]}
trigger='blur'
placeholder={t('请输入您的邮箱地址')}
name='email'
value={email}
onChange={handleChange}
prefix={<IconMail />}
/>
<div className='auth-login-actions'>
<Button
theme='solid'
block
className='auth-login-submit'
htmlType='submit'
loading={loading}
disabled={disableButton}
>
{disableButton ? `${t('重试')} (${countdown})` : t('提交')}
</Button>
</div>
</Form>
<Card className='border-0 !rounded-2xl overflow-hidden'>
<div className='flex justify-center pt-6 pb-2'>
<Title heading={3} className='text-gray-800 dark:text-gray-200'>
{t('密码重置')}
</Title>
</div>
<div className='px-2 py-8'>
<Form className='space-y-3'>
<Form.Input
field='email'
label={t('邮箱')}
placeholder={t('请输入您的邮箱地址')}
name='email'
value={email}
onChange={handleChange}
prefix={<IconMail />}
/>
<div className='space-y-2 pt-2'>
<Button
theme='solid'
className='w-full !rounded-full'
type='primary'
htmlType='submit'
onClick={handleSubmit}
loading={loading}
disabled={disableButton}
>
{disableButton
? `${t('重试')} (${countdown})`
: t('提交')}
</Button>
</div>
</Form>
<div className='mt-6 text-center text-sm'>
<Text>
{t('想起来了?')}{' '}
<Link
to='/login'
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-medium transition-colors'
>
{t('登录')}
</Link>
</Text>
</div>
</div>
</Card>
{turnstileEnabled && (
<div className='flex justify-center mt-6'>
<Turnstile
sitekey={turnstileSiteKey}
onVerify={(token) => {
setTurnstileToken(token);
}}
/>
</div>
)}
<div className='auth-login-register text-center'>
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
{t('想起来了?')}{' '}
<Link
to='/login'
className='!text-brand-deep dark:!text-brand-from hover:!text-brand dark:hover:!text-brand-from font-semibold transition-colors'
>
{t('登录')}
</Link>
</Text>
</div>
</div>
</GlassCard>
{turnstileEnabled && (
<div className='flex justify-center mt-6'>
<Turnstile
sitekey={turnstileSiteKey}
onVerify={(token) => {
setTurnstileToken(token);
}}
/>
</div>
)}
</div>
</div>
);
+110 -138
View File
@@ -65,6 +65,7 @@ import AuthBackground from '../common/AuthBackground';
import GlassCard from './GlassCard';
import AuthCardHeader from './AuthCardHeader';
import AuthLoginTabs from './AuthLoginTabs';
import AuthDivider from './AuthDivider';
import { Shield, Smartphone, QrCode } from 'lucide-react';
import AgreementModal from '../common/DocumentRenderer/AgreementModal';
import {
@@ -143,6 +144,26 @@ const RegisterForm = () => {
const [githubButtonDisabled, setGithubButtonDisabled] = useState(false);
const [showWeChatOpenTipModal, setShowWeChatOpenTipModal] = useState(false);
const githubTimeoutRef = useRef(null);
// 注册表单 / 微信验证码弹窗的表单实例:用于在原逻辑执行前做前端校验
const registerFormApi = useRef(null);
const wechatFormApi = useRef(null);
// 获取验证码前先校验邮箱必填与格式,通过后走原发送逻辑
const sendVerificationCodeWithValidation = async () => {
try {
await registerFormApi.current?.validate(['email']);
} catch {
return;
}
await sendVerificationCode();
};
const submitWeChatCodeWithValidation = async () => {
try {
await wechatFormApi.current?.validate();
} catch {
return;
}
await onSubmitWeChatVerificationCode();
};
const logo = getLogo();
const systemName = getSystemName();
@@ -459,7 +480,7 @@ const RegisterForm = () => {
}
};
// 注册按钮样式组件
// 第三方注册按钮:与登录页一致的 36px 描边按钮,无位移 / 扫光动效
const OAuthButton = ({
icon,
children,
@@ -468,36 +489,23 @@ const RegisterForm = () => {
disabled,
iconColor,
}) => (
<button
<Button
block
className='auth-oauth-button'
onClick={onClick}
disabled={loading || disabled}
className={`
group relative w-full h-10 flex items-center justify-center gap-2
bg-white/80 dark:bg-white/[0.08] backdrop-blur-sm
border border-gray-200/80 dark:border-white/[0.12]
rounded-xl shadow-sm
hover:bg-white dark:hover:bg-white/[0.12]
hover:shadow-md hover:shadow-gray-200/50 dark:hover:shadow-black/30
hover:-translate-y-0.5 hover:border-gray-300 dark:hover:border-white/20
active:translate-y-0
transition-all duration-200 ease-out
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0
overflow-hidden
`}
loading={loading}
disabled={disabled}
icon={
<span
className='auth-oauth-icon'
style={iconColor ? { color: iconColor } : undefined}
>
{icon}
</span>
}
>
{/* 悬停光效 */}
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/30 dark:via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500' />
<span
style={iconColor ? { color: iconColor } : undefined}
className='relative z-10 flex items-center justify-center w-4 h-4 text-gray-700 dark:text-gray-200'
>
{icon}
</span>
<span className='relative z-10 font-medium text-sm text-gray-700 dark:text-gray-200'>
{loading ? t('加载中...') : children}
</span>
</button>
{children}
</Button>
);
const renderOAuthOptions = () => {
@@ -509,7 +517,7 @@ const RegisterForm = () => {
subtitle={t('创建您的账户')}
/>
<div className='space-y-2'>
<div className='auth-option-list'>
{status.wechat_login && (
<OAuthButton
icon={<Icon svg={<WeChatIcon />} />}
@@ -591,40 +599,23 @@ const RegisterForm = () => {
</Suspense>
)}
{/* 分隔线 */}
<div className='relative py-3'>
<div className='absolute inset-0 flex items-center'>
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
</div>
<div className='relative flex justify-center'>
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
{t('或')}
</span>
</div>
</div>
<AuthDivider>{t('或')}</AuthDivider>
{/* 用户名注册按钮 */}
<button
<Button
theme='solid'
block
className='auth-login-submit'
icon={<IconMail />}
onClick={handleEmailRegisterClick}
disabled={emailRegisterLoading}
className='app-action-button 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 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 overflow-hidden'
>
{/* 闪光效果 */}
<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' />
<IconMail className='relative z-10' />
<span className='relative z-10 font-medium text-sm'>
{t('使用 用户名 注册')}
</span>
<ActionArrowRight
size={16}
className='relative z-10 group-hover:translate-x-1 transition-transform'
/>
</button>
{t('使用 用户名 注册')}
</Button>
</div>
{(hasUserAgreement || hasPrivacyPolicy) && (
<div className='mt-4 flex justify-center'>
<div className='auth-login-agreement flex justify-center'>
<Checkbox
checked={agreedToTerms}
onChange={(e) => setAgreedToTerms(e.target.checked)}
@@ -662,7 +653,7 @@ const RegisterForm = () => {
</div>
)}
<div className='mt-4 text-center'>
<div className='auth-login-register text-center'>
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
{t('已有账户?')}{' '}
<Link
@@ -675,7 +666,7 @@ const RegisterForm = () => {
</div>
{/* 安全提示 */}
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
<div className='auth-login-security'>
<Shield size={12} />
<span>{t('安全注册')}</span>
</div>
@@ -694,35 +685,35 @@ const RegisterForm = () => {
logoWrapperClassName='mb-2'
/>
<Form className='register-compact-form auth-glass-form'>
{/* 用户名输入框 —— 玻璃观感统一由 .auth-glass-form(GlassCard 内置样式)驱动 */}
{/* 前端校验通过后才调用原 handleSubmit;其内协议 / 长度 / 一致性判断原样保留 */}
<Form
className='auth-login-form'
getFormApi={(api) => (registerFormApi.current = api)}
onSubmit={() => handleSubmit()}
>
<Form.Input
field='username'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('用户名')}
</span>
}
label={t('用户名')}
rules={[{ required: true, message: t('请输入用户名') }]}
placeholder={t('请输入用户名')}
name='username'
size='large'
autoComplete='username'
onChange={(value) => handleChange('username', value)}
prefix={<IconUser size='small' />}
/>
{/* 密码输入框 */}
{/* 密码输入框:长度 8-20 与占位提示、后端约束一致 */}
<Form.Input
field='password'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('密码')}
</span>
}
label={t('密码')}
rules={[
{ required: true, message: t('请输入密码') },
{ min: 8, max: 20, message: t('密码长度需为 8-20 位') },
]}
trigger='blur'
placeholder={t('输入密码,最短 8 位,最长 20 位')}
name='password'
mode='password'
size='large'
autoComplete='new-password'
onChange={(value) => handleChange('password', value)}
prefix={<IconLock size='small' />}
@@ -731,15 +722,17 @@ const RegisterForm = () => {
{/* 确认密码输入框 */}
<Form.Input
field='password2'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('确认密码')}
</span>
}
label={t('确认密码')}
required
validate={(value, values) => {
if (!value) return t('请输入确认密码');
if (value !== values.password) return t('两次输入的密码不一致');
return '';
}}
trigger='blur'
placeholder={t('确认密码')}
name='password2'
mode='password'
size='large'
autoComplete='new-password'
onChange={(value) => handleChange('password2', value)}
prefix={<IconLock size='small' />}
@@ -749,22 +742,26 @@ const RegisterForm = () => {
<>
<Form.Input
field='email'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('邮箱')}
</span>
}
label={t('邮箱')}
rules={[
{ required: true, message: t('请输入邮箱') },
{
type: 'email',
transform: (v) => v?.trim(),
message: t('邮箱格式不正确'),
},
]}
trigger='blur'
placeholder={t('输入邮箱地址')}
name='email'
type='email'
size='large'
autoComplete='email'
onChange={(value) => handleChange('email', value)}
prefix={<IconMail size='small' />}
suffix={
<Button
size='small'
onClick={sendVerificationCode}
onClick={sendVerificationCodeWithValidation}
loading={verificationCodeLoading}
disabled={disableButton || verificationCodeLoading}
className='!rounded-lg'
@@ -777,14 +774,10 @@ const RegisterForm = () => {
/>
<Form.Input
field='verification_code'
label={
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
{t('验证码')}
</span>
}
label={t('验证码')}
rules={[{ required: true, message: t('请输入验证码') }]}
placeholder={t('输入验证码')}
name='verification_code'
size='large'
onChange={(value) => handleChange('verification_code', value)}
prefix={<IconKey size='small' />}
/>
@@ -792,7 +785,7 @@ const RegisterForm = () => {
)}
{(hasUserAgreement || hasPrivacyPolicy) && (
<div className='flex items-center mt-3'>
<div className='auth-login-agree-row flex items-center'>
<Checkbox
checked={agreedToTerms}
onChange={(e) => setAgreedToTerms(e.target.checked)}
@@ -827,34 +820,22 @@ const RegisterForm = () => {
</div>
)}
<div className='space-y-2 mt-3'>
{/* 注册按钮 */}
<button
type='submit'
onClick={handleSubmit}
<div className='auth-login-actions'>
{/* 注册按钮:提交经表单校验后调用原 handleSubmit,禁用条件不变 */}
<Button
theme='solid'
htmlType='submit'
block
className='auth-login-submit'
loading={registerLoading}
disabled={
registerLoading ||
((hasUserAgreement || hasPrivacyPolicy) && !agreedToTerms)
}
className='app-action-button 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'
>
{/* 闪光效果 */}
<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' />
{registerLoading ? (
<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>
<ActionArrowRight
size={16}
className='relative z-10 group-hover:translate-x-1 transition-transform'
/>
</>
)}
</button>
<span className='font-semibold'>{t('注 册')}</span>
<ActionArrowRight size={16} />
</Button>
</div>
</Form>
@@ -865,29 +846,20 @@ const RegisterForm = () => {
status.wechat_open_oauth ||
status.linuxdo_oauth ||
status.telegram_oauth) && (
<div className='mt-2'>
<div className='relative py-3'>
<div className='absolute inset-0 flex items-center'>
<div className='w-full border-t border-gray-200/80 dark:border-white/[0.08]'></div>
</div>
<div className='relative flex justify-center'>
<span className='px-3 text-xs text-gray-400 dark:text-gray-500 bg-white/60 dark:bg-neutral-900/70 backdrop-blur-md rounded-full'>
{t('或')}
</span>
</div>
</div>
<button
<div>
<AuthDivider>{t('或')}</AuthDivider>
<Button
block
className='auth-oauth-button'
onClick={handleOtherRegisterOptionsClick}
disabled={otherRegisterOptionsLoading}
className='w-full h-9 flex items-center justify-center gap-2 text-sm text-gray-600 dark:text-gray-300 border border-gray-200/80 dark:border-white/[0.12] rounded-lg hover:bg-gray-50 dark:hover:bg-white/[0.06] hover:border-gray-300 dark:hover:border-white/20 transition-all'
>
{t('其他注册选项')}
</button>
</Button>
</div>
)}
<div className='mt-4 text-center'>
<div className='auth-login-register text-center'>
<Text className='text-gray-500 dark:text-gray-400 text-xs'>
{t('已有账户?')}{' '}
<Link
@@ -900,7 +872,7 @@ const RegisterForm = () => {
</div>
{/* 安全提示 */}
<div className='mt-4 flex items-center justify-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500'>
<div className='auth-login-security'>
<Shield size={12} />
<span>{t('安全注册')}</span>
</div>
@@ -925,14 +897,14 @@ const RegisterForm = () => {
}
visible={showWeChatLoginModal}
maskClosable={true}
onOk={onSubmitWeChatVerificationCode}
onOk={submitWeChatCodeWithValidation}
onCancel={() => setShowWeChatLoginModal(false)}
okText={t('登录')}
centered={true}
okButtonProps={{
loading: wechatCodeSubmitLoading,
}}
className='wechat-login-modal'
className='wechat-login-modal auth-login-modal'
>
{/* 移动端提示 */}
{isMobileView && !isInWeChat && (
@@ -986,16 +958,16 @@ const RegisterForm = () => {
</p>
</div>
<Form>
<Form getFormApi={(api) => (wechatFormApi.current = api)}>
<Form.Input
field='wechat_verification_code'
placeholder={t('请输入验证码')}
label={t('验证码')}
rules={[{ required: true, message: t('请输入验证码') }]}
value={inputs.wechat_verification_code}
onChange={(value) =>
handleChange('wechat_verification_code', value)
}
className='!rounded-xl'
/>
</Form>
</Modal>
@@ -1089,7 +1061,7 @@ const RegisterForm = () => {
return (
<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 跑马灯占位高度,保证占位+容器恰为一屏,避免幽灵滚动
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
>
+27 -8
View File
@@ -71,6 +71,21 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
}
};
// 前端校验:与 handleSubmit 内原有判断一致,改为在输入框下方就地提示
const codeRules = [
{
required: true,
message: useBackupCode ? t('请输入备用码') : t('请输入验证码'),
},
{
validator: (_, value) => {
if (!value) return true;
if (useBackupCode) return value.length === 8 || t('备用码必须是8位');
return /^\d{6}$/.test(value) || t('验证码必须是6位数字');
},
},
];
if (isModal) {
return (
<div className='space-y-4'>
@@ -88,7 +103,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
value={verificationCode}
onChange={setVerificationCode}
onKeyPress={handleKeyPress}
size='large'
rules={codeRules}
trigger='blur'
style={{ marginBottom: 16 }}
autoFocus
/>
@@ -98,7 +114,6 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
type='primary'
loading={loading}
block
size='large'
style={{ marginBottom: 16 }}
>
{t('验证并登录')}
@@ -115,7 +130,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
setUseBackupCode(!useBackupCode);
setVerificationCode('');
}}
style={{ marginRight: 16, color: '#1890ff', padding: 0 }}
style={{ marginRight: 16, padding: 0 }}
className='!text-brand'
>
{useBackupCode ? t('使用认证器验证码') : t('使用备用码')}
</Button>
@@ -125,7 +141,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
theme='borderless'
type='tertiary'
onClick={onBack}
style={{ color: '#1890ff', padding: 0 }}
style={{ padding: 0 }}
className='!text-brand'
>
{t('返回登录')}
</Button>
@@ -177,7 +194,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
value={verificationCode}
onChange={setVerificationCode}
onKeyPress={handleKeyPress}
size='large'
rules={codeRules}
trigger='blur'
style={{ marginBottom: 16 }}
autoFocus
/>
@@ -187,7 +205,6 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
type='primary'
loading={loading}
block
size='large'
style={{ marginBottom: 16 }}
>
{t('验证并登录')}
@@ -204,7 +221,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
setUseBackupCode(!useBackupCode);
setVerificationCode('');
}}
style={{ marginRight: 16, color: '#1890ff', padding: 0 }}
style={{ marginRight: 16, padding: 0 }}
className='!text-brand'
>
{useBackupCode ? t('使用认证器验证码') : t('使用备用码')}
</Button>
@@ -214,7 +232,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
theme='borderless'
type='tertiary'
onClick={onBack}
style={{ color: '#1890ff', padding: 0 }}
style={{ padding: 0 }}
className='!text-brand'
>
{t('返回登录')}
</Button>
+4 -1
View File
@@ -130,7 +130,10 @@ export const ConsoleForm = forwardRef(function ConsoleForm(
layout={isSettings ? 'vertical' : layout}
labelCol={isSettings ? undefined : props.labelCol}
wrapperCol={isSettings ? undefined : props.wrapperCol}
labelAlign={isSettings ? 'left' : props.labelAlign}
labelAlign={isSettings ? 'start' : props.labelAlign}
autoComplete={
isSettings ? (props.autoComplete ?? 'off') : props.autoComplete
}
className={classes(
isSettings ? 'console-form settings-system-form' : 'console-form',
className,
+1
View File
@@ -377,6 +377,7 @@
.console-page .expert-platform-shell,
.console-page .skill-platform-metrics,
.console-page .skill-platform-toolbar,
.console-page .skill-platform-tag-chips,
.console-page .skill-platform-grid {
max-width: none;
margin-inline: 0;
+4 -3
View File
@@ -346,9 +346,10 @@ const PageLayout = () => {
<Header
className={
isAuthPage
? ['/org/login', '/login'].includes(location.pathname)
? 'login-layout-header'
: 'auth-layout-header'
? // 登录 / 注册 / 找回密码统一使用登录页同款标准顶栏;仅客户端授权页保留透明顶栏
location.pathname.toLowerCase() === '/client/authorize'
? 'auth-layout-header'
: 'login-layout-header'
: undefined
}
style={{
+36 -2
View File
@@ -23,7 +23,8 @@ import {
ChevronLeft as ActionChevronLeft,
} from '@/components/common/icons/ActionIcons';
import { consoleMenuPaths, getConsoleMenuKeys } from '../console/consoleRoutes';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
import { revealActiveSidebarItem } from '../../helpers/sidebarScroll';
import { Link, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { getLucideIcon } from '../../helpers/render';
@@ -97,6 +98,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
const showSkeleton = useMinimumLoadingTime(sidebarLoading, 200);
const [selectedKeys, setSelectedKeys] = useState(['home']);
const navigationRef = useRef(null);
// 平台关闭智能路由后,仍有生效中出境同意的普通用户保留入口以便撤回(§9.5,与企业"仅授权模式"同口径)
const [routerConsentGranted, setRouterConsentGranted] = useState(
() => readPersonalConsentCache() === '1',
@@ -493,6 +495,38 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
}
}, [location.pathname, location.search, routerMapState]);
useEffect(() => {
const navigation = navigationRef.current;
if (!navigation || showSkeleton) return;
let frame;
const scheduleReveal = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => revealActiveSidebarItem(navigation));
};
scheduleReveal();
const resizeObserver = new ResizeObserver(scheduleReveal);
resizeObserver.observe(navigation);
const mutationObserver = new MutationObserver(scheduleReveal);
mutationObserver.observe(navigation, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['hidden'],
});
return () => {
cancelAnimationFrame(frame);
resizeObserver.disconnect();
mutationObserver.disconnect();
};
}, [
showSkeleton,
selectedKeys,
collapsed,
forceExpanded,
openedKeys,
foldedGroups,
]);
// 监控折叠状态变化以更新 body class(--sidebar-current-width 由它驱动)。
// 抽屉态下跳过:body class 是全局的,抽屉临时展开不该顺手把桌面侧栏宽度也改掉。
useEffect(() => {
@@ -639,7 +673,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
collapsed={collapsed}
showAdmin={isAdmin()}
>
<nav className='ui-center-sidebar-nav'>
<nav ref={navigationRef} className='ui-center-sidebar-nav'>
{/* 聊天区域 */}
{hasSectionVisibleModules('chat') &&
renderGroup(
@@ -44,7 +44,6 @@ const ActionButtons = ({
userState,
isLoading,
isMobile,
isSelfUseMode,
headerNavModules,
sidebarModulesAdmin,
isOrgUser,
@@ -235,7 +234,6 @@ const ActionButtons = ({
userState={userState}
isLoading={isLoading}
isMobile={isMobile}
isSelfUseMode={isSelfUseMode}
headerNavModules={headerNavModules}
rightActions={headerNavModules?.rightActions}
sidebarModulesAdmin={sidebarModulesAdmin}
@@ -19,8 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import { Globe as ActionGlobe } from '@/components/common/icons/ActionIcons';
import React, { useEffect, useState } from 'react';
import { Button as AntButton } from 'antd';
import { Dropdown } from '@/components/ui';
import { Button as AntButton, Dropdown } from 'antd';
import { CN, GB, JP, KR, TH, VN } from 'country-flag-icons/react/3x2';
import { normalizeLanguage } from '../../../i18n/language';
import { orderEnabledLanguages } from '../../../i18n/catalog';
@@ -47,41 +46,32 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
window.removeEventListener(LANG_BOOT_UPDATED_EVENT, handleBootUpdated);
}, []);
const getItemClassName = (isSelected) =>
`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm ${
isSelected
? '!bg-ui-color-primary-light-default !font-semibold'
: 'hover:!bg-ui-color-fill-1'
}`;
// 展示哪些语言、按什么顺序由后台「语言与地区」配置决定(经 /api/i18n/locale 缓存下发)
const languages = orderEnabledLanguages(getBootConfig()?.enabled_languages);
return (
<Dropdown
position='bottomRight'
render={
<Dropdown.Menu>
{languages.map(({ code, endonym, flag }) => {
const Flag = FLAGS[flag];
return (
<Dropdown.Item
key={code}
onClick={() => onLanguageChange(code)}
className={getItemClassName(lang === code)}
>
{Flag && <Flag title={endonym} className='!w-5 !h-auto' />}
<span>{endonym}</span>
</Dropdown.Item>
);
})}
</Dropdown.Menu>
}
trigger={['hover', 'click']}
placement='bottomRight'
menu={{
selectable: true,
selectedKeys: [lang],
onClick: ({ key }) => onLanguageChange(key),
items: languages.map(({ code, endonym, flag }) => {
const Flag = FLAGS[flag];
return {
key: code,
icon: Flag ? <Flag title={endonym} className='w-5 h-auto' /> : null,
label: endonym,
};
}),
}}
>
<AntButton
type='text'
icon={<ActionGlobe size={16} strokeWidth={1.5} aria-hidden />}
aria-label={t('common.changeLanguage')}
aria-haspopup='menu'
className='ui-header-icon-action'
/>
</Dropdown>
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
import { Compass as ActionCompass } from '@/components/common/icons/ActionIcons';
import React, { useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { Button, Dropdown } from '@/components/ui';
import { Button, Dropdown } from 'antd';
import { ExternalLink } from 'lucide-react';
import { isNavigationPathActive } from '../../console/consoleRoutes';
@@ -92,63 +92,51 @@ const MobileNavMenu = ({ mainNavLinks, userState, t }) => {
return (
<Dropdown
trigger='click'
position='bottomLeft'
visible={visible}
onVisibleChange={setVisible}
render={
<Dropdown.Menu className='!min-w-[168px] !p-1.5 !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'>
{menuItems.map((item) => (
<Dropdown.Item
key={item.key}
onClick={() => {
setVisible(false);
if (item.externalLink) {
window.open(
item.externalLink,
'_blank',
'noopener,noreferrer',
);
} else if (item.to) {
navigate(item.to);
}
}}
className={`!rounded-lg !my-0.5 !px-3 !py-2 !text-sm !transition-colors ${
item.active
? '!bg-brand/10 dark:!bg-brand-deep/40 !text-brand-deep dark:!text-brand-from !font-semibold'
: '!text-gray-700 dark:!text-neutral-200'
}`}
trigger={['click']}
placement='bottomLeft'
open={visible}
onOpenChange={setVisible}
menu={{
selectedKeys: menuItems
.filter((item) => item.active)
.map((item) => item.key),
items: menuItems.map((item) => ({
key: item.key,
onClick: () => {
setVisible(false);
if (item.externalLink) {
window.open(item.externalLink, '_blank', 'noopener,noreferrer');
} else if (item.to) {
navigate(item.to);
}
},
label: (
<span
className='flex items-center gap-1.5'
aria-current={item.active ? 'page' : undefined}
>
<span
className='flex items-center gap-1.5'
aria-current={item.active ? 'page' : undefined}
>
{item.text}
{item.externalLink && (
<ExternalLink size={12} className='opacity-50' />
)}
</span>
</Dropdown.Item>
))}
</Dropdown.Menu>
}
{item.text}
{item.externalLink && (
<ExternalLink size={12} className='opacity-50' />
)}
</span>
),
})),
}}
>
<span className='inline-flex'>
<Button
theme='borderless'
type='tertiary'
aria-label={t('主导航')}
title={activeItem?.text}
aria-haspopup='menu'
aria-expanded={visible}
icon={<ActionCompass 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 [&_.ant-btn-content]:min-w-0'
>
<span className='ml-1 text-[13px] font-semibold truncate'>
{activeItem?.mobileText || activeItem?.text || t('导航')}
</span>
</Button>
</span>
<Button
type='text'
aria-label={t('主导航')}
title={activeItem?.text}
aria-haspopup='menu'
aria-expanded={visible}
icon={<ActionCompass size={16} />}
className='ml-1 px-2 max-w-[9rem] [&_.ant-btn-content]:min-w-0'
>
<span className='ml-1 text-[13px] font-semibold truncate'>
{activeItem?.mobileText || activeItem?.text || t('导航')}
</span>
</Button>
</Dropdown>
);
};
+22 -48
View File
@@ -19,7 +19,11 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import { Dropdown } from '@/components/ui';
import { Dropdown } from 'antd';
import {
ChevronDown,
ExternalLink,
} from '@/components/common/icons/ActionIcons';
import { useTranslation } from 'react-i18next';
import SkeletonWrapper from '../components/SkeletonWrapper';
import { isNavigationPathActive } from '../../console/consoleRoutes';
@@ -68,44 +72,27 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
return (
<Dropdown
key={link.itemKey}
trigger={'hover'}
position={'bottomLeft'}
render={
<Dropdown.Menu>
{link.items.map((subItem) => (
<Dropdown.Item key={subItem.itemKey}>
<Link
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'
style={{ textDecoration: 'none' }}
>
{subItem.text}
</Link>
</Dropdown.Item>
))}
</Dropdown.Menu>
}
trigger={['hover', 'click']}
placement='bottomLeft'
menu={{
selectedKeys: link.items
.filter((item) => isPathActive(item.to))
.map((item) => item.itemKey),
items: link.items.map((subItem) => ({
key: subItem.itemKey,
label: <Link to={subItem.to}>{subItem.text}</Link>,
})),
}}
>
<div
<button
type='button'
className={`${finalClasses} cursor-pointer`}
aria-haspopup='menu'
aria-current={isActive ? 'page' : undefined}
>
{linkContent}
{/* Dropdown arrow */}
<svg
className='w-3.5 h-3.5 opacity-50 group-hover:opacity-100 transition-all duration-300 group-hover:rotate-180'
fill='none'
viewBox='0 0 24 24'
stroke='currentColor'
>
<path
strokeLinecap='round'
strokeLinejoin='round'
strokeWidth={2}
d='M19 9l-7 7-7-7'
/>
</svg>
</div>
<ChevronDown size={14} aria-hidden />
</button>
</Dropdown>
);
}
@@ -120,20 +107,7 @@ const Navigation = ({ mainNavLinks, isMobile, isLoading, userState }) => {
className={`${baseClasses} ${spacingClasses} ${defaultClasses} ${hoverClasses}`}
>
{linkContent}
{/* External link icon */}
<svg
className='w-3 h-3 opacity-50 group-hover:opacity-100 transition-opacity'
fill='none'
viewBox='0 0 24 24'
stroke='currentColor'
>
<path
strokeLinecap='round'
strokeLinejoin='round'
strokeWidth={2}
d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'
/>
</svg>
<ExternalLink size={12} aria-hidden />
</a>
);
}
+4 -66
View File
@@ -19,11 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
import { ChevronDown as ActionChevronDown } from '@/components/common/icons/ActionIcons';
import React, { useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { Avatar, Button as AntButton, Dropdown as AntDropdown } from 'antd';
import { Button } from '@/components/ui';
import { UserRound, KeyRound, LogOut } from 'lucide-react';
import { getUserAvatarUrl, isAuthPagePath } from '../../../helpers';
import { getUserAvatarUrl } from '../../../helpers';
import SkeletonWrapper from '../components/SkeletonWrapper';
import { isHeaderModuleEnabled } from '../../../constants/headerNavModules';
@@ -46,7 +44,6 @@ const UserArea = ({
userState,
isLoading,
isMobile,
isSelfUseMode,
headerNavModules,
rightActions = {},
sidebarModulesAdmin = {},
@@ -55,7 +52,6 @@ const UserArea = ({
navigate,
t,
}) => {
const location = useLocation();
const [open, setOpen] = useState(false);
const isActionVisible = (key) => rightActions?.[key] !== false;
const hasHeaderModuleConfig =
@@ -68,9 +64,6 @@ const UserArea = ({
return section.enabled !== false && section[moduleKey] !== false;
};
// 在登录/注册/重置密码/企业登录页面时,未登录用户不显示登录注册按钮,避免重复
const isAuthPage = isAuthPagePath(location.pathname);
if (isLoading) {
return (
<SkeletonWrapper
@@ -143,7 +136,7 @@ const UserArea = ({
return (
<AntDropdown
trigger={['hover']}
trigger={['hover', 'click']}
placement='bottomRight'
open={open}
onOpenChange={setOpen}
@@ -193,64 +186,9 @@ const UserArea = ({
</AntButton>
</AntDropdown>
);
} else {
if (isAuthPage) {
return null;
}
const showRegisterButton = !isSelfUseMode;
const commonSizingAndLayoutClass =
'flex items-center justify-center !py-[10px] !px-1.5';
const loginButtonSpecificStyling =
'!bg-transparent hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep !transition-all !duration-200';
let loginButtonClasses = `${commonSizingAndLayoutClass} ${loginButtonSpecificStyling}`;
let registerButtonClasses = `${commonSizingAndLayoutClass}`;
const loginButtonTextSpanClass =
'!text-xs !text-ui-color-text-1 dark:!text-gray-300 !p-1.5';
const registerButtonTextSpanClass = '!text-xs !text-white !p-1.5';
if (showRegisterButton) {
if (isMobile) {
loginButtonClasses += ' !rounded-full';
} else {
loginButtonClasses += ' !rounded-l-full !rounded-r-none';
}
registerButtonClasses += ' !rounded-r-full !rounded-l-none';
} else {
loginButtonClasses += ' !rounded-full';
}
return (
<div className='flex items-center'>
<Link to='/org/login' className='flex'>
<Button
theme='borderless'
type='tertiary'
className={loginButtonClasses}
>
<span className={loginButtonTextSpanClass}>{t('登录')}</span>
</Button>
</Link>
{showRegisterButton && (
<div className='hidden md:block'>
<Link to='/register' className='flex -ml-px'>
<Button
theme='solid'
type='primary'
className={registerButtonClasses}
>
<span className={registerButtonTextSpanClass}>{t('注册')}</span>
</Button>
</Link>
</div>
)}
</div>
);
}
return null;
};
export default UserArea;
@@ -181,7 +181,6 @@ const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => {
userState={userState}
isLoading={isLoading}
isMobile={isMobile}
isSelfUseMode={isSelfUseMode}
headerNavModules={headerNavModules}
sidebarModulesAdmin={sidebarModulesAdmin}
isOrgUser={isOrgUser}
@@ -1,3 +1,7 @@
/* 等级与模型访问(level_policy)局部布局覆盖,全部只改尺寸不改配色 */
/* 等级与模型访问(level_policy)局部布局与图标样式 */
.level-policy-model-toggle.ant-btn .ant-btn-icon {
color: var(--text-primary);
}
/* 默认访问态 pureCard 单选:两张卡等分弹窗整行宽,避免随文案长短一宽一窄 */
@@ -1638,8 +1638,9 @@ const LevelPolicySetting = () => {
const button = (
<Button
size='small'
theme='borderless'
type={r.modelDiscountCount > 0 ? 'primary' : 'tertiary'}
className='level-policy-model-toggle'
theme={r.modelDiscountCount > 0 ? undefined : 'borderless'}
type={r.modelDiscountCount > 0 ? 'link' : 'tertiary'}
icon={
expanded ? (
<ActionChevronDown size={14} />
+1 -1
View File
@@ -849,7 +849,7 @@ const SystemSetting = () => {
<Card>
<Form.Section text={t('SSRF防护设置')}>
<Text extraText={t('SSRF防护详细说明')}>
<Text title={t('SSRF防护详细说明')}>
{t('配置服务器端请求伪造(SSRF)防护,用于保护内网资源安全')}
</Text>
<Row
+25 -15
View File
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { theme } from 'antd';
import { Button, Progress, Tag, Timeline, Typography } from '@/components/ui';
import {
IconAlertTriangle,
@@ -35,13 +36,14 @@ import './skill-components.css';
const { Text, Title, Paragraph } = Typography;
const SemanticTag = ({ value, fallback, className = '' }) => {
const SemanticTag = ({ value, fallback, className = '', style }) => {
const { t } = useTranslation();
const token = getSkillTagToken(value);
return (
<Tag
color={token.color}
className={className}
style={style}
aria-label={t(fallback || token.label)}
>
{t(fallback || token.label)}
@@ -62,20 +64,26 @@ export const ScopeSourceBadge = ({ source, detail }) => {
);
};
export const LicenseBadge = ({ expression, decision }) => (
<span className='skill-license-badge'>
<SemanticTag
value={
decision === 'blocked'
? 'deny'
: decision === 'approved'
? 'allow'
: 'license_pending'
}
fallback={expression || '许可证未知'}
/>
</span>
);
export const LicenseBadge = ({ expression, decision }) => {
const { token } = theme.useToken();
const value =
decision === 'blocked'
? 'deny'
: decision === 'approved'
? 'allow'
: 'license_pending';
const { color } = getSkillTagToken(value);
return (
<span className='skill-license-badge'>
<SemanticTag
value={value}
fallback={expression || '许可证未知'}
// 第 9 档在浅色下更深、暗色下更亮,保证小字号许可证的对比度。
style={{ color: token[`${color}-9`] }}
/>
</span>
);
};
export const RiskBadge = ({ conclusion }) => (
<SemanticTag
@@ -168,6 +176,7 @@ export const GrayscaleProgress = ({ percent = 0, label }) => (
);
export const SkillDetailSideSheet = ({
className,
visible,
onCancel,
title,
@@ -175,6 +184,7 @@ export const SkillDetailSideSheet = ({
footer,
}) => (
<OrgSideSheet
className={className}
visible={visible}
onCancel={onCancel}
title={title}
+1 -1
View File
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
export const SKILL_TAG_TOKENS = Object.freeze({
pending_import: { color: 'grey', label: '待导入' },
license_pending: { color: 'amber', label: '许可证待审核' },
license_pending: { color: 'gold', label: '许可证待审核' },
scan_pending: { color: 'orange', label: '待云端化改写' },
review_pending: { color: 'blue', label: '待审核' },
published: { color: 'green', label: '已发布' },
@@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Alert, Button, Empty, Table, Tag } from 'antd';
import { Button, Empty, Tag } from 'antd';
import { Table } from '@/components/ui';
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
import { listDecisions } from './api';
import { gateText, jevReasonText, srcText } from './labels';
@@ -138,14 +140,12 @@ const DecisionTable = ({ mode, orgId }) => {
columns={columns}
dataSource={data.items || []}
scroll={{ x: 'max-content' }}
locale={{
emptyText: (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('还没有智能路由请求')}
/>
),
}}
empty={
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('还没有智能路由请求')}
/>
}
pagination={{
// 接口固定 page_size=20,不提供每页条数切换
current: page,
+12 -7
View File
@@ -20,7 +20,6 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
Alert,
Button,
Form,
Input,
@@ -33,6 +32,7 @@ import {
Tag,
Typography,
} from 'antd';
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
import { showError, showSuccess } from '../../helpers';
import { getAdminStatus, loadOptions, saveOption, setJevKey } from './api';
@@ -333,7 +333,7 @@ const GlobalSettings = () => {
case 'int':
return (
<InputNumber
style={{ width: 200 }}
className='smart-router-setting-control'
min={f.min}
max={f.max}
value={Number(v) || 0}
@@ -353,7 +353,7 @@ const GlobalSettings = () => {
case 'select':
return (
<Select
style={{ width: 200 }}
className='smart-router-setting-control'
value={v}
options={f.options.map((o) => ({ label: o, value: o }))}
onChange={set}
@@ -371,7 +371,7 @@ const GlobalSettings = () => {
default:
return (
<Input
style={{ maxWidth: 360 }}
className='smart-router-setting-control'
value={v}
onChange={(e) => set(e.target.value)}
/>
@@ -470,7 +470,12 @@ const GlobalSettings = () => {
<div key={sec} className='smart-router-card'>
<div className='smart-router-card-title'>{t(title)}</div>
{/* 受控字段沿用 values 状态,Form 只提供竖排标签布局,不接管取值与提交 */}
<Form layout='vertical' component='div' requiredMark={false}>
<Form
layout='vertical'
component='div'
requiredMark={false}
className='smart-router-settings-form'
>
{FIELDS.filter((f) => f.section === sec).map((f) => (
<Form.Item
key={f.key}
@@ -501,9 +506,9 @@ const GlobalSettings = () => {
</span>
}
>
<Space size={8} wrap>
<Space size={8} wrap className='smart-router-key-tools'>
<Input.Password
style={{ width: 320 }}
className='smart-router-key-input'
placeholder={t('输入新密钥;留空表示不修改')}
value={keys[p]}
onChange={(e) =>
@@ -24,7 +24,6 @@ import {
Button,
Checkbox,
Collapse,
Drawer,
Form,
Input,
InputNumber,
@@ -33,6 +32,7 @@ import {
Switch,
Typography,
} from 'antd';
import { ConsoleDrawer as Drawer } from '../console/ConsolePrimitives';
import { Plus, Trash2 } from '../common/icons/ActionIcons';
import { showError, showSuccess } from '../../helpers';
import { saveProfile } from './api';
+15 -24
View File
@@ -19,16 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
Alert,
Button,
Empty,
Popconfirm,
Space,
Table,
Tag,
Typography,
} from 'antd';
import { Button, Empty, Popconfirm, Space, Tag, Typography } from 'antd';
import { Table } from '@/components/ui';
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
import { Plus } from '../common/icons/ActionIcons';
import { copy, showError, showSuccess } from '../../helpers';
import { deleteProfile, listCandidateModels, listProfiles } from './api';
@@ -230,20 +223,18 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => {
dataSource={list}
pagination={false}
scroll={{ x: 'max-content' }}
locale={{
emptyText: (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('还没有智能路由集合')}
>
{canWrite && (
<Button type='primary' onClick={() => setEditing({})}>
{t('新建集合')}
</Button>
)}
</Empty>
),
}}
empty={
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('还没有智能路由集合')}
>
{canWrite && (
<Button type='primary' onClick={() => setEditing({})}>
{t('新建集合')}
</Button>
)}
</Empty>
}
/>
)}
<ProfileEditor
@@ -19,7 +19,11 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Alert, Button, Input, Modal, Progress, Tag, Typography } from 'antd';
import { Button, Input, Progress, Tag, Typography } from 'antd';
import {
ConsoleAlert as Alert,
ConsoleModal as Modal,
} from '../console/ConsolePrimitives';
import { simulateProfile } from './api';
import { gateText, reasonText, srcText } from './labels';
+74 -1
View File
@@ -16,10 +16,19 @@
min-width: 0;
}
.smart-router-page .smart-router-intro.console-alert {
margin-block: 0;
}
.smart-router-alert {
margin-bottom: 18px;
}
/* Match the tab-first card spacing used by WebsiteSettings. */
.console-page .smart-router-tabs-card.ant-card > .ant-card-body {
padding-top: 8px;
}
/* 控制台介绍区:无图标、无渐变的说明块;标题与内边距由公共页头 / 容器统一 */
.smart-router-hero {
padding: 16px 24px;
@@ -176,7 +185,7 @@
.smart-router-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0 16px;
gap: 0 24px;
}
.smart-router-grid-full {
@@ -269,3 +278,67 @@
min-width: 0;
word-break: break-all;
}
.smart-router-settings-form {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 24px;
}
.smart-router-setting-control.ant-input-number,
.smart-router-setting-control.ant-select,
.smart-router-setting-control.ant-input {
width: 100%;
}
.smart-router-key-tools {
width: 100%;
}
.smart-router-key-input {
width: min(320px, 100%);
}
.smart-router-sheet .ant-drawer-body {
padding: 24px;
scrollbar-gutter: stable;
}
.smart-router-sheet .ant-modal {
max-width: calc(100vw - 32px);
}
@media (max-width: 768px) {
.smart-router-card,
.smart-router-consent-row {
padding: 16px;
}
.smart-router-settings-form {
grid-template-columns: minmax(0, 1fr);
}
.smart-router-sheet .smart-router-inline > .ant-select,
.smart-router-sheet .smart-router-inline > .ant-input-number {
max-width: 100%;
min-width: 0;
}
.smart-router-sheet .smart-router-model-select {
flex-basis: 100%;
}
.smart-router-key-tools > .ant-space-item,
.smart-router-key-input {
max-width: 100%;
}
.smart-router-kv {
grid-template-columns: minmax(0, 1fr);
gap: 4px;
}
.smart-router-kv dd {
margin-bottom: 12px;
}
}
@@ -1708,6 +1708,7 @@ const EditChannelModal = (props) => {
setModelOptions(localModelOptions);
setCustomModel('');
formApiRef.current?.setValue('custom_model', '');
handleInputChange('models', localModels);
if (addedModels.length > 0) {
@@ -20,10 +20,8 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react';
import { Button, Card } from 'antd';
import { ChevronDown, ChevronUp } from '@/components/common/icons/ActionIcons';
import PricingGroups from '../filter/PricingGroups';
import PricingVendors from '../filter/PricingVendors';
import PricingQuotaTypes from '../filter/PricingQuotaTypes';
import PricingTags from '../filter/PricingTags';
import PricingEndpointTypes from '../filter/PricingEndpointTypes';
/**
@@ -37,29 +35,20 @@ const MarketFilterSidebar = ({
vendorsMap,
filterVendor,
setFilterVendor,
filterGroup,
setFilterGroup,
usableGroup,
groupRatio,
showRatio,
filterQuotaType,
setFilterQuotaType,
filterTag,
setFilterTag,
filterEndpointType,
setFilterEndpointType,
endpointMap,
allModels,
tagModels,
quotaTypeModels,
endpointTypeModels,
groupCountModels,
}) => (
<Card className='mm-filter-panel' aria-label={t('模型筛选')}>
<div className='mm-filter-title'>
<div>
<h2>{t('筛选模型')}</h2>
<span>{t('按分组、厂商和计费方式快速定位')}</span>
<span>{[t('模型厂商'), t('计费类型'), t('端点类型')].join(' / ')}</span>
</div>
<div className='mm-filter-actions'>
<Button type='text' onClick={onReset}>
@@ -95,24 +84,6 @@ const MarketFilterSidebar = ({
models={quotaTypeModels}
title={t('计费类型')}
/>
<PricingGroups
filterGroup={filterGroup}
setFilterGroup={setFilterGroup}
groupRatio={groupRatio}
usableGroup={usableGroup}
showRatio={showRatio}
t={t}
models={groupCountModels}
title={t('用户分组')}
/>
<PricingTags
filterTag={filterTag}
setFilterTag={setFilterTag}
t={t}
models={tagModels}
allModels={allModels}
title={t('模型标签')}
/>
<PricingEndpointTypes
filterEndpointType={filterEndpointType}
setFilterEndpointType={setFilterEndpointType}
@@ -82,16 +82,15 @@ const ModelMarketPage = () => {
models,
} = pricingData;
const { quotaTypeModels, endpointTypeModels, tagModels, groupCountModels } =
usePricingFilterCounts({
models,
filterGroup,
filterQuotaType,
filterEndpointType,
filterVendor,
filterTag,
searchValue,
});
const { quotaTypeModels, endpointTypeModels } = usePricingFilterCounts({
models,
filterGroup,
filterQuotaType,
filterEndpointType,
filterVendor,
filterTag,
searchValue,
});
// 复用原侧栏的 resetPricingFilters:清空搜索词与五类筛选。
// 不传货币 / 单位 / 视图 setter,避免改动页面既有的计价展示口径。
@@ -141,23 +140,14 @@ const ModelMarketPage = () => {
vendorsMap={vendorsMap}
filterVendor={filterVendor}
setFilterVendor={setFilterVendor}
filterGroup={filterGroup}
setFilterGroup={setFilterGroup}
usableGroup={usableGroup}
groupRatio={groupRatio}
showRatio={showRatio}
filterQuotaType={filterQuotaType}
setFilterQuotaType={setFilterQuotaType}
filterTag={filterTag}
setFilterTag={setFilterTag}
filterEndpointType={filterEndpointType}
setFilterEndpointType={setFilterEndpointType}
endpointMap={endpointMap}
allModels={models}
tagModels={tagModels}
quotaTypeModels={quotaTypeModels}
endpointTypeModels={endpointTypeModels}
groupCountModels={groupCountModels}
/>
}
/>
@@ -283,7 +283,7 @@ function renderModelName(record, copyText, t, isRootUser) {
}
}
// ---- 使用记录(个人端)呈现:原型为 Ant Design 预设无边框标签与纯文本,不含渐变点、脉冲与悬停缩放 ----
// ---- 使用记录(个人端)呈现 ----
const RECORD_TYPE_COLORS = {
1: 'cyan',
2: 'green',
@@ -312,19 +312,39 @@ function renderRecordType(type, t) {
}
function renderRecordUseTime(record, t) {
const useTime = `${parseInt(record.use_time)}s`;
const useTime = parseInt(record.use_time, 10);
const validUseTime = Number.isFinite(useTime) && useTime >= 0;
const other = getLogOther(record.other);
const firstTime =
record.is_stream && other?.frt
? ` / ${(parseFloat(other.frt) / 1000.0).toFixed(1)}s`
: '';
const firstMilliseconds = parseFloat(other?.frt);
const validFirstTime =
Number.isFinite(firstMilliseconds) && firstMilliseconds >= 0;
// 首字耗时按实际显示的一位小数判色,避免显示 3.0s / 10.0s 却仍落在上一档。
const firstTime = validFirstTime
? (firstMilliseconds / 1000).toFixed(1)
: null;
const useTimeColor = !validUseTime
? undefined
: useTime < 101
? 'green'
: useTime < 300
? 'gold'
: 'magenta';
const firstTimeColor = !validFirstTime
? undefined
: Number(firstTime) < 3
? 'cyan'
: Number(firstTime) < 10
? 'orange'
: 'red';
return (
<span className='usage-record-use-time'>
<span>
{useTime}
{firstTime && <em>{firstTime}</em>}
</span>
<AntTag variant='filled' color={record.is_stream ? 'cyan' : undefined}>
<span className='usage-record-use-time' aria-label={t('用时/首字')}>
<AntTag color={useTimeColor}>{validUseTime ? `${useTime}s` : '—'}</AntTag>
{record.is_stream && (
<AntTag color={firstTimeColor}>
{validFirstTime ? `${firstTime}s` : '—'}
</AntTag>
)}
<AntTag color={record.is_stream ? 'blue' : undefined}>
{record.is_stream ? t('流') : t('非流')}
</AntTag>
</span>
@@ -336,7 +356,7 @@ const formatRecordNumber = (value) => {
return Number.isFinite(number) ? number.toLocaleString('en-US') : value;
};
// Both reference images show the same 2097px table at opposite scroll positions.
// 固定列宽保持横向滚动时的对齐,耗时列预留三枚标签的空间。
const RECORD_COLUMN_WIDTHS = {
time: 152,
channel: 85,
@@ -345,7 +365,7 @@ const RECORD_COLUMN_WIDTHS = {
group: 148,
type: 110,
model: 225,
use_time: 126,
use_time: 190,
prompt: 110,
completion: 110,
cost: 136,
+31 -14
View File
@@ -17,7 +17,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React, { forwardRef, useLayoutEffect, useRef, useState } from 'react';
import React, {
forwardRef,
useEffect,
useLayoutEffect,
useRef,
useState,
} from 'react';
import { Table, theme } from 'antd';
import { colord } from 'colord';
import { isCenterTableScope, prepareCenterColumns } from './centerTablePolicy';
@@ -56,8 +62,21 @@ const CenterTable = forwardRef(function CenterTable(
const scroller = root.querySelector('.ant-table-content,.ant-table-body');
const previousTabIndex = scroller?.getAttribute('tabindex');
if (scroller && previousTabIndex === null) scroller.tabIndex = 0;
const update = () => setWidth(root.clientWidth);
update();
const observer = new ResizeObserver(([entry]) => {
// ResizeObserver already measured the box; avoid a synchronous layout read.
setWidth(entry.contentRect.width);
});
observer.observe(root);
return () => {
observer.disconnect();
if (scroller && previousTabIndex === null)
scroller.removeAttribute('tabindex');
};
}, [enabled]);
useEffect(() => {
if (!enabled) return;
const root = tableRef.current?.nativeElement;
if (!root) return;
const measureActionWidths = () => {
const next = {};
root.querySelectorAll('th.center-action-cell').forEach((header) => {
@@ -69,9 +88,15 @@ const CenterTable = forwardRef(function CenterTable(
(element) => element.getBoundingClientRect().width > 0,
);
const widths = cells.map((cell) => {
const controls = [
const controlsWithWidths = [
...cell.querySelectorAll('button, a, [role="button"]'),
].filter((element) => element.getBoundingClientRect().width > 0);
]
.map((element) => ({
element,
width: element.getBoundingClientRect().width,
}))
.filter(({ width }) => width > 0);
const controls = controlsWithWidths.map(({ element }) => element);
if (!controls.length) return 0;
let group = controls[0].parentElement;
while (
@@ -85,10 +110,7 @@ const CenterTable = forwardRef(function CenterTable(
(Number.parseFloat(cellStyle.paddingRight) || 0);
const gap = Number.parseFloat(getComputedStyle(group).columnGap) || 8;
return (
controls.reduce(
(total, element) => total + element.getBoundingClientRect().width,
0,
) +
controlsWithWidths.reduce((total, { width }) => total + width, 0) +
gap * Math.max(0, controls.length - 1) +
padding
);
@@ -107,13 +129,8 @@ const CenterTable = forwardRef(function CenterTable(
});
};
const frame = requestAnimationFrame(measureActionWidths);
const observer = new ResizeObserver(update);
observer.observe(root);
return () => {
observer.disconnect();
cancelAnimationFrame(frame);
if (scroller && previousTabIndex === null)
scroller.removeAttribute('tabindex');
};
}, [enabled, width, columns, props.dataSource]);
return (
+4 -1
View File
@@ -261,8 +261,11 @@ export default function UiThemeProvider({ children }) {
// 日期面板的星期、月份名称来自 dayjs 全局语言,需与 Ant Design locale 保持一致。
dayjs.locale(DAYJS_LOCALES[language] || 'zh-cn');
useLayoutEffect(() => {
// The hosted download page shares the system shell and its popup tokens.
const isDownloadPage = /^\/weyai\/download\/?$/.test(pathname);
document.body.dataset.uiScope =
pathname.startsWith('/weyai/') || pathname.startsWith('/client/authorize')
(pathname.startsWith('/weyai/') && !isDownloadPage) ||
pathname.startsWith('/client/authorize')
? 'external'
: 'admin';
}, [pathname]);
+22 -1
View File
@@ -36,7 +36,10 @@ import {
Space as AntSpace,
} from 'antd';
import dayjs from 'dayjs';
import { useConsoleControlSize } from '../console/ConsoleContext';
import {
useConsoleControlSize,
useConsolePage,
} from '../console/ConsoleContext';
export const controlSize = (size) => (size === 'default' ? 'middle' : size);
export const placement = (position) =>
@@ -53,6 +56,12 @@ export const placement = (position) =>
const statusOf = (status) =>
['error', 'warning'].includes(status) ? status : undefined;
function useSettingsInputId(id) {
const generatedId = React.useId();
const isSettings = useConsolePage()?.page.key === 'setting';
return id ?? (isSettings ? generatedId : undefined);
}
// Existing screens consume values; DOM events stay inside this view boundary.
export const Input = forwardRef(function Input(
{
@@ -69,10 +78,20 @@ export const Input = forwardRef(function Input(
},
ref,
) {
const isSettings = useConsolePage()?.page.key === 'setting';
const Component = mode === 'password' ? AntInput.Password : AntInput;
return (
<Component
{...props}
id={useSettingsInputId(props.id)}
autoComplete={
props.autoComplete ??
(isSettings
? mode === 'password' || props.type === 'password'
? 'new-password'
: 'off'
: undefined)
}
ref={ref}
size={useConsoleControlSize(size)}
readOnly={readonly ?? props.readOnly}
@@ -91,6 +110,7 @@ export const TextArea = forwardRef(function TextArea(
return (
<AntInput.TextArea
{...props}
id={useSettingsInputId(props.id)}
ref={ref}
autoSize={autosize}
maxLength={props.maxLength ?? maxCount}
@@ -152,6 +172,7 @@ export const InputNumber = forwardRef(function InputNumber(
return (
<AntInputNumber
{...props}
id={useSettingsInputId(props.id)}
ref={ref}
size={useConsoleControlSize(size)}
controls={!hideButtons}
+62 -14
View File
@@ -82,8 +82,12 @@ export const Form = forwardRef(function Form(
const FormComponent = consolePage ? ConsoleForm : AntForm;
const [form] = AntForm.useForm();
const [, renderValues] = useReducer((value) => value + 1, 0);
const callbacks = useRef({ getFormApi, onValueChange });
callbacks.current = { getFormApi, onValueChange };
const callbacks = useRef({});
callbacks.current = {
getFormApi,
onValueChange,
renderValues: typeof children === 'function' ? renderValues : () => {},
};
const api = useMemo(
() => ({
getValues: () => form.getFieldsValue(true),
@@ -94,17 +98,17 @@ export const Form = forwardRef(function Form(
callbacks.current.onValueChange?.(form.getFieldsValue(true), {
[field]: value,
});
renderValues();
callbacks.current.renderValues();
},
setValues: (next) => {
form.setFieldsValue(next);
callbacks.current.onValueChange?.(form.getFieldsValue(true), next);
renderValues();
callbacks.current.renderValues();
},
reset: (fields) => {
form.resetFields(fields?.map?.(fieldPath));
callbacks.current.onValueChange?.(form.getFieldsValue(true));
renderValues();
callbacks.current.renderValues();
},
validate: (fields) => form.validateFields(fields?.map?.(fieldPath)),
submitForm: () => form.submit(),
@@ -122,10 +126,13 @@ export const Form = forwardRef(function Form(
useImperativeHandle(ref, () => ({ formApi: api, ...api }), [api]);
useEffect(() => {
callbacks.current.getFormApi?.(api);
renderValues();
callbacks.current.renderValues();
}, [api]);
useEffect(() => {
if (values) form.setFieldsValue(values);
if (values) {
form.setFieldsValue(values);
callbacks.current.renderValues();
}
}, [form, values]);
return (
<FormContext.Provider value={form}>
@@ -151,7 +158,13 @@ export const Form = forwardRef(function Form(
wrapperCol={
props.wrapperCol ?? (labelWidth ? { flex: '1 1 0' } : undefined)
}
labelAlign={labelAlign}
labelAlign={
labelAlign === 'left'
? 'start'
: labelAlign === 'right'
? 'end'
: labelAlign
}
onFinish={onSubmit}
onFinishFailed={
consolePage && onSubmitFail
@@ -168,7 +181,7 @@ export const Form = forwardRef(function Form(
}
onValuesChange={(_, all) => {
callbacks.current.onValueChange?.(all);
renderValues();
callbacks.current.renderValues();
}}
>
{typeof children === 'function' ? (
@@ -198,15 +211,41 @@ function labelProps(label) {
// Legacy Form.RadioGroup reports the selected value; standalone RadioGroup reports an event.
const FieldRadioGroup = forwardRef(function FieldRadioGroup(
{ onChange, ...props },
{ onChange, id, options, children, ...props },
ref,
) {
// A label must target a radio input, rather than the group's non-labelable div.
const optionIndex = options?.findIndex((option) => !option?.disabled);
let childLabeled = false;
return (
<Controls.RadioGroup
{...props}
ref={ref}
id={id ? `${id}-group` : undefined}
options={options?.map((option, index) =>
index === optionIndex && id
? {
...(typeof option === 'object'
? option
: { label: option, value: option }),
id,
}
: option,
)}
onChange={(event) => onChange?.(event.target.value, event)}
/>
>
{React.Children.map(children, (child) => {
if (
!id ||
childLabeled ||
!React.isValidElement(child) ||
child.props.disabled
)
return child;
childLabeled = true;
return React.cloneElement(child, { id });
})}
</Controls.RadioGroup>
);
});
@@ -284,6 +323,9 @@ export function withField(
) : (
<Component
{...props}
{...(Component === FieldRadioGroup && fieldLabel.label
? { 'aria-label': props['aria-label'] ?? fieldLabel.label }
: {})}
id={props.id ?? fieldLabel.htmlFor}
ref={ref}
style={style}
@@ -370,13 +412,19 @@ Form.Slot = function Slot({ label, error, children, ...props }) {
</AntForm.Item>
);
};
Form.Section = function Section({ text, extraText, children, ...props }) {
Form.Section = function Section({
text,
extraText,
children,
component: Component = 'section',
...props
}) {
return (
<section {...props}>
<Component {...props}>
<h3 className='ui-form-section'>{text}</h3>
{extraText && <p className='ui-field-help'>{extraText}</p>}
{children}
</section>
</Component>
);
};
Form.Label = function Label({ required, children, ...props }) {
+8 -6
View File
@@ -383,12 +383,14 @@ function CenterPaginatedTable({
{...props}
pagination={{
...centerPaginationOptions(config, isMobile),
showSizeChanger: Boolean(
local ||
config.onPageSizeChange ||
config.onShowSizeChange ||
config.onChange,
),
showSizeChanger:
config.showSizeChanger ??
Boolean(
local ||
config.onPageSizeChange ||
config.onShowSizeChange ||
config.onChange,
),
current,
pageSize,
onShowSizeChange: undefined,
+6
View File
@@ -29,6 +29,12 @@ export const isGroupAllowed = (groups, userGroup) => {
return allowedGroups.includes(getEffectiveUserGroup(userGroup));
};
export const isSidebarModuleVisible = (config, key, userGroup) =>
config?.enabled !== false &&
config?.[key] !== false &&
isGroupAllowed(config?.groups, userGroup) &&
isGroupAllowed(config?.moduleGroups?.[key], userGroup);
export const isHeaderActionButtonVisible = (config, key, userGroup) => {
let buttons = config;
+36
View File
@@ -0,0 +1,36 @@
/*
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
*/
export function revealActiveSidebarItem(container) {
if (!container || container.scrollHeight <= container.clientHeight) return;
const active = container.querySelector('[aria-current="page"]');
if (!active || !active.getClientRects().length) return;
const viewport = container.getBoundingClientRect();
const item = active.getBoundingClientRect();
const top = viewport.top + container.clientTop;
const bottom = top + container.clientHeight;
// 只移动菜单自身的滚动区,避免 scrollIntoView 连带滚动正文或页面外壳。
const offset =
item.top < top
? item.top - top
: item.bottom > bottom
? item.bottom - bottom
: 0;
if (offset) container.scrollTop += offset;
}
+21 -21
View File
@@ -154,27 +154,6 @@ export const useNavigation = (
to: '/user-center',
requireAuth: getHeaderModuleRequireAuth(modules, 'userCenter'),
},
{
text: t('控制台'),
itemKey: 'console',
to: '/console/analytics',
activePrefix: '/console',
adminOnly: true,
requireAuth: true,
},
// WeyAi 网页端:外链到网关的 /sso/start(每次点击都重新走一遍免登录授权),
// 需要登录;管理员可在「顶栏管理」里关闭
...(weyaiVisible
? [
{
text: t('WeyAi'),
itemKey: 'weyai',
isExternal: true,
externalLink: weyaiUrl,
requireAuth: true,
},
]
: []),
// 企业中心:仅当用户属于某个企业时作为一级入口展示(不跟随 headerNavModules 配置,
// 由 showOrgEntry 统一控制可见性,故标记 alwaysShow 跳过模块开关过滤)
...(showOrgEntry
@@ -189,6 +168,27 @@ export const useNavigation = (
},
]
: []),
// WeyAi 网页端:外链到网关的 /sso/start(每次点击都重新走一遍免登录授权),
// 需要登录;管理员可在「顶栏管理」里关闭
...(weyaiVisible
? [
{
text: t('WeyAi'),
itemKey: 'weyai',
isExternal: true,
externalLink: weyaiUrl,
requireAuth: true,
},
]
: []),
{
text: t('控制台'),
itemKey: 'console',
to: '/console/analytics',
activePrefix: '/console',
adminOnly: true,
requireAuth: true,
},
];
return allLinks.filter((link) => {
+6 -3
View File
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { useContext, useEffect, useState } from 'react';
import { useContext, useEffect, useMemo, useState } from 'react';
import { API } from '../../helpers/api';
import { UserContext } from '../../context/User';
import { StatusContext } from '../../context/Status';
@@ -29,7 +29,10 @@ export function usePartnerWorkspaceAccess(organizationId = null) {
const [userState] = useContext(UserContext);
const [statusState] = useContext(StatusContext);
const user = userState?.user;
const scope = partnerScope(user?.id, organizationId);
const scope = useMemo(
() => partnerScope(user?.id, organizationId),
[user?.id, organizationId],
);
const portalEnabled = statusState?.status?.commission_partner_portal_enabled;
// 分佣总开关关闭时不发起伙伴身份探测;旧后端不返回该字段,视为开启。
const commissionEnabled = statusState?.status?.commission_enabled !== false;
@@ -58,7 +61,7 @@ export function usePartnerWorkspaceAccess(organizationId = null) {
return () => {
cancelled = true;
};
}, [enabled, user, attempt, scope.key]);
}, [enabled, user, attempt, scope]);
// 绑定本次登录的用户快照,切换账号时在 effect 执行前就隐藏旧入口。
let status = 'loading';
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "Please enter chat application name",
"请输入密钥名称": "Enter key name",
"请输入密码": "Please enter password",
"请输入用户名/邮箱": "Please enter username / email",
"请输入企业名称/代码": "Please enter business name/code",
"请输入企业内登录名": "Please enter enterprise login name",
"请输入确认新密码": "Please confirm the new password",
"请输入管理员登录名": "Please enter administrator login name",
"请输入确认密码": "Please confirm the password",
"请输入备用码": "Please enter backup code",
"密码长度需为 8-20 位": "Password must be 8-20 characters long",
"请输入密钥": "Please enter the key",
"请输入密钥,一行一个": "Please enter the key, one per line",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Enter keys one per line, format: AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4124,6 +4124,14 @@
"请输入聊天应用名称": "Veuillez saisir le nom de l'application de chat",
"请输入密钥名称": "Saisir le nom de la clé",
"请输入密码": "Veuillez saisir un mot de passe",
"请输入用户名/邮箱": "Veuillez saisir le nom d'utilisateur ou l'e-mail",
"请输入企业名称/代码": "Veuillez saisir le nom ou le code de l'entreprise",
"请输入企业内登录名": "Veuillez saisir le login dans l'entreprise",
"请输入确认新密码": "Veuillez confirmer le nouveau mot de passe",
"请输入管理员登录名": "Veuillez saisir le login de l'administrateur",
"请输入确认密码": "Veuillez confirmer le mot de passe",
"请输入备用码": "Veuillez saisir le code de secours",
"密码长度需为 8-20 位": "Le mot de passe doit contenir 8 à 20 caractères",
"请输入密钥": "Veuillez saisir la clé",
"请输入密钥,一行一个": "Veuillez saisir la clé, une par ligne",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Saisissez les clés une par ligne, format : AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "チャットアプリ名を入力してください",
"请输入密钥名称": "キー名を入力",
"请输入密码": "パスワードを入力してください",
"请输入用户名/邮箱": "ユーザー名/メールアドレスを入力してください",
"请输入企业名称/代码": "会社名/コードを入力してください",
"请输入企业内登录名": "企業内ログイン名を入力してください",
"请输入确认新密码": "確認用の新しいパスワードを入力してください",
"请输入管理员登录名": "管理者ログイン名を入力してください",
"请输入确认密码": "パスワード(確認用)を入力してください",
"请输入备用码": "バックアップコードを入力してください",
"密码长度需为 8-20 位": "パスワードは8〜20文字である必要があります",
"请输入密钥": "APIキーを入力してください",
"请输入密钥,一行一个": "APIキーを入力してください(1行に1つずつ)",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "キーを1行に1つずつ入力してください。形式:AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "대화 앱 이름을 입력하세요",
"请输入密钥名称": "키 이름 입력",
"请输入密码": "비밀번호를 입력하세요",
"请输入用户名/邮箱": "사용자명 / 이메일을 입력하세요",
"请输入企业名称/代码": "비즈니스 이름/코드를 입력하세요",
"请输入企业内登录名": "기업 내 로그인 이름을 입력하세요",
"请输入确认新密码": "새 비밀번호 확인을 입력하세요",
"请输入管理员登录名": "관리자 로그인 이름을 입력하세요",
"请输入确认密码": "비밀번호 확인을 입력하세요",
"请输入备用码": "백업 코드를 입력하세요",
"密码长度需为 8-20 位": "비밀번호는 8~20자여야 합니다",
"请输入密钥": "키를 입력하세요",
"请输入密钥,一行一个": "키를 한 줄에 하나씩 입력하세요",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "키를 한 줄에 하나씩 입력하세요. 형식: AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4156,6 +4156,14 @@
"请输入聊天应用名称": "Пожалуйста, введите имя чат-приложения",
"请输入密钥名称": "Введите имя ключа",
"请输入密码": "Пожалуйста, введите пароль",
"请输入用户名/邮箱": "Введите имя пользователя/email",
"请输入企业名称/代码": "Введите название компании/код",
"请输入企业内登录名": "Введите имя входа предприятия",
"请输入确认新密码": "Подтвердите новый пароль",
"请输入管理员登录名": "Введите имя администратора",
"请输入确认密码": "Подтвердите пароль",
"请输入备用码": "Введите резервный код",
"密码长度需为 8-20 位": "Пароль должен иметь длину 8 - 20 символов",
"请输入密钥": "Пожалуйста, введите ключ",
"请输入密钥,一行一个": "Пожалуйста, введите ключи, по одному в строке",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Введите ключи по одному в строке в формате: AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "โปรดกรอกชื่อแอปแชท",
"请输入密钥名称": "กรอกชื่อคีย์",
"请输入密码": "กรุณากรอกรหัสผ่าน",
"请输入用户名/邮箱": "กรุณากรอกชื่อผู้ใช้ / อีเมล",
"请输入企业名称/代码": "กรุณากรอกชื่อธุรกิจ / รหัส",
"请输入企业内登录名": "กรุณากรอกชื่อผู้ใช้ภายในองค์กร",
"请输入确认新密码": "กรุณากรอกยืนยันรหัสผ่านใหม่",
"请输入管理员登录名": "กรุณากรอกชื่อผู้ใช้เข้าระบบของผู้ดูแล",
"请输入确认密码": "กรุณากรอกยืนยันรหัสผ่าน",
"请输入备用码": "กรุณากรอกรหัสสำรอง",
"密码长度需为 8-20 位": "รหัสผ่านต้องมีความยาว 8-20 ตัวอักษร",
"请输入密钥": "กรุณากรอกคีย์",
"请输入密钥,一行一个": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ ในรูปแบบ: AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "Vui lòng nhập tên ứng dụng trò chuyện",
"请输入密钥名称": "Nhập tên khóa",
"请输入密码": "Vui lòng nhập mật khẩu",
"请输入用户名/邮箱": "Vui lòng nhập tên người dùng / email",
"请输入企业名称/代码": "Vui lòng nhập tên doanh nghiệp/mã",
"请输入企业内登录名": "Vui lòng nhập tên đăng nhập trong doanh nghiệp",
"请输入确认新密码": "Vui lòng nhập xác nhận mật khẩu mới",
"请输入管理员登录名": "Vui lòng nhập tên đăng nhập quản trị viên",
"请输入确认密码": "Vui lòng nhập xác nhận mật khẩu",
"请输入备用码": "Vui lòng nhập mã dự phòng",
"密码长度需为 8-20 位": "Mật khẩu phải dài 8-20 ký tự",
"请输入密钥": "Vui lòng nhập khóa",
"请输入密钥,一行一个": "Vui lòng nhập khóa, mỗi dòng một cái",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Nhập khóa, mỗi dòng một khóa, định dạng: AccessKey|SecretAccessKey|Region",
+8
View File
@@ -4302,6 +4302,14 @@
"请输入聊天应用名称": "請輸入聊天應用名稱",
"请输入密钥名称": "請輸入金鑰名稱",
"请输入密码": "請輸入密碼",
"请输入用户名/邮箱": "請輸入使用者名稱/郵箱",
"请输入企业名称/代码": "請輸入企業名稱/代碼",
"请输入企业内登录名": "請輸入企業內登入名",
"请输入确认新密码": "請輸入確認新密碼",
"请输入管理员登录名": "請輸入管理員登入名",
"请输入确认密码": "請輸入確認密碼",
"请输入备用码": "請輸入備用碼",
"密码长度需为 8-20 位": "密碼長度需為 8-20 位",
"请输入密钥": "請輸入金鑰",
"请输入密钥,一行一个": "請輸入金鑰,一行一個",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "請輸入金鑰,一行一個,格式:AccessKey|SecretAccessKey|Region",
+9
View File
@@ -4253,6 +4253,15 @@
"请输入聊天应用名称": "请输入聊天应用名称",
"请输入密钥名称": "请输入密钥名称",
"请输入密码": "请输入密码",
"请输入用户名/邮箱": "请输入用户名/邮箱",
"请输入企业名称/代码": "请输入企业名称/代码",
"请输入企业内登录名": "请输入企业内登录名",
"请输入确认新密码": "请输入确认新密码",
"请输入管理员登录名": "请输入管理员登录名",
"请输入确认密码": "请输入确认密码",
"请输入备用码": "请输入备用码",
"密码长度需为 8-20 位": "密码长度需为 8-20 位",
"请输入邮箱验证码": "请输入邮箱验证码",
"请输入密钥": "请输入密钥",
"请输入密钥,一行一个": "请输入密钥,一行一个",
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region",
+158 -82
View File
@@ -19,6 +19,13 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button, Tooltip } from 'antd';
import {
ChartNoAxesCombined,
Network,
ReceiptText,
Wallet,
} from 'lucide-react';
import { API } from '../../helpers';
import { shouldLoadHistoricalTrend } from './dashboardHistory';
import './dashboard.css';
@@ -90,7 +97,10 @@ export default function Dashboard({
signal: controller.signal,
},
);
if (!response.data?.success || (response.data.data != null && !Array.isArray(response.data.data))) {
if (
!response.data?.success ||
(response.data.data != null && !Array.isArray(response.data.data))
) {
throw new Error('Invalid statement response');
}
return response.data.data || [];
@@ -292,7 +302,14 @@ export default function Dashboard({
failed: failedMonths.includes(key),
estimated: index === 5,
}));
const chartMax = Math.max(1, ...chart.map((row) => Math.abs(row.value)));
const chartMax =
Math.max(0, ...chart.map((row) => Math.abs(row.value))) || 1e10;
const axisFormat = new Intl.NumberFormat(i18n.language, {
maximumFractionDigits: Math.min(
6,
Math.max(2, 2 - Math.floor(Math.log10(chartMax / 1e10))),
),
});
return (
<div className='commission-dashboard'>
@@ -300,20 +317,34 @@ export default function Dashboard({
<h3 id='commission-month-overview'>{t('本月概览')}</h3>
<div className='commission-dashboard-core'>
<div className='commission-dashboard-stat'>
<span>{t('预估有效销售额')}</span>
<span>
<Wallet size={16} aria-hidden />
{t('预估有效销售额')}
</span>
<strong>{hasSales ? money(sales) : '—'}</strong>
{!hasSales && <small>{t('暂无销售额数据')}</small>}
</div>
<div className='commission-dashboard-stat commission-dashboard-stat--featured'>
<span>{t('预估应付提成')}</span>
<span>
<Wallet size={16} aria-hidden />
{t('预估应付提成')}
</span>
<strong>{money(estimated)}</strong>
</div>
<div className='commission-dashboard-stat'>
<span>{t('占销售额比例')}</span>
<span>
<ChartNoAxesCombined size={16} aria-hidden />
{t('占销售额比例')}
</span>
<strong>
{hasSales && sales > 0
? `${numberFormat.format((estimated / sales) * 100)}%`
: '—'}
{hasSales && sales > 0 ? (
<>
{numberFormat.format((estimated / sales) * 100)}
<small>%</small>
</>
) : (
'—'
)}
</strong>
</div>
</div>
@@ -322,18 +353,26 @@ export default function Dashboard({
[
'生效合作伙伴',
partners.filter((row) => row.status === 'active').length,
'家',
],
[
'正式归属客户',
assignments.filter(
(row) => row.status === 'formal' && !row.ended_at,
).length,
'个',
],
['保护期客户', protectedAssignments.length],
].map(([label, count]) => (
['保护期客户', protectedAssignments.length, '个'],
].map(([label, count, unit]) => (
<div className='commission-dashboard-stat' key={label}>
<span>{t(label)}</span>
<strong>{count}</strong>
<span>
<Network size={16} aria-hidden />
{t(label)}
</span>
<strong>
{count}
<small>{t(unit)}</small>
</strong>
</div>
))}
</div>
@@ -359,6 +398,15 @@ export default function Dashboard({
<span>{t(todo.label)}</span>
<strong className={`commission-dashboard-${todo.tone}`}>
{todo.rows.length}
<small>
{t(
todo.target === 'partners'
? '家'
: todo.target === 'exceptions'
? '条'
: '个',
)}
</small>
</strong>
</button>
))}
@@ -373,28 +421,30 @@ export default function Dashboard({
{t(todo.label)}
</span>
<h4>
{t('待处理 {{count}} 项', { count: todo.rows.length })}
{todo.rows.length > 0
? todo.rows
.slice(0, 2)
.map((row) =>
t('{{partner}} · {{month}}', {
partner:
partnerById.get(String(row.partner_id))?.name ||
t('伙伴 #{{id}}', { id: row.partner_id }),
month: row.statement_month,
}),
)
.join(' / ')
: t('待处理 {{count}} 项', { count: todo.rows.length })}
</h4>
<p>{t(todo.description)}</p>
{todo.rows.length > 0 && (
<small>
{todo.rows
.slice(0, 2)
.map((row) =>
t('{{partner}} · {{month}}', {
partner:
partnerById.get(String(row.partner_id))?.name ||
t('伙伴 #{{id}}', { id: row.partner_id }),
month: row.statement_month,
}),
)
.join(' / ')}
{t('待处理 {{count}} 项', { count: todo.rows.length })}
</small>
)}
</div>
<button
type='button'
className={`commission-dashboard-button${todo.rows.length ? ' commission-dashboard-button--primary' : ''}`}
<Button
type={todo.rows.length ? 'primary' : 'default'}
size='small'
onClick={() => navigateTodo(todo)}
aria-label={t('{{action}}:{{label}},{{count}} 项', {
action: t(todo.action),
@@ -403,7 +453,7 @@ export default function Dashboard({
})}
>
{t(todo.action)}
</button>
</Button>
</div>
))}
</div>
@@ -427,7 +477,10 @@ export default function Dashboard({
})
}
>
<span>{t('未绑定档位渠道')}</span>
<span>
<ReceiptText size={16} aria-hidden />
{t('未绑定档位渠道')}
</span>
<strong
className={
unboundChannels.length
@@ -436,6 +489,7 @@ export default function Dashboard({
}
>
{unboundChannels.length}
<small>{t('条')}</small>
</strong>
<small>{t('查看渠道档位')} →</small>
</button>
@@ -450,7 +504,10 @@ export default function Dashboard({
})
}
>
<span>{t('未绑定档位等级')}</span>
<span>
<ReceiptText size={16} aria-hidden />
{t('未绑定档位等级')}
</span>
<strong
className={
unboundLevels.length
@@ -459,6 +516,7 @@ export default function Dashboard({
}
>
{unboundLevels.length}
<small>{t('个')}</small>
</strong>
<p>{t('不含跟随模型或渠道档位的默认等级')}</p>
<small>{t('查看等级档位')} →</small>
@@ -483,67 +541,85 @@ export default function Dashboard({
months: failedMonths.join('、'),
})}
</span>
<button
type='button'
className='commission-dashboard-button'
onClick={() => setRetry((value) => value + 1)}
>
<Button size='small' onClick={() => setRetry((value) => value + 1)}>
{t('重试')}
</button>
</Button>
</div>
)}
<div className='commission-dashboard-chart' aria-busy={trendLoading}>
{chart.map((row) => (
<button
type='button'
key={row.month}
className={`commission-dashboard-chart-column${row.estimated ? ' commission-dashboard-chart-column--current' : ''}`}
onClick={() => onNavigate?.('bills', { month: row.month })}
aria-label={t('{{month}}:{{amount}},{{status}}', {
month: row.month,
amount: money(row.value),
status: t(
row.failed
? '加载失败'
<div className='commission-dashboard-chart-frame'>
<div className='commission-dashboard-chart-axis' aria-hidden>
{[4, 3, 2, 1, 0].map((tick) => (
<span key={tick}>
{axisFormat.format((chartMax * tick) / 4e10)}
</span>
))}
</div>
<div className='commission-dashboard-chart' aria-busy={trendLoading}>
{chart.map((row) => {
const pending = trendLoading && !row.estimated;
const valueLabel = row.failed || pending ? '—' : money(row.value);
const statusLabel = t(
row.failed
? '加载失败'
: pending
? '加载中'
: row.estimated
? '实时预估'
: row.hasData
? '账单应付'
: '暂无数据',
),
})}
>
<span className='commission-dashboard-chart-plot'>
<span
className='commission-dashboard-chart-bar'
style={{
height: `${Math.max(row.value ? 2 : 0, (Math.abs(row.value) / chartMax) * 100)}%`,
}}
);
return (
<Tooltip
key={row.month}
trigger={['hover', 'focus']}
title={`${row.month} · ${valueLabel} · ${statusLabel}`}
>
<span className='commission-dashboard-chart-value'>
{row.failed || (trendLoading && !row.estimated)
? '—'
: numberFormat.format(row.value / 1e10)}
</span>
</span>
</span>
<span className='commission-dashboard-chart-month'>
{row.month.slice(5)}
{t('月')}
</span>
<span className='commission-dashboard-chart-status'>
{row.failed
? t('加载失败')
: row.estimated
? t('预估')
: trendLoading
? t('加载中')
: !row.hasData
? t('暂无数据')
: '\u00a0'}
</span>
</button>
))}
<button
type='button'
key={row.month}
className={`commission-dashboard-chart-column${row.estimated ? ' commission-dashboard-chart-column--current' : ''}`}
onClick={() => onNavigate?.('bills', { month: row.month })}
aria-label={t('{{month}}:{{amount}},{{status}}', {
month: row.month,
amount: valueLabel,
status: statusLabel,
})}
>
<span className='commission-dashboard-chart-plot'>
<span
className='commission-dashboard-chart-bar'
style={{
height: `${Math.max(row.value ? 2 : 0, (Math.abs(row.value) / chartMax) * 100)}%`,
}}
>
<span className='commission-dashboard-chart-value'>
{row.failed || (trendLoading && !row.estimated)
? '—'
: numberFormat.format(row.value / 1e10)}
</span>
</span>
</span>
<span className='commission-dashboard-chart-month'>
{row.month.slice(5)}
{t('月')}
</span>
<span className='commission-dashboard-chart-status'>
{row.failed
? t('加载失败')
: row.estimated
? t('预估')
: trendLoading
? t('加载中')
: !row.hasData
? t('暂无数据')
: '\u00a0'}
</span>
</button>
</Tooltip>
);
})}
</div>
</div>
</section>
</div>
+174 -129
View File
@@ -19,8 +19,15 @@ For commercial licensing, please contact support@quantumnous.com
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button, Card, Empty, Input, Select, Table } from 'antd';
import { Search } from 'lucide-react';
import { Button, Empty, Input, Select } from 'antd';
import { Table } from '@/components/ui';
import { Search } from '@/components/common/icons/ActionIcons';
import {
ConsoleCard,
ConsoleSearchBar,
ConsoleSearchActions,
ConsoleTabs,
} from '../../components/console/ConsolePrimitives';
import { filterCommissionRows, matchesStatus } from './listFilters';
export default function ListPanel({
@@ -115,41 +122,43 @@ export default function ListPanel({
setPage(1);
server?.onChange({ ...draft, status, page: 1 });
};
const reset = () => {
setDraft({ query: '', type: '', partner: '' });
setFilters({});
setStatus('all');
server?.onChange({ status: 'all', page: 1 });
setScopedIds(null);
setPage(1);
};
const [filtersOpen, setFiltersOpen] = useState(false);
return (
<Card
className={`commission-card commission-list commission-list--${section}`}
>
<div className={`commission-list commission-list--${section}`}>
{tabSets[section] && (
<div
<ConsoleTabs
className='commission-list-tabs'
role='tablist'
aria-label={t('状态筛选')}
>
{tabSets[section].map(([key, label]) => (
<button
key={key}
type='button'
role='tab'
aria-selected={status === key}
className={status === key ? 'is-active' : ''}
onClick={() => {
setStatus(key);
setPage(1);
server?.onChange({ ...filters, status: key, page: 1 });
}}
>
{t(label)}
activeKey={status}
onChange={(key) => {
setStatus(key);
setPage(1);
server?.onChange({ ...filters, status: key, page: 1 });
}}
items={tabSets[section].map(([key, label]) => ({
key,
label: (
<span>
{server
? server.counts[
{ enabled: 'active', scheduled: 'pending' }[key] || key
] || 0
: rows.filter((row) => matchesStatus(row, key, section))
.length}
{t(label)}{' '}
<span className='commission-tab-count'>
{server
? server.counts[
{ enabled: 'active', scheduled: 'pending' }[key] || key
] || 0
: rows.filter((row) => matchesStatus(row, key, section))
.length}
</span>
</span>
</button>
))}
</div>
),
}))}
/>
)}
{scopedIds && (
<div className='commission-context-filter'>
@@ -166,79 +175,109 @@ export default function ListPanel({
</Button>
</div>
)}
<div className='commission-filter-bar'>
<Input
prefix={<Search size={16} aria-hidden />}
value={draft.query}
onChange={(event) => set('query', event.target.value)}
onPressEnter={query}
allowClear
placeholder={t(placeholders[section])}
aria-label={t(placeholders[section])}
/>
{typeOptions && (
<Select
aria-label={t('类型筛选')}
value={draft.type}
onChange={(value) => set('type', value)}
options={[
{
value: '',
label: t(
section === 'assignments'
? '全部客户类型'
: section === 'tiers'
? '全部来源'
: '全部类型',
),
},
...typeOptions.map(([value, label]) => ({
value,
label: t(label),
})),
]}
/>
)}
{section === 'partners' && (
<Select
aria-label={t('状态筛选')}
value={draft.status || ''}
onChange={(value) => set('status', value)}
options={['', 'draft', 'active', 'suspended', 'terminated'].map(
(value, i) => ({
value,
label: t(['全部状态', '草稿', '生效中', '已暂停', '已终止'][i]),
}),
)}
/>
)}
{['assignments', 'bills', 'adjustments'].includes(section) && (
<Select
aria-label={t('合作伙伴筛选')}
showSearch={{ optionFilterProp: 'label' }}
value={draft.partner}
onChange={(value) => set('partner', value)}
options={[
{ value: '', label: t('全部合作伙伴') },
...partners.map((row) => ({ value: row.id, label: row.name })),
]}
/>
)}
<Button type='primary' onClick={query}>
{t('查询')}
</Button>
<Button
onClick={() => {
setDraft({ query: '', type: '', partner: '' });
setFilters({});
setStatus('all');
server?.onChange({ status: 'all', page: 1 });
setScopedIds(null);
setPage(1);
<Button
className='commission-filter-toggle'
aria-expanded={filtersOpen}
onClick={() => setFiltersOpen((value) => !value)}
>
{t(filtersOpen ? '隐藏操作项' : '显示操作项')}
</Button>
<ConsoleSearchBar
className={`commission-filter-card${filtersOpen ? ' is-open' : ''}`}
>
<form
onSubmit={(event) => {
event.preventDefault();
query();
}}
>
{t('重置')}
</Button>
<div className='console-search-fields'>
<label className='console-search-field commission-search-field'>
<span>{t('搜索')}</span>
<Input
prefix={<Search size={16} aria-hidden />}
value={draft.query}
onChange={(event) => set('query', event.target.value)}
allowClear
placeholder={t(placeholders[section])}
aria-label={t(placeholders[section])}
/>
</label>
{typeOptions && (
<label className='console-search-field commission-search-field'>
<span>{t('类型筛选')}</span>
<Select
aria-label={t('类型筛选')}
value={draft.type}
onChange={(value) => set('type', value)}
options={[
{
value: '',
label: t(
section === 'assignments'
? '全部客户类型'
: section === 'tiers'
? '全部来源'
: '全部类型',
),
},
...typeOptions.map(([value, label]) => ({
value,
label: t(label),
})),
]}
/>
</label>
)}
{section === 'partners' && (
<label className='console-search-field commission-search-field'>
<span>{t('状态筛选')}</span>
<Select
aria-label={t('状态筛选')}
value={draft.status || ''}
onChange={(value) => set('status', value)}
options={[
'',
'draft',
'active',
'suspended',
'terminated',
].map((value, i) => ({
value,
label: t(
['全部状态', '草稿', '生效中', '已暂停', '已终止'][i],
),
}))}
/>
</label>
)}
{['assignments', 'bills', 'adjustments'].includes(section) && (
<label className='console-search-field commission-search-field'>
<span>{t('合作伙伴筛选')}</span>
<Select
aria-label={t('合作伙伴筛选')}
showSearch={{ optionFilterProp: 'label' }}
value={draft.partner}
onChange={(value) => set('partner', value)}
options={[
{ value: '', label: t('全部合作伙伴') },
...partners.map((row) => ({
value: row.id,
label: row.name,
})),
]}
/>
</label>
)}
</div>
<ConsoleSearchActions
onReset={reset}
searchLabel='查询'
loading={server?.busy}
/>
</form>
</ConsoleSearchBar>
<ConsoleCard className='commission-card commission-list-card'>
<div className='commission-filter-end'>
<span>
{t('共 {{count}} 条', {
@@ -255,35 +294,41 @@ export default function ListPanel({
</Button>
)}
</div>
</div>
<Table
rowKey='id'
loading={server?.busy}
columns={columns}
dataSource={filtered}
size='middle'
scroll={{ x: 'max-content' }}
pagination={{
size: 'small',
pageSize: server ? 100 : 10,
total: server ? server.total : filtered.length,
current: server ? server.page : page,
onChange: (next) => {
setPage(next);
server?.onChange({ ...filters, status, page: next });
},
showSizeChanger: false,
showTotal: (total) => t('共 {{total}} 条', { total }),
}}
locale={{
emptyText: (
<Table
rowKey='id'
loading={server?.busy}
columns={columns.map((column) => ({
width: 160,
...column,
...(/(?:_uyuan|_yuan|_bps|amount|count|quantity)$/.test(
column.dataIndex || '',
)
? { align: 'right' }
: {}),
}))}
dataSource={filtered}
size='middle'
scroll={{ x: 'max-content' }}
pagination={{
size: 'small',
pageSize: server ? 100 : 10,
total: server ? server.total : filtered.length,
current: server ? server.page : page,
onChange: (next) => {
setPage(next);
server?.onChange({ ...filters, status, page: next });
},
showSizeChanger: false,
showTotal: (total) => t('共 {{total}} 条', { total }),
}}
empty={
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={t('暂无数据')}
/>
),
}}
/>
</Card>
}
/>
</ConsoleCard>
</div>
);
}
+9 -1
View File
@@ -18,7 +18,13 @@ For commercial licensing, please contact support@quantumnous.com
*/
import React, { useEffect, useState } from 'react';
import { Alert, Button, Descriptions, Drawer, Spin, Table, Tag } from 'antd';
import { Button, Descriptions, Spin, Tag } from 'antd';
import { Table } from '@/components/ui';
import {
ConsoleAlert as Alert,
ConsoleDrawer as Drawer,
} from '../../components/console/ConsolePrimitives';
import { useCommissionThemeStyle } from './commissionTheme';
import { useTranslation } from 'react-i18next';
import { commissionActorName, commissionLabel, statusTagColor } from './labels';
import { EvidenceLink } from './operations';
@@ -31,6 +37,7 @@ export default function PartnerDetail({
onClose,
onEdit,
}) {
const themeStyle = useCommissionThemeStyle();
const { t, i18n } = useTranslation();
const [record, setRecord] = useState(null);
const [error, setError] = useState('');
@@ -65,6 +72,7 @@ export default function PartnerDetail({
);
return (
<Drawer
rootStyle={themeStyle}
rootClassName='commission-profile-drawer commission-detail-drawer'
title={
<span>
+44 -15
View File
@@ -58,6 +58,9 @@ import { BillingColumns, AdjustmentColumns } from './operations';
import { commissionLabel } from './labels';
import { PARTNER_NAVIGATION, partnerView } from './partnerNavigation';
import './partnerPortal.css';
import OrgPageHeader from '../Organization/components/OrgPageHeader';
import OrgModal from '../Organization/components/OrgModal';
import { useCommissionThemeStyle } from './commissionTheme';
const { Content } = Layout;
const { Title, Text } = Typography;
@@ -98,6 +101,8 @@ export default function PartnerPortal({
tag,
embedded = false,
}) {
const themeStyle = useCommissionThemeStyle();
const PartnerModal = embedded ? OrgModal : Modal;
const { t } = useTranslation();
const location = useLocation();
const [searchParams, setSearchParams] = useSearchParams();
@@ -1194,7 +1199,7 @@ export default function PartnerPortal({
</aside>
)}
<Layout>
<header className='commission-workspace-bar'>
<header className='commission-workspace-bar' hidden={embedded}>
<div>
{t(embedded ? '企业分佣' : '合作分佣')}
<span className='commission-crumb-slash'>/</span>
@@ -1210,7 +1215,9 @@ export default function PartnerPortal({
<span className='commission-workspace-role'>{t('伙伴工作台')}</span>
)}
</header>
<Content className='commission-v2-content'>
<Content
className={`commission-v2-content${embedded ? ' uc-page oc-page' : ''}`}
>
<div className='commission-page-header'>
<div className='commission-page-heading'>
{selected && (
@@ -1224,17 +1231,38 @@ export default function PartnerPortal({
{t('返回我的提成')}
</Button>
)}
<Title level={4}>{t(pageTitle)}</Title>
<Text type='secondary'>
{selected
? `${t('账单号')} #${selected.id} · ${selected.statement_month}`
: t(subtitles[active])}
{!selected &&
['overview', 'estimate'].includes(active) &&
summary.updated_at
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
: ''}
</Text>
{embedded ? (
<OrgPageHeader
title={t(pageTitle)}
subtitle={
selected ? (
`${t('账单号')} #${selected.id} · ${selected.statement_month}`
) : (
<>
{t(subtitles[active])}
{['overview', 'estimate'].includes(active) &&
summary.updated_at
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
: ''}
</>
)
}
/>
) : (
<Title level={4}>{t(pageTitle)}</Title>
)}
{!embedded && (
<Text type='secondary'>
{selected
? `${t('账单号')} #${selected.id} · ${selected.statement_month}`
: t(subtitles[active])}
{!selected &&
['overview', 'estimate'].includes(active) &&
summary.updated_at
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
: ''}
</Text>
)}
</div>
<div className='commission-actions'>
{selected && (
@@ -1315,7 +1343,8 @@ export default function PartnerPortal({
)}
</Content>
</Layout>
<Modal
<PartnerModal
style={themeStyle}
className='commission-modal partner-portal-modal'
visible={!!action}
title={`${t(action === 'reject' ? '驳回账单' : '确认账单')} · #${selected?.id || ''}`}
@@ -1377,7 +1406,7 @@ export default function PartnerPortal({
</p>
</>
)}
</Modal>
</PartnerModal>
</Layout>
);
}
+43
View File
@@ -0,0 +1,43 @@
/*
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 { theme } from 'antd';
// Portal overlays need the same semantic colors as the workspace root.
export function useCommissionThemeStyle() {
const { token } = theme.useToken();
return {
'--commission-primary': token.colorPrimary,
'--commission-primary-hover': token.colorPrimaryHover,
'--commission-primary-soft': token.colorPrimaryBg,
'--commission-primary-readable': token.colorLink,
'--commission-primary-solid': token.colorPrimary,
'--commission-on-primary': token.colorTextLightSolid,
'--commission-success': token.colorSuccessText,
'--commission-success-soft': token.colorSuccessBg,
'--commission-warning': token.colorWarningText,
'--commission-warning-soft': token.colorWarningBg,
'--commission-danger': token.colorErrorText,
'--commission-danger-soft': token.colorErrorBg,
'--commission-info': token.colorInfoText,
'--commission-info-soft': token.colorInfoBg,
'--commission-control-border': token.colorBorder,
'--commission-font': token.fontFamily,
};
}
+126 -59
View File
@@ -7,7 +7,7 @@
);
--dash-text: var(--text-primary, #1d2129);
--dash-card: var(--surface-card, #fff);
--dash-soft: color-mix(in srgb, var(--surface-bg-base) 52%, var(--dash-card));
--dash-soft: var(--surface-bg-base);
--dash-featured-bg: color-mix(
in srgb,
var(--commission-primary-soft, #e8f0ff) 62%,
@@ -18,11 +18,11 @@
var(--dash-primary) 24%,
var(--dash-line)
);
--dash-warning: color-mix(in srgb, #f59e0b 78%, var(--dash-text));
--dash-danger: color-mix(in srgb, #f56c7a 82%, var(--dash-text));
--dash-success: color-mix(in srgb, #22c55e 78%, var(--dash-text));
--dash-warning-bg: color-mix(in srgb, #f59e0b 12%, var(--dash-card));
--dash-danger-bg: color-mix(in srgb, #f56c7a 12%, var(--dash-card));
--dash-warning: var(--commission-warning);
--dash-danger: var(--commission-danger);
--dash-success: var(--commission-success);
--dash-warning-bg: var(--commission-warning-soft);
--dash-danger-bg: var(--commission-danger-soft);
--dash-grid: color-mix(in srgb, var(--dash-text) 11%, transparent);
--dash-muted-bar: color-mix(
in srgb,
@@ -70,7 +70,7 @@
.commission-dashboard-period {
flex-shrink: 0;
border: 1px solid var(--dash-line);
border-radius: 4px;
border-radius: 8px;
background: var(--dash-card);
padding: 6px 12px;
font-size: 12px;
@@ -81,26 +81,29 @@
.commission-dashboard-support {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
gap: 20px;
}
.commission-dashboard-stat,
.commission-dashboard-card {
border: 1px solid var(--dash-line);
border-radius: 6px;
border-radius: 10px;
background: var(--dash-card);
box-shadow: none;
min-width: 0;
}
.commission-dashboard-stat {
padding: 16px 20px;
padding: 22px 24px;
border-radius: 8px;
}
.commission-dashboard-stat > span,
.commission-dashboard-summary-item > span,
.commission-dashboard-health-item > span {
display: block;
display: flex;
align-items: center;
gap: 9px;
font-size: 13px;
font-weight: 400;
color: var(--dash-muted);
@@ -111,13 +114,27 @@
font-variant-numeric: tabular-nums;
}
.commission-dashboard-stat > span > svg,
.commission-dashboard-health-item > span > svg {
flex-shrink: 0;
color: var(--dash-primary);
}
.commission-dashboard strong > small {
margin-inline-start: 6px;
font-size: 13px;
font-weight: 400;
letter-spacing: 0;
color: var(--dash-muted);
}
.commission-dashboard-stat > strong {
display: block;
margin-top: 8px;
font-size: 28px;
font-size: 30px;
font-weight: 600;
letter-spacing: -0.7px;
line-height: 1.3;
line-height: 1.5;
overflow-wrap: anywhere;
}
@@ -129,8 +146,12 @@
}
.commission-dashboard-stat--featured {
background: var(--dash-featured-bg);
border-color: var(--dash-featured-line);
background: linear-gradient(
120deg,
var(--dash-card),
var(--commission-primary-soft)
);
border-color: var(--dash-line);
}
.commission-dashboard-stat--featured > strong {
@@ -138,7 +159,7 @@
}
.commission-dashboard-support {
margin-top: 12px;
margin-top: 16px;
}
.commission-dashboard-support .commission-dashboard-stat {
@@ -146,35 +167,35 @@
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 14px 20px;
padding: 16px 22px;
}
.commission-dashboard-support .commission-dashboard-stat > strong {
margin: 0;
font-size: 22px;
font-size: 23px;
}
.commission-dashboard p.commission-dashboard-note {
margin-top: 12px;
margin-top: 14px;
font-size: 12px;
}
.commission-dashboard-main {
display: grid;
grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
gap: 16px;
margin: 16px 0;
grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
gap: 20px;
margin: 24px 0 20px;
}
.commission-dashboard-card {
padding: 18px 20px;
padding: 24px;
}
.commission-dashboard-todo-summary {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px;
margin-bottom: 8px;
gap: 12px;
margin-bottom: 6px;
}
.commission-dashboard button {
@@ -188,10 +209,10 @@
}
.commission-dashboard-summary-item {
padding: 10px 12px;
padding: 14px;
text-align: left;
border: 1px solid var(--dash-line);
border-radius: 4px;
border: 1px solid transparent;
border-radius: 8px;
background: var(--dash-soft);
min-width: 0;
}
@@ -203,7 +224,7 @@
.commission-dashboard-summary-item > strong {
display: block;
margin-top: 6px;
font-size: 22px;
font-size: 23px;
font-weight: 600;
}
@@ -229,7 +250,7 @@
justify-content: space-between;
gap: 14px;
border-bottom: 1px solid var(--dash-line);
padding: 15px 0;
padding: 19px 0;
}
.commission-dashboard-todo:last-child {
@@ -241,9 +262,17 @@
min-width: 0;
}
.commission-dashboard-todo > .ant-btn {
flex-shrink: 0;
}
.commission-dashboard-summary-item strong > small {
font-size: 11px;
}
.commission-dashboard-tag {
display: inline-block;
border-radius: 4px;
border-radius: 8px;
padding: 1px 7px;
font-size: 11px;
line-height: 1.8;
@@ -280,7 +309,7 @@
.commission-dashboard-button {
flex-shrink: 0;
border: 1px solid var(--dash-line);
border-radius: 4px;
border-radius: 8px;
padding: 6px 12px;
color: var(--text-secondary);
background: var(--dash-card);
@@ -290,14 +319,19 @@
.commission-dashboard-button--primary {
border-color: var(--dash-primary);
color: #fff;
color: var(--commission-on-primary);
background: var(--dash-primary);
}
.commission-dashboard-button:hover,
.commission-dashboard-summary-item:hover,
.commission-dashboard-health-item:hover {
filter: brightness(0.97);
border-color: var(--dash-primary);
}
.commission-dashboard-chart-column:hover .commission-dashboard-chart-bar,
.commission-dashboard-chart-column:focus-visible
.commission-dashboard-chart-bar {
background: var(--commission-primary-hover);
}
.commission-dashboard-health h3 {
@@ -306,11 +340,10 @@
.commission-dashboard-health-item {
width: 100%;
margin-top: 12px;
border: 0;
border: 1px solid var(--dash-line);
border-radius: 4px;
padding: 16px;
margin-top: 18px;
border: 1px solid transparent;
border-radius: 8px;
padding: 24px;
text-align: left;
background: var(--dash-soft);
}
@@ -318,7 +351,7 @@
.commission-dashboard-health-item > strong {
display: block;
margin-top: 8px;
font-size: 28px;
font-size: 32px;
line-height: 1.3;
font-weight: 600;
}
@@ -356,7 +389,7 @@
margin: 0 0 20px;
border: 1px solid
color-mix(in srgb, var(--dash-warning) 24%, var(--dash-line));
border-radius: 4px;
border-radius: 8px;
padding: 10px 12px;
background: var(--dash-warning-bg);
color: var(--dash-warning);
@@ -366,7 +399,30 @@
.commission-dashboard-chart {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
padding-top: 16px;
min-width: 0;
}
.commission-dashboard-chart-frame {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
gap: 16px;
padding: 16px 16px 0;
}
.commission-dashboard-chart-axis {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 145px;
color: var(--dash-muted);
font-size: 11px;
font-variant-numeric: tabular-nums;
text-align: end;
line-height: 1;
}
.commission-dashboard-chart-axis > span {
transform: translateY(-50%);
}
.commission-dashboard-chart-column {
@@ -384,22 +440,17 @@
justify-content: center;
height: 145px;
border-bottom: 1px solid var(--dash-line);
background: repeating-linear-gradient(
to top,
transparent 0,
transparent 47px,
var(--dash-grid) 47px,
var(--dash-grid) 48px
);
background-image: linear-gradient(var(--dash-grid) 1px, transparent 1px);
background-size: 100% 25%;
}
.commission-dashboard-chart-bar {
position: relative;
display: block;
width: 42%;
max-width: 72px;
max-width: 44px;
min-height: 1px;
border-radius: 2px 2px 0 0;
border-radius: 4px 4px 0 0;
background: var(--dash-muted-bar);
}
@@ -430,7 +481,7 @@
font-size: 11px;
}
@media (max-width: 1150px) {
@media (max-width: 1300px) {
.commission-dashboard-todo-summary {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@@ -444,16 +495,11 @@
}
}
@media (max-width: 900px) {
@media (max-width: 1000px) {
.commission-dashboard-main {
grid-template-columns: 1fr;
}
.commission-dashboard-core,
.commission-dashboard-support {
grid-template-columns: 1fr;
}
.commission-dashboard-health-metrics {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -461,6 +507,22 @@
}
}
@media (max-width: 768px) {
.commission-dashboard-core,
.commission-dashboard-support {
grid-template-columns: 1fr;
gap: 12px;
}
.commission-dashboard-todo-summary {
gap: 10px;
}
.commission-dashboard-summary-item {
padding: 12px;
}
}
@media (max-width: 520px) {
.commission-dashboard-heading,
.commission-dashboard-trend-heading {
@@ -489,4 +551,9 @@
.commission-dashboard-chart-value {
font-size: 10px;
}
.commission-dashboard-chart-frame {
gap: 8px;
padding-inline: 0;
}
}
+7 -7
View File
@@ -31,7 +31,7 @@
}
.commission-form-section-grid .commission-form-field {
gap: 6px;
gap: 8px;
}
.commission-form-section-grid .ant-input-number,
@@ -45,7 +45,7 @@
}
.commission-partner-sheet {
--commission-control-height: 32px;
--commission-control-height: 34px;
}
.commission-partner-sheet .ant-drawer-body {
@@ -75,19 +75,19 @@
.commission-partner-sheet-actions {
display: flex;
justify-content: flex-end;
gap: 14px;
gap: 8px;
}
.commission-partner-sheet .ant-radio-group {
min-height: 32px;
min-height: 34px;
display: flex;
align-items: center;
gap: 16px;
}
.commission-partner-sheet .commission-evidence-upload-button {
height: 32px;
border-radius: 4px;
height: 34px;
border-radius: var(--commission-radius);
}
.commission-partner-sheet .commission-evidence-meta {
@@ -97,7 +97,7 @@
.commission-settlement-context {
grid-column: 1 / -1;
padding: 12px 16px;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-card);
}
+27 -15
View File
@@ -38,6 +38,15 @@ import {
partnerWorkspaceFallback,
} from '../PartnerPortal/redirect';
import Loading from '../../components/common/ui/Loading';
import OrgPageHeader from '../Organization/components/OrgPageHeader';
import { useCommissionThemeStyle } from './commissionTheme';
import { Table } from '@/components/ui';
import {
ConsoleAlert as Alert,
ConsoleCard as Card,
ConsoleModal as Modal,
ConsoleTabs as Tabs,
} from '../../components/console/ConsolePrimitives';
import {
Home,
Users,
@@ -57,17 +66,12 @@ import PartnerPortal from './PartnerPortal';
import { partnerScope, createPartnerTransport } from './partnerScope';
import { tierStatus } from './listFilters';
import {
Alert,
Button,
Card,
DatePicker,
Dropdown,
Empty,
Modal,
Select,
Spin,
Table,
Tabs,
Tag,
Typography,
} from 'antd';
@@ -237,7 +241,7 @@ function PaymentTable({ payments, admin = false }) {
rowKey='id'
dataSource={payments}
pagination={false}
locale={{ emptyText: emptyState(t('暂无付款记录')) }}
empty={emptyState(t('暂无付款记录'))}
columns={[
{ title: t('打款日期'), dataIndex: 'paid_at', render: formatDateTime },
{ title: t('实付金额'), dataIndex: 'amount_uyuan', render: money },
@@ -448,7 +452,7 @@ function AdminStatementDetail({
pageSize: 10,
}}
scroll={{ x: 1800 }}
locale={{ emptyText: emptyState(t('暂无计费明细')) }}
empty={emptyState(t('暂无计费明细'))}
/>
)}
</>
@@ -463,7 +467,7 @@ function AdminStatementDetail({
rowKey='id'
dataSource={operations}
pagination={false}
locale={{ emptyText: emptyState(t('暂无操作记录')) }}
empty={emptyState(t('暂无操作记录'))}
columns={[
{
title: t('操作'),
@@ -519,7 +523,7 @@ function AdminStatementDetail({
rowKey='id'
dataSource={adjustments}
pagination={false}
locale={{ emptyText: emptyState(t('暂无调整单')) }}
empty={emptyState(t('暂无调整单'))}
columns={[
...AdjustmentColumns(t, money),
{ title: t('状态'), dataIndex: 'status', render: tag },
@@ -565,6 +569,7 @@ function AdminStatementDetail({
);
}
function AdminPage() {
const themeStyle = useCommissionThemeStyle();
const [userState] = useContext(UserContext);
const { t } = useTranslation();
const location = useLocation();
@@ -1531,7 +1536,10 @@ function AdminPage() {
/>
);
return (
<div className='commission-v2 commission-admin-workspace'>
<div
className='commission-v2 commission-admin-workspace'
style={themeStyle}
>
<div className='commission-admin-main'>
<header className='commission-workspace-bar'>
<span>
@@ -1849,6 +1857,7 @@ export function PartnerWorkspace({ organizationId = null }) {
}
function ScopedPartnerWorkspace({ scope, isCurrent }) {
const themeStyle = useCommissionThemeStyle();
const [userState] = useContext(UserContext);
const { t } = useTranslation();
const { status, partnerType, retry } = usePartnerWorkspaceAccess(
@@ -1874,11 +1883,13 @@ function ScopedPartnerWorkspace({ scope, isCurrent }) {
return <Navigate to={COMPANY_PARTNER_WORKSPACE_PATH} replace />;
if (status === 'denied')
return scope.enterprise ? (
<Alert
type='warning'
showIcon
title={t('当前企业没有可用的分佣访问权限')}
/>
<div
className='uc-page oc-page commission-access-state'
style={themeStyle}
>
<OrgPageHeader title={t('企业分佣')} />
<Alert type='warning' title={t('当前企业没有可用的分佣访问权限')} />
</div>
) : (
<Navigate to={partnerWorkspaceFallback(userState?.user?.role)} replace />
);
@@ -1904,6 +1915,7 @@ function ScopedPartnerWorkspace({ scope, isCurrent }) {
return (
<div
data-partner-scope={scope.key}
style={themeStyle}
className={
scope.enterprise ? 'partner-portal-scope--embedded' : undefined
}
+5
View File
@@ -54,6 +54,7 @@ import { API } from '../../helpers';
import RemoteIdentitySelect from './RemoteIdentitySelect';
import { fetchAllLatestTiers } from './latestTiers';
import './formSections.css';
import { useCommissionThemeStyle } from './commissionTheme';
const time = (value) => (value ? new Date(value * 1000).toLocaleString() : '—');
export function Field({ label, children, required = false }) {
@@ -203,6 +204,7 @@ export function OperationsDialog({
onClose,
onSaved,
}) {
const themeStyle = useCommissionThemeStyle();
const { t } = useTranslation();
const [form, setForm] = useState({});
const [error, setError] = useState('');
@@ -474,6 +476,7 @@ export function OperationsDialog({
};
return (
<Dialog
style={themeStyle}
className={partnerProfile ? 'commission-partner-sheet' : modalClassName}
width={modalWidth}
title={t(title || '详情')}
@@ -1201,6 +1204,7 @@ export function SettlementDialog({
onClose,
onSaved,
}) {
const themeStyle = useCommissionThemeStyle();
const { t } = useTranslation();
const [form, setForm] = useState({});
const [busy, setBusy] = useState(false);
@@ -1298,6 +1302,7 @@ export function SettlementDialog({
};
return (
<Modal
style={themeStyle}
className='commission-modal commission-modal--form commission-modal--settlement'
width={720}
title={t(
+27 -14
View File
@@ -1,6 +1,6 @@
.partner-portal .commission-v2-sider {
width: 220px !important;
flex-basis: 220px !important;
width: 220px;
flex-basis: 220px;
}
/* Organization owns the global header, sidebar and scroll container. */
@@ -42,10 +42,23 @@
}
.partner-portal--embedded .commission-v2-content {
padding: 24px var(--uc-page-pad-x) var(--uc-page-pad-bottom);
padding: var(--uc-page-pad-top) var(--uc-page-pad-x) var(--uc-page-pad-bottom);
background: transparent;
}
.partner-portal--embedded .commission-workspace-bar[hidden] {
display: none;
}
.partner-portal--embedded .commission-page-header {
align-items: stretch;
flex-direction: column;
}
.partner-portal--embedded .commission-page-heading {
width: 100%;
}
.partner-portal--embedded .commission-page-header {
align-items: flex-end;
margin-bottom: 18px;
@@ -131,7 +144,7 @@
padding: 10px 14px;
border: 1px solid
color-mix(in srgb, var(--commission-primary) 24%, transparent);
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--commission-primary-soft);
color: var(--text-primary);
font-size: 13px;
@@ -145,8 +158,8 @@
.partner-portal-metrics {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
margin-top: 12px;
gap: 18px;
margin-top: 18px;
}
.partner-portal-metrics-three {
@@ -158,7 +171,7 @@
min-height: 118px;
padding: 16px 20px;
border: 1px solid var(--border-subtle);
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--commission-surface-raised);
}
@@ -249,7 +262,7 @@
}
.partner-portal-chart-bar.is-negative {
background: #f76560;
background: var(--commission-danger);
}
.partner-portal-chart-label {
@@ -309,7 +322,7 @@ button.partner-portal-reminder:hover {
flex-shrink: 0;
width: 34px;
height: 34px;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--commission-primary-soft);
color: var(--commission-primary-readable);
}
@@ -351,7 +364,7 @@ button.partner-portal-reminder:hover {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
flex-wrap: wrap;
}
.partner-portal .partner-portal-row-actions .ant-btn-link {
@@ -468,8 +481,8 @@ button.partner-portal-reminder:hover {
@media (max-width: 700px) {
.partner-portal .commission-v2-sider {
width: 168px !important;
flex-basis: 168px !important;
width: 168px;
flex-basis: 168px;
}
.partner-portal .commission-brand {
@@ -503,8 +516,8 @@ button.partner-portal-reminder:hover {
@media (max-width: 640px) {
.partner-portal .commission-v2-sider {
width: 100% !important;
flex-basis: auto !important;
width: 100%;
flex-basis: auto;
}
.partner-portal .partner-portal-card.ant-card > .ant-card-body {
+132 -123
View File
@@ -3,60 +3,17 @@
.commission-modal,
.commission-profile-drawer,
.commission-partner-sheet {
/* 新版分佣只消费全局主题 token,主题色和明暗模式由控制台统一驱动。 */
--commission-primary: var(--brand-primary);
--commission-primary-hover: var(--brand-primary-hover);
--commission-primary-soft: var(--brand-primary-soft);
/* Links on dark surfaces need a lighter reading color than the brand swatch. */
--commission-primary-readable: color-mix(
in srgb,
var(--commission-primary) 58%,
var(--text-primary)
);
/* White text on the default brand blue is below AA contrast; deepen solid fills. */
--commission-primary-solid: color-mix(
in srgb,
var(--commission-primary) 78%,
#000
);
--commission-success: color-mix(in srgb, #22c55e 78%, var(--text-primary));
--commission-success-soft: color-mix(
in srgb,
#22c55e 12%,
var(--surface-card)
);
--commission-warning: color-mix(in srgb, #f59e0b 82%, var(--text-primary));
--commission-warning-soft: color-mix(
in srgb,
#f59e0b 12%,
var(--surface-card)
);
--commission-danger: color-mix(in srgb, #f56c7a 82%, var(--text-primary));
--commission-danger-soft: color-mix(
in srgb,
#f56c7a 12%,
var(--surface-card)
);
--commission-info: color-mix(in srgb, #22d3ee 78%, var(--text-primary));
--commission-info-soft: color-mix(in srgb, #22d3ee 12%, var(--surface-card));
--commission-primary-readable: var(--commission-primary);
--commission-primary-solid: var(--commission-primary);
--text-tertiary: var(--text-secondary);
--commission-radius: 4px;
--commission-control-height: 32px;
--commission-surface-raised: color-mix(
in srgb,
var(--surface-card) 94%,
var(--text-primary)
);
--commission-surface-toolbar: color-mix(
in srgb,
var(--surface-card) 86%,
var(--surface-bg-base)
);
--commission-surface-control: color-mix(
in srgb,
var(--surface-card) 78%,
var(--surface-bg-base)
);
--commission-radius: 8px;
--commission-control-height: 34px;
--commission-surface-raised: var(--surface-card);
--commission-surface-toolbar: var(--surface-card);
--commission-surface-control: var(--surface-card);
--commission-border-strong: color-mix(
in srgb,
var(--border-subtle) 78%,
@@ -77,9 +34,7 @@
transparent
);
color: var(--text-primary);
font-family:
-apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial,
sans-serif;
font-family: var(--commission-font, inherit);
font-size: 14px;
line-height: 1.5715;
}
@@ -175,7 +130,7 @@
width: 24px;
height: 24px;
flex-shrink: 0;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--commission-primary-solid);
}
.commission-navigation {
@@ -195,7 +150,7 @@
margin: 2px 0;
padding: 0 12px;
border: 0;
border-radius: 4px;
border-radius: var(--commission-radius);
background: transparent;
color: var(--text-secondary);
font: inherit;
@@ -225,8 +180,8 @@
margin-left: auto;
padding: 0 6px;
border-radius: 8px;
color: #fff;
background: #f53f3f;
color: var(--commission-on-primary);
background: var(--commission-danger);
font-size: 12px;
line-height: 16px;
}
@@ -248,7 +203,7 @@
}
.commission-crumb-slash {
padding: 0 8px;
color: #c9cdd4;
color: var(--text-secondary);
}
.commission-workspace-role {
padding: 3px 12px;
@@ -296,7 +251,7 @@
width: 138px;
}
.commission-card {
margin-top: 12px;
margin-top: 18px;
border: 1px solid var(--border-subtle);
border-radius: 10px;
background: var(--commission-surface-raised);
@@ -314,8 +269,7 @@
display: inline-flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
white-space: nowrap;
flex-wrap: wrap;
}
.commission-row-actions .commission-more-actions {
position: relative;
@@ -347,7 +301,7 @@
.commission-v2 .commission-status {
height: 22px;
padding: 0 8px;
border-radius: 2px;
border-radius: 6px;
font-size: 12px;
white-space: nowrap;
}
@@ -360,52 +314,13 @@
font-weight: 500;
color: var(--text-primary);
}
.commission-list-tabs {
display: flex;
align-items: stretch;
gap: 4px;
overflow-x: auto;
border-bottom: 1px solid var(--commission-border-strong);
padding: 0 4px;
margin-bottom: 12px;
.commission-list-tabs .ant-tabs-nav {
margin-bottom: 16px;
}
.commission-list-tabs > button {
position: relative;
flex-shrink: 0;
padding: 10px 16px;
border: 0;
background: transparent;
font: inherit;
.commission-tab-count {
margin-inline-start: 6px;
color: var(--text-secondary);
cursor: pointer;
}
.commission-list-tabs > button:hover {
color: var(--commission-primary-readable);
}
.commission-list-tabs > button.is-active {
color: var(--commission-primary-readable);
font-weight: 500;
}
.commission-list-tabs > button.is-active::after {
content: '';
position: absolute;
bottom: 0;
left: 12px;
right: 12px;
height: 2px;
background: var(--commission-primary);
}
.commission-list-tabs > button > span {
margin-left: 6px;
padding: 0 6px;
border-radius: 8px;
background: var(--surface-bg-base);
color: var(--text-tertiary);
font-size: 12px;
}
.commission-list-tabs > button.is-active > span {
color: var(--commission-primary-readable);
background: var(--commission-primary-soft);
font-variant-numeric: tabular-nums;
}
.commission-filter-bar {
display: flex;
@@ -414,7 +329,7 @@
flex-wrap: wrap;
padding: 10px 12px;
border: 1px solid var(--border-subtle);
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--commission-surface-toolbar);
margin-bottom: 12px;
}
@@ -485,7 +400,7 @@
display: flex;
flex-direction: column;
min-width: 0;
gap: 6px;
gap: 8px;
color: var(--text-secondary);
font-size: 14px;
}
@@ -500,7 +415,7 @@
}
.commission-tier-targets .ant-select {
height: auto;
min-height: 32px;
min-height: var(--commission-control-height);
}
.commission-field-hint {
color: var(--text-tertiary);
@@ -513,7 +428,7 @@
gap: 12px;
padding: 12px 14px;
grid-column: 1/-1;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-bg-base);
}
.commission-checklist .ant-checkbox-wrapper {
@@ -541,8 +456,7 @@
}
.commission-history-table .ant-table-thead > tr > th {
padding: 10px 14px;
background: var(--surface-bg-base);
color: var(--text-primary);
color: var(--text-secondary);
font-size: 13px;
font-weight: 500;
white-space: nowrap;
@@ -564,7 +478,7 @@
}
.commission-exception-content .ant-descriptions {
padding: 12px;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-bg-base);
overflow-wrap: anywhere;
}
@@ -586,11 +500,11 @@
align-items: center;
justify-content: center;
min-width: 108px;
height: 32px;
height: var(--commission-control-height);
gap: 7px;
padding: 0 14px;
border: 1px solid var(--border-subtle);
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-card);
color: var(--commission-primary-readable);
cursor: pointer;
@@ -663,7 +577,7 @@
gap: 6px;
padding: 16px 20px;
border: 1px solid var(--border-subtle);
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-card);
}
.statement-summary-values > div:last-child {
@@ -685,7 +599,7 @@
.commission-detail-tabs {
margin-top: 12px;
padding: 0 20px 16px;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-card);
}
.commission-tier-summary {
@@ -740,7 +654,7 @@
.commission-bill-step.is-current > span,
.commission-bill-step.is-done > span {
background: var(--commission-primary);
color: #fff;
color: var(--commission-on-primary);
}
.commission-bill-step.is-done::after {
background: var(--commission-primary);
@@ -758,12 +672,12 @@
.commission-drawer-actions {
display: flex;
justify-content: flex-end;
gap: 14px;
gap: 8px;
}
.commission-profile-section {
margin-bottom: 12px;
padding: 16px 20px;
border-radius: 4px;
border-radius: var(--commission-radius);
background: var(--surface-card);
}
.commission-profile-section h3 {
@@ -889,7 +803,7 @@
min-width: 120px;
}
.commission-list > .ant-card-body {
padding: 12px !important;
padding: 16px;
}
.commission-list-tabs > button {
padding: 10px 12px;
@@ -904,7 +818,7 @@
width: 100%;
}
.commission-modal {
max-width: calc(100vw - 24px);
max-width: calc(100vw - 32px);
}
.commission-detail-toolbar {
align-items: flex-start;
@@ -962,7 +876,7 @@
margin: 12px 0 20px;
padding: 16px;
background: var(--surface-bg-base);
border-radius: 4px;
border-radius: var(--commission-radius);
}
.commission-deduction-summary > div {
display: flex;
@@ -976,3 +890,98 @@
grid-template-columns: 1fr;
}
}
.commission-card > .ant-card-body {
padding: 24px;
}
.commission-card > .ant-card-body > h5.ant-typography {
font-size: 16px;
font-weight: 600;
}
.commission-list {
min-width: 0;
}
.commission-list-card.commission-card {
margin-top: 18px;
}
.commission-filter-end {
justify-content: flex-end;
margin-bottom: 18px;
}
.commission-search-field {
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
color: var(--text-secondary);
font-size: 13px;
}
.commission-search-field .ant-select {
width: 100%;
}
.commission-filter-card .console-search-fields {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 16px;
}
.commission-filter-card .console-search-actions {
margin-top: 16px;
}
.commission-filter-toggle.ant-btn {
display: none;
}
.commission-detail-tabs {
margin-top: 18px;
padding: 8px 24px 24px;
border: 1px solid var(--border-subtle);
border-radius: 10px;
}
.commission-access-state {
min-width: 0;
}
.commission-nav-item:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.commission-evidence-upload-button:focus-within {
outline: 2px solid var(--commission-primary);
outline-offset: 2px;
}
@media (max-width: 768px) {
.commission-filter-card .console-search-fields {
grid-template-columns: minmax(0, 1fr);
}
.commission-card > .ant-card-body {
padding: 16px;
}
.commission-filter-toggle.ant-btn {
display: inline-flex;
margin-bottom: 16px;
}
.commission-filter-card:not(.is-open) {
display: none;
}
.commission-page-header {
flex-direction: column;
align-items: stretch;
}
.commission-actions {
width: 100%;
max-width: 100%;
justify-content: flex-start;
}
.commission-detail-tabs {
padding: 8px 16px 16px;
}
.commission-operation-form {
grid-template-columns: minmax(0, 1fr);
}
.commission-bill-steps {
overflow-x: auto;
gap: 16px;
padding-bottom: 8px;
}
.commission-bill-step {
min-width: 96px;
}
}
+35 -9
View File
@@ -46,6 +46,7 @@ import { StatusContext } from '../../context/Status';
import GlassCard from '../../components/auth/GlassCard';
import AuthCardHeader from '../../components/auth/AuthCardHeader';
import AuthLoginTabs from '../../components/auth/AuthLoginTabs';
import AuthDivider from '../../components/auth/AuthDivider';
import AuthBackground from '../../components/common/AuthBackground';
const LAST_ORG_KEY = 'org_login_last';
@@ -77,6 +78,12 @@ const OrgLogin = () => {
const [pendingLoginName, setPendingLoginName] = useState(loginParam);
// 实际生效模式:系统未开直登则始终走企业标识
const effectiveMode = directLoginEnabled ? loginMode : 'identifier';
// Step1 受控输入的前端必填提示:失焦后仍为空时在框下提示(不改变按钮禁用与提交逻辑)
const [blurred, setBlurred] = useState({});
const markBlurred = (key) =>
setBlurred((prev) => (prev[key] ? prev : { ...prev, [key]: true }));
const emptyHelp = (key, empty, message) =>
blurred[key] && empty ? { validateStatus: 'error', help: message } : {};
const logo = getLogo();
const systemName = getSystemName();
@@ -496,6 +503,11 @@ const OrgLogin = () => {
label={t('登录名')}
htmlFor='org-direct-login-name'
required
{...emptyHelp(
'login_name',
!directForm.login_name.trim(),
t('请输入登录名'),
)}
>
<Input
id='org-direct-login-name'
@@ -504,6 +516,7 @@ const OrgLogin = () => {
onChange={(v) =>
setDirectForm({ ...directForm, login_name: v })
}
onBlur={() => markBlurred('login_name')}
placeholder={t('请输入登录名')}
size='default'
autoFocus
@@ -513,6 +526,11 @@ const OrgLogin = () => {
label={t('密码')}
htmlFor='org-direct-password'
required
{...emptyHelp(
'password',
!directForm.password,
t('请输入密码'),
)}
>
<Input
id='org-direct-password'
@@ -521,6 +539,7 @@ const OrgLogin = () => {
onChange={(v) =>
setDirectForm({ ...directForm, password: v })
}
onBlur={() => markBlurred('password')}
mode='password'
placeholder={t('请输入密码')}
size='default'
@@ -562,6 +581,11 @@ const OrgLogin = () => {
label={t('企业名称/代码')}
htmlFor='org-login-identifier'
required
{...emptyHelp(
'identifier',
!identifier.trim(),
t('请输入企业名称/代码'),
)}
>
<AutoComplete
id='org-login-identifier'
@@ -571,6 +595,7 @@ const OrgLogin = () => {
onChange={(v) =>
setIdentifier(typeof v === 'string' ? v : '')
}
onBlur={() => markBlurred('identifier')}
onSearch={handleSuggestSearch}
onSelect={(code) => {
setIdentifier(code);
@@ -626,11 +651,7 @@ const OrgLogin = () => {
{selfRegisterEnabled && (
<>
<div className='mt-1 flex items-center gap-3 text-xs text-gray-400'>
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
<span>{t('还没有企业?')}</span>
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
</div>
<AuthDivider>{t('还没有企业?')}</AuthDivider>
<Button
theme='borderless'
size='default'
@@ -647,6 +668,7 @@ const OrgLogin = () => {
{step === 2 && (
<Form
className='auth-login-form'
onSubmit={doLogin}
initValues={{ login_name: prefilledLoginName }}
>
@@ -658,7 +680,9 @@ const OrgLogin = () => {
size='default'
autoFocus={!prefilledLoginName}
autoComplete='username'
rules={[{ required: true, message: t('请输入登录名') }]}
rules={[
{ required: true, message: t('请输入企业内登录名') },
]}
/>
<Form.Input
field='password'
@@ -719,12 +743,12 @@ const OrgLogin = () => {
)}
{step === 3 && (
<Form onSubmit={doChangePassword}>
<Form className='auth-login-form' onSubmit={doChangePassword}>
<Banner
type='warning'
closeIcon={null}
description={t('首次登录需修改初始密码后方可使用。')}
className='mb-3'
className='auth-login-banner'
/>
<Form.Input
field='new_password'
@@ -732,6 +756,7 @@ const OrgLogin = () => {
placeholder={t('请输入新密码')}
mode='password'
size='default'
required
autoFocus
autoComplete='new-password'
onKeyDown={handleCapsLock}
@@ -749,11 +774,12 @@ const OrgLogin = () => {
placeholder={t('请再次输入新密码')}
mode='password'
size='default'
required
autoComplete='new-password'
onKeyDown={handleCapsLock}
onKeyUp={handleCapsLock}
validate={(value, values) => {
if (!value) return t('请再次输入新密码');
if (!value) return t('请输入确认新密码');
if (value !== values.new_password)
return t('两次输入的新密码不一致');
return '';
+27 -39
View File
@@ -29,6 +29,7 @@ import OrgCredentialResult from '../../components/auth/OrgCredentialResult';
import GlassCard from '../../components/auth/GlassCard';
import AuthCardHeader from '../../components/auth/AuthCardHeader';
import AuthLoginTabs from '../../components/auth/AuthLoginTabs';
import AuthDivider from '../../components/auth/AuthDivider';
import AuthBackground from '../../components/common/AuthBackground';
import {
LOGIN_NAME_PATTERN,
@@ -78,6 +79,12 @@ const OrgRegister = () => {
};
const sendCode = async () => {
// 先就地校验联系邮箱(必填 + 格式),未通过时由输入框下方提示
try {
await formApi.current?.validate(['contact_email']);
} catch {
return;
}
const email = (values.contact_email || '').trim();
if (!email) {
Toast.warning(t('请先输入联系邮箱'));
@@ -171,14 +178,9 @@ const OrgRegister = () => {
type='info'
closeIcon={null}
description={t('当前未开放企业自助注册,请联系平台管理员开通企业。')}
className='mb-4'
className='auth-login-banner'
/>
<Button
theme='solid'
size='large'
block
onClick={() => navigate('/org/login')}
>
<Button theme='solid' block onClick={() => navigate('/org/login')}>
{t('返回企业登录')}
</Button>
</GlassCard>
@@ -209,37 +211,26 @@ const OrgRegister = () => {
/>
) : (
<>
<style>{`
.org-register-form .ant-form-item {
margin-bottom: 14px !important;
padding: 0 !important;
}
.org-register-form .ant-form-item-label {
margin-bottom: 6px !important;
}
`}</style>
<Form
className='org-register-form auth-glass-form'
className='auth-login-form'
getFormApi={(api) => (formApi.current = api)}
onValueChange={(v) => setValues(v)}
>
<Form.Input
field='name'
size='large'
label={t('企业名称')}
placeholder={t('请输入企业名称(登录时可用于搜索定位)')}
rules={[{ required: true, message: t('请输入企业名称') }]}
/>
<Form.Input
field='owner_login_name'
size='large'
label={t('管理员登录名')}
placeholder={t('请设置管理员登录名,如 zhang.san')}
extraText={t(
'登录企业空间使用的管理员账号名,注册后不可修改;请勿使用 admin、root 等通用名',
)}
rules={[
{ required: true, message: t('请设置管理员登录名') },
{ required: true, message: t('请输入管理员登录名') },
{
pattern: LOGIN_NAME_PATTERN,
message: t(
@@ -254,26 +245,30 @@ const OrgRegister = () => {
/>
<Form.Input
field='owner_display_name'
size='large'
label={t('管理员显示名')}
placeholder={t('选填')}
/>
<Form.Input
field='contact_name'
size='large'
label={t('联系人')}
placeholder={t('选填')}
/>
<Form.Input
field='contact_email'
size='large'
label={t('联系邮箱')}
placeholder={t('用于接收通知')}
rules={
emailVerifyEnabled
rules={[
...(emailVerifyEnabled
? [{ required: true, message: t('请输入联系邮箱') }]
: []
}
: []),
// 格式校验:选填时为空不报错,有值时需为合法邮箱
{
type: 'email',
transform: (v) => v?.trim(),
message: t('邮箱格式不正确'),
},
]}
trigger='blur'
suffix={
emailVerifyEnabled ? (
<Button
@@ -292,25 +287,23 @@ const OrgRegister = () => {
{emailVerifyEnabled && (
<Form.Input
field='verify_code'
size='large'
label={t('邮箱验证码')}
placeholder={t('请输入验证码')}
rules={[{ required: true, message: t('请输入验证码') }]}
rules={[{ required: true, message: t('请输入邮箱验证码') }]}
/>
)}
<Form.Input
field='contact_phone'
size='large'
label={t('联系电话')}
placeholder={t('选填')}
/>
</Form>
<div className='mt-5'>
<div className='auth-login-actions'>
<Button
theme='solid'
size='large'
block
className='auth-login-submit'
loading={submitting}
onClick={handleSubmit}
>
@@ -318,14 +311,9 @@ const OrgRegister = () => {
</Button>
</div>
<div className='mt-4 flex items-center gap-3 text-xs text-gray-400'>
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
<span>{t('已有企业?')}</span>
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
</div>
<AuthDivider>{t('已有企业?')}</AuthDivider>
<Button
theme='borderless'
size='large'
block
className='!text-brand'
onClick={() => navigate('/org/login')}
@@ -340,7 +328,7 @@ const OrgRegister = () => {
return (
<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 跑马灯占位高度,保证占位+容器恰为一屏,避免幽灵滚动
style={{ minHeight: 'calc(100vh - var(--content-top-offset, 0px))' }}
>
@@ -46,6 +46,7 @@ const orgPageTitles = {
audit: '审计日志',
'personal-settings': '个人设置',
settings: '企业设置',
commission: '企业分佣',
};
// 分组页显示“分组 / 当前页面”,其他页面保留“企业中心 / 当前页面”。
@@ -63,6 +64,7 @@ const orgPageGroups = {
recharge: '财务与日志',
logs: '财务与日志',
audit: '财务与日志',
commission: '财务与日志',
'agent-audit': '财务与日志',
'personal-settings': '系统设置',
settings: '系统设置',
+2 -1
View File
@@ -456,9 +456,10 @@ const Organization = () => {
}, [orgId, user]);
useEffect(() => {
const requestState = orgRequest;
fetchOrgInfo();
return () => {
orgRequest.current++;
requestState.current++;
};
}, [fetchOrgInfo]);
+3 -6
View File
@@ -44,7 +44,6 @@ const AmountOptionsManager = ({
const [options, setOptions] = useState([]);
const [loading, setLoading] = useState(false);
const [editModal, setEditModal] = useState({ visible: false, data: null });
const [, setFormApi] = useState(null);
const onScopeChange = useEffectEvent(() => {
loadOptions();
@@ -239,12 +238,10 @@ const AmountOptionsManager = ({
onCancel={() => setEditModal({ visible: false, data: null })}
footer={null}
width={600}
// initValues 仅在挂载时生效,关闭后销毁表单以便下次按当前行初始化。
keepDOM={false}
>
<Form
initValues={editModal.data || {}}
onSubmit={handleSave}
getFormApi={(api) => setFormApi(api)}
>
<Form initValues={editModal.data || {}} onSubmit={handleSave}>
<Form.InputNumber
field='amount'
label={t('充值金额(元)')}
@@ -344,9 +344,13 @@ export default function GeneralSettings(props) {
/>
</Col>
<Col xs={24} sm={12} md={8} lg={8} xl={8}>
<Form.Slot label={t('站点额度展示类型及汇率')}>
<Form.Slot
label={t('站点额度展示类型及汇率')}
htmlFor='settings-quota-display-rate'
>
<InputGroup style={{ width: '100%' }}>
<Input
id='settings-quota-display-rate'
prefix={'1 USD = '}
style={{ width: '50%' }}
value={combinedRate}
@@ -354,6 +358,7 @@ export default function GeneralSettings(props) {
disabled={inputs.QuotaDisplayType === 'USD'}
/>
<Select
aria-label={t('站点额度展示类型及汇率')}
style={{ width: '50%' }}
value={inputs.QuotaDisplayType}
onChange={handleFieldChange('QuotaDisplayType')}
@@ -204,7 +204,7 @@ export default function SettingsOrgUserNavModules(props) {
description={t(
'仅对 org_only(仅企业资源)模式的员工账号生效。已默认隐藏 C 端入口(密钥/模型超市/用户中心/充值/推广等),开箱即生效;如需放开某项,打开对应开关并保存。',
)}
style={{ marginBottom: '16px' }}
style={{ marginBlock: '16px' }}
/>
<div style={{ fontWeight: 600, marginBottom: '12px' }}>
@@ -119,7 +119,7 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
<Form
labelPosition='left'
labelAlign='right'
labelAlign='end'
labelWidth={180}
onSubmit={onSubmit}
initValues={{
@@ -145,7 +145,7 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
<Form
labelPosition='left'
labelAlign='right'
labelAlign='end'
labelWidth={180}
onSubmit={onSubmit}
initValues={{
@@ -486,6 +486,7 @@ export default function ModelSettingsVisualEditor(props) {
</Checkbox>
</Space>
<Table
rowKey='name'
columns={columns}
dataSource={pagedData}
pagination={{
+14 -9
View File
@@ -860,11 +860,14 @@ export default function SettingsWeyAi() {
return (
<Card>
<Form.Section
component='form'
onSubmit={(event) => event.preventDefault()}
autoComplete='off'
text={t('WeyAi')}
extraText={t('WeyAi 桌面端与网页端的账号接入配置,仅超级管理员可见')}
>
{/* 保存期间也盖住表单:三批串行提交加回读有一两秒,这期间的输入会被
成功后的回读冲掉 */}
成功后的回读冲掉 */}
<Spin spinning={loading || saving}>
<div className='weyai-settings flex flex-col gap-4'>
{groupLoadFailed && (
@@ -917,6 +920,7 @@ export default function SettingsWeyAi() {
<Text className='block mb-1'>{t('网页端客户端密钥')}</Text>
<Input
mode='password'
autoComplete='new-password'
value={secretInput}
onChange={setSecretInput}
aria-label={t('网页端客户端密钥')}
@@ -979,6 +983,7 @@ export default function SettingsWeyAi() {
<Text className='block mb-1'>{t('公网访问客户端密钥')}</Text>
<Input
mode='password'
autoComplete='new-password'
value={remoteSecretInput}
onChange={setRemoteSecretInput}
aria-label={t('公网访问客户端密钥')}
@@ -1052,15 +1057,15 @@ export default function SettingsWeyAi() {
{t('黑名单优先于开放范围;收回权限只禁止访问,不删除数据')}
</Text>
{/* 后端只在登录、密钥刷新、密钥轮换时重算开放范围,普通请求
走 60 秒的账号状态缓存但不重算范围,已登录会话要等访问
密钥到期(2 小时)才被挡下。不写出来,管理员会以为收紧立刻生效 */}
走 60 秒的账号状态缓存但不重算范围,已登录会话要等访问
密钥到期(2 小时)才被挡下。不写出来,管理员会以为收紧立刻生效 */}
<Text type='tertiary' size='small' className='block'>
{t(
'收紧范围或加入黑名单后,已登录的网页端会话最长到访问密钥到期(2 小时)或重新登录时才会重新校验',
)}
</Text>
{/* 开放范围与黑名单只管网页端登录;登录时下发的 WeyAi 密钥是普通
密钥,没有失效时点。管理员若靠黑名单止损会误以为用量已停 */}
密钥,没有失效时点。管理员若靠黑名单止损会误以为用量已停 */}
<Text type='tertiary' size='small' className='block'>
{t(
'已下发的 WeyAi 密钥不受开放范围和黑名单影响,仍可直接调用模型;要停用请到密钥管理或企业密钥页禁用该密钥,或禁用该用户。桌面端登录不受开放范围限制',
@@ -1098,8 +1103,8 @@ export default function SettingsWeyAi() {
placeholder={t('选择用户分组')}
/>
{/* 企业托管账号的用户分组一律是 default,与普通注册用户相同:
这一项若对企业范围也生效,选了 default 就等于放开所有企业,
企业卡的名单形同虚设。后端只在个人范围匹配它 */}
这一项若对企业范围也生效,选了 default 就等于放开所有企业,
企业卡的名单形同虚设。后端只在个人范围匹配它 */}
<Text type='tertiary' size='small'>
{t(
'按用户所在分组判断,只对个人范围登录生效;以企业范围登录时不看这一项',
@@ -1107,8 +1112,8 @@ export default function SettingsWeyAi() {
</Text>
</div>
{/* ID 输入框开 addOnBlur:Semi TagInput 默认只在回车时把输入
提交成标签,管理员输完直接点「保存」会先失焦,没提交的输入
被丢掉,看起来就是"配置不生效、刷新后也不回显"。 */}
提交成标签,管理员输完直接点「保存」会先失焦,没提交的输入
被丢掉,看起来就是"配置不生效、刷新后也不回显"。 */}
<div className='mb-4'>
<Text className='block mb-1'>{t('开放用户 ID')}</Text>
<TagInput
@@ -1184,7 +1189,7 @@ export default function SettingsWeyAi() {
)}
</Text>
{/* 自助注册(免激活时)出来的企业可用分组就是自助注册默认分组,
把它选进来等于把"指定范围"变成人人可自助获得 */}
把它选进来等于把"指定范围"变成人人可自助获得 */}
<Text type='tertiary' size='small' className='block'>
{t(
'若包含企业自助注册的默认分组,自助注册且已激活的企业也会一并开放',
@@ -237,6 +237,9 @@ const SettingsWeyAiContentStorage = () => {
return (
<Card>
<Form.Section
component='form'
onSubmit={(event) => event.preventDefault()}
autoComplete='off'
text={t('内容存储')}
extraText={t(
'WeyAi 展示内容(作品视频、封面、模板包)专用的腾讯云 COS 存储桶,和系统 COS 桶分开;没有配置时内容功能不可用,不会改用系统桶',
@@ -305,6 +308,7 @@ const SettingsWeyAiContentStorage = () => {
<Text className='block mb-1'>SecretKey</Text>
<Input
mode='password'
autoComplete='new-password'
value={secretKeyInput}
onChange={setSecretKeyInput}
aria-label='SecretKey'
+73 -66
View File
@@ -75,6 +75,7 @@ const SkillPlatform = () => {
const [total, setTotal] = useState(0);
const pageSize = 50;
const [selected, setSelected] = useState(null);
const [detailTab, setDetailTab] = useState('review');
const [detail, setDetail] = useState(null);
const [importVisible, setImportVisible] = useState(false);
const [importing, setImporting] = useState(false);
@@ -269,6 +270,7 @@ const SkillPlatform = () => {
const loadDetail = useCallback(
async (skill) => {
setDetailTab('review');
setSelected(skill);
try {
const response = await API.get(
@@ -868,11 +870,81 @@ const SkillPlatform = () => {
<SkillDetailSideSheet
visible={!!selected}
className='skill-platform-review-drawer'
onCancel={() => {
setSelected(null);
setDetail(null);
}}
title={detail?.definition?.canonical_id || t('Skill 详情')}
footer={
detail && currentVersion && detailTab === 'review' ? (
<div className='skill-review-actions'>
<Button
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/rescan`,
)
}
>
{t('重新扫描')}
</Button>
<Button onClick={openModelTest}>{t('模型实测')}</Button>
{currentVersion.reviews?.[0]?.status === 'pending' && (
<Button
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/review/start`,
)
}
>
{t('开始审核')}
</Button>
)}
{currentVersion.reviews?.[0]?.status === 'reviewing' && (
<>
<Button
type='primary'
onClick={() => {
// 逐项勾选替代一键 hardcode:默认全不勾,
// 强制审核人对四个维度逐项作出确认。
setReviewChecklist({
value: false,
localization: false,
safety: false,
quality: false,
});
setReviewDecision({ approved: true });
}}
>
{t('审核通过')}
</Button>
<Button
type='danger'
onClick={() => {
setReviewReason('');
setReviewDecision({ approved: false });
}}
>
{t('驳回')}
</Button>
</>
)}
{currentVersion.reviews?.[0]?.status === 'approved' && (
<Button
theme='solid'
type='primary'
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/publish`,
)
}
>
{t('发布此版本')}
</Button>
)}
</div>
) : null
}
>
{detail && (
<div className='skill-platform-detail'>
@@ -900,7 +972,7 @@ const SkillPlatform = () => {
{t('紧急停用')}
</Button>
</div>
<Tabs type='line'>
<Tabs type='line' activeKey={detailTab} onChange={setDetailTab}>
<TabPane tab={t('审核工作台')} itemKey='review'>
{currentVersion && (
<div className='skill-review-workbench'>
@@ -926,71 +998,6 @@ const SkillPlatform = () => {
/>
</section>
<pre>{currentVersion.body}</pre>
<div className='skill-review-actions'>
<Button
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/rescan`,
)
}
>
{t('重新扫描')}
</Button>
<Button onClick={openModelTest}>{t('模型实测')}</Button>
{currentVersion.reviews?.[0]?.status === 'pending' && (
<Button
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/review/start`,
)
}
>
{t('开始审核')}
</Button>
)}
{currentVersion.reviews?.[0]?.status === 'reviewing' && (
<>
<Button
type='primary'
onClick={() => {
// 逐项勾选替代一键 hardcode:默认全不勾,
// 强制审核人对四个维度逐项作出确认。
setReviewChecklist({
value: false,
localization: false,
safety: false,
quality: false,
});
setReviewDecision({ approved: true });
}}
>
{t('审核通过')}
</Button>
<Button
type='danger'
onClick={() => {
setReviewReason('');
setReviewDecision({ approved: false });
}}
>
{t('驳回')}
</Button>
</>
)}
{currentVersion.reviews?.[0]?.status === 'approved' && (
<Button
theme='solid'
type='primary'
onClick={() =>
execute(
`/api/skill-platform/versions/${currentVersion.id}/publish`,
)
}
>
{t('发布此版本')}
</Button>
)}
</div>
</div>
)}
</TabPane>
+11 -2
View File
@@ -169,8 +169,8 @@
}
.skill-review-workbench pre {
max-height: 440px;
overflow: auto;
min-width: 0;
overflow-wrap: anywhere;
padding: 16px;
border-radius: 12px;
background: var(--ui-color-fill-0);
@@ -178,6 +178,15 @@
font-family: 'IBM Plex Mono', 'Cascadia Code', monospace;
}
.skill-review-actions {
justify-content: flex-end;
gap: 8px;
}
.skill-platform-review-drawer .ant-drawer-body {
max-height: none;
}
.skill-derive-grid {
grid-template-columns: 1fr 1fr;
}
+8 -10
View File
@@ -21,6 +21,7 @@ import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
ConsoleCard,
ConsoleAlert,
ConsoleTabs,
} from '../../components/console/ConsolePrimitives';
import ProfileTable from '../../components/smart-router/ProfileTable';
@@ -68,16 +69,13 @@ const SmartRouterPage = () => {
return (
<div className='smart-router-page'>
<div className='smart-router-hero'>
<div className='smart-router-eyebrow'>{t('Smart Router')}</div>
<h1>{t('智能路由')}</h1>
<p>
{t(
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
)}
</p>
</div>
<ConsoleCard>
<ConsoleAlert
className='smart-router-intro'
title={t(
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
)}
/>
<ConsoleCard className='smart-router-tabs-card'>
<ConsoleTabs
activeKey={activeKey}
onChange={onTab}
+6 -10
View File
@@ -231,9 +231,6 @@ html.dark .usage-record-consume-card {
.usage-logs-table.usage-record-table .usage-record-time span {
color: var(--ur-time-date);
}
.usage-logs-table.usage-record-table .usage-record-use-time em {
color: var(--ur-consume-first-time);
}
.usage-logs-table.usage-record-table .ant-tag {
padding: 0 7px;
border-radius: 6px;
@@ -247,9 +244,12 @@ html.dark .usage-record-consume-card {
color: var(--ur-text);
}
.usage-logs-table.usage-record-table .usage-record-use-time .ant-tag {
margin-inline-end: 0;
padding: 0 6px;
font-size: 11px;
line-height: 18px;
font-size: 12px;
font-weight: 500;
font-variant-numeric: tabular-nums;
line-height: 22px;
}
.usage-logs-table.usage-record-table .usage-record-cost {
color: var(--ur-cost);
@@ -309,13 +309,9 @@ html.dark .usage-record-consume-card {
.usage-record-use-time {
display: inline-flex;
align-items: center;
gap: 8px;
gap: 6px;
white-space: nowrap;
}
.usage-record-use-time em {
color: var(--ur-time-date);
font-style: normal;
}
.usage-record-cost {
color: var(--ur-cost);
font-weight: 600;
+9 -47
View File
@@ -41,7 +41,8 @@ import {
} from 'lucide-react';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
import { isGroupAllowed } from '../../helpers/navigationVisibility';
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
import { useWeyAiDownloadEntry } from '../../hooks/common/useWeyAiWebEntry';
@@ -57,47 +58,12 @@ const UserCenterSidebar = () => {
const { visible: weyaiDownloadEnabled } = useWeyAiDownloadEntry();
// 获取侧边栏配置
const sidebarConfig = useMemo(() => {
const defaultConfig = {
enabled: true,
groups: [],
moduleGroups: {},
dashboard: true,
usageRecord: true,
serviceDashboard: true,
topup: true,
invoice: true,
invite: true,
settings: true,
};
try {
const configStr = statusState?.status?.SidebarModulesAdmin;
if (configStr) {
const config = JSON.parse(configStr);
const uc = config.userCenter || {};
// 向后兼容:只有旧配置同时隐藏了 usageLog 和 taskLog,才隐藏合并后的 usageRecord;
// 只隐藏其中之一时保持显示,避免用户意外失去本应可见的日志入口
if (
uc.usageRecord === undefined &&
uc.usageLog === false &&
uc.taskLog === false
) {
uc.usageRecord = false;
}
const merged = { ...defaultConfig, ...uc };
return {
...merged,
enabled:
merged.enabled !== false &&
isGroupAllowed(merged.groups, userGroup),
};
}
} catch (error) {
// 使用默认配置
}
return defaultConfig;
}, [statusState?.status?.SidebarModulesAdmin, userGroup]);
const sidebarConfig = useMemo(
() =>
normalizeSidebarModulesAdmin(statusState?.status?.SidebarModulesAdmin)
.userCenter,
[statusState?.status?.SidebarModulesAdmin],
);
// 统一单一品牌色高亮(云平台风格):菜单项不再各用一种颜色,
// 激活态统一走 brand(azure),非激活中性灰,靠图标本身区分功能。
@@ -175,11 +141,7 @@ const UserCenterSidebar = () => {
const inMiniProgram = isMiniProgramWebView();
return allItems.filter(
(item) =>
sidebarConfig[item.configKey] !== false &&
isGroupAllowed(
sidebarConfig.moduleGroups?.[item.configKey],
userGroup,
) &&
isSidebarModuleVisible(sidebarConfig, item.configKey, userGroup) &&
!(inMiniProgram && isMiniProgramPaymentPath(item.itemKey)),
);
}, [allItems, sidebarConfig, userGroup]);
+9 -4
View File
@@ -37,6 +37,8 @@ import {
Receipt,
} from 'lucide-react';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
import { useMarquee } from '../../hooks/common/useMarquee';
import PageBackground from '../../components/common/PageBackground';
import UserCenterSidebar from './UserCenterSidebar';
@@ -61,6 +63,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const { t } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
const [userState] = useContext(UserContext);
const userGroup = userState?.user?.group;
const navItems = [
{
@@ -116,8 +120,7 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const inMiniProgram = isMiniProgramWebView();
const visibleNavItems = navItems.filter(
(item) =>
sidebarConfig?.enabled !== false &&
sidebarConfig?.[item.key] !== false &&
isSidebarModuleVisible(sidebarConfig, item.key, userGroup) &&
!(inMiniProgram && isMiniProgramPaymentPath(item.path)),
);
@@ -155,6 +158,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const UserCenter = ({ keyManagementMode = false }) => {
const [statusState] = useContext(StatusContext);
const [userState] = useContext(UserContext);
const userGroup = userState?.user?.group;
// 仅用于页面外壳的样式标识(看板与子页面底色不同),不参与路由判断
const ucRoute = useLocation().pathname.split('/')[2] || 'dashboard';
@@ -192,7 +197,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
: routePathMap[
userCenterRoutes.find(
(key) =>
userCenterConfig[key] !== false &&
isSidebarModuleVisible(userCenterConfig, key, userGroup) &&
!(
inMiniProgram &&
isMiniProgramPaymentPath(`/user-center/${routePathMap[key]}`)
@@ -203,7 +208,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
? `/user-center/${firstVisiblePath}`
: '/';
const guardUserCenterRoute = (key, element) => {
if (userCenterConfig.enabled === false || userCenterConfig[key] === false) {
if (!isSidebarModuleVisible(userCenterConfig, key, userGroup)) {
return <Navigate to={firstVisibleRoute} replace />;
}
return element;
+76 -96
View File
@@ -32,7 +32,7 @@ import {
} from '@/components/common/icons/ActionIcons';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button, Skeleton, Tag } from '@/components/ui';
import { Button, Skeleton, Tag } from 'antd';
import {
AlertTriangle,
Cpu,
@@ -49,8 +49,7 @@ import {
import { API } from '../../helpers/api';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
import PageBackground from '../../components/common/PageBackground';
import UserCenterBreadcrumb from '../../components/common/UserCenterBreadcrumb';
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
import { useWeyAiWebEntry } from '../../hooks/common/useWeyAiWebEntry';
import {
PLATFORMS,
@@ -247,9 +246,12 @@ const WeyAiDownload = ({ embedded = false }) => {
);
const scrollToAll = () => {
document
.getElementById(ALL_PACKAGES_ID)
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
document.getElementById(ALL_PACKAGES_ID)?.scrollIntoView({
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches
? 'instant'
: 'smooth',
block: 'start',
});
};
const download = (url) => window.open(url, '_self');
@@ -275,21 +277,16 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='wd-file__main'>
<div className='wd-file__title'>
<span>{archLabel(file.arch) || file.name}</span>
{file.kind && <Tag size='small'>{file.kind}</Tag>}
{isReco && (
<Tag size='small' color='blue'>
{t('推荐')}
</Tag>
)}
{file.kind && <Tag>{file.kind}</Tag>}
{isReco && <Tag className='wd-recommended-tag'>{t('推荐')}</Tag>}
</div>
<span className='wd-file__meta' title={file.name}>
{fileMeta(file)}
</span>
</div>
<Button
icon={<ActionDownload size={14} />}
theme={isReco ? 'solid' : 'light'}
type='primary'
icon={<ActionDownload size={16} aria-hidden />}
type={isReco ? 'primary' : 'default'}
aria-label={`${t('下载')} ${file.name}`}
onClick={() => download(file.url)}
>
@@ -322,7 +319,7 @@ const WeyAiDownload = ({ embedded = false }) => {
</h2>
<div className='wd-reco__meta'>
<code>{recommended.name}</code>
{recommended.size && (
{recommended.size > 0 && (
<span>{formatSize(recommended.size)}</span>
)}
{release?.version && <span>v{release.version}</span>}
@@ -342,15 +339,13 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
<div className='wd-reco__actions'>
<Button
size='large'
theme='solid'
type='primary'
icon={<ActionDownload size={16} />}
icon={<ActionDownload size={16} aria-hidden />}
onClick={() => download(recommended.url)}
>
{t('下载 WeyAi')}
</Button>
<Button theme='borderless' type='tertiary' onClick={scrollToAll}>
<Button type='text' onClick={scrollToAll}>
{t('其他平台与架构')}
</Button>
</div>
@@ -387,10 +382,8 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
<div className='wd-reco__actions'>
<Button
size='large'
theme='solid'
type='primary'
icon={<ActionDownload size={16} />}
icon={<ActionDownload size={16} aria-hidden />}
onClick={() => download(androidApk.url)}
>
{t('下载 Android 版')}
@@ -431,7 +424,7 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
{client.os !== 'mobile' && (
<div className='wd-reco__actions'>
<Button theme='solid' type='primary' onClick={scrollToAll}>
<Button type='primary' onClick={scrollToAll}>
{t('查看全部安装包')}
</Button>
</div>
@@ -445,17 +438,8 @@ const WeyAiDownload = ({ embedded = false }) => {
if (!statusLoaded || loading) {
return (
<section className='wd-card wd-skeleton' aria-busy='true'>
<Skeleton
loading
active
placeholder={
<>
<Skeleton.Title style={{ width: 240 }} />
<Skeleton.Paragraph rows={2} style={{ marginTop: 12 }} />
<Skeleton.Button style={{ width: 160, marginTop: 12 }} />
</>
}
/>
<Skeleton active title={{ width: '40%' }} paragraph={{ rows: 2 }} />
<Skeleton.Button active style={{ width: 160, maxWidth: '100%' }} />
</section>
);
}
@@ -477,9 +461,8 @@ const WeyAiDownload = ({ embedded = false }) => {
desc={loadError}
actions={
<Button
theme='solid'
type='primary'
icon={<ActionRefreshCw size={14} />}
icon={<ActionRefreshCw size={16} aria-hidden />}
onClick={load}
>
{t('重试')}
@@ -542,16 +525,14 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='wd-file__main'>
<div className='wd-file__title'>
<span>{I18N_TECHNICAL_TEXT.ANDROID}</span>
<Tag size='small'>apk</Tag>
<Tag>apk</Tag>
</div>
<span className='wd-file__meta' title={androidApk.name}>
{androidMeta}
</span>
</div>
<Button
icon={<ActionDownload size={14} />}
theme='light'
type='primary'
icon={<ActionDownload size={16} aria-hidden />}
aria-label={`${t('下载')} ${androidApk.name}`}
onClick={() => download(androidApk.url)}
>
@@ -572,72 +553,71 @@ const WeyAiDownload = ({ embedded = false }) => {
};
const rootClass = `weyai-download ${
embedded
? 'weyai-download--embedded'
: 'weyai-download--standalone mt-[60px]'
embedded ? 'weyai-download--embedded' : 'weyai-download--standalone'
}`;
const heroActions = (
<div className='wd-hero-actions'>
{isLoggedIn && webVisible && webUrl && (
<Button
icon={<ActionGlobe size={16} aria-hidden />}
onClick={() => window.open(webUrl, '_blank', 'noopener')}
>
{t('使用网页版')}
</Button>
)}
<Button
icon={<ActionExternalLink size={16} aria-hidden />}
onClick={() => {
window.location.href = OPEN_APP_URL;
}}
>
{t('已安装?打开 WeyAi')}
</Button>
</div>
);
return (
<div className={rootClass}>
{!embedded && <PageBackground grid />}
<div className='weyai-download__inner'>
{embedded && <UserCenterBreadcrumb />}
<header className='wd-hero'>
<div className='min-w-0'>
<div className='wd-hero'>
{!embedded && (
<div className='wd-eyebrow'>
<MonitorDown size={14} aria-hidden='true' />
<MonitorDown size={16} aria-hidden='true' />
{I18N_TECHNICAL_TEXT.WEYAI_DESKTOP}
</div>
<h1>{t('下载 WeyAi 桌面端')}</h1>
<p>{t('用你的账号登录,直接使用平台提供的模型和余额')}</p>
<div className='wd-hero-meta'>
{release?.version && (
<span className='wd-chip'>
{t('最新版本 v{{version}}', { version: release.version })}
</span>
)}
{release?.releaseDate && (
<span className='wd-chip wd-chip--muted'>
{t('发布于 {{date}}', {
date: formatReleaseDate(release.releaseDate),
})}
</span>
)}
{/* 有清单时按实际有安装包的平台展示,别在缺某平台 feed 时还声称支持 */}
<span className='wd-chip wd-chip--muted'>
{[
...(platformsWithFiles.length
? platformsWithFiles
: PLATFORMS
).map((platform) => PLATFORM_LABEL[platform]),
...(androidApk ? ['Android'] : []),
].join(' · ')}
)}
<UserCenterPageHeader
title={t('下载 WeyAi 桌面端')}
subtitle={t('用你的账号登录,直接使用平台提供的模型和余额')}
breadcrumb={embedded ? undefined : null}
extra={heroActions}
/>
<div className='wd-hero-meta'>
{release?.version && (
<span className='wd-chip'>
{t('最新版本 v{{version}}', { version: release.version })}
</span>
</div>
</div>
<div className='wd-hero-actions'>
{/* 未登录访客不给网页版按钮:hook 对匿名恒可见,点了会直接打到网关的
/sso/start 再被弹回登录,不如顶栏那样先引导登录 */}
{isLoggedIn && webVisible && webUrl && (
<Button
icon={<ActionGlobe size={14} />}
theme='light'
type='primary'
onClick={() => window.open(webUrl, '_blank', 'noopener')}
>
{t('使用网页版')}
</Button>
)}
<Button
icon={<ActionExternalLink size={14} />}
onClick={() => {
window.location.href = OPEN_APP_URL;
}}
>
{t('已安装?打开 WeyAi')}
</Button>
{release?.releaseDate && (
<span className='wd-chip wd-chip--muted'>
{t('发布于 {{date}}', {
date: formatReleaseDate(release.releaseDate),
})}
</span>
)}
{/* 有清单时按实际有安装包的平台展示,别在缺某平台 feed 时还声称支持 */}
<span className='wd-chip wd-chip--muted'>
{[
...(platformsWithFiles.length
? platformsWithFiles
: PLATFORMS
).map((platform) => PLATFORM_LABEL[platform]),
...(androidApk ? ['Android'] : []),
].join(' · ')}
</span>
</div>
</header>
</div>
{renderPackages()}

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