fix(ui): 完善界面交互与开发配置
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": ["Bash(go build:*)"]
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
||||
"promptCacheTtl": "1h"
|
||||
}
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
+1
-3
@@ -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
|
||||
|
||||
@@ -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. 工具差异(本节允许不同)
|
||||
|
||||
|
||||
@@ -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. 工具差异(本节允许不同)
|
||||
|
||||
|
||||
@@ -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 标记;其他自动化调用方也必须遵守此约定。
|
||||
|
||||
+153
-25
@@ -1,6 +1,6 @@
|
||||
# 变更记录(CHANGELOG)
|
||||
|
||||
> 状态:有效(持续追加) · 更新:2026-11-18 · 版本:v3.4
|
||||
> 状态:有效(持续追加) · 更新:2026-11-18 · 版本:v3.5
|
||||
|
||||
对现状仍有影响的功能与修复记录,按日期倒序。改造、迁移、优化等一次性过程不在此记录。
|
||||
|
||||
@@ -10,21 +10,37 @@
|
||||
|
||||
## 2026-11-18
|
||||
|
||||
### 调整 · 智能路由卡片首部页签间距
|
||||
### 调整 · 认证页表单必填标识、就地校验与间距统一
|
||||
|
||||
- **范围**:`/console/smart-router` 的选项卡卡片,以及 UI 公共规范第 10 节。
|
||||
- **变更**:参照官网设置页,将页签卡片主体顶部内边距从 24px 调整为 8px,减少 16px 多余留白;规范明确卡片首部页签的顶部间距、默认高度与适用条件。
|
||||
- **影响**:仅调整该卡片顶部间距,保留页签高度、文字、切换逻辑、权限、请求和其他方向内边距;企业中心的智能路由组件不受影响。
|
||||
- **回滚**:移除 `SmartRouter/index.jsx` 的 `smart-router-tabs-card` 类及对应 CSS 规则,按差异还原规范条目。
|
||||
- **关联**:`docs/standards/UI_COMPONENT_STANDARDS.md` 第 10 节。
|
||||
- **范围**:`/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 节。
|
||||
|
||||
### 修复 · WeyAi 下载页与顶部菜单统一主题
|
||||
### 调整 · 开发环境默认开启云脑入口
|
||||
|
||||
- **范围**:`/weyai/download`、用户中心内嵌下载页,以及共享顶栏的账户、语言与主导航菜单。
|
||||
- **变更**:本站下载页进入系统样式作用域,修复头像浮层缺少背景与颜色变量;下载页复用公共页头与原生 antd 按钮、标签、骨架,对齐浅深主题、卡片、间距、图标和响应式布局,移除旧装饰渐变与悬浮动效。顶部菜单使用原生 antd 菜单与可聚焦触发器,账户和语言菜单支持点击,下载页锚点跟随实际顶栏高度并遵守减少动态效果偏好。
|
||||
- **影响**:仅调整展示与菜单操作方式,保留下载地址、开放范围、权限判断、请求、语言与主题持久化;其他 WeyAI 外部页仍使用原作用域。
|
||||
- **回滚**:按本条涉及的下载页、`UiThemeProvider.jsx` 与顶栏菜单组件差异还原,保留其他工作区修改。
|
||||
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md` 第 1、4 节;`docs/standards/UI_COMPONENT_STANDARDS.md`。
|
||||
- **范围**:开发环境配置、环境回归测试与 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 依赖检查
|
||||
|
||||
@@ -34,13 +50,21 @@
|
||||
- **回滚**:仅还原本条相关 Hook 差异、复制测试与本记录,保留其他工作区修改。
|
||||
- **关联**:`test/unit/clipboard.test.js`、`src/hooks/common/usePartnerWorkspaceEntry.js`、`src/pages/Organization/index.jsx`。
|
||||
|
||||
### 修复 · 渠道自定义模型填入后清空
|
||||
### 修复 · 技能许可证徽标兼容深浅主题
|
||||
|
||||
- **范围**:`/console/channel` 创建渠道与更新渠道信息表单。
|
||||
- **变更**:点击自定义模型名称的“填入”后,同步清空组件状态与表单字段值,避免输入框保留已处理的名称。
|
||||
- **影响**:保留模型合并、逗号分隔、去重、提示与原有渠道保存逻辑。
|
||||
- **回滚**:仅还原 `EditChannelModal.jsx` 中本条新增的字段清空调用与本记录。
|
||||
- **关联**:`src/components/table/channels/modals/EditChannelModal.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 分类标签与搜索栏左对齐
|
||||
|
||||
@@ -50,6 +74,14 @@
|
||||
- **回滚**:移除 `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` 顶部模型筛选卡。
|
||||
@@ -58,6 +90,22 @@
|
||||
- **回滚**:仅还原 `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`。
|
||||
@@ -66,13 +114,93 @@
|
||||
- **回滚**:仅还原 `AmountOptionsManager.jsx` 本条相关差异与本记录,保留其他工作区修改。
|
||||
- **关联**:`src/pages/Setting/AmountOptionsManager.jsx`。
|
||||
|
||||
### 调整 · 认证页输入框 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 节。
|
||||
- **范围**:`/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 节。
|
||||
|
||||
### 规范 · 适配层日期契约、标签写法与控制台页头
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
- 系统设置(`page.key === 'setting'`):表单统一纵向布局、8px 标签间距、24px 栅格、控件等宽,校验信息预留高度;弹窗页脚按钮高 34px、间距 8px、右对齐。规则限定在 `.settings-page` / `.settings-form-dialog`。
|
||||
- 控制台上下文中 `CompactModeToggle` 不渲染,表格密度状态保留;其他模块仍可使用紧凑模式。
|
||||
- 平台 Skill 中心的分类标签区域与搜索工具栏同宽、左对齐,不保留独立的最大宽度和自动居中;窄屏按原间距自然换行。
|
||||
- 平台 Skill 详情的审核工作台仅由抽屉正文纵向滚动,技能原文不设置独立滚动区;审核操作进入抽屉固定页脚,按钮右对齐、间距 8px,仅在审核页签展示。
|
||||
- 官网文章抽屉允许点击遮罩关闭,X、取消、遮罩共用同一未保存内容确认流程。
|
||||
|
||||
## 4. 验收要点
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 后台 UI 全局基线
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v3.7
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v3.11
|
||||
|
||||
后台外壳与布局基线:顶栏、侧栏、公告、页头与内容边距、登录页,以及原型未定义场景、登录关卡与验收流程。主题与组件样式见 `UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
@@ -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`;企业侧栏不提供菜单搜索。
|
||||
@@ -81,8 +83,8 @@
|
||||
### 4.5 登录页与认证顶栏
|
||||
|
||||
- 认证页(`/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` 呈现;字段节奏 24px,凭据字段只预留必要的错误提示高度,正常、报错、修正三态布局稳定。第三方登录用描边整行按钮,无位移与扫光;分隔线用 `AuthDivider`。规则集中在 `src/styles/prototype.css` 的 `.auth-login-page` 段。
|
||||
- 副标题、“记住登录名”、管理员重置提示与“忘记密码”使用加深 20% 的次文字色,无悬停底色,“忘记密码”悬停再加深;“切换企业”与“登录”同为主按钮样式。个人登录必填校验用 `rules`,通过后调用原登录处理函数。样式调整不得改变登录校验、回调与载荷。
|
||||
- 登录卡片无顶部装饰线、反光、外发光、角落光晕与 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` 只接受正安全整数,不代表动态内存调度 |
|
||||
|
||||
@@ -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` 时全部停用。
|
||||
|
||||
@@ -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'>` +“复制”链接,复制提示沿用原文案。
|
||||
|
||||
|
||||
@@ -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 } =
|
||||
|
||||
@@ -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) => {
|
||||
@@ -166,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();
|
||||
@@ -826,14 +836,10 @@ const LoginForm = () => {
|
||||
<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'
|
||||
@@ -849,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'
|
||||
@@ -864,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)}
|
||||
@@ -987,7 +989,7 @@ const LoginForm = () => {
|
||||
}
|
||||
visible={showWeChatLoginModal}
|
||||
maskClosable={true}
|
||||
onOk={onSubmitWeChatVerificationCode}
|
||||
onOk={submitWeChatCodeWithValidation}
|
||||
onCancel={() => setShowWeChatLoginModal(false)}
|
||||
okText={t('登录')}
|
||||
centered={true}
|
||||
@@ -1048,11 +1050,12 @@ 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)
|
||||
|
||||
@@ -121,10 +121,20 @@ const PasswordResetForm = () => {
|
||||
subtitle={t('密码重置')}
|
||||
/>
|
||||
|
||||
<Form className='auth-login-form'>
|
||||
{/* 前端校验(必填 + 邮箱格式)通过后才调用原 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}
|
||||
@@ -138,7 +148,6 @@ const PasswordResetForm = () => {
|
||||
block
|
||||
className='auth-login-submit'
|
||||
htmlType='submit'
|
||||
onClick={handleSubmit}
|
||||
loading={loading}
|
||||
disabled={disableButton}
|
||||
>
|
||||
|
||||
@@ -144,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();
|
||||
@@ -665,14 +685,16 @@ const RegisterForm = () => {
|
||||
logoWrapperClassName='mb-2'
|
||||
/>
|
||||
|
||||
<Form className='auth-login-form'>
|
||||
{/* 前端校验通过后才调用原 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'
|
||||
autoComplete='username'
|
||||
@@ -680,14 +702,15 @@ const RegisterForm = () => {
|
||||
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'
|
||||
@@ -699,11 +722,14 @@ 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'
|
||||
@@ -716,11 +742,16 @@ 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'
|
||||
@@ -730,7 +761,7 @@ const RegisterForm = () => {
|
||||
suffix={
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendVerificationCode}
|
||||
onClick={sendVerificationCodeWithValidation}
|
||||
loading={verificationCodeLoading}
|
||||
disabled={disableButton || verificationCodeLoading}
|
||||
className='!rounded-lg'
|
||||
@@ -743,11 +774,8 @@ 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'
|
||||
onChange={(value) => handleChange('verification_code', value)}
|
||||
@@ -757,7 +785,7 @@ const RegisterForm = () => {
|
||||
)}
|
||||
|
||||
{(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)}
|
||||
@@ -793,13 +821,12 @@ const RegisterForm = () => {
|
||||
)}
|
||||
|
||||
<div className='auth-login-actions'>
|
||||
{/* 注册按钮:与登录按钮同款实心主按钮(36px),保留原提交触发与禁用条件 */}
|
||||
{/* 注册按钮:提交经表单校验后调用原 handleSubmit,禁用条件不变 */}
|
||||
<Button
|
||||
theme='solid'
|
||||
htmlType='submit'
|
||||
block
|
||||
className='auth-login-submit'
|
||||
onClick={handleSubmit}
|
||||
loading={registerLoading}
|
||||
disabled={
|
||||
registerLoading ||
|
||||
@@ -870,7 +897,7 @@ const RegisterForm = () => {
|
||||
}
|
||||
visible={showWeChatLoginModal}
|
||||
maskClosable={true}
|
||||
onOk={onSubmitWeChatVerificationCode}
|
||||
onOk={submitWeChatCodeWithValidation}
|
||||
onCancel={() => setShowWeChatLoginModal(false)}
|
||||
okText={t('登录')}
|
||||
centered={true}
|
||||
@@ -931,11 +958,12 @@ 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)
|
||||
|
||||
@@ -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,6 +103,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
|
||||
value={verificationCode}
|
||||
onChange={setVerificationCode}
|
||||
onKeyPress={handleKeyPress}
|
||||
rules={codeRules}
|
||||
trigger='blur'
|
||||
style={{ marginBottom: 16 }}
|
||||
autoFocus
|
||||
/>
|
||||
@@ -177,6 +194,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
|
||||
value={verificationCode}
|
||||
onChange={setVerificationCode}
|
||||
onKeyPress={handleKeyPress}
|
||||
rules={codeRules}
|
||||
trigger='blur'
|
||||
style={{ marginBottom: 16 }}
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,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
|
||||
@@ -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} />
|
||||
|
||||
@@ -849,7 +849,7 @@ const SystemSetting = () => {
|
||||
|
||||
<Card>
|
||||
<Form.Section text={t('SSRF防护设置')}>
|
||||
<Text extraText={t('SSRF防护详细说明')}>
|
||||
<Text title={t('SSRF防护详细说明')}>
|
||||
{t('配置服务器端请求伪造(SSRF)防护,用于保护内网资源安全')}
|
||||
</Text>
|
||||
<Row
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.smart-router-page .smart-router-intro.console-alert {
|
||||
margin-block: 0;
|
||||
}
|
||||
|
||||
.smart-router-alert {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
@@ -181,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 {
|
||||
@@ -274,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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
@@ -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 }) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "チャットアプリ名を入力してください",
|
||||
"请输入密钥名称": "キー名を入力",
|
||||
"请输入密码": "パスワードを入力してください",
|
||||
"请输入用户名/邮箱": "ユーザー名/メールアドレスを入力してください",
|
||||
"请输入企业名称/代码": "会社名/コードを入力してください",
|
||||
"请输入企业内登录名": "企業内ログイン名を入力してください",
|
||||
"请输入确认新密码": "確認用の新しいパスワードを入力してください",
|
||||
"请输入管理员登录名": "管理者ログイン名を入力してください",
|
||||
"请输入确认密码": "パスワード(確認用)を入力してください",
|
||||
"请输入备用码": "バックアップコードを入力してください",
|
||||
"密码长度需为 8-20 位": "パスワードは8〜20文字である必要があります",
|
||||
"请输入密钥": "APIキーを入力してください",
|
||||
"请输入密钥,一行一个": "APIキーを入力してください(1行に1つずつ)",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "キーを1行に1つずつ入力してください。形式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "대화 앱 이름을 입력하세요",
|
||||
"请输入密钥名称": "키 이름 입력",
|
||||
"请输入密码": "비밀번호를 입력하세요",
|
||||
"请输入用户名/邮箱": "사용자명 / 이메일을 입력하세요",
|
||||
"请输入企业名称/代码": "비즈니스 이름/코드를 입력하세요",
|
||||
"请输入企业内登录名": "기업 내 로그인 이름을 입력하세요",
|
||||
"请输入确认新密码": "새 비밀번호 확인을 입력하세요",
|
||||
"请输入管理员登录名": "관리자 로그인 이름을 입력하세요",
|
||||
"请输入确认密码": "비밀번호 확인을 입력하세요",
|
||||
"请输入备用码": "백업 코드를 입력하세요",
|
||||
"密码长度需为 8-20 位": "비밀번호는 8~20자여야 합니다",
|
||||
"请输入密钥": "키를 입력하세요",
|
||||
"请输入密钥,一行一个": "키를 한 줄에 하나씩 입력하세요",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "키를 한 줄에 하나씩 입력하세요. 형식: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4156,6 +4156,14 @@
|
||||
"请输入聊天应用名称": "Пожалуйста, введите имя чат-приложения",
|
||||
"请输入密钥名称": "Введите имя ключа",
|
||||
"请输入密码": "Пожалуйста, введите пароль",
|
||||
"请输入用户名/邮箱": "Введите имя пользователя/email",
|
||||
"请输入企业名称/代码": "Введите название компании/код",
|
||||
"请输入企业内登录名": "Введите имя входа предприятия",
|
||||
"请输入确认新密码": "Подтвердите новый пароль",
|
||||
"请输入管理员登录名": "Введите имя администратора",
|
||||
"请输入确认密码": "Подтвердите пароль",
|
||||
"请输入备用码": "Введите резервный код",
|
||||
"密码长度需为 8-20 位": "Пароль должен иметь длину 8 - 20 символов",
|
||||
"请输入密钥": "Пожалуйста, введите ключ",
|
||||
"请输入密钥,一行一个": "Пожалуйста, введите ключи, по одному в строке",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Введите ключи по одному в строке в формате: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "โปรดกรอกชื่อแอปแชท",
|
||||
"请输入密钥名称": "กรอกชื่อคีย์",
|
||||
"请输入密码": "กรุณากรอกรหัสผ่าน",
|
||||
"请输入用户名/邮箱": "กรุณากรอกชื่อผู้ใช้ / อีเมล",
|
||||
"请输入企业名称/代码": "กรุณากรอกชื่อธุรกิจ / รหัส",
|
||||
"请输入企业内登录名": "กรุณากรอกชื่อผู้ใช้ภายในองค์กร",
|
||||
"请输入确认新密码": "กรุณากรอกยืนยันรหัสผ่านใหม่",
|
||||
"请输入管理员登录名": "กรุณากรอกชื่อผู้ใช้เข้าระบบของผู้ดูแล",
|
||||
"请输入确认密码": "กรุณากรอกยืนยันรหัสผ่าน",
|
||||
"请输入备用码": "กรุณากรอกรหัสสำรอง",
|
||||
"密码长度需为 8-20 位": "รหัสผ่านต้องมีความยาว 8-20 ตัวอักษร",
|
||||
"请输入密钥": "กรุณากรอกคีย์",
|
||||
"请输入密钥,一行一个": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ ในรูปแบบ: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "請輸入聊天應用名稱",
|
||||
"请输入密钥名称": "請輸入金鑰名稱",
|
||||
"请输入密码": "請輸入密碼",
|
||||
"请输入用户名/邮箱": "請輸入使用者名稱/郵箱",
|
||||
"请输入企业名称/代码": "請輸入企業名稱/代碼",
|
||||
"请输入企业内登录名": "請輸入企業內登入名",
|
||||
"请输入确认新密码": "請輸入確認新密碼",
|
||||
"请输入管理员登录名": "請輸入管理員登入名",
|
||||
"请输入确认密码": "請輸入確認密碼",
|
||||
"请输入备用码": "請輸入備用碼",
|
||||
"密码长度需为 8-20 位": "密碼長度需為 8-20 位",
|
||||
"请输入密钥": "請輸入金鑰",
|
||||
"请输入密钥,一行一个": "請輸入金鑰,一行一個",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "請輸入金鑰,一行一個,格式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4253,6 +4253,15 @@
|
||||
"请输入聊天应用名称": "请输入聊天应用名称",
|
||||
"请输入密钥名称": "请输入密钥名称",
|
||||
"请输入密码": "请输入密码",
|
||||
"请输入用户名/邮箱": "请输入用户名/邮箱",
|
||||
"请输入企业名称/代码": "请输入企业名称/代码",
|
||||
"请输入企业内登录名": "请输入企业内登录名",
|
||||
"请输入确认新密码": "请输入确认新密码",
|
||||
"请输入管理员登录名": "请输入管理员登录名",
|
||||
"请输入确认密码": "请输入确认密码",
|
||||
"请输入备用码": "请输入备用码",
|
||||
"密码长度需为 8-20 位": "密码长度需为 8-20 位",
|
||||
"请输入邮箱验证码": "请输入邮箱验证码",
|
||||
"请输入密钥": "请输入密钥",
|
||||
"请输入密钥,一行一个": "请输入密钥,一行一个",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,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();
|
||||
@@ -497,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'
|
||||
@@ -505,6 +516,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, login_name: v })
|
||||
}
|
||||
onBlur={() => markBlurred('login_name')}
|
||||
placeholder={t('请输入登录名')}
|
||||
size='default'
|
||||
autoFocus
|
||||
@@ -514,6 +526,11 @@ const OrgLogin = () => {
|
||||
label={t('密码')}
|
||||
htmlFor='org-direct-password'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'password',
|
||||
!directForm.password,
|
||||
t('请输入密码'),
|
||||
)}
|
||||
>
|
||||
<Input
|
||||
id='org-direct-password'
|
||||
@@ -522,6 +539,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, password: v })
|
||||
}
|
||||
onBlur={() => markBlurred('password')}
|
||||
mode='password'
|
||||
placeholder={t('请输入密码')}
|
||||
size='default'
|
||||
@@ -563,6 +581,11 @@ const OrgLogin = () => {
|
||||
label={t('企业名称/代码')}
|
||||
htmlFor='org-login-identifier'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'identifier',
|
||||
!identifier.trim(),
|
||||
t('请输入企业名称/代码'),
|
||||
)}
|
||||
>
|
||||
<AutoComplete
|
||||
id='org-login-identifier'
|
||||
@@ -572,6 +595,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setIdentifier(typeof v === 'string' ? v : '')
|
||||
}
|
||||
onBlur={() => markBlurred('identifier')}
|
||||
onSearch={handleSuggestSearch}
|
||||
onSelect={(code) => {
|
||||
setIdentifier(code);
|
||||
@@ -656,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'
|
||||
@@ -730,6 +756,7 @@ const OrgLogin = () => {
|
||||
placeholder={t('请输入新密码')}
|
||||
mode='password'
|
||||
size='default'
|
||||
required
|
||||
autoFocus
|
||||
autoComplete='new-password'
|
||||
onKeyDown={handleCapsLock}
|
||||
@@ -747,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 '';
|
||||
|
||||
@@ -79,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('请先输入联系邮箱'));
|
||||
@@ -224,7 +230,7 @@ const OrgRegister = () => {
|
||||
'登录企业空间使用的管理员账号名,注册后不可修改;请勿使用 admin、root 等通用名',
|
||||
)}
|
||||
rules={[
|
||||
{ required: true, message: t('请设置管理员登录名') },
|
||||
{ required: true, message: t('请输入管理员登录名') },
|
||||
{
|
||||
pattern: LOGIN_NAME_PATTERN,
|
||||
message: t(
|
||||
@@ -251,11 +257,18 @@ const OrgRegister = () => {
|
||||
field='contact_email'
|
||||
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
|
||||
@@ -276,7 +289,7 @@ const OrgRegister = () => {
|
||||
field='verify_code'
|
||||
label={t('邮箱验证码')}
|
||||
placeholder={t('请输入验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
rules={[{ required: true, message: t('请输入邮箱验证码') }]}
|
||||
/>
|
||||
)}
|
||||
<Form.Input
|
||||
|
||||
@@ -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: '系统设置',
|
||||
|
||||
@@ -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={{
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,15 +69,12 @@ 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>
|
||||
<ConsoleAlert
|
||||
className='smart-router-intro'
|
||||
title={t(
|
||||
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
|
||||
)}
|
||||
/>
|
||||
<ConsoleCard className='smart-router-tabs-card'>
|
||||
<ConsoleTabs
|
||||
activeKey={activeKey}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+43
-22
@@ -365,41 +365,51 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
transform: none;
|
||||
transition: none;
|
||||
}
|
||||
/* 字段节奏统一 24px:与必填字段预留的一行报错高度一致,报错出现时布局不跳动 */
|
||||
.auth-login-page .ant-form-item {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
/* Zero margin avoids Ant Form's error compensation; control height reserves one error line. */
|
||||
/*
|
||||
* 表单项节奏(必填 / 非必填一致):表单项无下边距,输入框下方固定预留一行报错位,
|
||||
* 报错出现 / 消失时布局不跳动。下边距为 0 同时避开 Ant Form 的报错高度补偿。
|
||||
*/
|
||||
.auth-login-page .ant-form-item,
|
||||
.auth-login-page .auth-login-required-field {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.auth-login-page .auth-login-required-field .ant-form-item-control {
|
||||
min-height: calc(var(--auth-control-height) + 24px);
|
||||
.auth-login-page .ant-form-item .ant-form-item-control {
|
||||
min-height: calc(var(--auth-control-height) + var(--auth-error-line));
|
||||
}
|
||||
.auth-login-page .ant-form-item-label {
|
||||
padding-bottom: 6px;
|
||||
/* label 与输入框间距 7px(原 10px 统一减少 3px);需高于 antd 竖排表单自带的 8px 内边距优先级 */
|
||||
.auth-login-page .ant-form .ant-form-item .ant-form-item-label,
|
||||
.auth-login-modal .ant-form .ant-form-item .ant-form-item-label {
|
||||
padding: 0 0 7px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.auth-login-page .ant-form-item-label > label {
|
||||
.auth-login-page .ant-form-item-label > label,
|
||||
.auth-login-modal .ant-form-item-label > label {
|
||||
height: auto;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
/* 报错与补充说明:12px,紧贴输入框,不额外占下边距 */
|
||||
.auth-login-page .ant-form-item-explain,
|
||||
.auth-login-page .ant-form-item-extra,
|
||||
.auth-login-modal .ant-form-item-explain,
|
||||
.auth-login-modal .ant-form-item-extra {
|
||||
min-height: 0;
|
||||
padding-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
/* 补充说明可能多行并超出预留报错位,与下一项 label 留 4px */
|
||||
.auth-login-page .ant-form-item-extra {
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.auth-login-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.auth-login-fields .ant-form-item {
|
||||
/* 与 gap 12px 叠加后字段节奏同为 24px,和其他认证表单一致 */
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.auth-login-page .auth-login-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding-top: 4px;
|
||||
/* 字段后的按钮直接落在预留报错位之下;按钮之间 8px */
|
||||
.auth-login-fields > .ant-btn + .ant-btn {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.auth-login-page .auth-login-forgot {
|
||||
height: auto;
|
||||
@@ -441,6 +451,17 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
.auth-login-page,
|
||||
.auth-login-modal {
|
||||
--auth-control-height: 36px;
|
||||
--auth-error-line: 22px;
|
||||
}
|
||||
.auth-login-page .auth-login-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
/* 协议勾选行与其后的主按钮 */
|
||||
.auth-login-page .auth-login-agree-row {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.auth-login-page .login-card-glow,
|
||||
.auth-login-page .login-card-halo,
|
||||
@@ -531,7 +552,7 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
background: var(--ui-color-border-light);
|
||||
}
|
||||
.auth-login-fields .auth-divider {
|
||||
margin-block: 4px 0;
|
||||
margin-block: 16px 4px;
|
||||
}
|
||||
.auth-login-page .auth-login-agreement {
|
||||
margin-top: 16px;
|
||||
|
||||
@@ -32,7 +32,12 @@ const context = {
|
||||
};
|
||||
const controls = await loadFrontendModule(
|
||||
new URL('../../src/components/ui/controls.jsx', import.meta.url),
|
||||
{ react: React, antd: Ant, dayjs, '../console/ConsoleContext': context },
|
||||
{
|
||||
react: { ...React, useId: () => 'generated-control-id' },
|
||||
antd: Ant,
|
||||
dayjs,
|
||||
'../console/ConsoleContext': context,
|
||||
},
|
||||
);
|
||||
const ui = await loadFrontendModule(
|
||||
new URL('../../src/components/ui/index.jsx', import.meta.url),
|
||||
@@ -82,6 +87,48 @@ test('legacy controls keep value callbacks and remote search behavior in v6', ()
|
||||
assert.equal(Object.hasOwn(select.props, 'onSearch'), false);
|
||||
});
|
||||
|
||||
test('settings secrets declare autocomplete without changing login fields', () => {
|
||||
context.useConsolePage = () => ({ page: { key: 'setting' } });
|
||||
try {
|
||||
for (const props of [{ mode: 'password' }, { type: 'password' }]) {
|
||||
assert.equal(
|
||||
controls.Input.render(props, null).props.autoComplete,
|
||||
'new-password',
|
||||
);
|
||||
assert.equal(
|
||||
controls.Input.render({ ...props, autoComplete: 'off' }, null).props
|
||||
.autoComplete,
|
||||
'off',
|
||||
);
|
||||
}
|
||||
assert.equal(controls.Input.render({}, null).props.autoComplete, 'off');
|
||||
for (const Control of [
|
||||
controls.Input,
|
||||
controls.TextArea,
|
||||
controls.InputNumber,
|
||||
]) {
|
||||
assert.equal(Control.render({}, null).props.id, 'generated-control-id');
|
||||
assert.equal(
|
||||
Control.render({ id: 'explicit-id' }, null).props.id,
|
||||
'explicit-id',
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
context.useConsolePage = () => null;
|
||||
}
|
||||
assert.equal(
|
||||
controls.Input.render({ mode: 'password' }, null).props.autoComplete,
|
||||
undefined,
|
||||
);
|
||||
assert.equal(
|
||||
controls.Input.render(
|
||||
{ type: 'password', autoComplete: 'current-password' },
|
||||
null,
|
||||
).props.autoComplete,
|
||||
'current-password',
|
||||
);
|
||||
});
|
||||
|
||||
test('card semantic styles survive the legacy adapter without losing slots', () => {
|
||||
const card = ui.Card.render(
|
||||
{
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
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 assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createServer } from 'node:http';
|
||||
import { mkdtemp, mkdir, writeFile, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { findDevService, logAddresses } from '../../scripts/dev-service.mjs';
|
||||
|
||||
test('dev discovery reuses a matching project after a stale log and rejects a different source', async (t) => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'monkey-service-test-'));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
await mkdir(path.join(root, 'src'));
|
||||
await writeFile(path.join(root, 'src/index.jsx'), 'project-entry');
|
||||
const servers = [];
|
||||
const listen = async (source) => {
|
||||
const server = createServer((req, res) => {
|
||||
res.end(
|
||||
'//# sourceMappingURL=data:application/json;base64,' +
|
||||
Buffer.from(JSON.stringify({ sourcesContent: [source] })).toString(
|
||||
'base64',
|
||||
),
|
||||
);
|
||||
});
|
||||
servers.push(server);
|
||||
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
return server.address().port;
|
||||
};
|
||||
t.after(() =>
|
||||
Promise.all(
|
||||
servers.map((server) => new Promise((resolve) => server.close(resolve))),
|
||||
),
|
||||
);
|
||||
const wrong = await listen('another-project');
|
||||
const correct = await listen('project-entry');
|
||||
await writeFile(
|
||||
path.join(root, 'dev.log'),
|
||||
'Local: http://127.0.0.1:' + wrong + '/',
|
||||
);
|
||||
assert.equal(
|
||||
await findDevService({ root, getPorts: async () => [wrong, correct] }),
|
||||
'http://127.0.0.1:' + correct + '/',
|
||||
);
|
||||
assert.equal(
|
||||
await findDevService({ root, getPorts: async () => [wrong] }),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test('logs support UTF-16LE and newest Local addresses first', () => {
|
||||
const text = 'Local: http://127.0.0.1:5174/\nLocal: http://127.0.0.1:4176/';
|
||||
const expected = ['http://127.0.0.1:4176/', 'http://127.0.0.1:5174/'];
|
||||
assert.deepEqual(logAddresses(Buffer.from(text)), expected);
|
||||
assert.deepEqual(
|
||||
logAddresses(Buffer.from('\ufeff' + text, 'utf16le')),
|
||||
expected,
|
||||
);
|
||||
});
|
||||
@@ -106,6 +106,30 @@ test('normal fields keep Ant Form automatic IDs and unnamed slots retain child I
|
||||
assert.equal(slot.props.children, child);
|
||||
});
|
||||
|
||||
test('radio group labels target an enabled input and preserve value callbacks', () => {
|
||||
const values = [];
|
||||
const item = Form.RadioGroup.render(
|
||||
{
|
||||
field: 'mode',
|
||||
label: 'Mode',
|
||||
onChange: (value) => values.push(value),
|
||||
options: [
|
||||
{ label: 'Disabled', value: 'disabled', disabled: true },
|
||||
{ label: 'Observe', value: 'observe' },
|
||||
],
|
||||
},
|
||||
null,
|
||||
);
|
||||
const control = item.props.children;
|
||||
const group = control.type.render({ ...control.props, id: 'mode' }, null);
|
||||
assert.equal(group.props.id, 'mode-group');
|
||||
assert.equal(group.props.options[1].id, 'mode');
|
||||
assert.equal(group.props.options[0].id, undefined);
|
||||
assert.equal(group.props['aria-label'], 'Mode');
|
||||
group.props.onChange({ target: { value: 'observe' } });
|
||||
assert.deepEqual(values, ['observe']);
|
||||
});
|
||||
|
||||
test('single filter labels preserve existing control IDs', () => {
|
||||
for (const id of [undefined, 'existing-input']) {
|
||||
const element = ConsoleFilterField({
|
||||
@@ -134,3 +158,88 @@ test('composite filters use an accessible group instead of labeling a container'
|
||||
assert.equal(control, children);
|
||||
}
|
||||
});
|
||||
|
||||
test('static forms rely on field subscriptions while render props receive updates', async () => {
|
||||
for (const renderProp of [false, true]) {
|
||||
let renders = 0;
|
||||
let api;
|
||||
let store = {};
|
||||
const updates = [];
|
||||
const effects = [];
|
||||
const form = {
|
||||
getFieldsValue: () => store,
|
||||
getFieldValue: (path) => store[path[0]],
|
||||
setFieldsValue: (next) => {
|
||||
store = { ...store, ...next };
|
||||
},
|
||||
resetFields: () => {
|
||||
store = {};
|
||||
},
|
||||
};
|
||||
const { Form: TestForm } = await load('../../src/components/ui/form.jsx', {
|
||||
react: {
|
||||
...React,
|
||||
useContext: () => null,
|
||||
useReducer: () => [
|
||||
0,
|
||||
() => {
|
||||
renders++;
|
||||
},
|
||||
],
|
||||
useRef: (current) => ({ current }),
|
||||
useMemo: (factory) => factory(),
|
||||
useEffect: (effect) => effects.push(effect),
|
||||
useImperativeHandle: () => {},
|
||||
},
|
||||
antd: {
|
||||
Form: Object.assign(() => null, { useForm: () => [form] }),
|
||||
Checkbox: { Group: Input },
|
||||
},
|
||||
'./controls': Object.fromEntries(
|
||||
[
|
||||
'Input',
|
||||
'TextArea',
|
||||
'InputNumber',
|
||||
'Select',
|
||||
'DatePicker',
|
||||
'TimePicker',
|
||||
'RadioGroup',
|
||||
'TagInput',
|
||||
'TreeSelect',
|
||||
'AutoComplete',
|
||||
'Upload',
|
||||
'Switch',
|
||||
].map((name) => [name, Input]),
|
||||
),
|
||||
'../console/ConsoleContext': { useConsolePage: () => null },
|
||||
'../console/ConsolePrimitives': {},
|
||||
});
|
||||
const tree = TestForm.render(
|
||||
{
|
||||
children: renderProp ? () => null : React.createElement('span'),
|
||||
values: { initial: true },
|
||||
getFormApi: (next) => {
|
||||
api = next;
|
||||
},
|
||||
onValueChange: (values) => updates.push(values),
|
||||
labelAlign: 'left',
|
||||
},
|
||||
null,
|
||||
);
|
||||
effects.forEach((effect) => effect());
|
||||
assert.equal(tree.props.children.props.labelAlign, 'start');
|
||||
assert.deepEqual(api.getValues(), { initial: true });
|
||||
api.setValue('name', 'first');
|
||||
api.setValues({ name: 'second' });
|
||||
assert.equal(api.getValue('name'), 'second');
|
||||
api.reset();
|
||||
tree.props.children.props.onValuesChange({}, { name: 'typed' });
|
||||
assert.deepEqual(updates, [
|
||||
{ initial: true, name: 'first' },
|
||||
{ initial: true, name: 'second' },
|
||||
{},
|
||||
{ name: 'typed' },
|
||||
]);
|
||||
assert.equal(renders, renderProp ? 6 : 0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -175,8 +175,13 @@ test('config isolates HTML, JUnit and traces and supports extended projects', ()
|
||||
},
|
||||
),
|
||||
);
|
||||
const base = read({}),
|
||||
ci = read({ CI: '1', PW_EXTENDED_LAYOUT: '1', PW_WORKERS: '1' });
|
||||
const base = read({ PW_TARGET: 'local-dev' }),
|
||||
ci = read({
|
||||
CI: '1',
|
||||
PW_EXTENDED_LAYOUT: '1',
|
||||
PW_WORKERS: '1',
|
||||
PW_TARGET: 'local-dev',
|
||||
});
|
||||
assert.equal(base.projects.length, 2);
|
||||
assert.equal(ci.projects.length, 8);
|
||||
assert.equal(base.use.headless, false);
|
||||
@@ -192,6 +197,11 @@ test('config isolates HTML, JUnit and traces and supports extended projects', ()
|
||||
);
|
||||
assert.ok(base.use.launchOptions.args.includes('--hide-scrollbars'));
|
||||
assert.ok(base.webServer.command.includes('--strictPort'));
|
||||
assert.equal(
|
||||
read({ PW_TARGET: 'remote', PW_BASE_URL: 'http://127.0.0.1:5174/' })
|
||||
.webServer,
|
||||
undefined,
|
||||
);
|
||||
assert.deepEqual(read({}, ['--list']).reporter, [['list']]);
|
||||
assert.throws(
|
||||
() => read({ CI: '1' }, ['--headed']),
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
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 test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { revealActiveSidebarItem } from '../../src/helpers/sidebarScroll.js';
|
||||
|
||||
function container(top, bottom, visible = true) {
|
||||
return {
|
||||
scrollHeight: 1200,
|
||||
clientHeight: 500,
|
||||
clientTop: 2,
|
||||
scrollTop: 100,
|
||||
getBoundingClientRect: () => ({ top: 100 }),
|
||||
querySelector: () => ({
|
||||
getClientRects: () => (visible ? [{}] : []),
|
||||
getBoundingClientRect: () => ({ top, bottom }),
|
||||
}),
|
||||
};
|
||||
}
|
||||
test('reveals an item below the sidebar viewport with the minimum scroll', () => {
|
||||
const node = container(650, 692);
|
||||
revealActiveSidebarItem(node);
|
||||
assert.equal(node.scrollTop, 190);
|
||||
});
|
||||
test('reveals an item above the sidebar viewport with the minimum scroll', () => {
|
||||
const node = container(50, 92);
|
||||
revealActiveSidebarItem(node);
|
||||
assert.equal(node.scrollTop, 48);
|
||||
});
|
||||
test('preserves manual scrolling when the selected menu is already fully visible', () => {
|
||||
const node = container(120, 162);
|
||||
revealActiveSidebarItem(node);
|
||||
assert.equal(node.scrollTop, 100);
|
||||
});
|
||||
test('does not force open a hidden group or scroll a menu without overflow', () => {
|
||||
const hidden = container(650, 692, false);
|
||||
revealActiveSidebarItem(hidden);
|
||||
assert.equal(hidden.scrollTop, 100);
|
||||
const short = container(650, 692);
|
||||
short.scrollHeight = 500;
|
||||
revealActiveSidebarItem(short);
|
||||
assert.equal(short.scrollTop, 100);
|
||||
revealActiveSidebarItem(null);
|
||||
});
|
||||
test('handles pending or unavailable active items without changing scroll', () => {
|
||||
const node = container(650, 692);
|
||||
node.querySelector = () => null;
|
||||
revealActiveSidebarItem(node);
|
||||
assert.equal(node.scrollTop, 100);
|
||||
});
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtemp, readFile, writeFile, rm } from 'node:fs/promises';
|
||||
import { mkdir, mkdtemp, readFile, writeFile, rm } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { createServer as createHttpServer } from 'node:http';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -35,10 +35,11 @@ async function fixture(run) {
|
||||
path.join(dir, 'vite.config.js'),
|
||||
await readFile(path.join(root, 'vite.config.js')),
|
||||
);
|
||||
// vite.config.js 引用的旧内核 @layer 兜底插件(b7bac50b5)需同目录存在
|
||||
// 保留 Vite 配置引用的构建插件目录结构。
|
||||
await mkdir(path.join(dir, 'scripts/vite'), { recursive: true });
|
||||
await writeFile(
|
||||
path.join(dir, 'vite-plugin-legacy-css-layers.js'),
|
||||
await readFile(path.join(root, 'vite-plugin-legacy-css-layers.js')),
|
||||
path.join(dir, 'scripts/vite/legacy-css-layers.js'),
|
||||
await readFile(path.join(root, 'scripts/vite/legacy-css-layers.js')),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(dir, '.env.development'),
|
||||
@@ -121,7 +122,10 @@ test('checked-in defaults preserve same-origin behavior and disable analytics',
|
||||
for (const mode of ['development', 'production']) {
|
||||
const env = loadEnv(mode, root);
|
||||
assert.equal(env.VITE_REACT_APP_SERVER_URL, '');
|
||||
assert.equal(env.VITE_CLOUD_BRAIN_UI_ENABLED, 'false');
|
||||
assert.equal(
|
||||
env.VITE_CLOUD_BRAIN_UI_ENABLED,
|
||||
mode === 'development' ? 'true' : 'false',
|
||||
);
|
||||
assert.equal(analytics(await config(root, mode)), html);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ import vm from 'node:vm';
|
||||
|
||||
import legacyCssLayers, {
|
||||
flattenCssLayers,
|
||||
} from '../vite-plugin-legacy-css-layers.js';
|
||||
} from '../scripts/vite/legacy-css-layers.js';
|
||||
|
||||
// ---------- flattenCssLayers ----------
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"installCommand": "npm ci",
|
||||
"buildCommand": "npm run build",
|
||||
"github": {
|
||||
"silent": true
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import path from 'node:path';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig, loadEnv, transformWithEsbuild } from 'vite';
|
||||
import legacyCssLayers from './vite-plugin-legacy-css-layers.js';
|
||||
import legacyCssLayers from './scripts/vite/legacy-css-layers.js';
|
||||
|
||||
/**
|
||||
* 未配置代理变量时保留原有联调地址,兼容自定义 mode。
|
||||
|
||||
Reference in New Issue
Block a user