Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a0d9e15cd | |||
| 04cf3324a3 | |||
| a811793825 | |||
| 9576ba674a | |||
| 870b51d054 | |||
| ed693a450a | |||
| 49515f4ef3 | |||
| f896495048 | |||
| a532b860c8 | |||
| dd4da99f1d | |||
| 437a0345e8 | |||
| 9b9e98a6b4 | |||
| 574b6efa1e | |||
| 45979985fe | |||
| 4cd894b7ae | |||
| 09e1d7cf7f | |||
| 2ae4a625b5 | |||
| 031e22ee49 | |||
| ef67244aea | |||
| 436195a229 | |||
| 46aaa44a77 | |||
| ab79dfd357 | |||
| 461f0c577a | |||
| 72e7fe1072 | |||
| d90319f43a | |||
| 9145ed5834 | |||
| 94ac3db60c | |||
| 2aa9d73325 | |||
| 605cff1d58 | |||
| 04cc45bbb7 | |||
| 7908ed53a3 | |||
| 9b6eb1c7c4 | |||
| f88a404fab | |||
| 074c4422f9 | |||
| f8c451b7b8 | |||
| ff93660768 | |||
| b6a859bcad | |||
| 5610fdc273 | |||
| db3dba1e96 | |||
| 737c353d84 | |||
| d878f0db21 | |||
| 67969a041d | |||
| ef3f405190 | |||
| e154b31b99 | |||
| 3dc2624e00 | |||
| 822d26c0dd | |||
| 923e27de08 | |||
| 19fd943660 | |||
| 28b71237df | |||
| 0fe6151153 | |||
| 7b7616b3fa | |||
| 7802020982 | |||
| 2889fee300 | |||
| cb74c2b310 | |||
| d40d88d292 | |||
| 67719540ba | |||
| c604a8ff9c | |||
| 4ffe9dadbf | |||
| ed9820e6a6 | |||
| 5463a0c772 | |||
| 85214b308a | |||
| cfb9f85c90 | |||
| 635351f539 | |||
| 5c0849e82b | |||
| 54b3e0cc21 | |||
| d3404996fd | |||
| b0860467d5 | |||
| a075732cb4 | |||
| fc09e2307a | |||
| 43048626a6 | |||
| 15192c433b | |||
| 1fd4e084b6 | |||
| 29bf03b770 | |||
| 0ac883ea62 | |||
| 87d2c2894b | |||
| 399a3d7907 | |||
| d14a517fdc | |||
| 2e6fe73939 | |||
| b8659d0a9a | |||
| f9dd9297b8 | |||
| 3ffba4ac6c | |||
| 7b9cc0ba40 | |||
| 26c9b367a5 | |||
| 5f48bfda12 | |||
| 67d08b69c2 | |||
| ae190663f0 | |||
| de1c1de1ab | |||
| edb74f1223 |
+3
-4
@@ -4,6 +4,8 @@
|
||||
node_modules/
|
||||
/.pnp
|
||||
.pnp.js
|
||||
bun.lock
|
||||
bun.lockb
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
@@ -14,10 +16,6 @@ node_modules/
|
||||
/e2e/
|
||||
/.e2e/
|
||||
/tests/
|
||||
*.test.*
|
||||
*.spec.*
|
||||
# Maintained unit regressions are source; local acceptance suites stay ignored.
|
||||
!test/unit/*.test.js
|
||||
/playwright/.auth/
|
||||
/playwright-report/
|
||||
/test-results/
|
||||
@@ -29,6 +27,7 @@ node_modules/
|
||||
/build
|
||||
/dist/
|
||||
/dist-ssr/
|
||||
vercel.json
|
||||
|
||||
# tool caches and temporary files
|
||||
__pycache__/
|
||||
|
||||
@@ -60,7 +60,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
- **样式**:不新增 ConfigProvider、主题状态或存储 key;颜色只来自 token 或页面变量,JSX 不写十六进制,不用全局 `!important`。
|
||||
- **图标与依赖**:按钮图标从 `src/components/common/icons/ActionIcons.js` 导入,装饰图标用 `lucide-react`;禁止引入 Semi、Radix UI、Floating UI、`@lobehub/*`、MUI、Chakra、Headless UI、leva、antd-style、react-layout-kit。
|
||||
- **请求**:只用 `API`,参数用 `params`,先判 `success`;分页 `p` 从 1 开始、`page_size` ≤ 100;`catch` 不重复提示 AxiosError;`finally` 回收 loading。
|
||||
- **命名与文件**:状态用 `items`、`total`、`page`、`pageSize`、`loading`、`submitting`、`editingRecord`、`drawerOpen`;新 `.js` / `.jsx` 带 AGPL 许可证头;入库单测放 `test/unit/`;新文案用 `t('中文原文')` 并补齐 9 个语言包。
|
||||
- **命名与文件**:状态用 `items`、`total`、`page`、`pageSize`、`loading`、`submitting`、`editingRecord`、`drawerOpen`;不重复添加通用长版权文件头;入库单测放 `test/unit/`;新文案用 `t('中文原文')` 并补齐 9 个语言包。
|
||||
- **可访问性**:交互元素可键盘操作且焦点可见;纯图标按钮加 `aria-label`;状态不只靠颜色表达;动效遵守 `prefers-reduced-motion`。
|
||||
|
||||
## 5. 目录规则
|
||||
@@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
|
||||
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。
|
||||
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 结果替代完整验收。
|
||||
3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851 与 360×800(最小必测视口);正常、空数据、失败、校验、重复提交;只读验收的非 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`。
|
||||
6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。
|
||||
@@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
|
||||
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
|
||||
|
||||
> 规范版本:v3.6 · 更新:2026-11-19
|
||||
> 规范版本:v3.8 · 更新:2026-11-24
|
||||
|
||||
## 10. 工具差异(本节允许不同)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
- **样式**:不新增 ConfigProvider、主题状态或存储 key;颜色只来自 token 或页面变量,JSX 不写十六进制,不用全局 `!important`。
|
||||
- **图标与依赖**:按钮图标从 `src/components/common/icons/ActionIcons.js` 导入,装饰图标用 `lucide-react`;禁止引入 Semi、Radix UI、Floating UI、`@lobehub/*`、MUI、Chakra、Headless UI、leva、antd-style、react-layout-kit。
|
||||
- **请求**:只用 `API`,参数用 `params`,先判 `success`;分页 `p` 从 1 开始、`page_size` ≤ 100;`catch` 不重复提示 AxiosError;`finally` 回收 loading。
|
||||
- **命名与文件**:状态用 `items`、`total`、`page`、`pageSize`、`loading`、`submitting`、`editingRecord`、`drawerOpen`;新 `.js` / `.jsx` 带 AGPL 许可证头;入库单测放 `test/unit/`;新文案用 `t('中文原文')` 并补齐 9 个语言包。
|
||||
- **命名与文件**:状态用 `items`、`total`、`page`、`pageSize`、`loading`、`submitting`、`editingRecord`、`drawerOpen`;不重复添加通用长版权文件头;入库单测放 `test/unit/`;新文案用 `t('中文原文')` 并补齐 9 个语言包。
|
||||
- **可访问性**:交互元素可键盘操作且焦点可见;纯图标按钮加 `aria-label`;状态不只靠颜色表达;动效遵守 `prefers-reduced-motion`。
|
||||
|
||||
## 5. 目录规则
|
||||
@@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
|
||||
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。
|
||||
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 结果替代完整验收。
|
||||
3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851 与 360×800(最小必测视口);正常、空数据、失败、校验、重复提交;只读验收的非 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`。
|
||||
6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。
|
||||
@@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
|
||||
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
|
||||
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
|
||||
|
||||
> 规范版本:v3.6 · 更新:2026-11-19
|
||||
> 规范版本:v3.8 · 更新:2026-11-24
|
||||
|
||||
## 10. 工具差异(本节允许不同)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ 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 安装与构建命令。
|
||||
仓库仅维护 `package-lock.json`,并忽略 `bun.lock` / `bun.lockb`。本地与 CI 使用 `npm ci` 安装依赖、`npm run dev` 启动开发服务、`npm run build` 构建。
|
||||
|
||||
```bash
|
||||
git clone --branch weiyuan https://git.weytoken.com/qiubs/monkey-ai-web.git
|
||||
@@ -35,7 +35,7 @@ npm ci
|
||||
npm run dev
|
||||
```
|
||||
|
||||
开发服务监听 `0.0.0.0`,默认端口 5174,被占用时 Vite 自动顺延,以终端输出的 `Local:` 地址为准。需要供验收脚本读取地址时,把输出重定向到 `dev.log`(如 `nohup npm run dev > dev.log 2>&1 &`)。
|
||||
开发服务默认监听 `0.0.0.0`,端口为 5174,支持访问本机地址和局域网 IP。端口被占用时 Vite 自动顺延,以终端输出的 `Local:` 和 `Network:` 地址为准。开发服务禁用项目未使用的 `import.meta.glob` 转换,普通动态导入和热更新照常使用。需要供验收脚本读取地址时,把输出重定向到 `dev.log`(如 `nohup npm run dev > dev.log 2>&1 &`)。
|
||||
|
||||
| 命令 | 模式 | 自动加载的配置文件 |
|
||||
| ----------------- | ----------- | ---------------------------------- |
|
||||
@@ -135,7 +135,6 @@ monkey-ai-web/
|
||||
- **路由与权限**:在 `src/App.jsx` 注册路由,用 `PrivateRoute`、`AdminRoute`(role ≥ 10)、`RootRoute`(role ≥ 100)守卫;企业中心子路由在 `src/pages/Organization/index.jsx`。部分模块的可见性来自 `/api/status`,不能只靠隐藏菜单控制权限。
|
||||
- **UI**:通用组件用 Ant Design;存量页面经 `src/components/ui` 适配层保留原契约;主题只由 `UiThemeProvider` 提供,不新增 ConfigProvider;按钮图标从 `src/components/common/icons/ActionIcons.js` 导入。页面改动需检查浅色、深色与窄屏。
|
||||
- **国际化**:文案写 `t('中文原文')`,新 key 补齐 `src/i18n/locales/` 下 9 个语言包;运行时开放语言以 `src/i18n/catalog.js` 为准(简中、繁中、英、日、韩、越、泰),`fr.json`、`ru.json` 尚未登记。
|
||||
- **文件头**:每个 `.js` / `.jsx` 顶部须带 AGPL 许可证注释(ESLint 强制),参考相邻文件。
|
||||
|
||||
## 6. 常用命令与提交检查
|
||||
|
||||
@@ -143,11 +142,12 @@ monkey-ai-web/
|
||||
| --- | --- |
|
||||
| `npm run dev` | 启动开发服务 |
|
||||
| `npm run build` | 生产构建,输出 `dist/` |
|
||||
| `npm run verify:build -- <产物目录> --startup` | 校验静态入口、首屏 JS gzip 预算和按需加载边界;产物须用 `--manifest` 生成 |
|
||||
| `npm run preview` | 本地预览构建结果(默认端口 4173) |
|
||||
| `npm test -- --test-concurrency=1` | 串行运行单测(扫描 `src/`、`tests/`、`test/unit/`) |
|
||||
| `npm test -- --test-concurrency=1` | 串行运行单测(扫描 `src/`、`tests/`、`test/unit/`;新增共享单测放 `test/unit/`) |
|
||||
| `npm run eslint` / `npm run eslint:fix` | ESLint 检查(零警告门禁)/ 自动修复 |
|
||||
| `npm run lint` / `npm run lint:fix` | Prettier 检查 / 全仓格式化 |
|
||||
| `npm run check:ui` | UI 依赖、完整 lock 图与品牌图标资产 hash 审计 |
|
||||
| `npm run check:ui` | 审计应用源码、脚本、单测和根目录 JS 配置中的旧 UI 库引用,以及依赖声明、锁文件和品牌图标资产 SHA-256 |
|
||||
| `npm run check` | 依次执行 `check:ui`、ESLint、单测与生产构建,任一步失败即停止 |
|
||||
| `npm run vendor:icons` | 重新生成品牌图标资产 |
|
||||
| `npm run test:e2e` / `test:e2e:headed` / `test:e2e:report` | Playwright 验收 / 有头运行 / 查看报告 |
|
||||
@@ -171,11 +171,12 @@ node --env-file=.env.playwright.local e2e/auth-login/run.mjs
|
||||
|
||||
测试先通过项目目录、启动日志与监听进程查找并验证已有开发服务;历史日志中的失效地址不能作为新启服务的依据。仅确认本项目服务不存在时才启动,结束时只清理本次启动的进程。项目 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 默认运行桌面及两个移动项目:`chrome-mobile`(最小视口 360×800)与 `chrome-mobile-393`(393×851)。通用用例继承项目视口,专项用例可覆盖视口测试指定场景。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-工具)。
|
||||
|
||||
| 命令 / 参数 | 用途与默认值 |
|
||||
| --- | --- |
|
||||
| `npm run test:e2e:headless` | 无头运行;本地默认有头离屏,CI 强制无头 |
|
||||
| `npm run test:e2e -- --project=chrome-mobile` | 运行默认配置中的 360×800 手机项目。专项 UI 验收也须覆盖此最小视口 |
|
||||
| `npm run test:e2e:extended` | 全部 8 视口;也可设置 `PW_EXTENDED_LAYOUT=1` |
|
||||
| `npm run test:e2e:dist` | 验证已有静态产物并严格启动 4176;不自动构建 |
|
||||
| `npm run test:acceptance -- <参数>` | 串行单测、临时目录构建、产物校验、强制 local-dist/4176 测试 |
|
||||
@@ -191,6 +192,9 @@ Trace、失败截图、CI JUnit 在 `test-results/<runId>/`,HTML 在 `playwrig
|
||||
|
||||
## 7. 构建与部署
|
||||
|
||||
- **首屏分包**:React 运行时独立缓存,公告和协议预览保留在按需 chunk;首页仅在收到非空 Markdown 时下载解析器。首屏启动 JS 预算为 820 KiB gzip,不含路由按需包和 CSS;验收构建使用 `npm run build -- --manifest --outDir <临时目录>`,再执行 `npm run verify:build -- <临时目录> --startup`。
|
||||
- **开发预热**:只预热应用入口、布局和路由,不预热所有页面或禁用依赖发现。没有全量 `vendor` 分组,也没有将图表、文档等浏览器依赖外置。
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm run build
|
||||
@@ -199,19 +203,19 @@ npm run preview
|
||||
|
||||
将 `dist/` 作为静态站点发布,部署环境需处理:
|
||||
|
||||
- **共享测试环境**:局域网沿用现有域名或 IP 与端口。由网关提供构建后的静态文件和 SPA 路由回退,并继续转发测试后端接口。Vite 的源码转换与 HMR 只用于独立的开发服务。自动发布时,先完成构建与检查,再切换站点目录,避免访问到构建中的文件。
|
||||
- **路由回退**:使用 BrowserRouter,直接访问 `/org/...` 等页面时静态服务器需回退到 `index.html`,否则刷新返回 404。
|
||||
- **接口转发**:生产环境配置反向代理或独立后端地址;Vite 开发代理不会进入产物,`preview` 不能代替生产网关。
|
||||
- **流式与长连接**:SSE 接口需关闭响应缓冲并设置合理超时;WebSocket 需配置连接升级。
|
||||
- **缓存**:`index.html` 应及时更新,带哈希的静态资源可长缓存;后端地址写在产物中,切换需重新构建并发布。
|
||||
- **部署路径**:当前按域名根路径部署;部署到子目录需检查 Vite `base`、路由与静态资源地址。
|
||||
|
||||
仓库中的 `vercel.json` 只关闭了 GitHub 通知,未配置路由回退或代理,不能作为完整部署配置。
|
||||
|
||||
## 8. 常见问题
|
||||
|
||||
| 现象 | 优先检查 |
|
||||
| --- | --- |
|
||||
| 页面能打开但提示状态或接口加载失败 | 后端是否可用;Network 中 `/api/status` 的目标地址与响应;代理配置 |
|
||||
| 共享测试站出现 Vite 红色遮罩 | 检查站点网关的前端上游。共享测试站应由网关提供构建后的静态文件,Vite 开发服务仅用于联调。开发服务对 `.npmrc` 请求直接返回 404。 |
|
||||
| 登录后又回到登录页 | `/api/user/self` 响应、Cookie 是否发送、跨域凭证策略、账号状态 |
|
||||
| 企业数据为空或串到其他企业 | 当前组织选择、`current_org_id` 与请求头 `X-Org-Id` |
|
||||
| 修改环境变量后无变化 | 是否重启开发服务或重新构建发布;HTML 与静态资源缓存 |
|
||||
|
||||
+691
-1
@@ -1,6 +1,6 @@
|
||||
# 变更记录(CHANGELOG)
|
||||
|
||||
> 状态:有效(持续追加) · 更新:2026-11-19 · 版本:v3.6
|
||||
> 状态:有效(持续追加) · 更新:2026-11-26 · 版本:v3.14
|
||||
|
||||
对现状仍有影响的功能与修复记录,按日期倒序。改造、迁移、优化等一次性过程不在此记录。
|
||||
|
||||
@@ -8,8 +8,698 @@
|
||||
|
||||
**记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `git revert <提交>`,提交含多项改动时按文件还原(`git checkout <提交>^ -- <文件>`),不整仓 reset。本文不作为规则依据。
|
||||
|
||||
## 2026-11-26
|
||||
|
||||
### 统一智能路由的判定模型文案
|
||||
|
||||
- **范围** 个人、平台和企业的判定明细、试路由、集合、授权和管理设置。
|
||||
- **变更** 判定来源显示「智能路由」,合规闸门显示「已调用模型」或对应原因。集合开关说明使用判定模型所需的平台设置和出境授权。
|
||||
- **影响** 历史判定记录按新文案展示,新增管理日志使用「判定模型」名称。
|
||||
- **回滚** 恢复对应的状态标签、语言包与后端提示文案。
|
||||
- **关联** [智能路由判定模型文案调整方案](../../docs/04-渠道与路由/22-智能路由判定模型文案调整方案.md)。
|
||||
|
||||
### 智能路由支持 Jev 专用出站代理
|
||||
|
||||
- **范围** 智能路由全局设置中的 Jev 判定请求。
|
||||
- **变更** 超级管理员可以配置、测试和清除 HTTP、HTTPS 或 SOCKS5 系列代理。
|
||||
- **影响** 测试展示 Google 连通性、耗时、出口 IP 和国家或地区。
|
||||
- **回滚** 清除代理即可恢复 Jev 原有的服务器网络设置。
|
||||
- **关联** 智能路由 Jev 设置和管理接口。
|
||||
|
||||
### 修复 · 稳定推广分享弹窗高度
|
||||
|
||||
- **范围**:顶栏「推广分享」弹窗的链接分享和海报分享页签。
|
||||
- **变更**:两个页签共用等高的内容区,并按视口限制高度。邀请卡片和海报预览共用列宽、圆角和最小高度。
|
||||
- **影响**:切换页签时弹窗位置保持稳定,两张卡片对齐,内容超出可用高度时在页签内滚动。
|
||||
- **回滚**:恢复推广分享弹窗原有的页签高度、滚动和预览卡片样式。
|
||||
- **关联**:`src/components/promotion/promotion-poster.css`。
|
||||
|
||||
### 清理 · 移除 Bun 锁文件、Vercel 配置和根目录声明文档
|
||||
|
||||
- **范围**:依赖锁文件、Vercel 配置、根目录声明文档和 Git 忽略规则。
|
||||
- **变更**:移除 `bun.lock`、`vercel.json` 和 `NOTICE.md`,清理现行文档中的对应引用,忽略 `bun.lock`、`bun.lockb` 和 `vercel.json`。
|
||||
- **影响**:npm 继续使用 `package-lock.json`。Vercel Git 部署改由 Vercel 项目设置提供安装和构建命令。
|
||||
- **回滚**:还原本次文档和忽略规则改动,并从变更前的 Git 版本恢复三个文件。
|
||||
- **关联**:`.gitignore`、`README.md`、`docs/standards/DEV_STANDARDS.md`。
|
||||
|
||||
### 调整 · 暂时隐藏推广分享中的邀请奖励规则入口
|
||||
|
||||
- **范围**:顶栏「推广 → 推广分享」弹窗。
|
||||
- **变更**:暂停渲染弹窗底部「查看邀请奖励规则」入口。
|
||||
- **影响**:用户仍可通过弹窗分享邀请链接、邀请码和海报。
|
||||
- **回滚**:将 `SHOW_INVITATION_REWARD_RULES` 设为 `true`。
|
||||
- **关联**:`src/components/promotion/PromotionPosterModal.jsx`。
|
||||
|
||||
## 2026-11-25
|
||||
|
||||
### 优化 · 成员排行按需加载并固定翻页结果
|
||||
|
||||
- **范围**:企业中心「消耗明细 → 成员排行」。
|
||||
- **变更**:打开排行页签时按已应用的筛选查询,翻页和更改每页人数时沿用同一快照。刷新或重新筛选会获取当前榜单。
|
||||
- **影响**:查看明细日志时省去排行请求。榜单更新期间翻页仍显示同一时点的名次;快照过期后自动回到第 1 页。
|
||||
- **回滚**:恢复前端原有的排行加载与分页逻辑;分页响应兼容未传快照的客户端。
|
||||
- **关联**:`src/pages/Organization/OrgLogs.jsx`、`src/hooks/org/useOrgData.js`、`docs/ui/ORG_CENTER_SPEC.md`。
|
||||
|
||||
### 优化 · 企业消耗明细成员排行支持服务端分页
|
||||
|
||||
- **范围**:企业中心「消耗明细 → 成员排行」及 `GET /api/org/logs/ranking`。
|
||||
- **变更**:在权限和筛选范围内按成员汇总,消耗额度由高到低,同额按成员 ID 升序,返回当前页和总人数。
|
||||
- **影响**:可以翻到第 50 名以后,跨页名次连续,前三名沿用主题强调色。
|
||||
- **回滚**:先回退前端排行分页,再回退后端接口。旧前端仍可使用原有的 `limit` 查询。
|
||||
- **关联**:`src/pages/Organization/OrgLogs.jsx`、`src/hooks/org/useOrgData.js`。
|
||||
|
||||
### 同步 · 三中心列表与本地权限适配
|
||||
|
||||
- **范围**:合入纯前端仓库 `weiyuan` 从 `574b6efa1` 至 `ed693a450` 的增量。
|
||||
- **变更**:用户列表的自动搜索同时传递状态筛选和取消信号,企业日志在后续页重新筛选时同步刷新总数。企业内容页按操作权限显示创建、上传、分发与删除入口。兑换码按后端的查询、创建、编辑和删除权限显示操作,启停沿用编辑权限。个人密钥编辑表单在打开时加载模型、分组和技能选项。
|
||||
- **影响**:角色分配、额度调整、模型映射、企业代理会话以及日志查询、排行、导出的独立权限继续使用全栈接口契约。
|
||||
- **回滚**:按对应页面和共享依赖回退本次前端增量。
|
||||
- **关联**:`src/components/table/users/`、`src/hooks/org/useOrgData.js`、`src/pages/Organization/`。
|
||||
|
||||
### 优化 · 消费记录固定首尾列
|
||||
|
||||
- **范围**:用户中心 `/user-center/usage-record` 的消费记录调用明细。
|
||||
- **变更**:时间列固定在左侧,操作列显示时固定在右侧。
|
||||
- **影响**:横向滚动中间字段时,仍可读取时间并打开账单详情。
|
||||
- **回滚**:还原消费记录时间列和操作列的固定配置。
|
||||
- **关联**:`src/components/table/usage-logs/`、`docs/ui/USER_CENTER_SPEC.md`。
|
||||
|
||||
### 优化 · 兑换码编辑侧栏窗
|
||||
|
||||
- **范围**:控制台 `/console/redemption` 编辑入口。
|
||||
- **变更**:编辑兑换码信息与添加兑换码共用右侧侧栏窗。
|
||||
- **影响**:两种表单使用相同的宽度、关闭方式和页脚,编辑继续回填当前记录。
|
||||
- **回滚**:还原兑换码编辑表单的独立弹窗。
|
||||
- **关联**:`src/components/table/redemptions/modals/EditRedemptionModal.jsx`、`docs/ui/CONSOLE_SPEC.md`。
|
||||
|
||||
### 优化 · 兑换码列表行内操作
|
||||
|
||||
- **范围**:控制台 `/console/redemption` 表格操作列。
|
||||
- **变更**:「查看详情」入口简化为「查看」,启用、禁用和删除从更多菜单移至行内,按钮单行排列并随操作列固定在右侧。
|
||||
- **影响**:桌面与窄屏均可直接使用行操作,启停权限和删除确认沿用原规则。
|
||||
- **回滚**:还原兑换码操作列按钮、宽度和换行样式。
|
||||
- **关联**:`src/components/table/redemptions/`、`docs/ui/CONSOLE_SPEC.md`。
|
||||
|
||||
### 优化 · 兑换码列表与表单
|
||||
|
||||
- **范围**:控制台 `/console/redemption` 与 `/console/channel` 的表头。
|
||||
- **变更**:沿用渠道列表的表格与行内操作样式,提升两页表头文字对比度,固定兑换码操作列,新增同页详情弹窗,统一添加侧栏窗与编辑弹窗的表单及页脚。
|
||||
- **影响**:可在详情弹窗查看与复制原码,批量复制随选中态启用,清除失效操作保留二次确认。
|
||||
- **回滚**:还原兑换码列表、表单、详情弹窗和对应样式与文案。
|
||||
- **关联**:`src/components/table/redemptions/`、`docs/ui/CONSOLE_SPEC.md`。
|
||||
|
||||
### 修复 · 企业成员排行的主题色与跨页名次
|
||||
|
||||
- **范围**:企业中心 `/org/logs` 的成员排行。
|
||||
- **变更**:前三名使用主题派生的三档底色,其他名次使用中性色;在分页前生成全表名次。
|
||||
- **影响**:切换系统主色或明暗模式时,排名徽章同步更新;翻页时继续显示全表名次。
|
||||
- **回滚**:还原排名列的名次生成和徽章配色。
|
||||
- **关联**:`src/pages/Organization/OrgLogs.jsx`、`src/styles/org-center.css`、`docs/ui/ORG_CENTER_SPEC.md`。
|
||||
|
||||
### 修复 · Vite 读取 npm 配置文件触发错误遮罩
|
||||
|
||||
- **范围**:Vite 开发服务的文件请求处理。
|
||||
- **变更**:在资源转换前拦截 `.npmrc` 请求并返回 404,同时将 `.npmrc` 加入文件访问拒绝列表。
|
||||
- **影响**:npm 配置文件请求不会启动资源转换或触发全站热更新错误遮罩。应用使用的文本资源导入继续由 Vite 转换。
|
||||
- **回滚**:还原 Vite 的 npm 配置文件拦截和对应访问规则。
|
||||
- **关联**:`vite.config.js`、`README.md`。
|
||||
|
||||
### 修复 · 控制台数据看板持续加载
|
||||
|
||||
- **范围**:控制台 `/console/analytics` 运营看板、创作作品详情抽屉及公共 API 的只读请求。
|
||||
- **变更**:看板首轮查询取消后可重新发起,作品详情的当前副作用接管加载状态。只读请求默认 60 秒超时,运营看板核心请求设置为 30 秒。
|
||||
- **影响**:两处首次加载可正常结束。只读接口持续无响应时返回超时错误,页面可按原有失败流程结束加载。
|
||||
- **回滚**:还原运营看板和作品详情的加载处理,以及公共 API 的只读超时。
|
||||
- **关联**:`src/hooks/analytics/useAnalyticsData.js`、`src/components/creation/WorkFeed/WorkDetailDrawer.jsx`、`src/helpers/api.js`。
|
||||
|
||||
## 2026-11-24
|
||||
|
||||
### 功能 · 计费详情弹窗增加费用明细与计算公式
|
||||
|
||||
- **范围**:使用记录 `/user-center/usage-record` 与控制台使用日志的「详情」弹窗(共用 `UsageLogsTable.jsx`)。
|
||||
- **变更**:新增「费用明细」:公式行(总金额 = 各计费项小计相加)与分项表(计费项、用量、单价、小计、合计),每行标注单价由哪些倍率构成;用量从「成本因子」移到分项表,成本因子只留倍率等补充信息。拆分逻辑在 `billingBreakdown.js`,口径对照后端结算公式;各行按展示精度四舍五入后与合计的差额归入「舍入与其他调整」一项,保证界面上的数字逐项相加恰好等于合计(`reconcileDisplayAmounts`);分项之和与实扣相差超过 1 个额度单位时视为口径未覆盖(如任务按时长 / 分辨率系数计价),token 兜底预扣与差额调整行同样不拆分,这些情况都不显示费用明细。已在费用明细里逐行列出的用量不再出现在成本因子区;按次 / 按秒计费的明细里没有 token 行,token 用量仍留在成本因子区。弹窗里的倍率由保留 3 位小数改为最多 6 位。超级管理员多一个「超管指标」区块,三项:官方价金额(1 倍率)= 同样用量按「模型原厂价格」计价 ÷ 原厂价登记汇率,整体倍率 = 实扣 ÷ 官方价金额,实际折扣 = 整体倍率 ÷ 登记汇率(汇率在 系统设置-倍率设置-模型原厂价格 页签顶部配置,option `OfficialPriceExchangeRate`,默认 7,仅超级管理员可读写),由后端只在超级管理员的日志响应里附加(`other.root_billing`,不落库),普通管理员与用户的接口不返回;未登记原厂价、或含音频 / 图片输入 / 工具调用等原厂价格表没有价目的计费项时不显示;按次计费但实扣含任务系数、出图接口、token 兜底预扣与差额调整行同样不显示。
|
||||
- **影响**:前端只改展示,不改请求。同批后端改动会改变扣费:Claude 联网搜索开始按次计费(此前算了价但未扣,流式与原生 Claude 格式此前也不记录次数;只对 Claude 模型收,其他走 Anthropic 协议的渠道即使上报搜索次数也不收;体验中心 / Playground 对 Claude 模型开启原生联网搜索时同样会多出这笔费用);扣费取整统一为四舍五入到 1 个额度单位(`common.QuotaFromFloat`,取整前先消除浮点噪声):Claude 原生结算、按次 / 按秒 / 任务类计费此前是向下取整,现在小数部分 ≥ 0.5 的每笔多 1 个额度单位(如 0.3 × 1.5 × 500000 由 224999 变为 225000);OpenAI 兼容路径原本就是四舍五入,不变。Claude 原生与音频 / 实时语音路径有费用时至少扣 1 个额度单位(此前不足 1 个单位扣 0)。邀请返佣仍向下取整(`common.QuotaFloorFromFloat`,只消除浮点噪声),保证返佣不超过「比例 × 消费」;token 预扣估算是准入闸门、不是最终扣费,保持原样。发布窗口内已提交未结算的视频任务,预扣(旧版向下取整)与结算(新版四舍五入)可能差 1 个额度单位:结算时重算结果与预扣只差 1 个单位的按预扣结清(`common.SettleRecomputedQuota`),不补扣不退款。缺少计费信息的日志不显示费用明细,弹窗与原来一致。后端结算公式变更时须同步 `billingBreakdown.js`。本条未做浏览器走查。
|
||||
- **回滚**:`git revert` 对应提交;`billingBreakdown.js` 与其单测为新增文件。
|
||||
- **关联**:`src/components/table/usage-logs/{UsageLogsTable.jsx,billingBreakdown.js,UsageLogs.css}`、`src/pages/Setting/Ratio/OfficialPriceExchangeRateSetting.jsx`、`test/unit/{usage-billing-breakdown,usage-billing-detail-render,official-price-exchange-rate-setting}.test.js`、后端 `common/quota.go`、`relay/compatible_handler.go`、`relay/channel/claude/relay-claude.go`、`service/quota.go`、`service/log_overall_ratio.go`、`controller/log.go`。
|
||||
|
||||
### 修复 · 企业登录接入人机验证
|
||||
|
||||
- **范围**:企业登录页 `/org/login`(企业标识登录与免企业标识直登)。
|
||||
- **变更**:系统开启 Turnstile 时,企业登录页显示人机验证,提交 `/api/org/login`、`/api/org/login/direct` 时带上 `turnstile` 参数;后端两条接口同步挂上 `TurnstileCheck`(未开启时自动放行)。
|
||||
- **影响**:未开启 Turnstile 的部署无变化。开启后,企业成员在通过人机验证前不能提交登录;两步验证、多企业选择两步不再重复验证。
|
||||
- **回滚**:`git revert` 对应提交(前后端须一起回滚,只回滚前端会导致开启 Turnstile 的部署无法企业登录)。
|
||||
- **关联**:`src/pages/OrgLogin/index.jsx`、`router/org-router.go`。
|
||||
|
||||
### 新增 · 渠道透传时应用模型映射
|
||||
|
||||
- **范围**:控制台渠道编辑框的「渠道额外设置」。
|
||||
- **变更**:「透传请求体」下方新增「透传时应用模型映射」,支持单独开启并保存。
|
||||
- **影响**:新建渠道和缺少该设置的历史渠道默认关闭。开启后,实际透传且命中渠道映射的请求使用映射后的上游模型名。
|
||||
- **回滚**:关闭该渠道的「透传时应用模型映射」并保存。
|
||||
- **关联**:`src/components/table/channels/modals/EditChannelModal.jsx`、`src/i18n/locales/`。
|
||||
|
||||
### 修复 · 控制台会员列表与弹窗
|
||||
|
||||
- **范围**:控制台 `/console/subscription` 的会员列表、新建与编辑会员卡弹窗。
|
||||
- **变更**:列表卡补充「会员列表」标题,快捷筛选移到标题之后。操作列沿用用户列表的「编辑」和「更多」,额度与金额右对齐。新建和编辑弹窗的主按钮统一为「确定」,桌面宽度调整为 575px。
|
||||
- **影响**:有效会员行可正常渲染。补发额度从「更多」进入确认弹窗,原有筛选和会员操作仍使用原接口。
|
||||
- **回滚**:还原会员页的工具栏、操作列、弹窗和对应翻译。
|
||||
- **关联**:`src/pages/Subscription/index.jsx`、`src/i18n/locales/`、`docs/standards/UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
### 调整 · 顶栏推广海报预览
|
||||
|
||||
- **范围**:顶栏「推广分享」弹窗的「海报分享」页签。
|
||||
- **变更**:模板色铺满海报预览区,色块、预览和 PNG 导出共用配色。通过 CSS 隐藏海报页签的奖励规则入口。
|
||||
- **影响**:切换模板时整块预览同步换色,「链接分享」页签仍可打开奖励规则。
|
||||
- **回滚**:还原推广弹窗的模板配色与奖励入口显隐样式。
|
||||
- **关联**:`src/components/promotion/PromotionPosterModal.jsx`、`src/components/promotion/promotion-poster.css`。
|
||||
|
||||
### 调整 · Playwright 默认覆盖两档移动视口
|
||||
|
||||
- **范围**:项目 Playwright 配置与设备环境校验。
|
||||
- **变更**:显式保留 `chrome-mobile` 的 360×800,新增默认项目 `chrome-mobile-393` 覆盖 393×851。
|
||||
- **影响**:继承项目视口的用例默认在两档手机尺寸运行,设备环境检查校验实际尺寸、触摸和截图。
|
||||
- **回滚**:从默认项目与设备配置移除 393×851 项目,并恢复对应断言。
|
||||
- **关联**:`playwright.config.js`、`scripts/browser-environment.mjs`、`scripts/ui-review/config.json`。
|
||||
|
||||
### 修复 · 企业设置的数据库密码表单
|
||||
|
||||
- **范围**:企业设置「提示词采集」的数据库连接配置。
|
||||
- **变更**:将数据库连接字段放入原生表单,为数据库用户名和密码指定自动填充属性。
|
||||
- **影响**:消除 Chrome 对数据库凭据字段的表单和自动填充警告。
|
||||
- **回滚**:还原数据库连接配置表单的 `component` 属性和两个凭据字段的 `autoComplete` 属性。
|
||||
- **关联**:`src/pages/Organization/OrgSettings.jsx`。
|
||||
|
||||
### 修复 · 渠道自动禁用开关初始化
|
||||
|
||||
- **范围**:控制台渠道管理的新建和编辑渠道表单。
|
||||
- **变更**:表单统一初始化「是否自动禁用」,详情返回的 0 和 1 转为开关使用的布尔值。
|
||||
- **影响**:消除 `auto_ban` 重复初始化警告,提交仍使用 0 或 1。
|
||||
- **回滚**:还原自动禁用开关的初始化配置。
|
||||
- **关联**:`src/components/table/channels/modals/EditChannelModal.jsx`。
|
||||
|
||||
### 调整 · 企业设置数据安全页签间距
|
||||
|
||||
- **范围**:企业设置「数据安全」的子页签。
|
||||
- **变更**:去掉子页签叠加的顶部内边距,沿用设置卡的 24px 内容间距。
|
||||
- **影响**:子页签文字与「登录与安全」的内容标题从相同高度开始。
|
||||
- **回滚**:移除企业设置对子页签顶部内边距的覆盖。
|
||||
- **关联**:`src/styles/org-center.css`。
|
||||
|
||||
### 调整 · 编辑标签的请求头变量提示
|
||||
|
||||
- **范围**:控制台渠道管理的「编辑标签」抽屉。
|
||||
- **变更**:将「支持变量」与渠道密钥占位符合并为一行,使用相同的字体和样式。
|
||||
- **影响**:请求头模板仍使用 `{api_key}`,表单行为保持原样。
|
||||
- **回滚**:还原请求头变量提示的布局。
|
||||
- **关联**:`src/components/table/channels/modals/EditTagModal.jsx`。
|
||||
|
||||
### 调整 · 渠道列表复选框与创建入口
|
||||
|
||||
- **范围**:控制台 `/console/channel` 的普通列表和标签聚合模式。
|
||||
- **变更**:多选复选框固定在表格左侧,「创建渠道」移到列表工具栏右侧、列设置按钮左边。
|
||||
- **影响**:窄屏横向滚动时仍可选择渠道,标签分组行保持不可选。创建权限和弹窗沿用原流程。
|
||||
- **回滚**:还原多选列的固定配置,并将创建按钮移回分类页签区域。
|
||||
- **关联**:`src/components/table/channels/ChannelsTable.jsx`、`src/components/table/channels/index.jsx`、`src/components/table/channels/ChannelsTabs.jsx`。
|
||||
|
||||
### 调整 · 表格日期范围与自动搜索
|
||||
|
||||
- **范围**:控制台、企业中心、用户中心的表格筛选区。
|
||||
- **变更**:日期范围共用快捷周期、格式和确认交互。接入公共 300ms 搜索调度,可取消过期查询。个人密钥的本地过滤按批处理。
|
||||
- **影响**:搜索保留当前页与表格操作状态,重置恢复各页面默认条件及初始页。
|
||||
- **回滚**:按受影响页面恢复筛选事件和列表请求,并还原表格日期和搜索公共入口。
|
||||
- **关联**:`docs/standards/UI_COMPONENT_STANDARDS.md` 第 4、6 节,`src/hooks/common/useFilterSearch.js`。
|
||||
|
||||
### 调整 · 控制台预约、渠道与企业列表
|
||||
|
||||
- **范围**:控制台 `/console/demo-reservations`、`/console/channel`、`/console/organizations`。
|
||||
- **变更**:预约列表将「状态」改为「是否已响应」,两态开关隐藏内部文字。开启时确认「是否进行响应」,关闭时确认「是否取消响应」。渠道列表固定 ID 和名称,企业列表固定 ID 和企业名称。
|
||||
- **影响**:渠道及企业列表的操作列固定在右侧,多选框和其他未固定列在表格内横向滚动。窄屏空间不足时,左侧列参与滚动,为右侧操作和表格内容留出空间。预约开关沿用原确认流程。
|
||||
- **回滚**:还原预约表头和开关配置,以及渠道、企业列表的固定列配置。
|
||||
- **关联**:`src/pages/DemoReservations/index.jsx`、`src/components/table/channels/ChannelsTable.jsx`、`src/pages/AdminOrganizations/index.jsx`。
|
||||
|
||||
### 调整 · 业务系统授权标题
|
||||
|
||||
- **范围**:`/org/my-capabilities?tab=connectors`。
|
||||
- **变更**:主标题改为「业务系统授权」,与页签共用文案。
|
||||
- **影响**:两个页签的主标题都使用各自的页签名称。
|
||||
- **回滚**:恢复主标题单独配置。
|
||||
- **关联**:`src/pages/Organization/OrgMyCapabilities.jsx`。
|
||||
|
||||
### 调整 · 我的 AI 能力页签位置
|
||||
|
||||
- **范围**:企业中心 `/org/my-capabilities`。
|
||||
- **变更**:将「我的技能」「业务系统授权」页签移到通用页头下方,统一页签和正文的左右边距。
|
||||
- **影响**:切换后展示当前页签对应的标题、说明和使用指引,旧路由和模块开关沿用原逻辑。
|
||||
- **回滚**:还原合并页的页头渲染方式和两个子页的页头。
|
||||
- **关联**:`src/pages/Organization/OrgMyCapabilities.jsx`、`src/pages/Organization/OrgMySkills.jsx`、`src/pages/Organization/OrgMyConnectors.jsx`。
|
||||
|
||||
### 调整 · 企业云端大脑界面与导航
|
||||
|
||||
- **范围**:企业中心 `/org/cloud-brain` 的页头、页签和工作区布局。
|
||||
- **变更**:与体验中心云端大脑共用页头与线型页签,统一内容边距、图标和操作区排布。页签支持方向键移动焦点和键盘确认。
|
||||
- **影响**:保留企业专家管理、项目关联、专家卡片与任务流程。管理面板可通过「完成管理」或选择页签返回工作区。
|
||||
- **回滚**:还原企业页头和页签分支及对应样式。
|
||||
- **关联**:`src/pages/CloudBrain/index.jsx`、`src/pages/CloudBrain/cloud-brain.css`、`src/pages/ExperienceCenter/components/ExperiencePageHeader.jsx`。
|
||||
|
||||
### 调整 · 企业知识页页头、引导间距与保存文案
|
||||
|
||||
- **范围**:企业中心 `/org/knowledge`。
|
||||
- **变更**:页头对齐体验中心云端大脑,移除「企业可信知识层」标签,将 BETA 徽标移至「企业知识」标题右侧。「快速上手」提示条上方增加 12px 留白,两个知识库弹窗的主按钮统一为「保存」。
|
||||
- **影响**:页头使用统一的面包屑、标题和说明布局,两个弹窗沿用各自的提交逻辑。
|
||||
- **回滚**:还原原页头、提示条外边距和两个弹窗的确认按钮文案。
|
||||
- **关联**:`src/pages/Organization/OrgKnowledge.jsx`、`src/pages/Organization/org-knowledge.css`。
|
||||
|
||||
### 调整 · 企业调用质量页头
|
||||
|
||||
- **范围**:企业中心调用质量页。
|
||||
- **变更**:移除主标题上方重复的「调用质量」标签,使用通用企业页头。
|
||||
- **影响**:主标题和说明对齐企业中心规范,面包屑与使用指引保留原入口。
|
||||
- **回滚**:还原调用质量页头及对应的局部样式。
|
||||
- **关联**:`src/pages/Organization/OrgQuality.jsx`、`src/pages/Organization/org-quality.css`、`src/styles/org-page.css`。
|
||||
|
||||
### 修复 · 企业技能治理快速上手条
|
||||
|
||||
- **范围**:企业专家工坊、分发与锁定和业务系统连接器的快速上手条。
|
||||
- **变更**:网格内容从顶部按自然高度排列,连接器的快速上手条到页签导航的间距缩为 8px。
|
||||
- **影响**:内容较少时,页头、引导条与下方内容保持紧凑,引导条继续打开原有抽屉。
|
||||
- **回滚**:移除共用网格的顶部对齐声明和连接器页签的间距覆盖。
|
||||
- **关联**:`src/styles/org-page.css`、`src/pages/Organization/OrgConnectors.jsx`、`src/pages/Organization/org-connectors.css`。
|
||||
|
||||
### 调整 · 企业 Agent 任务审计
|
||||
|
||||
- **范围**:企业中心 `/org/agent-audit` 的任务元数据、待对账、安全策略及正文弹窗。
|
||||
- **变更**:任务卡片区分运行与计费状态,补充页签计数、空状态、表单标签与保存反馈,支持窄屏读取长编号。
|
||||
- **影响**:审计入口、筛选分页、策略保留和正文二次确认继续使用现有接口与权限。操作反馈沿用系统主题色,状态标签保留语义色。
|
||||
- **回滚**:还原该页组件、页面样式、原专家样式中的审计规则和对应语言项。
|
||||
- **关联**:`src/pages/Organization/OrgAgentAudit.jsx`、`src/pages/Organization/org-agent-audit.css`、`docs/ui/ORG_CENTER_SPEC.md`。
|
||||
|
||||
### 修复 · 个人密钥保存失败后保留表单
|
||||
|
||||
- **范围**:用户中心密钥管理的新建和编辑抽屉。
|
||||
- **变更**:保存失败时保留分组及其他输入,结束提交时统一恢复按钮状态。
|
||||
- **影响**:用户可以在原表单上修正信息或直接重试,继续沿用原有密钥接口。
|
||||
- **回滚**:还原密钥表单提交结束时的重置逻辑。
|
||||
- **关联**:`src/components/table/tokens/modals/EditTokenModal.jsx`。
|
||||
|
||||
### 调整 · 企业技能治理页面布局
|
||||
|
||||
- **范围**:分发与锁定、企业专家工坊、业务系统连接器。
|
||||
- **变更**:统一页头、主操作、列表卡片和表单弹层。整理成员预览、专家版本与连接器卡片,补齐连接器页签空态。
|
||||
- **影响**:页面权限、接口和已有治理操作沿用原流程。
|
||||
- **回滚**:还原三个页面及相关样式的布局改动。
|
||||
- **关联**:`src/pages/Organization/OrgSkillAssignments.jsx`、`src/pages/Organization/OrgExperts.jsx`、`src/pages/Organization/OrgConnectors.jsx`。
|
||||
|
||||
### 调整 · 企业技能中心布局
|
||||
|
||||
- **范围**:企业中心技能库与自研 Skill。
|
||||
- **变更**:统一页头与页签顺序,整理技能操作区、引入目录与自研技能表单标签。
|
||||
- **布局细节**:企业技能库与自研 Skill 的操作按钮统一放在当前页头右侧,与分发与锁定页一致。自研 Skill 的快速上手贴近页签。
|
||||
- **影响**:两种页签继续使用原有路由参数、权限及技能治理操作。
|
||||
- **回滚**:还原技能中心、两个子页与共用页签容器的对应布局改动。
|
||||
- **关联**:`src/pages/Organization/OrgSkillCenter.jsx`、`src/pages/Organization/org-skills.css`。
|
||||
|
||||
### 修复 · 企业质量维度分布提示栏对齐
|
||||
|
||||
- **范围**:企业中心质量监控「维度分布」的六个页签。
|
||||
- **变更**:图标和文案从提示栏左侧内边距起排,两者垂直居中对齐,间距为 6px。窄屏换行后文案各行左对齐。
|
||||
- **影响**:仅调整企业端维度分布提示栏的布局,覆盖警告和信息提示。
|
||||
- **回滚**:移除企业端维度分布提示栏的居中样式。
|
||||
- **关联**:`src/components/quality/quality.css`。
|
||||
|
||||
### 修复 · 表格分组布局与渠道分组参数
|
||||
|
||||
- **范围**:用户、企业、渠道、模型、密钥等调用分组表格,以及渠道筛选和编辑表单。
|
||||
- **变更**:分组标签统一单行紧凑显示。渠道筛选按查询参数编码,分组表单统一处理字符串和数组回填。
|
||||
- **影响**:分组显示、复制和模型更多分组入口沿用原有行为。用户、渠道、企业及密钥接口各自沿用已有字段类型。
|
||||
- **回滚**:还原分组布局、列宽配置及渠道分组转换与查询参数改动。
|
||||
- **关联**:`src/components/common/table/TableGroupTags.jsx`、`src/helpers/groupList.js`、`src/hooks/channels/useChannelsData.jsx`。
|
||||
|
||||
### 调整 · 企业效能分析页面
|
||||
|
||||
- **范围**:企业中心效能分析。
|
||||
- **变更**:统一页头、指标卡、列表卡、成本对账和移动端空态,版本下钻支持回车提交。
|
||||
- **影响**:保留各区块的排列和数据逻辑,指标图标及主操作随系统主题色。
|
||||
- **回滚**:还原效能分析页组件与页面样式。
|
||||
- **关联**:`src/pages/Organization/OrgEffectiveness.jsx`、`src/pages/Organization/org-effectiveness.css`。
|
||||
|
||||
### 修复 · 编辑用户分组提交格式
|
||||
|
||||
- **范围**:`/console/user` 编辑用户的分组字段。
|
||||
- **变更**:按后端的单分组权限契约回填和保存,历史名称中的逗号原样保留。
|
||||
- **影响**:保留已有分组选择及请求地址。
|
||||
- **回滚**:还原编辑用户表单的分组转换。
|
||||
- **关联**:`src/components/table/users/modals/EditUserModal.jsx`。
|
||||
|
||||
### 调整 · 明确最小移动验收视口
|
||||
|
||||
- **范围**:Playwright 与专项 UI 验收。
|
||||
- **变更**:明确 360×800 是必测的最小移动视口,保留 393×851 专项覆盖。
|
||||
- **影响**:默认 `chrome-mobile` 项目已使用 360×800。
|
||||
- **回滚**:还原本条对应的验收规范与 README 说明。
|
||||
- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md`、`scripts/ui-review/config.json`。
|
||||
|
||||
### 修复 · 编辑用户抽屉关闭时标题闪动
|
||||
|
||||
- **范围**:`/console/user` 的编辑用户抽屉。
|
||||
- **变更**:关闭时保留当前用户,退出动画期间维持编辑标题和分区。
|
||||
- **影响**:下次打开时按选中的行重新加载用户信息。
|
||||
- **回滚**:恢复关闭抽屉时的选中用户清理逻辑。
|
||||
- **关联**:`src/hooks/users/useUsersData.jsx`。
|
||||
|
||||
### 修复 · 企业调用质量维度分布提示栏间距
|
||||
|
||||
- **范围**:`/org/quality` 的维度分布卡片。
|
||||
- **变更**:复用 18px 区块间距,统一提示栏与页签、结果区之间的留白。
|
||||
- **影响**:有提示、无提示和查询失败时均沿用同一组间距。
|
||||
- **回滚**:还原企业端维度分布的容器样式和表格上边距。
|
||||
- **关联**:`src/components/quality/QualityBreakdown.jsx`、`src/components/quality/quality.css`。
|
||||
|
||||
### 修复 · 补齐运营设置保存按钮对齐
|
||||
|
||||
- **范围**:`/console/setting?tab=operation` 的额度、邀请消费返佣、监控、兜底渠道、日志、屏蔽词过滤、跑马灯、技能超市与技能注入。
|
||||
- **变更**:9 个保存按钮复用运营设置操作区,与对应表单左边缘对齐。
|
||||
- **影响**:覆盖桌面和移动端,沿用各区块的保存处理。
|
||||
- **回滚**:还原本条涉及的保存按钮容器。
|
||||
- **关联**:`src/pages/Setting/Operation/`、`src/pages/Setting/Setting.css`。
|
||||
|
||||
### 调整 · 用户编辑抽屉对齐渠道编辑
|
||||
|
||||
- **范围**:`/console/user` 表格操作列的编辑用户抽屉。
|
||||
- **变更**:统一抽屉标题、分区标题、图标、面板间距和固定页脚,余额控件按视口切换单双列。
|
||||
- **影响**:保留原有用户字段、校验、额度调整和更新接口,提交期间防止重复保存。
|
||||
- **回滚**:还原用户编辑抽屉及对应的样式规则。
|
||||
- **关联**:`src/components/table/users/modals/EditUserModal.jsx`、`src/components/console/module-alignment.css`。
|
||||
|
||||
### 修复 · 统一表格分组标签文字
|
||||
|
||||
- **范围**:企业列表及共用分组标签的表格。
|
||||
- **变更**:分组列的 `default`、`vip`、`svip` 显示标准名称,移除企业列表追加的默认分组标记。
|
||||
- **影响**:默认分组配置、访问权限和计费规则沿用原逻辑。
|
||||
- **回滚**:还原分组列渲染与对应公共规范。
|
||||
- **关联**:`src/components/common/table/TableGroupTags.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
### 修复 · 运营设置操作区对齐
|
||||
|
||||
- **范围**:`/console/setting?tab=operation` 的通用、COS、提示词采集、语言与地区及管理员权限下放设置。
|
||||
- **变更**:将操作按钮与表单内容左边缘对齐,统一按钮组及语言规则校验提示的间距,权限选项沿用横向排列并统一行列间距。
|
||||
- **影响**:语言规则正常和校验失败时均保留操作区间距。
|
||||
- **回滚**:还原运营设置操作区的布局与样式。
|
||||
- **关联**:`src/pages/Setting/Operation/SettingsGeneral.jsx`、`src/pages/Setting/Operation/SettingsLanguage.jsx`、`src/pages/Setting/Setting.css`。
|
||||
|
||||
### 调整 · 企业日志筛选栏对齐消费记录
|
||||
|
||||
- **范围**:审计日志的提示词记录与操作审计卡片间距,消耗明细的明细日志、成员排行和绘图与视频筛选栏。
|
||||
- **变更**:复用个人消费记录的筛选卡布局、操作区和移动端折叠,统一搜索提交入口。审计日志的说明条上下及筛选卡至列表卡采用 18px 公共间距。
|
||||
- **影响**:沿用各页签的筛选条件、默认时间和请求逻辑。
|
||||
- **回滚**:还原本条对应的页面筛选区、公共样式和组件。
|
||||
- **关联**:`src/components/common/table/UsageRecordFilterCard.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`、`docs/ui/ORG_CENTER_SPEC.md`。
|
||||
|
||||
### 修复 · 企业成员页浮层触发节点引用
|
||||
|
||||
- **范围**:企业成员列表的状态开关和移除确认。
|
||||
- **变更**:表格状态开关和兼容层确认框将 `ref` 转发给 Ant Design 组件。
|
||||
- **影响**:消除 React 18 的 `Trigger` 引用告警,提示框可定位到对应的开关和按钮。
|
||||
- **回滚**:还原本条对应的组件引用转发及单测修改。
|
||||
- **关联**:`src/components/common/table/TableStatusSwitch.jsx`、`src/components/ui/index.jsx`。
|
||||
|
||||
### 修复 · 表格危险操作失败后可重试
|
||||
|
||||
- **范围**:表格操作列的删除、注销和冻结。
|
||||
- **变更**:业务回调回传提交结果。确认框在失败时保留当前记录,提交期间拦截重复确认。
|
||||
- **影响**:继续使用原接口、提示文案、权限判断及成功后的列表更新逻辑。
|
||||
- **回滚**:还原本条涉及的提交结果传递和确认框改动。
|
||||
- **关联**:`src/components/common/table/confirmTableAction.js`、`docs/standards/UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
### 修复 · 模型超市筛选按钮对齐
|
||||
|
||||
- **范围**:`/market` 顶部筛选按钮。
|
||||
- **变更**:统一按钮内容的对齐方式,厂商图标调整为 16px,图标右侧文字下移 1px 以改善视觉对齐。
|
||||
- **影响**:带图标和纯文字的选项采用相同的对齐方式。
|
||||
- **回滚**:还原筛选按钮及其图标的对齐样式。
|
||||
- **关联**:`src/components/table/model-pricing/market/market.css`、`src/components/table/model-pricing/filter/PricingVendors.jsx`。
|
||||
|
||||
### 调整 · 统一 WeyAi 下载页
|
||||
|
||||
- **范围**:公开下载页与用户中心下载页。
|
||||
- **变更**:共用下载页布局和样式,用户中心保留面包屑,下载背景延伸至导航区域。
|
||||
- **影响**:两个入口使用相同的推荐卡、安装包列表与下载交互,布局按各自的可用宽度排列。
|
||||
- **回滚**:还原本条对应的下载组件、样式和布局规范。
|
||||
- **关联**:`src/pages/WeyAiDownload/`、`docs/ui/GLOBAL_UI_BASELINE.md`。
|
||||
|
||||
### 修复 · 表格危险操作确认交互
|
||||
|
||||
- **范围**:表格操作列的删除、注销和冻结。
|
||||
- **变更**:统一危险操作入口和确认按钮,补齐直接执行入口的确认步骤;取消优先聚焦。
|
||||
- **影响**:保留已有业务提示文案和提交逻辑。
|
||||
- **回滚**:还原本条对应的行操作入口和公共确认组件。
|
||||
- **关联**:`src/components/common/table/TableActionPopconfirm.jsx`、`src/components/common/table/TableActionModal.jsx`。
|
||||
|
||||
## 2026-11-23
|
||||
|
||||
### 功能 · 统一权限体系前端(合入 weiyuan 后按 antd 6 重做)
|
||||
|
||||
- **范围**:控制台路由守卫与侧栏、权限管理 5 页(菜单管理、平台角色、功能套餐、角色模板、运行模式)、用户管理、企业管理;企业中心入口与侧栏、角色管理(新增 `/org/roles`)、员工管理,以及其余企业中心页面的按钮显隐;企业登录页。
|
||||
- **变更**:新增 `src/authz`(`usePerm` / `Perm` / `PermRoute` / `ConsoleRoute`),已切到新权限体系的模块按权限点判断,未切换的沿用原角色判断;超管"进入企业"改走代理会话(`X-Proxy-Session`,只存当前标签页);当前企业统一经 `helpers/orgContext.js` 读写;员工管理合并为一张表并改为服务端筛选分页,新增员工编辑;用户管理新增状态筛选、"添加额度"(按调整量)与"分配角色";企业管理新增所有者、功能套餐、预警通知列与"更换所有者";授权树支持父子联动、半选与全部展开 / 收起;企业登录支持两步验证与首登改密。
|
||||
- **影响**:未切换时各入口的可见性与原来一致。员工管理不再有"员工权限 / 员工账号"页签;`OrgMemberAccounts.jsx` 只导出两个弹窗。接口变化见 `docs/10-数据安全与权限/10-权限体系重构改造方案.md` §13。本条所列页面均未做浏览器走查。
|
||||
- **回滚**:`git revert` 对应提交;权限管理页、`src/authz`、`orgContext.js` 为新增文件。
|
||||
- **关联**:`src/authz/*`、`src/pages/Permission/*`、`src/components/authz/PermTree.jsx`、`src/pages/Organization/{index,OrgSidebar,OrgRoles,OrgMembers,OrgMemberAccounts}.jsx`、`src/pages/Organization/orgMenuAccess.js`、`src/components/table/users/*`、`src/pages/AdminOrganizations/*`、`src/App.jsx`、`src/components/layout/SiderBar.jsx`。
|
||||
|
||||
### 修复 · 表格启停开关与分组样式统一
|
||||
|
||||
- **范围**:已有启停开关、调用或计费分组的表格,以及操作列删除确认规范。
|
||||
- **变更**:复用密钥管理的小尺寸状态开关和企业列表的分组标签;规范删除确认、提交防重及失败处理,文案可自定义。
|
||||
- **影响**:保持原接口、权限、确认及删除流程;单组与多组使用同一颜色映射。
|
||||
- **回滚**:分别还原共享组件接入和对应规范差异。
|
||||
- **关联**:`src/components/common/table/TableStatusSwitch.jsx`、`src/components/common/table/TableGroupTags.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
### 调整 · 渠道聚合标签编辑抽屉
|
||||
|
||||
- **范围**:`/console/channel` 标签聚合模式下的编辑标签抽屉。
|
||||
- **变更**:标签抽屉沿用编辑渠道的标题、面板和页脚,将标签名称与分组放入响应式栅格。创建渠道、编辑渠道和编辑标签的圆形图标均对齐模型编辑抽屉。
|
||||
- **影响**:可通过关闭按钮或取消退出,提交继续使用标签批量覆盖接口及校验规则。
|
||||
- **回滚**:还原标签编辑抽屉的布局、控件和页脚改动。
|
||||
- **关联**:`src/components/table/channels/modals/EditTagModal.jsx`、`src/components/table/channels/modals/EditChannelModal.jsx`、`src/components/console/module-alignment.css`。
|
||||
|
||||
### 调整 · 预约列表导出和操作确认
|
||||
|
||||
- **范围**:`/console/demo-reservations` 预约列表。
|
||||
- **变更**:复用日志页的导出按钮,水平居中表格列,加宽操作列左侧的状态列,启用、禁用与删除操作采用密钥管理页的确认弹窗样式。
|
||||
- **影响**:启停和删除在确认后提交;导出继续下载当前选中预约的 CSV。
|
||||
- **回滚**:还原预约列表的工具栏、列定义、确认弹窗与对应语言条目。
|
||||
- **关联**:`src/pages/DemoReservations/index.jsx`、`src/i18n/locales/`。
|
||||
|
||||
### 修复 · 审计提示词记录模型列样式
|
||||
|
||||
- **范围**:`/org/audit` 提示词调用记录的模型列。
|
||||
- **变更**:移除紫色标签,复用相邻提示词列的文字样式,保留长名称省略和悬浮提示。
|
||||
- **影响**:文字随浅深主题切换,不受品牌色覆盖;查询、权限和调用明细不变。
|
||||
- **回滚**:还原模型列渲染及共享文字类名提取。
|
||||
- **关联**:`src/pages/Organization/OrgPromptRecords.jsx`。
|
||||
|
||||
### 修复 · 消费记录渠道标签可读性
|
||||
|
||||
- **范围**:`/user-center/usage-record` 消费记录和绘图与视频任务记录表格的渠道列。
|
||||
- **变更**:调用明细采用与任务记录相同的默认填充标签,移除按渠道 ID 配色及井号图标,并修正点击复制的参数。
|
||||
- **影响**:两张表的渠道标签随亮暗主题使用中性底色,保留渠道名称提示和调用明细的多密钥序号。
|
||||
- **回滚**:按关联文件还原本条对应的标签渲染与样式。
|
||||
- **关联**:`src/components/table/usage-logs/UsageLogsColumnDefs.jsx`、`src/components/table/task-logs/TaskLogsColumnDefs.jsx`、`src/pages/UserCenter/UsageRecord.css`。
|
||||
|
||||
### 优化 · WeyAi 独立下载页原型对齐
|
||||
|
||||
- **范围**:`/weyai/download` 独立下载页和此路由的顶栏下载入口。
|
||||
- **变更**:首屏并排展示推荐安装区和工作台示意。安装包按系统分组,文件名和大小分行,指引区跟随可用宽度折行。
|
||||
- **影响**:首屏光晕、推荐提示、焦点环和顶栏选中态随当前主题生效。
|
||||
- **回滚**:按关联文件还原本条的布局与样式变更。
|
||||
- **关联**:`src/pages/WeyAiDownload/{index.jsx,weyai-download.css}`、`docs/ui/GLOBAL_UI_BASELINE.md` 第 5 节。
|
||||
|
||||
### 调整 · 官网设置关于我们文案
|
||||
|
||||
- **范围**:控制台官网设置。
|
||||
- **变更**:关于页签、页签说明、团队成员共用提示和跨页签校验文案统一使用“关于我们”,同步更新九个语言包。
|
||||
- **影响**:文案随当前界面语言显示,已保存的官网配置继续按原结构读取。
|
||||
- **回滚**:按关联文件还原对应文案。
|
||||
- **关联**:`src/pages/WebsiteSettings/{model.js,README.md}`、`src/i18n/locales/`。
|
||||
|
||||
### 修复 · Vite 开发服务暴露面
|
||||
|
||||
- **范围**:本地开发服务与共享测试环境部署说明。
|
||||
- **变更**:升级 Vite 和 esbuild,禁用开发服务中项目未使用的 `import.meta.glob` 转换。
|
||||
- **影响**:本机和局域网可继续访问开发端口 5174,普通动态导入和热更新沿用现有流程,共享测试环境可使用静态构建产物。
|
||||
- **回滚**:按关联文件还原配置和依赖锁定。
|
||||
- **关联**:`vite.config.js`、`package.json`、`package-lock.json`、`README.md`。
|
||||
|
||||
### 优化 · WeyAi 桌面端下载页
|
||||
|
||||
- **范围**:独立下载页 `/weyai/download` 与用户中心内嵌下载页。
|
||||
- **变更**:独立页扩大桌面内容区,整合版本信息、打开入口和推荐安装包。两处下载页均按系统分组展示安装包,按可用宽度切换列数,文件名完整换行,交互色跟随系统主题配置。
|
||||
- **影响**:鼠标或键盘激活“其他平台与架构”后,焦点落在安装包分区标题,随后按 Tab 可进入第一个包的下载按钮。
|
||||
- **回滚**:按关联文件还原本条对应的布局、样式和焦点处理。
|
||||
- **关联**:`src/pages/WeyAiDownload/{index.jsx,weyai-download.css}`、`docs/ui/GLOBAL_UI_BASELINE.md` 第 5 节。
|
||||
|
||||
### 优化 · 兜底渠道选择器
|
||||
|
||||
- **范围** 控制台「渠道管理」的渠道编辑抽屉。
|
||||
- **变更** 下拉项和已选标签显示渠道 ID 与名称,禁用状态以灰态和悬停提示表达。
|
||||
- **影响** 可按 ID、名称、分组和地域搜索。写入兜底链时仍按选择顺序提交数字 ID。
|
||||
- **回滚** 还原渠道编辑抽屉的选项标签和搜索字段。
|
||||
- **关联** `src/components/table/channels/modals/EditChannelModal.jsx`。
|
||||
|
||||
### 功能 · 预约演示列表管理
|
||||
|
||||
- **范围** 控制台「预约演示」。
|
||||
- **变更** 支持当前页多选、导出选中行的 CSV、逐条启停与确认删除。列宽按常见字段长度分配,表头字段居中,需求列随窗口加宽,窄屏下固定复选框和操作列。
|
||||
- **影响** 历史和新提交记录默认启用,删除记录从预约列表中移除并保留在数据库中。
|
||||
- **回滚** 还原本次前后端变更。旧版列表会重新显示软删除记录。
|
||||
- **关联** `src/pages/DemoReservations/` 和 `website_demo_requests`。
|
||||
|
||||
## 2026-11-21
|
||||
|
||||
### 修复 · 视频生成任务队列分页
|
||||
|
||||
- **范围**:体验中心视频生成页的任务队列。
|
||||
- **变更**:任务列表原先只请求一次 `GET /api/video/tasks`(不带分页参数,后端只返回首页),分页器仅在这一页内做前端切片,总数与翻页都不准确。改为复用该接口的服务端分页:请求携带 `p` / `page_size`,读取响应 `total`;翻页、切换每页条数(切换后回到第 1 页)都会重新请求;刷新、删除、取消、轮询结束后重载当前页,删除末页最后一条时回退到上一页;新提交的任务仅在第 1 页时插入表头,其余页只更新总数;快速翻页只采纳最后一次请求结果,加载中表格显示 loading。队列标题计数改为服务端总数,勾选仅针对当前页。
|
||||
- **影响**:分状态统计(排队 / 生成中 / 完成 / 失败)仍按当前页计算;轮询、播放、再生成、下载行为不变。
|
||||
- **回滚**:`git checkout <提交>^ -- <关联文件>`。
|
||||
- **关联**:`src/hooks/video/useVideoGeneration.js`、`src/pages/ExperienceCenter/components/AICreation/{VideoGenerationTab,Video/VideoTaskQueue}.jsx`。
|
||||
|
||||
## 2026-11-20
|
||||
|
||||
### 优化 · 体验中心页头与图片生成布局
|
||||
|
||||
- **范围**:体验中心云端大脑、图片生成、视频生成三页(新创作台灰度开启时的页面不在此范围)。
|
||||
- **变更**:三页页头统一为用户中心规格(面包屑“体验中心 / 当前页面”、28 / 32px 标题、14 / 22px 副标题、右侧操作),内容边距读取 `--uc-page-pad-*`;去掉图片、视频标题前的图标;图片生成表单卡标题改为“参数设置”,移动端收起时显示当前模型;云端大脑的使用指引与可用专家数移到页头右侧。图片生成宽屏下左侧参数栏固定,右侧生成历史整列局部滚动;视频生成宽屏下任务队列展开改为自底向上的浮层覆盖,不再挤压参数与预览区,支持 Esc 收起;队列表格样式与交互对齐密钥管理列表(middle 尺寸、46px 常规字重表头、文字链接操作),分页器移出表格滚动区并改为前端分页,修复切换每页条数时的布局抖动;任务 ID 完整纯文本展示,状态标签去掉图标、仅保留文字与边框并在单元格内水平垂直居中;图片、视频、云端大脑三页底部内边距统一减半;云端大脑“专家广场 / 我的任务”改为与 `/console/analytics` 一致的线型页签(企业中心宿主保留原分段按钮);图片生成历史工具栏合并为单行(模型、尺寸筛选并入首行),卡片提示词单行省略、缩略图 3:2,单一时间分组时省略分组标题(多分组时为紧凑标签),1920 宽屏常见浏览器可视高度(约 950px)下可完整看到工具栏与两行图片。右侧滚动视口 12px 圆角与左侧参数卡底边对齐,无匹配任务时空状态在列表区水平垂直居中。宽屏舒适密度下两行卡片按可视高度均分拉伸(行高 260–440px),第二行底边与左侧参数卡底边对齐;“清除筛选”移到筛选区最前、图标文字居中,出现时不推动下拉框;模型 / 尺寸下拉固定 190 / 128px,超长名称省略并在悬停时提示全名。对比模式勾选框缩小为 28px 浮层并修正复选框居中(去掉 antd 外层占位伪元素);云端大脑页头与页签间距减为 8px。三页(新创作台除外)页底与 `/console/analytics` 统一为 `--uc-page-bg`,云端大脑不再叠加装饰光晕;已在系统主题预设与自定义主色、浅深模式下验证。
|
||||
- **影响**:重置、移动端折叠、视频参数折叠、任务队列刷新 / 删除 / 播放、使用指引、专家 / 任务页签与无限加载行为不变;企业中心的云端大脑保留原卡片页头。
|
||||
- **回滚**:按文件还原下列文件,并删除 `ExperiencePageHeader.jsx` 与 `experience-page.css`。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/{ExperiencePageHeader,ImageGeneration,VideoGeneration}.jsx`、`src/pages/ExperienceCenter/components/AICreation/{ImageGenerationForm,ImageGenerationTab,ImageTaskList,Video/VideoTaskQueue}.jsx`、`ImageTaskList.css`、`src/pages/ExperienceCenter/experience-page.css`、`src/pages/ExperienceCenter/components/AICreation/{Image/ImageGenerationForm,Video/VideoWorkspace}.css`、`src/pages/CloudBrain/{index.jsx,cloud-brain.css}`、`docs/ui/GLOBAL_UI_BASELINE.md`。
|
||||
|
||||
### 优化 · 体验中心侧栏对齐用户中心
|
||||
|
||||
- **范围**:体验中心桌面端侧栏(云端大脑、图片生成、视频生成)。
|
||||
- **变更**:移除“体验中心”标题块与毛玻璃、渐变、选中竖条等装饰,改用用户中心侧栏同一套 `ui-center-sidebar` 结构与样式;底部按钮改为“收起导航 / 展开导航”,收起态仅显示图标并以 `title` 提示;BETA 标记与未读角标保留。
|
||||
- **影响**:展开 / 收起宽度、菜单项尺寸、选中色与用户中心一致,折叠状态在两个中心间同步;不改路由、模块可见性判定与移动端底部导航。
|
||||
- **回滚**:按文件还原 `ExperienceSidebar.jsx`、`ExperienceCenter/index.jsx` 与 `center-layout.css` 的对应段落。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/ExperienceSidebar.jsx`、`src/pages/ExperienceCenter/index.jsx`、`src/styles/center-layout.css`。
|
||||
|
||||
### 修复 · 图片生成历史首载闪烁
|
||||
|
||||
- **范围**:体验中心图片生成页的历史缩略图。
|
||||
- **变更**:首次加载仅在后台补齐缺失链接,避免已加载的缩略图因换源而重载。
|
||||
- **影响**:保留过期链接自动恢复和手动刷新入口。
|
||||
- **回滚**:逆向恢复本条对应的历史图片链接补齐逻辑。
|
||||
- **关联**:`src/hooks/image/useImageTaskManagement.js`。
|
||||
|
||||
### 修复 · 视频生成能力标签
|
||||
|
||||
- **范围**:体验中心视频生成页标题区。
|
||||
- **变更**:恢复图生视频、文生视频、多模型支持三枚说明标签;窄屏换行,配色继承系统主题。
|
||||
- **影响**:不改变模型能力判断、模式选择或生成流程。
|
||||
- **回滚**:逆向恢复标题区的标签结构和局部样式。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/VideoGeneration.jsx`。
|
||||
|
||||
### 优化 · 体验中心视频生成工作区
|
||||
|
||||
- **范围**:视频生成页的参数面板、视频预览和任务队列。
|
||||
- **变更**:以图片生成工作区的描边卡片为基准,统一标题、控件和空态;参数面板与任务队列可通过键盘折叠,任务队列不再遮挡预览;表单滚动区保留高级参数的展开高度,避免队列展开或窗口较矮时压缩折叠项。
|
||||
- **影响**:跟随系统主题配置;保持模型、视频生成、计价、任务和灰度开关契约。
|
||||
- **回滚**:仅逆向恢复本条对应的页面结构和样式。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/VideoGenerationTab.jsx`、`src/pages/ExperienceCenter/components/AICreation/Video/VideoWorkspace.css`。
|
||||
|
||||
### 修复 · 官网设置品牌名称对齐
|
||||
|
||||
- **范围**:控制台官网设置的关于页签、说明、首页共用提示及校验提示。
|
||||
- **变更**:统一使用“微元算力”,同步九个语言包。
|
||||
- **影响**:不改变配置结构、表单校验或保存逻辑;联调存量文案仅替换实查命中的文章标题和正文。
|
||||
- **回滚**:逆向恢复本条的文案差异;如需回滚联调数据,先比对最新配置与保存前备份,只恢复本次变动的两处,避免覆盖后续编辑。
|
||||
- **关联**:`src/pages/WebsiteSettings/model.js`、`src/i18n/locales/`、`/api/website/page-config`。
|
||||
|
||||
### 优化 · 图片生成创作表单
|
||||
|
||||
- **范围**:体验中心图片生成页左侧创作表单。
|
||||
- **变更**:固定桌面端标题与生成区,归组模型和生成方式,整合提示词工具、模板、参考图与参数的视觉层次;移动端可收起表单并保留生成操作。
|
||||
- **影响**:沿用系统主题色与现有生成、引用、计价流程;右侧历史不变。
|
||||
- **回滚**:仅逆向恢复本条对应的表单结构和局部样式差异。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/ImageGenerationForm.jsx`、`src/pages/ExperienceCenter/components/AICreation/Image/ImageGenerationForm.css`、`src/pages/ExperienceCenter/components/AICreation/Image/ImageSizePicker.jsx`。
|
||||
|
||||
### 优化 · 体验中心图片生成工作区
|
||||
|
||||
- **范围**:图片生成页的双栏工作区、创作表单和生成历史。
|
||||
- **变更**:以模型超市的描边卡片为参考,统一缩略图、状态占位和操作区;窄屏堆叠,选中和焦点状态跟随系统主题色。
|
||||
- **影响**:保留任务、模型和计价流程;历史卡片在各显示密度下均可打开详情和操作菜单。
|
||||
- **回滚**:逆向恢复本条的页面布局、表单及历史卡片差异。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/ImageGenerationTab.jsx`、`ImageGenerationForm.jsx`、`ImageTaskList.jsx`。
|
||||
|
||||
### 修复 · 风控看板自动封号历史
|
||||
|
||||
- 复用运营看板折叠面板外框,展开时由分隔线连接标题和内容;保留默认展开、筛选、刷新、分页与解封行为。
|
||||
|
||||
### 修复 · 控制台调用质量维度分布
|
||||
|
||||
- 对齐维度页签、数据来源提示和表格间距;表格随内容增高,空态不滚动,仅数据列超宽时支持横向滚动。保留排序、下钻与前 50 项查询规则。
|
||||
|
||||
### 性能 · 开发预热与公共首屏分包
|
||||
|
||||
- **范围**:Vite 开发和生产配置、应用启动、首页和认证页的加载边界。
|
||||
- **变更**:预热入口、布局和路由;启动路径直接导入所需模块,拆出可单独缓存的 React 运行时;公告、协议预览和首页 Markdown 解析按需加载。
|
||||
- **影响**:减少默认首页和认证页首屏 JS,不改变接口、权限、设置与登录流程;支持基于构建清单验收启动预算及懒加载边界。
|
||||
- **回滚**:仅逆向恢复本条对应的配置、显式导入、懒加载与产物校验差异。
|
||||
- **关联**:`vite.config.js`、`src/index.jsx`、`src/components/auth/LazyAgreementModal.jsx`、`scripts/verify-build.mjs`。
|
||||
|
||||
### 修复 · 旧 UI 库审计规则统一
|
||||
|
||||
- **范围**:ESLint、UI 依赖审计、回归单测与开发文档。
|
||||
- **变更**:通过共享规则拦截旧 UI 包的导入、重导出及静态可确定的动态加载;审计扩展到根目录 JS 配置、脚本和单测,并检查 npm 别名与嵌套传递依赖。
|
||||
- **影响**:不改变运行时依赖或 UI 行为;保留本地品牌图标的来源与 SHA-256 校验。
|
||||
- **回滚**:仅逆向恢复本条对应的规则、审计、测试和文档差异。
|
||||
- **关联**:`eslint.config.cjs`、`scripts/ui-dependency-policy.cjs`、`scripts/check-ui-dependencies.mjs`、`test/unit/ui-dependency-policy.test.js`。
|
||||
|
||||
### 修复 · 个人密钥管理查询交互对齐
|
||||
|
||||
- **范围**:用户中心密钥管理的查询、搜索、分页。
|
||||
- **变更**:保留按名称、Key 或分组匹配的单输入框,对齐控制台的输入防抖、立即搜索和重置操作。
|
||||
- **影响**:普通列表复用 `/api/token/` 服务端分页;搜索复用该个人接口取全,在本地匹配和分页,不调用管理员接口。
|
||||
- **回滚**:仅逆向恢复本条对应的查询表单和密钥数据加载差异。
|
||||
- **关联**:`src/pages/KeyManagement/index.jsx`、`src/hooks/tokens/useTokensData.jsx`、`docs/ui/KEY_MANAGEMENT_SPEC.md`。
|
||||
|
||||
### 修复 · 客服浮钮收起箭头残留
|
||||
|
||||
- **范围**:全站右下角客服浮钮。
|
||||
- **变更**:从展开状态打开面板后,仅用底部圆形关闭按钮关闭时保留收起箭头;点面板右上角关闭或外部时隐藏箭头。点击侧边展开按钮后,箭头不再因按钮位置变化而立即消失;从收起状态临时打开面板后仍回到收起状态。
|
||||
- **影响**:保留键盘焦点反馈和触屏收起入口,不改变客服会话逻辑。
|
||||
- **回滚**:逆向恢复本条对应的客服浮钮焦点处理和样式差异。
|
||||
- **关联**:`src/components/customer-service/index.jsx`、`src/components/customer-service/styles.css`。
|
||||
|
||||
### 修复 · 全站表格统一分页
|
||||
|
||||
- **范围**:各中心、业务页面、卡片和弹层内原有分页的表格。
|
||||
- **变更**:统一为密钥管理的小型右对齐分页,补齐单页结果的条数入口和移动端跳页;未启用分页的表格保持原样。
|
||||
- **影响**:前端分页继续使用已加载数据,接口分页沿用原接口与筛选条件;换条数回到第一页,已分页的行不再二次切片。密钥管理本地筛选不再仅查当前接口页;兑换码翻页和换条数保留已提交的关键词。
|
||||
- **回滚**:逆向恢复本条对应的共享分页、页面分页接入、测试和规范差异。
|
||||
|
||||
### 更新 · 移除重复的长版权文件头
|
||||
|
||||
- **范围**:源码、脚本、样式、配置和测试中的统一长文件头。
|
||||
- **变更**:将原声明集中到 `NOTICE.md`,移除重复模板、ESLint 文件头规则及相关依赖。
|
||||
- **影响**:不改变业务逻辑,独立版权和第三方声明保持原样。
|
||||
- **回滚**:按本条差异逆向恢复长文件头、规则、依赖和规范,保留其他工作区改动。
|
||||
- **关联**:`NOTICE.md`、`eslint.config.cjs`、`package.json`、`package-lock.json`、`docs/standards/DEV_STANDARDS.md`。
|
||||
|
||||
### 修复 · ESLint 不再自动补写许可证头
|
||||
|
||||
- **范围**:JavaScript / JSX 许可证头检查。
|
||||
- **变更**:保留原许可证校验,关闭该规则的自动写入与替换。
|
||||
- **影响**:文件头缺失仍报错,现有版权和许可证声明保持不变。
|
||||
- **回滚**:还原本条配置和文档差异。
|
||||
- **关联**:`eslint.config.cjs`、`README.md`、`docs/standards/DEV_STANDARDS.md`。
|
||||
|
||||
### 修复 · 共享单测不再被全局忽略
|
||||
|
||||
- **范围**:Git 忽略规则和前端单测目录。
|
||||
- **变更**:移除按测试扩展名全局忽略的规则,将 12 个本地回归测试迁入 `test/unit/`,保留已跟踪的存量测试。
|
||||
- **影响**:团队可共享这些测试;本地验收目录仍被忽略,不改变生产代码。
|
||||
- **回滚**:恢复本条忽略规则与文档差异,并将迁移用例按原路径移回。
|
||||
- **关联**:`.gitignore`、`test/unit/`、`docs/standards/DEV_STANDARDS.md`、`README.md`。
|
||||
|
||||
### 修复 · 全量 undefined / NaN 展示防护与主题兼容回归
|
||||
|
||||
- **范围**:分析看板、组织/个人中心、充值/发票/订单/订阅、佣金、渠道模型测试、服务监控,以及亮色/暗色主题下的数字展示路径。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 统一开发与 Ant Design CRUD 规范
|
||||
|
||||
> 状态:有效 · 适用:React 18.3、antd 6.7.0、Vite 5.4、Node ≥ 22.13 · 更新:2026-11-18 · 版本:v2.3
|
||||
> 状态:有效 · 适用:React 18.3、antd 6.7.0、Vite 5.4、Node ≥ 22.13 · 更新:2026-11-26 · 版本:v2.6
|
||||
|
||||
新增与重构 CRUD 的编码规范:目录与命名、组件选择、请求、React 组件与状态、表单与弹层、权限、i18n,以及可直接复制的页面模板。外观取值见 `UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
| React | 函数组件 + Hooks;派生值在渲染中计算;记忆化只用于测量过的问题(第 4 节) |
|
||||
| 状态命名 | `items`、`total`、`page`、`pageSize`、`filters`、`loading`、`submitting`、`editingRecord`、`drawerOpen` |
|
||||
| 表单 | `Form.useForm` + `rules`;失败不关闭弹层;提交按钮 `loading` 防重复(第 6 节) |
|
||||
| 文件 | 带 AGPL 许可证头;单测放 `test/unit/`;文案补齐 9 个语言包 |
|
||||
| 文件 | 不重复添加通用长版权文件头;单测放 `test/unit/`;文案补齐 9 个语言包 |
|
||||
|
||||
**相关代码**:`src/helpers/api.js`、`src/helpers/utils.jsx`、`src/helpers/paging.js`、`src/helpers/auth.jsx`、`src/components/ui/`、`src/components/console/`、`src/pages/Organization/components/`
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
| 视图(企业中心) | `src/pages/Organization/Org<Module>.jsx`,Hook 放 `src/hooks/org/` | 同上;单文件过大时拆到 `components/` |
|
||||
| 视图(用户中心) | `src/pages/UserCenter/<Module>.jsx` + 同名 `.css` | 同上 |
|
||||
| 控制台路由入口 | `src/pages/<Module>/index.jsx` | 由 `App.jsx` 以 `React.lazy` 加载 |
|
||||
| 单元测试 | `test/unit/<module>-*.test.js` | `.gitignore` 忽略 `*.test.*`,仅此目录可入库 |
|
||||
| 单元测试 | `test/unit/<module>-*.test.js` | `.gitignore` 不再按测试扩展名全局忽略;保留已跟踪的存量测试 |
|
||||
|
||||
### 1.2 命名
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
| 样式 | 页面根类 + 局部变量族 `--<前缀>-*`;文件 kebab-case | `.km-page`、`--km-card-border`、`key-management.css` |
|
||||
| 后端字段 | 保持 snake_case 原样,不在前端改名 | `created_time`、`page_size` |
|
||||
|
||||
### 1.3 必备文件头
|
||||
### 1.3 版权声明
|
||||
|
||||
ESLint 规则 `header/header` 要求每个 `.js/.jsx` 顶部带 AGPL 许可证块注释,直接复制任一现有源码文件的第 1–18 行;缺失会让 `npm run eslint` 失败。
|
||||
源码不重复添加通用长版权文件头,保留独立的第三方声明。
|
||||
|
||||
## 2. Ant Design 组件边界
|
||||
|
||||
@@ -110,7 +110,7 @@ ESLint 规则 `header/header` 要求每个 `.js/.jsx` 顶部带 AGPL 许可证
|
||||
|
||||
- 外观取值(颜色、间距、圆角、字号、各组件样式)以 `docs/standards/UI_COMPONENT_STANDARDS.md` 为准,本文只写编码约束。
|
||||
- 按钮与操作图标:`import { Plus, Pencil, Trash2, RefreshCw, Search } from '@/components/common/icons/ActionIcons'`,按钮内传 `size={16}`;装饰图标用 `lucide-react`。
|
||||
- 禁止导入 `@lobehub/*`、Radix UI、Floating UI、Semi、MUI、Chakra、Headless UI、leva、antd-style、react-layout-kit(ESLint `no-restricted-imports` 与 `npm run check:ui` 拦截)。
|
||||
- 禁止导入 `@lobehub/*`、Radix UI、Floating UI、Semi、MUI(含旧 `@material-ui/*`)、Chakra、Headless UI、leva、antd-style、react-layout-kit。ESLint 的 `ui-dependencies/no-legacy-ui` 与 `npm run check:ui` 共用 `scripts/ui-dependency-policy.cjs`,不要在入口重复维护包名。
|
||||
- JSX 不写十六进制颜色;不用全局 `!important`;新视图不用 Tailwind 颜色类(如 `text-gray-500`),改用 token 或页面变量。
|
||||
|
||||
## 3. 请求封装与错误处理
|
||||
@@ -121,6 +121,7 @@ ESLint 规则 `header/header` 要求每个 `.js/.jsx` 顶部带 AGPL 许可证
|
||||
- `API` 已提供:`New-API-User` 请求头;`/api/org/*` 自动注入 `X-Org-Id`(显式传入优先);并发相同 GET 去重(`disableDuplicate: true` 关闭,带取消信号或请求组的 GET 不共享);HTTP 错误统一提示(`skipErrorHandler: true` 跳过并由页面自行处理)。受会话约束的接口首次返回 401 时取消该会话未完成的只读请求,阻止该会话继续发请求,并仅清理、跳转 `/org/login?expired=true` 一次。公开接口或显式 `sessionBound: false` 的请求不参与会话联动。
|
||||
- 同一批必须全部成功的只读请求,可传入同一个 `requestGroup: new AbortController()`;首次拒绝的 HTTP 4xx/5xx 取消同组剩余读取。普通失败不取消无关请求,正常并发不限流;已发送的写入不由请求组批量取消。调用方仍须处理 Promise 拒绝,并在 `finally` 清理加载状态。
|
||||
- 查询参数用 `params` 对象,不手拼查询字符串(手拼不会编码 `&`、`#`、中文)。
|
||||
- `API` 的 GET、HEAD、OPTIONS 默认在 60 秒后超时,调用方可以通过 `timeout` 覆盖。保持在 `finally` 回收加载状态,并让过期请求与当前请求的状态互不干扰。
|
||||
- 响应按 `{ success, message, data }` 处理,先判断 `success`;具体字段以接口契约为准。
|
||||
- 分页参数 `p` 从 1 开始,`page_size` 默认 `ITEMS_PER_PAGE`(10,须与后端一致);后端对 `page_size > 100` 静默截断为 100,需要全量数据时用 `collectPagedItems(fetchPage)`(`src/helpers/paging.js`)。
|
||||
|
||||
@@ -202,7 +203,7 @@ try {
|
||||
- 批量操作:`rowSelection={{ selectedRowKeys, onChange: setSelectedRowKeys }}`。
|
||||
- 删除后的页码回退、筛选后的页码重置放在 hook 中处理(不要散落在组件中)。
|
||||
- 列设置只用于已有该功能的表格(`docs/ui/TABLE_COLUMN_SETTINGS_SPEC.md`)。
|
||||
- 分页统一用适配层 `Table` / `Pagination`;`/console`、`/org` 下自动统一,其他路由按下例显式传入,避免改页容量时请求两次:
|
||||
- 所有路由的分页表格用适配层 `Table` / `Pagination`。完整数据交给 `Table` 本地分页,不传 `total`;已由页面筛选切片或由接口返回单页数据时传 `total`,表格不会再次切片。未开启分页的表格保持原样。受控分页按下例传入,条数回调自行回到第 1 页,不再触发翻页回调:
|
||||
|
||||
```jsx
|
||||
pagination={{
|
||||
@@ -211,10 +212,6 @@ pagination={{
|
||||
total,
|
||||
onPageChange: handlePageChange,
|
||||
onPageSizeChange: handlePageSizeChange,
|
||||
showSizeChanger: true,
|
||||
pageSizeOpts: [10, 20, 50, 100],
|
||||
showTotal: (count) => t('共 {{total}} 条', { total: count }),
|
||||
preventPageChangeOnPageSizeChange: true,
|
||||
}}
|
||||
```
|
||||
|
||||
@@ -226,7 +223,7 @@ pagination={{
|
||||
- 防重复:提交中按钮 `loading` 或 `confirmLoading`;hook 内 `submitting` 为真时直接返回。
|
||||
- 成功:`showSuccess` → 关闭 → 刷新当前页;失败:保留弹层与已填内容。
|
||||
- 打开时重置:弹层加 `forceRender`,在 `useEffect([open, record])` 中先 `resetFields()` 再 `setFieldsValue(record)`。
|
||||
- 删除:`Popconfirm` 的 `onConfirm` 返回 Promise 以显示加载;批量或不可撤销操作用 `Modal.confirm`。
|
||||
- 删除:确认回调返回 Promise 以显示加载;确认形态、危险按钮、失败保留与键盘交互见组件规范第 8 节。
|
||||
- 日期提交前转换为后端格式(多为 Unix 秒);有未保存内容时沿用页面已有的关闭确认流程。
|
||||
|
||||
## 7. 加载、空态与错误态
|
||||
@@ -294,7 +291,7 @@ pagination={{
|
||||
### 12.1 检查与构建
|
||||
|
||||
- Prettier:`singleQuote`、`jsxSingleQuote`,换行 LF;规范类文档使用紧凑表格(`.prettierrc.mjs` 的 overrides)。
|
||||
- ESLint:许可证头、`no-undef`、未使用 import 报错、Hooks 规则、禁用 UI 库导入,`--max-warnings=0`。
|
||||
- ESLint:`no-undef`、未使用 import 报错、Hooks 规则、禁用 UI 库导入,`--max-warnings=0`。
|
||||
|
||||
```bash
|
||||
npm run eslint # 0 错误 0 警告
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# UI 公共组件与样式规范
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.5
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-20 · 版本:v2.6
|
||||
|
||||
所有后台页面共用的主题与组件标准。页面规范只记录与本文不同的部分;编码约定见 `DEV_STANDARDS.md`,外壳与布局见 `GLOBAL_UI_BASELINE.md`。
|
||||
|
||||
@@ -125,17 +125,26 @@ html.dark .km-page {
|
||||
|
||||
## 4. 表格搜索栏(筛选卡)
|
||||
|
||||
- **筛选卡与列表卡间距**:从筛选卡底边到下方列表卡顶边统一为 18px,复用 `--uc-layout-gap`。同一对相邻区块只设置一次间距,优先由共同容器的 `gap` 控制。企业端以 `/org/logs` 为对齐基准,审计日志若在页签与筛选卡之间插入说明条,说明条上下也各留 18px。
|
||||
- 背景:使用不透明的卡片纯色;浅色为白色,深色沿用主题卡片色,不使用渐变背景。
|
||||
- 字段竖排:标签在上(13px,次文字色,下距 8px),控件在下且宽度占满单元格。
|
||||
- 栅格:列间距与行间距 16px;按页面宽度取 3–5 列(企业中心 3 列、控制台 4 列、用户中心 5 列,时间范围可跨 2 列);≤ 768px 单列。
|
||||
- 操作:“重置”“搜索”位于右下,间距 8px;“搜索”为 primary 且 `htmlType='submit'`,回车提交。
|
||||
- 行为:搜索与重置都回到第 1 页;重置 = 清空表单 + 以默认条件重新查询;只切换筛选的页签放在筛选卡上方。
|
||||
- 搜索保留当前页码、每页条数、排序、勾选和展开等表格操作状态。点击“重置”时取消待执行搜索及在途筛选请求,恢复本页的默认筛选条件,回到第 1 页并初始化本页的表格操作状态。只切换筛选的页签放在筛选卡上方。
|
||||
- 移动端:用户中心与控制台默认收起,通过“显示 / 隐藏操作项”或“筛选”按钮展开;列设置入口不随筛选收起。
|
||||
- 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心使用 `OrgFilterCard`,不要另写网格。
|
||||
- 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心常规筛选使用 `OrgFilterCard`。消耗明细及提示词记录复用个人消费记录的筛选布局和移动端折叠。
|
||||
- 标准列表以 `/console/token` 为参考,覆盖控制台分佣、兑换码、会员卡和发票,企业及个人分佣,以及用户中心密钥管理(含各自子页、页签和详情列表)。使用 `ConsoleCollection`(或通过 `CardPro` 接入);独立列表可用 `ConsoleCollectionSearch` + `ConsoleFilterGrid`。筛选栅格为三列、≤ 1100px 两列、≤ 768px 单列。
|
||||
- 搜索操作在筛选卡右下,先默认样式“重置”(无图标),再带放大镜的主按钮“搜索”;点击和回车共用同一个提交入口。保留原有即时筛选及请求方式,移动端统一通过“显示/隐藏操作项”切换。
|
||||
- 搜索操作在筛选卡右下,先默认样式“重置”(无图标),再带放大镜的主按钮“搜索”;点击和回车共用同一个提交入口。移动端统一通过“显示/隐藏操作项”切换。
|
||||
- 工具栏在列表卡内、表格上方:列表标题、计数或快捷筛选在左;已有的批量、导出、刷新、列设置、新建等动作在右,主操作尽量靠右,使用公共操作图标和清晰文案。窗口变窄时自然换行。只读明细若没有筛选或业务动作,不新增占位按钮。
|
||||
|
||||
### 4.1 时间范围及自动搜索
|
||||
|
||||
- 表格筛选的范围控件使用 `DatePicker` 或 `Form.DatePicker` 的 `tableFilter`,开始和结束输入框共用一个控件,支持清除。仅日期使用 `YYYY-MM-DD`,含时间使用 `YYYY-MM-DD HH:mm:ss`。日期弹层使用当前主题;桌面快捷周期位于日历左侧,窄屏可换行。
|
||||
- 快捷周期依次为今天、近 7 天、本周、近 30 天、本月,复用 `DATE_RANGE_PRESETS`。相对周期按选择时的本地日期计算,匹配已提交范围时显示选中态。页面沿用自身初始日期或空值。选择完整范围、确认时间、选择快捷周期或清除后,通过同一个值变更入口提交;临时选择、悬浮预览和下拉搜索词不触发列表查询。
|
||||
- `useFilterSearch` 将字段变更合并为一次 300ms 防抖查询。兼容表单用 `onValueChange={scheduleSearch}`,原生 Ant Design Form 用 `onValuesChange` 传最终值;独立受控字段可用 `changeFilter(setValue)`。输入框、数字组件、选择器、开关、复选和异步选择组件均在实际筛选值变化时接入。搜索按钮和回车共用 `submitSearch`,立即执行待查询条件。
|
||||
- 后端分页沿用现有查询接口,传当前页及条件,同时将 `AbortSignal` 传到 `API`。字段变化、重置和卸载取消在途查询,忽略过期响应。以页码或已应用条件驱动请求的页面可用 `useTableFilterQuery` 将取消操作传给 `useFilterSearch`。
|
||||
- 本地分页先按条件处理完整数据集再切页。独立控件可用 `useLocalTableFilters` 分开显示值与已应用值,再用 `useFilteredTableRows` 计算结果。大数组过滤复用 `filterTableRows`,超出 500 行时分片让出主线程,并在每批检查取消状态。
|
||||
|
||||
## 5. 表格
|
||||
|
||||
### 5.1 表头与行
|
||||
@@ -151,12 +160,14 @@ html.dark .km-page {
|
||||
### 5.2 列
|
||||
|
||||
- 每列显式 `width`,长文本 `ellipsis` 并配 `Tooltip`;金额与数量右对齐;时间统一格式,必要时日期与时间分两行。
|
||||
- 状态列用 `Tag` 或 `Switch`(见第 11 节);启停开关请求中禁用,失败恢复原状态。
|
||||
- 操作列放在最后,标题固定为“操作”,按钮为 `type='link' size='small'`,同一行操作间距 8px;用户中心、企业中心、控制台(含系统设置)的操作列统一 `fixed: 'right'`。`/console/user` 的用户列表和 `/console/commission?view=partners` 的合作伙伴列表使用 `TableRowActions`:直出高频动作,其余放进带下箭头的文字“更多”菜单。其他列表沿用既有操作呈现方式,不批量套用此菜单。菜单点击打开、右对齐,无有效菜单项时不渲染入口;危险项置末、标记 `danger` 并保留业务确认。现有权限、状态限制、禁用项和回调不得因收纳而改变,方向键、Enter、Escape 可操作菜单。
|
||||
- 状态列用只读 `Tag` 或 `TableStatusSwitch`(见第 11 节);启停开关请求中禁用,失败恢复原状态。
|
||||
- 调用、计费和访问权限分组列使用 `TableGroupTags`,单组与多组按同一套颜色渲染(见第 11 节)。
|
||||
- 操作列放在最后,标题固定为“操作”,按钮为 `type='link' size='small'`,同一行操作间距 8px;用户中心、企业中心、控制台(含系统设置)的操作列统一 `fixed: 'right'`。`/console/user` 的用户列表、`/console/subscription` 的会员列表和 `/console/commission?view=partners` 的合作伙伴列表使用 `TableRowActions`:直出高频动作,其余放进带下箭头的文字“更多”菜单。其他列表沿用既有操作呈现方式,不批量套用此菜单。菜单点击打开、右对齐,无有效菜单项时不渲染入口;危险项置末、标记 `danger` 并保留业务确认。现有权限、状态限制、禁用项和回调不得因收纳而改变,方向键、Enter、Escape 可操作菜单。
|
||||
- 三中心表格通过 `CenterActionTable` 统一处理,最后一列存在创建、查看、编辑、测试、详情、删除、添加、设置、配置、弹窗 / 抽屉或请求交互时,列头统一显示“操作”并固定右侧,宽度按按钮 / 交互数量计算。没有操作列但估算列宽超出容器时,从右侧固定末 4 列,列数不足时降为 3、2、1 列。固定列使用不透明底色并保持表头层级;横向滚动条遵循 Ant Design 官方固定列表格行为,允许鼠标、触控板、触屏和键盘滚动,不隐藏滚动条。
|
||||
- 列显隐只在已有列设置的表格中提供,统一使用 `ColumnSettings`(见 `docs/ui/TABLE_COLUMN_SETTINGS_SPEC.md`)。
|
||||
- 三中心表头背景统一由 `center-table.css` 绘制:页面通过 `--center-table-head-bg` 提供色调,公共层在不透明的容器底色上叠加同色填充,普通列与固定列保持一致;页面不再直接覆盖表头 `background`。固定列使用 antd 6 的 `.ant-table-cell-fix` 与原生动态层级,不写死 `z-index`,不使用旧版 `fix-left` / `fix-right` 类名补丁;表头不换行,表头与正文沿用同一列宽和对齐方式。
|
||||
- 操作列在异步数据或列变化后重新测量可见行的按钮宽度,取最大值;列宽不超过表格容器,按钮组在空间不足时换行。左右固定区总宽超过容器时,保留右侧操作列,其余固定列参与横向滚动;容器恢复足够宽度后恢复原固定配置,避免窄屏相互遮挡。
|
||||
- 操作列的删除入口置末并用 `danger`;点击仅打开确认,确认后的提交与刷新按第 8 节执行。无权删除或当前状态不允许删除时,沿用业务的隐藏或禁用规则。
|
||||
|
||||
### 5.3 状态
|
||||
|
||||
@@ -171,7 +182,9 @@ html.dark .km-page {
|
||||
- 位置:列表卡底部右对齐,上距 16px;移动端换行显示并提供快速跳页。
|
||||
- 外观:小尺寸,可切换每页条数 `[10, 20, 50, 100]`,总数文案 `t('共 {{total}} 条', { total })`。
|
||||
- 用法:分页列表使用 `@/components/ui` 的 `Table` / `Pagination`。第 4 节的标准列表及其明细分页均沿用密钥管理:表格底部右对齐、小尺寸,依次显示“共 N 条”、上一页/页码/下一页、每页条数(10、20、50、100),移动端保留跳页。已加载的明细可本地分页;服务端分页传 `currentPage`、`pageSize`、`total` 以及分页回调,切换每页条数回到第 1 页,只发一次请求。导出仍作用于原有结果范围,不受当前页条数影响。
|
||||
- 删除当前页最后一条后回到上一页;前端分页的列表在筛选或数据变化时回到第 1 页。`/org/*` 的独立表格、页签和下钻明细均用此分页规则;已加载的树形表格按根节点分页,子节点不拆散;接口已分页时沿用原查询与总数。
|
||||
- 删除当前页最后一条后回到上一页;筛选和搜索沿用当前页,重置回到第 1 页。`/org/*` 的独立表格、页签和下钻明细均用此分页规则;已加载的树形表格按根节点分页,子节点不拆散;接口已分页时沿用原查询与总数。
|
||||
- 受控分页须实现条数回调(或兼容的统一变更回调)才显示条数选择,不用客户端切片模拟固定条数的服务端接口;分页启用且有结果时单页也显示分页栏。
|
||||
- 接入自动搜索的表格使用 `preservePage`。筛选后当前页没有结果时仍保留页码,分页栏显示实际结果总数并允许手动返回。删除后的页码调整由对应删除流程处理。
|
||||
|
||||
## 7. 表单项
|
||||
|
||||
@@ -191,7 +204,11 @@ html.dark .km-page {
|
||||
| 外观 | 圆角 12px;标题 16px / 600;正文与页脚使用 antd 默认间距 |
|
||||
| 页脚 | 次操作(取消)在前、主操作(确定 / 保存)在后,按钮高 34px、间距 8px;危险确认用 `okButtonProps={{ danger: true }}` |
|
||||
| 行为 | 提交中 `confirmLoading`;校验或请求失败不关闭;X、取消、Esc、遮罩关闭行为一致 |
|
||||
| 确认框 | 单条删除用 `Popconfirm`;批量或不可撤销操作用 `Modal.confirm`(企业中心用 `OrgModal.confirm`) |
|
||||
| 表格操作列危险确认 | 删除、注销和冻结使用小尺寸危险链接,更多菜单使用危险菜单项。普通单条操作用 `TableActionPopconfirm`,注销、企业冻结等影响较大的操作用确认弹窗。取消在前,危险确认在后;优先聚焦取消 |
|
||||
|
||||
- 保留业务定制的标题、正文和按钮文案,并接入国际化。确认信息明确操作对象和影响。
|
||||
- 只有明确确认才发送请求;取消、Esc 或关闭不修改数据。确认回调返回 Promise,提交中显示加载并防止重复请求,失败保留确认及上下文并提示原因。成功后关闭确认并刷新列表,删除当前页最后一条时按分页规范回退。
|
||||
- 表格危险操作的回调在 API 明确失败时返回 `false`。确认框保持打开,业务回调保留原有错误提示。受控弹窗由业务在成功后关闭。
|
||||
|
||||
## 9. 抽屉
|
||||
|
||||
@@ -221,7 +238,8 @@ html.dark .km-page {
|
||||
- **状态**用语义色:成功 `success`、失败 `error`、进行中 `processing`、等待 / 警告 `warning`、中性 `default`。
|
||||
- **分类**(分组、类型、模型标签等)用调色板色(`blue`、`green`、`purple`、`gold`、`cyan` 等 antd 预设),不用非预设色名。
|
||||
- 全局默认描边;卡片内的分类标签与企业中心表格标签用无边框样式,新代码写 `variant='filled'`(antd 6 已弃用 `bordered={false}`,二者视觉等价;存量写法可在修改时顺带收敛)。标签间距 8px,表格内标签不留右外边距。
|
||||
- 可启停的记录用 `Switch size='small'`,`onChange` 调原处理函数;无启停接口的列表保留只读 `Tag`。
|
||||
- **表格启停开关**以 `/user-center/key-management` 为准,复用 `TableStatusSwitch`:小尺寸、开启显示「启用」并使用系统主题主色,关闭显示「禁用」并使用组件中性色。其他既有布尔含义可自定义两态文字。保留键盘焦点、可访问名称、原有确认和权限;关闭状态不等于控件不可操作。只读状态仍用 `Tag`,过期、耗尽等非二元状态的说明保留,表单与筛选区开关不套用本规则。
|
||||
- **表格分组颜色与布局**以 `/console/organizations` 分组列为准,复用 `TableGroupTags`(单个标签也可用 `TableGroupTag`)。三种分组的标签文字固定为 `default`、`vip`、`svip`,颜色分别为蓝、黄、红。分组列禁止追加「(默认)」等说明,默认分组设置继续在表单中体现。`premium`、`pro` 沿用原名及红、黄配色,自定义分组用中性色。使用 antd 浅底描边标签并适配明暗主题。标签逐个着色、去重,按 4px 间距单行排列。纯分组列复用 `TABLE_GROUP_COLUMN_WIDTH`(148px),以完整容纳三枚标准标签为准。超出单元格的分组可横向滚动,已有的「+N」展开仍可使用。空值继承、智能熔断和非调用分组沿用各自的业务展示。
|
||||
|
||||
## 12. 按钮与图标
|
||||
|
||||
@@ -245,8 +263,8 @@ html.dark .km-page {
|
||||
|
||||
组件分层(antd 原生、中心封装、契约封装、专用组件)及选用方式见 `DEV_STANDARDS.md` 2.1、2.2 节。`src/components/ui/*` 只做视图映射,不放请求、权限与业务状态。
|
||||
|
||||
- 禁止导入:`@lobehub/*`、Radix UI、Floating UI、Semi、MUI、Chakra、Headless UI、leva、antd-style、react-layout-kit(`eslint.config.cjs` 的 `no-restricted-imports`)。
|
||||
- `npm run check:ui` 审计源码导入、完整 lock 图与品牌图标资产 hash,已包含在 `npm run check` 中。
|
||||
- 禁用范围见开发规范第 2.4 节;ESLint 与 `npm run check:ui` 共用一份规则,本地品牌图标不是运行时 UI 依赖。
|
||||
- `npm run check:ui` 审计根目录 JS 配置、应用源码、脚本和单测的包引用,并检查依赖声明、锁文件中的传递包和别名,以及品牌图标资产 SHA-256。命令已包含在 `npm run check` 中。
|
||||
- `antd` 与 `@ant-design/icons` 精确锁定版本;`src/components/ui/antd-v5-compat.css` 统一标签间距、分页选择器宽度与必填标记字体,页面样式可以覆盖。
|
||||
- 当前版本 API 约定:Card 用 `variant`,Drawer 用 `size`,弹层遮罩用 `mask` 配置,Alert 标题用 `title`;样式选择器使用 `.ant-modal-container`、`.ant-alert-title`、`.ant-collapse-body`。聊天消息列表使用 `List`(antd 已标记弃用),替换前需先建立该区域的视觉基线。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 控制台 UI 规范(/console/\*)
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.4
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-25 · 版本:v2.7
|
||||
|
||||
管理控制台 `/console/*` 的规范:统一页头、控制台原语与差异样式。
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
- 提示栏:控制台内的 `Banner` / `Alert` 统一走 `ConsoleAlert`,内边距 12px 16px、正文 14 / 22px、图标 16px,颜色取对应语义 token。
|
||||
- 系统设置(`page.key === 'setting'`):表单统一纵向布局、8px 标签间距、24px 栅格、控件等宽,校验信息预留高度;弹窗页脚按钮高 34px、间距 8px、右对齐。规则限定在 `.settings-page` / `.settings-form-dialog`。
|
||||
- 控制台上下文中 `CompactModeToggle` 不渲染,表格密度状态保留;其他模块仍可使用紧凑模式。
|
||||
- 兑换码列表沿用渠道列表的行内链接按钮、右侧固定操作列和底部分页。「查看、复制、编辑、禁用/启用、删除」在同一行直接显示,保留既有权限和状态限制,删除仍需确认。窄屏横向滚动时操作列不换行。批量复制在选中兑换码后可用,清除失效兑换码由独立的危险操作确认承载。
|
||||
- 添加兑换码与编辑兑换码信息共用右侧侧栏窗、表单样式及页脚。查看详情使用弹窗,优先展示兑换码和状态,再列出额度、时间与兑换人信息。
|
||||
- 平台 Skill 中心的分类标签区域与搜索工具栏同宽、左对齐,不保留独立的最大宽度和自动居中;窄屏按原间距自然换行。
|
||||
- 平台 Skill 详情的审核工作台仅由抽屉正文纵向滚动,技能原文不设置独立滚动区;审核操作进入抽屉固定页脚,按钮右对齐、间距 8px,仅在审核页签展示。
|
||||
- 官网文章抽屉允许点击遮罩关闭,X、取消、遮罩共用同一未保存内容确认流程。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 后台 UI 全局基线
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-19 · 版本:v3.12
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-23 · 版本:v3.14
|
||||
|
||||
后台外壳与布局基线:顶栏、侧栏、公告、页头与内容边距、登录页,以及原型未定义场景、登录关卡与验收流程。主题与组件样式见 `UI_COMPONENT_STANDARDS.md`。
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
| 滚动条 | 全站 6px,`#8b8b8b`,悬停 `#636363`,页面不得单独设置 |
|
||||
| 装饰 | 无设计依据不加渐变、玻璃、发光、浮起与动效 |
|
||||
| 登录关卡 | 真实 UI 登录,企业先于个人,凭据只经环境变量(第 6 节) |
|
||||
| 验收 | 浅深主题 × 1920×1000 / 393×851,有头离屏串行,唯一页面不抢焦点,模拟与真实分开记录(第 7 节) |
|
||||
| 验收 | 浅深主题 × 1920×1000 / 393×851 / 360×800,有头离屏串行,唯一页面不抢焦点,模拟与真实分开记录(第 7 节) |
|
||||
|
||||
**相关代码**:`src/styles/{user-center,center-layout,org-page,prototype}.css`、`src/index.css`、`src/components/layout/`
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
1. **内容边距**:读取 `user-center.css` 的 `--uc-page-pad-top/x/bottom`(桌面 30 / 36 / 36px,≤ 768px 为 16 / 16 / 24px)。普通页面根节点用 `.uc-page`;数据看板 `.uc-dashboard`、服务监控 `.user-center-service-page`(`calc(64px + 顶距)`,抵消宿主 `-mt-[64px]`)、下载页 `.weyai-download--embedded` 直接引用这些变量。企业功能页(`.org-*-page`、`.knowledge-page`、`.org-workbench`)走 `org-page.css`。禁止写死页面级边距或使用 `p-4 sm:p-6 lg:p-8`。工作区块间距 `--uc-layout-gap: 18px`。
|
||||
2. **页头**:用户中心用 `<UserCenterPageHeader title subtitle extra />`,企业中心用 `OrgPageHeader`(内部复用前者)。面包屑 12 / 18px,距内容区顶 30px,父级 `--text-secondary`、当前项 `--text-primary`,分隔符左右 10px,与标题 24px;标题 28 / 32px / 650 / 字距 -0.6px(`--uc-heading`);副标题 14 / 22px、上距 6px(`--uc-subtitle`);页头与首块 18px;右侧操作放 `extra`(间距 8px,窄屏换行)。页面不得覆盖这些数值,数据看板只保留 hero 装饰层。
|
||||
3. **面包屑登记**:用户中心在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记,显示“用户中心 / 当前页面”;企业中心在 `OrgBreadcrumb` 的 `orgPageGroups` 登记,分组页显示“分组 / 当前页面”,其他为“企业中心 / 当前页面”,未登记页面以标题兜底。带 hero 的企业功能页在 hero 内首个元素顶部放 `<OrgBreadcrumb />`。不在原本没有面包屑的页面新增导航;没有副标题文案时只传 `title`。
|
||||
3. **面包屑登记**:用户中心在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记,显示“用户中心 / 当前页面”;企业中心在 `OrgBreadcrumb` 的 `orgPageGroups` 登记,分组页显示“分组 / 当前页面”,其他为“企业中心 / 当前页面”,未登记页面以标题兜底;体验中心(云端大脑 / 图片生成 / 视频生成)用 `ExperiencePageHeader`(内部复用 `UserCenterPageHeader`),显示“体验中心 / 当前页面”,企业中心宿主的云端大脑保留原卡片页头。带 hero 的企业功能页在 hero 内首个元素顶部放 `<OrgBreadcrumb />`。不在原本没有面包屑的页面新增导航;没有副标题文案时只传 `title`。
|
||||
4. **滚动条**:全站滑块 `#8b8b8b`、悬停 `#636363`、宽高 6px、圆角 3px、轨道透明,值来自 `tokens.css` 的 `--brand-scroll` / `--brand-scroll-hover`,规则集中在 `src/index.css`。页面 CSS 与内联样式禁止设置 `scrollbar-width` / `scrollbar-color`(Chrome 121+ 设置后会忽略 `::-webkit-scrollbar`),标准属性只在 `@supports not selector(::-webkit-scrollbar)` 中给 Firefox。三中心操作表格沿用 Ant Design 固定列表格的横向滚动行为,不隐藏滚动条。
|
||||
5. **验证**:逐页核对左右边距、面包屑顶距、标题与副标题字号间距、滚动条静止与悬停颜色(桌面 / 移动 × 浅 / 深)。
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
|
||||
- 带侧栏页面按 4.4;控制台按 `CONSOLE_SPEC.md`;其余页面内容默认 24px 30px、移动 16px。筛选区自然换行,表格在自身容器横向滚动;不通过隐藏正文、裁剪校验信息或固定整页宽度迎合截图。
|
||||
- 模型超市与技能超市的工作区居中,含内边距的最大宽度为 1760px;横向内边距为 `clamp(20px, 4vw, 80px)`,Hero 搜索区域沿用同一横向留白,600px 及以下为 20px。覆盖 3840 / 2560 / 1920 至 360px 宽度,目录按实际可用宽度减少列数,保留卡片正文和控件正常字号,不通过整体缩放压缩内容。
|
||||
- WeyAi 两个下载路由共用页头、安装卡、工作台示意、平台安装包、功能和使用步骤。公开页的居中容器含内边距最大宽度为 1464px。首屏在页面可用宽度 960px 及以下上下排列,安装包分组在 1024px 及以上显示三列,在 768–1023px 显示两列,其余宽度显示一列,文件名可换行。用户中心内嵌页沿用第 4.4 节的面包屑和内容边距,下载页背景从面包屑区域开始覆盖内容区,面包屑与首屏标题区间隔 24px。
|
||||
- 背景图优先复用原型的原始 SVG / 图片,放入 `src/assets/prototype` 并注明来源;原型用 CSS 绘制的背景按测量值在页面作用域复现,不用生成插画替代。
|
||||
- 企业工作台横幅 `.ew-hero` 的浅金 / 深棕背景与三层轮廓只用于 `.org-workbench`,不扩散到其他页面。
|
||||
- 原型未定义、antd 有组件:用当前版本默认样式与主题 token。antd 无对应部件:语义背景 / 文字 / 边框,无装饰背景、阴影与动画,间距 8 / 16 / 24px,窄屏堆叠且操作可达;新增此类统一规则先写入本文。
|
||||
@@ -150,8 +151,8 @@
|
||||
| 配置 | 约定 |
|
||||
| --- | --- |
|
||||
| 设备源 | `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 沿用模板;平板仅为桌面设备的平板尺寸 |
|
||||
| 视口 | 默认 1920×1080、360×800、393×851;扩展增加 768×1024、1024×768、1366×768、1440×900、2560×1440、3840×2160 |
|
||||
| 手机 | Pixel 5 UA、触摸、移动模式和 DPR 2.75;默认项目覆盖 360×800(`chrome-mobile`)和 393×851(`chrome-mobile-393`),screen 沿用模板;平板仅为桌面设备的平板尺寸 |
|
||||
| 本地目标 | 未指定目标时自动发现并复用已有开发服务,确认不存在后才启动 `http://127.0.0.1:4176/`;开发和预览均严格占用指定端口,禁止静默回退 |
|
||||
| 目标切换 | `local-dist` 先校验静态入口与引用资源,再启动 Vite preview;`remote` 必须提供 `PW_BASE_URL`,不启动服务 |
|
||||
| 窗口 | 本地默认有头离屏;`PW_HEADLESS=1` 无头,CI 强制无头;隐藏滚动条并禁用后台降频 |
|
||||
@@ -175,7 +176,7 @@
|
||||
|
||||
### 7.3 采集与判定
|
||||
|
||||
- 固定视口(桌面 1920×1000 / 移动 393×851,专项另有规定从其规定)、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce`、相同数据与状态;用角色、标签、测试标识定位,用条件等待,不依赖固定延时与坐标。
|
||||
- 固定视口(桌面 1920×1000,移动 393×851 和 360×800。360×800 是必测的最小移动视口,专项可增加其他尺寸)、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce`、相同数据与状态;用角色、标签、测试标识定位,用条件等待,不依赖固定延时与坐标。
|
||||
- 等待懒加载、骨架屏、提交中状态结束;检查错误消息、控制台、实际路由与无效数值,不能只凭无 pageerror 判定通过。
|
||||
- 只读验收记录所有非 GET `/api/` 请求(应为 0);模拟响应按接口真实结构提供并标注;真实写入只用可清理的测试数据;支付未启用不得写成支付通过。
|
||||
- 定位双字按钮允许 antd 默认字间距,如 `getByRole('button', { name: /^(?:loadings+)?保s*存$/ })`;虚拟 Select 用可见选项或组合框键盘操作,不点击隐藏的辅助选项。
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
| --- | --- |
|
||||
| 路由 | `/user-center/key-management`,旧 `/key-management` 重定向 |
|
||||
| 视图 | `KeyManagement/index.jsx` + `key-management.css`;编辑抽屉由 `EditTokenModal presentation='drawer'` 渲染 |
|
||||
| 业务 | `useTokensData`、`/api/token*`、`buildTokenPayload`、启停与删除确认不变 |
|
||||
| 列表 | 固定列宽,每页 5 条;列设置不持久化 |
|
||||
| 业务 | `useTokensData` 负责后端查询与分页;`buildTokenPayload`、启停与删除确认不变 |
|
||||
| 列表 | 固定列宽,默认每页 10 条;列设置不持久化 |
|
||||
| 抽屉 | 模型列表 440px;创建 / 编辑 560px(移动 100%) |
|
||||
| 外壳 | 页头与边距按 `GLOBAL_UI_BASELINE.md` 4.4 |
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
| `src/pages/KeyManagement/key-management.css` | 页面作用域样式与 `--km-*` 变量 |
|
||||
| `src/components/table/tokens/modals/EditTokenDrawer.jsx` | 创建 / 编辑抽屉视图 |
|
||||
| `src/components/table/tokens/modals/EditTokenModal.jsx` | 状态、`formApi`、`submit`、`buildTokenPayload`;`presentation='drawer'` 时渲染抽屉 |
|
||||
| `src/hooks/tokens/useTokensData.jsx` | 列表、搜索、分页、启停、删除(不改) |
|
||||
| `src/hooks/tokens/useTokensData.jsx` | 列表、搜索、分页、启停、删除 |
|
||||
|
||||
独立路由形态(`.km-page-standalone`)只补顶栏偏移(桌面 100px、移动 80px)。
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
| 区域 | 规则 |
|
||||
| --- | --- |
|
||||
| 页头 | `UserCenterPageHeader`;“新手教程 / 查看操作指引”图标按钮保留在右侧 |
|
||||
| 查询卡 | 单字段:标签 + `Input allowClear`(宽 620px)+“重置”“搜索”;卡片上下内边距 22px,描边 `#f0f0f0`(深色 `--border-subtle`) |
|
||||
| 列表 | `Table size='middle' tableLayout='fixed'`,列宽 150 / 300 / 150 / 100 / 180 / 100 / 100 / 130;每页 5 条;列设置用 `ColumnSettings`,不持久化 |
|
||||
| 状态 | `Switch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` |
|
||||
| 分组 | `Tag color='blue'` 无边框 + `Tooltip`;额度为 `Tag color='success'` |
|
||||
| 查询卡 | 保留单输入框,匹配密钥名称、Key 或分组。输入防抖,点击搜索或按回车立即提交,重置取消待提交条件并回到普通列表第 1 页 |
|
||||
| 列表 | `Table size='middle' tableLayout='fixed'`,列宽 150 / 300 / 150 / 100 / 180 / 100 / 100 / 130;默认每页 10 条;列设置用 `ColumnSettings`,不持久化 |
|
||||
| 状态 | `TableStatusSwitch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` |
|
||||
| 分组 | `TableGroupTags` + `Tooltip`,颜色按组件公共规范;额度为 `Tag color='success'` |
|
||||
| 密钥 | `<code>` 密钥框(底 `#f4f6f9`、描边 `#e4e9ee`,深色引用 `--surface-bg-base` / `--border-subtle`)+ 显示、隐藏、复制图标按钮 + `Tooltip`;脱敏提示 `Alert type='success'` |
|
||||
| 模型抽屉 | 440px;正文 20px;卡片间 18px;信息卡 16px(标签 12 / 18px);分类头 45px(底 `#f6f8fa`);模型名高 28px(等宽 12px、底 `#fafafa`);行距 9.5px、列距 8px;面板描边 `#e4e9ef` |
|
||||
| 编辑抽屉 | 560px(移动 100%);适配 `Form requiredMark={false}`;过期快捷 `Button` 组(间距 5px、描边 `#d9dfe6`、无按钮阴影,`aria-pressed`);仅“自定义”显示 `DatePicker showTime`;高级设置 `Collapse`(`forceRender`)+ `Switch` + `Divider`;页脚按钮间距 10px |
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
## 3. 保留功能与已知差异
|
||||
|
||||
- 默认名称 `claudeNN`、每页 5 条、过去日期禁用为业务默认;“搜索”与回车即时生效。
|
||||
- 默认名称 `claudeNN`、过去日期禁用为业务默认。
|
||||
- 普通列表通过 `/api/token/` 服务端分页。个人搜索接口当前不支持单条件同时匹配名称、Key 和分组,也不提供分页结果;为保持原有条件,搜索复用个人列表接口取全后本地匹配和分页,不调用控制台管理接口。未取全时不展示部分搜索结果。
|
||||
- 技能注入关闭时“绑定技能”字段仅隐藏,仍注册在表单中,载荷不变。
|
||||
- 模型抽屉不显示来源说明行;“自定义”过期选项选中时仅文字变主色。
|
||||
- 第三方新手引导(Joyride)沿用其自身配色配置。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 企业中心 UI 规范(/org/\*)
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.3
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-25 · 版本:v2.5
|
||||
|
||||
企业中心 12 个目标页的规范:企业中心变量、通用组件的企业中心变体与各页面规则。
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
| 关注点 | 规则 |
|
||||
| --- | --- |
|
||||
| 范围 | 工作台、数据看板、员工管理、项目管理、预算中心、审批中心、密钥管理、企业充值、消耗明细、审计日志、个人设置、企业设置;“我的 AI 能力”“组织架构”“角色管理”不改 |
|
||||
| 范围 | 工作台、数据看板、员工管理、项目管理、预算中心、审批中心、令牌管理(原“密钥管理”)、企业充值、消耗明细、审计日志、个人设置、企业设置;“我的 AI 能力”不改;“组织架构”页面名称统一为“部门管理”(与权限目录一致,2026-11-23);“角色管理”为统一权限体系新增页面(2026-11-23) |
|
||||
| 样式 | `org-center.css`,作用域 `.org-center .oc-page`,颜色只写 `--oc-*`(第 2 节) |
|
||||
| 组件变体 | 紧凑表格、3 列筛选、无图标行操作、`.oc-list-tabs`、无边框标签(第 3 节) |
|
||||
| 弹层 | `OrgModal` / `OrgSideSheet`,原型风格遮罩;密钥抽屉 560px |
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
- 视觉依据:在线原型 `http://192.168.0.161:8888` 顶栏“企业中心”(深色用“切换至暗色主题”),只作视觉依据,不作业务、路由、数据依据。
|
||||
- 只对齐背景、字体、图标、表格、表单、卡片、页签、搜索条件、操作列、弹窗、按钮、颜色、文字、间距与已有交互反馈;不改请求、载荷、状态、路由、权限与触发条件。
|
||||
- 原型有而系统无的功能不补建:员工筛选卡、CSV 导出、新建员工 / 分配角色 / 离职、角色管理、在职 / 离职筛选、订单号搜索、分组列、发票入口。例外:企业密钥管理的分组列与列设置已按需求实现。
|
||||
- 原型有而系统无的功能不补建:CSV 导出、在职 / 离职页签、订单号搜索、分组列、发票入口。例外:企业密钥管理的分组列与列设置已按需求实现。
|
||||
|
||||
## 2. 作用域与变量
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
- **页头**:`OrgPageHeader`(内部复用 `UserCenterPageHeader`),规格见 `GLOBAL_UI_BASELINE.md` 4.4;页头不放操作按钮,操作移入列表卡头。面包屑分组见 4.4 第 3 条。
|
||||
- **列表卡 `OrgListCard`**:卡头与表格间距 20px;表格为紧凑变体(正文 13px,表头 12px / 500、底色 `--oc-soft`,行上下内边距 17px);分页按公共组件规范,覆盖页签及表格明细。
|
||||
- **筛选卡 `OrgFilterCard`**:固定 3 列;筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。
|
||||
- **筛选卡 `OrgFilterCard`**:默认 3 列。提示词记录和消耗明细的筛选区沿用个人消费记录的布局。筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。
|
||||
- **行操作 `OrgRowActions`**:link 按钮 13 / 24px、无内边距、间距 10px,不带图标。
|
||||
- **列表页签 `.oc-list-tabs`**:导航高 44px,页签内边距 12px 0,选中与悬停色为 `--oc-brand`;只切换筛选时加 `.oc-tabs-nav-only`。
|
||||
- **标签**:表格与卡片内标签统一无边框(`variant='filled'`);非 antd 预设色改用 `gold` / `purple`。
|
||||
@@ -64,14 +64,15 @@
|
||||
| --- | --- | --- |
|
||||
| 工作台 | `OrgHero` 标签化身份与 `oc-wb-*` 卡片(额度、密钥、用量、最近申请);横幅 `.ew-hero` 背景只在 `.org-workbench` 作用域 | 额度周期标签放在重置卡;最近申请无分页 |
|
||||
| 数据看板 | `oc-dash-*` hero(健康提示“企业运行正常”、企业名、企业额度、组织概况)+ `OrgAnalyticsPanel`(汇总条、趋势 `Segmented`、分布、明细页签) | 时间范围 7 / 30 / 90 天;企业名来自 `orgInfo.name`,无值时隐藏 |
|
||||
| 员工管理 | 页签(员工权限 / 员工账号)+ 列表卡;首列与操作列固定;备注独立列;状态 `Switch` | 无筛选卡与在职 / 离职页签 |
|
||||
| 员工管理 | 筛选卡(关键字、分组、组织、状态,服务端筛选)+ 单张列表卡,不分页签;备注独立列;状态 `Switch`;新建 / 编辑用抽屉 | 无在职 / 离职页签 |
|
||||
| 项目管理 | `OrgListCard` + link 操作(模型 / 分组 / 成员 / 密钥 / 编辑);状态开关 | 操作列不再显示“停用” |
|
||||
| 预算中心 | `.oc-policy` 固定说明条;列宽 300 / 110 / 260 / 120 / 120 / 130;状态开关 | 已加载数据前端分页 |
|
||||
| 审批中心 | 状态页签(回调 `setStatusFilter`)+ 申请列表卡;拒绝弹窗竖排表单项 | — |
|
||||
| Agent 任务审计 | 保留页头状态筛选、任务元数据 / 待对账 / 安全策略三个页签。记录按卡片排列,任务状态和计费状态使用独立标签,弹窗使用 `OrgModal` | 正文必须填写有效审计原因并经二次确认。页签计数、操作和焦点使用系统品牌色,状态标签使用语义色。窄屏按单列排列卡片,长编号换行 |
|
||||
| 密钥管理 | 密钥框 + 显隐 / 复制、可用模型 link、分组列、状态开关、绝对时间;列设置用共享组件;创建 / 编辑为 560px `OrgSideSheet` | 列设置只在当前页面生效;非操作列整体横向滚动,仅在可见列宽度超过容器时显示滚动条 |
|
||||
| 企业充值 | 企业钱包 + 充值工作区(额度卡 / 自定义 / 支付方式)+ 订单卡 + 记录;订单“立即充值”与支付方式点击同为 `handlePreTopUp` | 档位与折扣来自后台配置;无订单号搜索与发票入口 |
|
||||
| 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 三列筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 |
|
||||
| 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐 | — |
|
||||
| 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 消费记录样式筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 |
|
||||
| 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐,筛选区参考消费记录;说明条上下与筛选卡至列表卡均间隔 18px | — |
|
||||
| 个人设置 | 复用用户中心 `ui-personal-*`、`AvatarSection`、`SectionHeader`;三页签:头像设置 / 个人资料 / 通知设置;企业身份并入资料头 | 昵称在弹窗中修改 |
|
||||
| 企业设置 | 设置卡内页签 + 区块头(刷新 / 保存设置);复制为 14px 无内边距图标按钮 | 保留“数据安全”“危险区域”页签 |
|
||||
|
||||
@@ -83,12 +84,14 @@
|
||||
|
||||
## 5. 消耗明细(/org/logs)
|
||||
|
||||
- 绘图与视频由 `components/OrgTaskRecords.jsx` 呈现,复用 `useTaskLogsData({ organizationMode: true })`、`TaskLogsFilters`、`getTaskLogsColumns`、`exportTaskLogsPageCsv`、`ColumnSelectorModal`、`ContentModal`;结构为筛选卡 + “任务记录”列表卡(导出本页 / 刷新 / 列设置),不渲染“本页统计”区块,移动端筛选直接展开。
|
||||
- 三个页签和审计日志下的提示词记录共用个人消费记录的筛选布局:桌面五列,时间范围跨两列;窄屏三列,移动端单列并默认收起。操作区位于右下,“重置”在前,“搜索”在后,点击和回车共用提交入口。
|
||||
- 绘图与视频由 `components/OrgTaskRecords.jsx` 呈现,复用 `useTaskLogsData({ organizationMode: true })`、`TaskLogsFilters`、`getTaskLogsColumns`、`exportTaskLogsPageCsv`、`ColumnSelectorModal`、`ContentModal`;结构为筛选卡 + “任务记录”列表卡(导出本页 / 刷新 / 列设置),不渲染“本页统计”区块。
|
||||
- 任务表列宽 185 / 185 / 110 / 110 / 250 / 330 / 110 / 155 / 145 / 150;模型为行内胶囊,费用主色右对齐;分页沿用公共规范。“刷新”与“搜索”调用同一 `refresh`。
|
||||
- 时间范围为本页签自有的可编辑字段(默认最近 7 天,含快捷预设),与“明细日志”筛选互不影响;起止颠倒沿用原提示。
|
||||
- 末列“操作”不固定:视频任务显示“点击预览视频”,失败任务保留失败原因查看,其余显示“-”。
|
||||
- 预览视频沿用 `ContentModal`:标题栏“视频预览”与关闭按钮、16:9 播放区、加载态、播放失败或无地址时 `Empty` 空态、页脚复制链接 / 新标签页打开 / 关闭;关闭时暂停视频,重开同一视频不残留加载指示。
|
||||
- 成员排行行键使用 `user_id-名次序号`,避免后端同一成员多行时出现重复 key。
|
||||
- 只有具备排行权限并打开「成员排行」时才查询榜单。首次打开使用已生效的成员、模型和时间范围,默认每页 10 人。翻页和更改每页人数均携带服务端返回的 `snapshot`。搜索、重置、刷新及切换企业会重新查询当前条件下的榜单。快照过期时自动按原筛选和页容量回到第 1 页重取一次。
|
||||
- 服务端按成员汇总后按消耗额度降序排列,同额按成员 ID 升序。行键使用 `user_id`,名次按返回页码、页容量和行号连续计算。前三名使用当前主题的强调色及三档底色,其余名次使用中性色。
|
||||
- 明细日志查询不写 URL;绘图与视频筛选沿用原有 URL 同步。
|
||||
- 保留差异:明细日志无列设置、分组列、操作列;任务表无渠道 / 用户 ID 筛选、平台列、排序与任务 ID 复制。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 用户中心 UI 规范(/user-center/\*)
|
||||
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-18 · 版本:v2.4
|
||||
> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-25 · 版本:v2.5
|
||||
|
||||
个人登录后用户中心页面的规范,只记录与公共规范不同的部分;密钥管理、服务监控见各自规范。
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
- 页签:纯文字页签(公共列表页签样式),与下方 20px,URL `?tab=` 同步并懒挂载。
|
||||
- 筛选卡:5 列栅格,时间范围跨 2 列;背景使用 `--surface-card` 纯色(浅色为白色、深色为主题卡片色);操作“重置 / 搜索”右下。
|
||||
- 列表卡:标题 15px / 600,导出、列设置位于卡头右侧;表头字重 400(公共标准为 500,待收敛)。
|
||||
- 消费记录调用明细为固定列宽宽表,时间分两行(日期 11px、时间 15px / 600),操作列文字“查看”,固定在右侧;横向滚动条保留 Ant Design 官方固定列表格行为,固定列兼容规则遵循公共规范第 5.2 节。
|
||||
- 消费记录调用明细为固定列宽宽表,横向滚动时“时间”列固定在左侧,“操作”列显示时固定在右侧,中间列可滚动。时间分两行(日期 11px、时间 15px / 600),固定列兼容规则遵循公共规范第 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'>` +“复制”链接,复制提示沿用原文案。
|
||||
|
||||
+2
-69
@@ -1,24 +1,8 @@
|
||||
const globals = require('globals');
|
||||
const { rules: headerRules } = require('eslint-plugin-header');
|
||||
const react = require('eslint-plugin-react');
|
||||
const reactHooks = require('eslint-plugin-react-hooks');
|
||||
const unusedImports = require('eslint-plugin-unused-imports');
|
||||
|
||||
const headerRule = headerRules.header;
|
||||
const header = {
|
||||
rules: {
|
||||
header: {
|
||||
...headerRule,
|
||||
meta: {
|
||||
...headerRule.meta,
|
||||
schema: [
|
||||
{ enum: ['block', 'line'] },
|
||||
{ type: 'array', items: { type: 'string' } },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const { uiDependencyConfig } = require('./scripts/ui-dependency-policy.cjs');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
@@ -34,6 +18,7 @@ module.exports = [
|
||||
'src/assets/brand-icons/*.js',
|
||||
],
|
||||
},
|
||||
uiDependencyConfig,
|
||||
{
|
||||
files: ['**/*.{js,jsx}'],
|
||||
linterOptions: { reportUnusedDisableDirectives: 'off' },
|
||||
@@ -45,63 +30,11 @@ module.exports = [
|
||||
},
|
||||
settings: { react: { version: 'detect' } },
|
||||
plugins: {
|
||||
header,
|
||||
react,
|
||||
'react-hooks': reactHooks,
|
||||
'unused-imports': unusedImports,
|
||||
},
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: [
|
||||
{
|
||||
group: [
|
||||
'@radix-ui/*',
|
||||
'@floating-ui/*',
|
||||
'@lobehub/ui',
|
||||
'@lobehub/ui/*',
|
||||
'@lobehub/icons',
|
||||
'@lobehub/icons/*',
|
||||
'@douyinfe/semi-*',
|
||||
'@headlessui/*',
|
||||
'@mui/*',
|
||||
'@chakra-ui/*',
|
||||
'leva',
|
||||
'leva/*',
|
||||
'antd-style',
|
||||
'react-layout-kit',
|
||||
],
|
||||
message:
|
||||
'Use antd public APIs or the audited local brand SVG assets. Preserve legacy components/ui callback contracts.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'header/header': [
|
||||
2,
|
||||
'block',
|
||||
[
|
||||
'',
|
||||
'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',
|
||||
'',
|
||||
],
|
||||
],
|
||||
'no-multiple-empty-lines': ['error', { max: 1 }],
|
||||
|
||||
// ===== 防线:杜绝“用了未定义/未导入标识符”导致的运行时崩溃(本次线上事故根因)=====
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { defineConfig } from 'i18next-cli';
|
||||
|
||||
/** @type {import('i18next-cli').I18nextToolkitConfig} */
|
||||
|
||||
Generated
+230
-141
@@ -55,9 +55,8 @@
|
||||
"@playwright/test": "1.64.1",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"esbuild": "0.21.5",
|
||||
"esbuild": "0.25.12",
|
||||
"eslint": "9.39.5",
|
||||
"eslint-plugin-header": "^3.1.1",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-unused-imports": "4.4.1",
|
||||
@@ -66,7 +65,7 @@
|
||||
"postcss": "^8.5.3",
|
||||
"prettier": "^3.0.0",
|
||||
"tailwindcss": "^3",
|
||||
"vite": "5.4.21"
|
||||
"vite": "6.4.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.13.0",
|
||||
@@ -543,9 +542,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
|
||||
"integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
|
||||
"integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -556,13 +555,13 @@
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
|
||||
"integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
|
||||
"integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -573,13 +572,13 @@
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -590,13 +589,13 @@
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -607,13 +606,13 @@
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -624,13 +623,13 @@
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -641,13 +640,13 @@
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -658,13 +657,13 @@
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -675,13 +674,13 @@
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
|
||||
"integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
|
||||
"integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -692,13 +691,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -709,13 +708,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
|
||||
"integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
|
||||
"integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -726,13 +725,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
|
||||
"integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
|
||||
"integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
@@ -743,13 +742,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
|
||||
"integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
|
||||
"integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
@@ -760,13 +759,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
|
||||
"integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
|
||||
"integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -777,13 +776,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
|
||||
"integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
|
||||
"integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
@@ -794,13 +793,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
|
||||
"integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
|
||||
"integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -811,13 +810,13 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -828,13 +827,30 @@
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -845,13 +861,30 @@
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -862,13 +895,30 @@
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -879,13 +929,13 @@
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -896,13 +946,13 @@
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
|
||||
"integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
|
||||
"integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -913,13 +963,13 @@
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -930,7 +980,7 @@
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
@@ -5825,9 +5875,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz",
|
||||
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.12.tgz",
|
||||
"integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
@@ -5835,32 +5885,35 @@
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
"@esbuild/aix-ppc64": "0.25.12",
|
||||
"@esbuild/android-arm": "0.25.12",
|
||||
"@esbuild/android-arm64": "0.25.12",
|
||||
"@esbuild/android-x64": "0.25.12",
|
||||
"@esbuild/darwin-arm64": "0.25.12",
|
||||
"@esbuild/darwin-x64": "0.25.12",
|
||||
"@esbuild/freebsd-arm64": "0.25.12",
|
||||
"@esbuild/freebsd-x64": "0.25.12",
|
||||
"@esbuild/linux-arm": "0.25.12",
|
||||
"@esbuild/linux-arm64": "0.25.12",
|
||||
"@esbuild/linux-ia32": "0.25.12",
|
||||
"@esbuild/linux-loong64": "0.25.12",
|
||||
"@esbuild/linux-mips64el": "0.25.12",
|
||||
"@esbuild/linux-ppc64": "0.25.12",
|
||||
"@esbuild/linux-riscv64": "0.25.12",
|
||||
"@esbuild/linux-s390x": "0.25.12",
|
||||
"@esbuild/linux-x64": "0.25.12",
|
||||
"@esbuild/netbsd-arm64": "0.25.12",
|
||||
"@esbuild/netbsd-x64": "0.25.12",
|
||||
"@esbuild/openbsd-arm64": "0.25.12",
|
||||
"@esbuild/openbsd-x64": "0.25.12",
|
||||
"@esbuild/openharmony-arm64": "0.25.12",
|
||||
"@esbuild/sunos-x64": "0.25.12",
|
||||
"@esbuild/win32-arm64": "0.25.12",
|
||||
"@esbuild/win32-ia32": "0.25.12",
|
||||
"@esbuild/win32-x64": "0.25.12"
|
||||
}
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
@@ -5947,16 +6000,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-header": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz",
|
||||
"integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"eslint": ">=7.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react": {
|
||||
"version": "7.37.5",
|
||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz",
|
||||
@@ -12213,21 +12256,24 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.4.21",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.21.tgz",
|
||||
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
|
||||
"version": "6.4.6",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-6.4.6.tgz",
|
||||
"integrity": "sha512-RtsraAwEG68idOA6iUOoIpOlcSKROnf815aIq9qHTSrDNpLoBrBa12suyfcEd8qn0xwOVQI1Yhm1GbmTjF600A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.43",
|
||||
"rollup": "^4.20.0"
|
||||
"esbuild": "^0.25.0",
|
||||
"fdir": "^6.4.4",
|
||||
"picomatch": "^4.0.2",
|
||||
"postcss": "^8.5.3",
|
||||
"rollup": "^4.34.9",
|
||||
"tinyglobby": "^0.2.13"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
@@ -12236,19 +12282,25 @@
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^18.0.0 || >=20.0.0",
|
||||
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.4.0"
|
||||
"terser": "^5.16.0",
|
||||
"tsx": "^4.8.1",
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"jiti": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
@@ -12269,9 +12321,46 @@
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
},
|
||||
"tsx": {
|
||||
"optional": true
|
||||
},
|
||||
"yaml": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite/node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz",
|
||||
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"picomatch": "^3 || ^4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"picomatch": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite/node_modules/picomatch": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.7.tgz",
|
||||
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/void-elements": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/void-elements/-/void-elements-3.1.0.tgz",
|
||||
|
||||
+2
-3
@@ -89,9 +89,8 @@
|
||||
"@playwright/test": "1.64.1",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"esbuild": "0.21.5",
|
||||
"esbuild": "0.25.12",
|
||||
"eslint": "9.39.5",
|
||||
"eslint-plugin-header": "^3.1.1",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-unused-imports": "4.4.1",
|
||||
@@ -100,7 +99,7 @@
|
||||
"postcss": "^8.5.3",
|
||||
"prettier": "^3.0.0",
|
||||
"tailwindcss": "^3",
|
||||
"vite": "5.4.21"
|
||||
"vite": "6.4.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.13.0",
|
||||
|
||||
+2
-22
@@ -1,26 +1,8 @@
|
||||
/*
|
||||
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 { defineConfig } from '@playwright/test';
|
||||
import {
|
||||
browserChannel,
|
||||
contextOptions,
|
||||
defaultProjectViewports,
|
||||
projectViewports,
|
||||
} from './scripts/browser-environment.mjs';
|
||||
import { runtimeOptions } from './scripts/playwright-runtime.mjs';
|
||||
@@ -48,9 +30,7 @@ if (
|
||||
)
|
||||
)
|
||||
throw new Error('CI requires headless non-interactive tests');
|
||||
const viewports = runtime.extended
|
||||
? projectViewports
|
||||
: projectViewports.slice(0, 2);
|
||||
const viewports = runtime.extended ? projectViewports : defaultProjectViewports;
|
||||
|
||||
// UI_VISUAL_OFFSCREEN=0 仅限人工本地可视化调试时临时使用。
|
||||
// Agent、CI、无头/自动化环境禁止设置该值,必须保持默认离屏模式
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// 有头 Chrome 焦点守卫:唯一页面、禁止新建 / 切换标签页、后台建页兜底、前台状态检测。
|
||||
// 规则见 docs/ui/GLOBAL_UI_BASELINE.md 第 7.1 节。
|
||||
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { readFileSync } from 'node:fs';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { devices } from '@playwright/test';
|
||||
@@ -32,9 +13,9 @@ const aliases = {
|
||||
'laptop-wxga': 'wxga',
|
||||
};
|
||||
export const browserChannel = config.browser.channel;
|
||||
export const defaultProjectViewports = ['desktop', 'mobile', 'mobile-393'];
|
||||
export const projectViewports = [
|
||||
'desktop',
|
||||
'mobile',
|
||||
...defaultProjectViewports,
|
||||
'tablet',
|
||||
'desktop-boundary',
|
||||
'laptop-hd',
|
||||
@@ -49,7 +30,9 @@ export function deviceOptions(name) {
|
||||
if (!size) throw new Error(`Unknown viewport: ${name}`);
|
||||
const descriptor =
|
||||
devices[
|
||||
config.browser[key === 'mobile' ? 'mobileDevice' : 'desktopDevice']
|
||||
config.browser[
|
||||
key.startsWith('mobile') ? 'mobileDevice' : 'desktopDevice'
|
||||
]
|
||||
];
|
||||
if (!descriptor) throw new Error(`Unknown device profile for ${name}`);
|
||||
const { defaultBrowserType, ...context } = descriptor;
|
||||
|
||||
@@ -3,20 +3,28 @@ import { createHash } from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { Linter } from 'eslint';
|
||||
import policy from './ui-dependency-policy.cjs';
|
||||
|
||||
const root = fileURLToPath(new URL('../', import.meta.url));
|
||||
const forbidden = [
|
||||
/^@radix-ui\//,
|
||||
/^@floating-ui\//,
|
||||
/^@lobehub\/(?:ui|icons)(?:\/|$)/,
|
||||
/^@douyinfe\/semi-(?:ui|icons|foundation)(?:\/|$)/,
|
||||
/^@headlessui\//,
|
||||
/^@mui\//,
|
||||
/^@chakra-ui\//,
|
||||
/^(?:leva|antd-style|react-layout-kit)(?:\/|$)/,
|
||||
];
|
||||
export const isForbiddenUiDependency = (name) =>
|
||||
forbidden.some((pattern) => pattern.test(name));
|
||||
const { isForbiddenUiDependency, uiDependencyConfig } = policy;
|
||||
const linter = new Linter({ cwd: root });
|
||||
const sourceConfig = [uiDependencyConfig];
|
||||
const sourceDirectories = new Set(['src', 'scripts', 'test', 'tests']);
|
||||
const excludedDirectories = new Set([
|
||||
'node_modules',
|
||||
'dist',
|
||||
'dist-ssr',
|
||||
'build',
|
||||
'coverage',
|
||||
'report',
|
||||
'logs',
|
||||
'test-results',
|
||||
'playwright-report',
|
||||
'blob-report',
|
||||
'kt_batches',
|
||||
'kt_out',
|
||||
]);
|
||||
export { isForbiddenUiDependency };
|
||||
|
||||
export function auditManifest(manifest, lock) {
|
||||
const issues = [];
|
||||
@@ -26,14 +34,22 @@ export function auditManifest(manifest, lock) {
|
||||
'optionalDependencies',
|
||||
'peerDependencies',
|
||||
]) {
|
||||
for (const name of Object.keys(manifest[section] || {})) {
|
||||
if (isForbiddenUiDependency(name))
|
||||
for (const [name, specifier] of Object.entries(manifest[section] || {})) {
|
||||
const alias = /^npm:((?:@[^/]+\/)?[^@/]+)(?:@|$)/.exec(specifier)?.[1];
|
||||
if (isForbiddenUiDependency(name)) {
|
||||
issues.push(`package.json ${section}: ${name}`);
|
||||
} else if (isForbiddenUiDependency(alias)) {
|
||||
issues.push(`package.json ${section}: ${name} -> ${alias}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const location of Object.keys(lock.packages || {})) {
|
||||
if (isForbiddenUiDependency(location.split('node_modules/').at(-1))) {
|
||||
for (const [location, entry] of Object.entries(lock.packages || {})) {
|
||||
const names = location.split(/(?:^|\/)node_modules\//);
|
||||
if (names.length === 1) continue;
|
||||
if (isForbiddenUiDependency(names.at(-1))) {
|
||||
issues.push(`package-lock.json: ${location}`);
|
||||
} else if (isForbiddenUiDependency(entry.name)) {
|
||||
issues.push(`package-lock.json: ${location} -> ${entry.name}`);
|
||||
}
|
||||
}
|
||||
if (!lock.packages || lock.lockfileVersion < 2)
|
||||
@@ -42,58 +58,26 @@ export function auditManifest(manifest, lock) {
|
||||
}
|
||||
|
||||
export function auditSource(source, filename) {
|
||||
const linter = new Linter({ configType: 'eslintrc' });
|
||||
linter.defineRule('ui-dependencies', {
|
||||
create(context) {
|
||||
const inspect = (node) => {
|
||||
if (
|
||||
node?.type === 'Literal' &&
|
||||
typeof node.value === 'string' &&
|
||||
isForbiddenUiDependency(node.value)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
message: `Use Ant Design or the audited local brand assets: ${node.value}`,
|
||||
});
|
||||
}
|
||||
};
|
||||
return {
|
||||
ImportDeclaration: (node) => inspect(node.source),
|
||||
ExportNamedDeclaration: (node) => inspect(node.source),
|
||||
ExportAllDeclaration: (node) => inspect(node.source),
|
||||
ImportExpression: (node) => inspect(node.source),
|
||||
CallExpression: (node) => {
|
||||
if (
|
||||
node.callee.type === 'Identifier' &&
|
||||
node.callee.name === 'require'
|
||||
)
|
||||
inspect(node.arguments[0]);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
return linter
|
||||
.verify(
|
||||
source,
|
||||
{
|
||||
parserOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: { jsx: true },
|
||||
},
|
||||
rules: { 'ui-dependencies': 'error' },
|
||||
},
|
||||
{ filename, allowInlineConfig: false },
|
||||
)
|
||||
.verify(source, sourceConfig, { filename, allowInlineConfig: false })
|
||||
.map((issue) => `${filename}:${issue.line}: ${issue.message}`);
|
||||
}
|
||||
|
||||
async function sourceFiles(dir) {
|
||||
async function sourceFiles(dir, isRoot = true) {
|
||||
const files = [];
|
||||
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
||||
const name = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) files.push(...(await sourceFiles(name)));
|
||||
else if (/\.[cm]?[jt]sx?$/.test(entry.name)) files.push(name);
|
||||
if (entry.isDirectory()) {
|
||||
if (
|
||||
isRoot
|
||||
? sourceDirectories.has(entry.name)
|
||||
: !entry.name.startsWith('.') && !excludedDirectories.has(entry.name)
|
||||
) {
|
||||
files.push(...(await sourceFiles(name, false)));
|
||||
}
|
||||
} else if (entry.isFile() && /\.(?:js|jsx|cjs|mjs)$/.test(entry.name)) {
|
||||
files.push(name);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
@@ -106,7 +90,7 @@ export async function checkUiDependencies(directory = root) {
|
||||
await readFile(path.join(directory, 'package-lock.json'), 'utf8'),
|
||||
);
|
||||
const issues = auditManifest(manifest, lock);
|
||||
const files = await sourceFiles(path.join(directory, 'src'));
|
||||
const files = await sourceFiles(directory);
|
||||
for (const filename of files) {
|
||||
issues.push(
|
||||
...auditSource(
|
||||
@@ -143,7 +127,7 @@ export async function checkUiDependencies(directory = root) {
|
||||
return {
|
||||
issues,
|
||||
files: files.length,
|
||||
packages: Object.keys(lock.packages).length - 1,
|
||||
packages: Math.max(0, Object.keys(lock.packages || {}).length - 1),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 找出会溢出的具体位置。控制台是围绕中文两字标签设计的,泰语平均膨胀 3.16x,
|
||||
// 短标签最高 9x,密集表格首当其冲。
|
||||
//
|
||||
// 判据:Semi 的 Table column `width: N`(px)在 14px 字号下大致可容
|
||||
// 判据:表格列的 `width: N`(px)在 14px 字号下大致可容
|
||||
// 中文 ≈ N/14 字,拉丁/泰文 ≈ N/7.5 字符(泰文含上下叠加符号,按拉丁估更保守)。
|
||||
// 超出即报,按超出比例排序。这是静态估算,不替代真机目视走查。
|
||||
const fs = require('fs');
|
||||
@@ -20,7 +20,7 @@ const DICTS = LANGS.map((l) => [l, load(l)]);
|
||||
const PX_PER_CHAR = 7.5; // 拼音文字/韩/泰在 14px 下的保守平均字宽
|
||||
// 日文假名与汉字、繁体中文都是全角,按字号整宽计
|
||||
const PX_PER_CHAR_BY_LANG = { ja: 14, 'zh-TW': 14 };
|
||||
const PADDING = 24; // Semi 表头左右内边距 + 排序图标余量
|
||||
const PADDING = 24; // 表头左右内边距及排序图标的估算余量
|
||||
|
||||
function walk(dir, files = []) {
|
||||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// 有头 Chrome 焦点守卫:唯一页面、禁止新建 / 切换标签页、后台建页兜底、前台状态检测。
|
||||
// 规则见 docs/ui/GLOBAL_UI_BASELINE.md 第 7.1 节。
|
||||
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
const FOCUS_ANNOTATION = 'focus-guard';
|
||||
|
||||
export default class AcceptanceReporter {
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// 浏览器焦点守护:有头真实 Chrome 运行时尽最大可能不抢占用户桌面焦点。
|
||||
// - 唯一页面:每个用例只有一个页面,由 CDP Target.createTarget({ background: true }) 后台创建,
|
||||
// 不走 context.newPage()(Playwright 内部创建时不带 background,会以前台方式打开窗口)。
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { randomUUID } from 'node:crypto';
|
||||
|
||||
export const browserStabilityArgs = Object.freeze([
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 as base, expect } from '@playwright/test';
|
||||
import {
|
||||
checkFocus,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { preview } from 'vite';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { positiveInteger } from './playwright-runtime.mjs';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { mkdtemp, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { spawn } from 'node:child_process';
|
||||
import { readdir, stat, access } from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { mkdtemp, writeFile, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { readdir } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
const forbiddenPackages = [
|
||||
/^@(?:radix-ui|floating-ui|lobehub|headlessui|mui|material-ui|chakra-ui)\//,
|
||||
/^@douyinfe\/semi-/,
|
||||
/^(?:leva|antd-style|react-layout-kit)(?:[/?#]|$)/,
|
||||
];
|
||||
|
||||
function isForbiddenUiDependency(specifier) {
|
||||
return (
|
||||
typeof specifier === 'string' &&
|
||||
forbiddenPackages.some((pattern) => pattern.test(specifier))
|
||||
);
|
||||
}
|
||||
|
||||
const rule = {
|
||||
meta: {
|
||||
schema: [],
|
||||
messages: {
|
||||
forbidden:
|
||||
'Use Ant Design or the audited local brand assets instead of {{specifier}}.',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
const inspect = (node) => {
|
||||
const specifier =
|
||||
node?.type === 'Literal'
|
||||
? node.value
|
||||
: node?.type === 'TemplateLiteral' && node.expressions.length === 0
|
||||
? node.quasis[0].value.cooked
|
||||
: null;
|
||||
|
||||
if (isForbiddenUiDependency(specifier)) {
|
||||
context.report({ node, messageId: 'forbidden', data: { specifier } });
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
ImportDeclaration: (node) => inspect(node.source),
|
||||
ExportNamedDeclaration: (node) => inspect(node.source),
|
||||
ExportAllDeclaration: (node) => inspect(node.source),
|
||||
ImportExpression: (node) => inspect(node.source),
|
||||
CallExpression: (node) => {
|
||||
const { callee } = node;
|
||||
const isRequire =
|
||||
callee.type === 'Identifier' && callee.name === 'require';
|
||||
const isRequireResolve =
|
||||
callee.type === 'MemberExpression' &&
|
||||
!callee.computed &&
|
||||
callee.object.type === 'Identifier' &&
|
||||
callee.object.name === 'require' &&
|
||||
callee.property.name === 'resolve';
|
||||
if (isRequire || isRequireResolve) inspect(node.arguments[0]);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const uiDependencyConfig = {
|
||||
files: ['**/*.{js,jsx,cjs,mjs}'],
|
||||
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
||||
plugins: { 'ui-dependencies': { rules: { 'no-legacy-ui': rule } } },
|
||||
rules: { 'ui-dependencies/no-legacy-ui': 'error' },
|
||||
};
|
||||
|
||||
module.exports = { isForbiddenUiDependency, uiDependencyConfig };
|
||||
@@ -9,6 +9,7 @@
|
||||
"viewports": {
|
||||
"desktop": [1920, 1080],
|
||||
"mobile": [360, 800],
|
||||
"mobile-393": [393, 851],
|
||||
"tablet": [768, 1024],
|
||||
"laptop": [1024, 768],
|
||||
"hd": [1366, 768],
|
||||
|
||||
+81
-26
@@ -1,27 +1,77 @@
|
||||
/*
|
||||
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, access } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { gzipSync } from 'node:zlib';
|
||||
|
||||
export async function verifyBuild(directory) {
|
||||
const BOOTSTRAP_GZIP_LIMIT = 820 * 1024;
|
||||
const NOTICE = 'src/components/layout/NoticeModal.jsx';
|
||||
const AGREEMENT = 'src/components/common/DocumentRenderer/AgreementModal.jsx';
|
||||
const HEADER = 'src/components/layout/headerbar/index.jsx';
|
||||
const HOME = 'src/pages/Home/index.jsx';
|
||||
const MARKED = 'node_modules/marked/lib/marked.esm.js';
|
||||
|
||||
function resolveAsset(root, asset) {
|
||||
const filename = path.resolve(root, asset.replace(/^\//, ''));
|
||||
if (!filename.startsWith(root + path.sep))
|
||||
throw new Error(`Build asset escapes output directory: ${asset}`);
|
||||
return filename;
|
||||
}
|
||||
|
||||
function staticChunks(manifest, roots) {
|
||||
const seen = new Set();
|
||||
const visit = (key) => {
|
||||
if (seen.has(key)) return;
|
||||
const chunk = manifest[key];
|
||||
if (!chunk) throw new Error(`Missing build manifest chunk: ${key}`);
|
||||
seen.add(key);
|
||||
for (const dependency of chunk.imports || []) visit(dependency);
|
||||
};
|
||||
roots.forEach(visit);
|
||||
return seen;
|
||||
}
|
||||
|
||||
async function verifyStartup(root) {
|
||||
const manifest = JSON.parse(
|
||||
await readFile(path.join(root, '.vite', 'manifest.json'), 'utf8'),
|
||||
);
|
||||
const entry = 'index.html';
|
||||
for (const [routes, deferred] of [
|
||||
[
|
||||
[entry, HOME, HEADER],
|
||||
[NOTICE, MARKED],
|
||||
],
|
||||
[
|
||||
[entry, 'src/components/auth/LoginForm.jsx', HEADER],
|
||||
[AGREEMENT, NOTICE],
|
||||
],
|
||||
[
|
||||
[entry, 'src/components/auth/RegisterForm.jsx', HEADER],
|
||||
[AGREEMENT, NOTICE],
|
||||
],
|
||||
]) {
|
||||
const eager = staticChunks(manifest, routes);
|
||||
for (const feature of deferred) {
|
||||
if (!manifest[feature]?.isDynamicEntry || eager.has(feature))
|
||||
throw new Error(`Expected an independent lazy chunk: ${feature}`);
|
||||
}
|
||||
}
|
||||
|
||||
const files = new Set(
|
||||
[...staticChunks(manifest, [entry])].map((key) => manifest[key].file),
|
||||
);
|
||||
let bootstrapGzipBytes = 0;
|
||||
for (const file of files) {
|
||||
const source = await readFile(resolveAsset(root, file));
|
||||
bootstrapGzipBytes += gzipSync(source).length;
|
||||
}
|
||||
if (bootstrapGzipBytes > BOOTSTRAP_GZIP_LIMIT)
|
||||
throw new Error(
|
||||
`Bootstrap JS exceeds 820 KiB gzip: ${bootstrapGzipBytes} B`,
|
||||
);
|
||||
return { bootstrapGzipBytes, bootstrapChunks: files.size };
|
||||
}
|
||||
|
||||
export async function verifyBuild(directory, { startup = false } = {}) {
|
||||
const root = path.resolve(directory);
|
||||
const html = await readFile(path.join(root, 'index.html'), 'utf8');
|
||||
// Inspect actual resource tags, not URLs embedded in comments or inline scripts.
|
||||
@@ -40,17 +90,22 @@ export async function verifyBuild(directory) {
|
||||
if (!assets.some((value) => /\.js$/.test(value)))
|
||||
throw new Error('Build has no JavaScript entry');
|
||||
for (const asset of assets) {
|
||||
const filename = path.resolve(root, asset.replace(/^\//, ''));
|
||||
if (!filename.startsWith(root + path.sep))
|
||||
throw new Error(`Build asset escapes output directory: ${asset}`);
|
||||
await access(filename);
|
||||
await access(resolveAsset(root, asset));
|
||||
}
|
||||
return { root, assets: assets.length };
|
||||
return {
|
||||
root,
|
||||
assets: assets.length,
|
||||
...(startup ? await verifyStartup(root) : {}),
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
process.argv[1] &&
|
||||
path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
||||
) {
|
||||
console.log(await verifyBuild(process.argv[2] || 'dist'));
|
||||
const args = process.argv.slice(2);
|
||||
const directory = args.find((argument) => argument !== '--startup') || 'dist';
|
||||
console.log(
|
||||
await verifyBuild(directory, { startup: args.includes('--startup') }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,8 @@
|
||||
/*
|
||||
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 postcss from 'postcss';
|
||||
|
||||
// 旧浏览器的级联层(@layer)兜底。
|
||||
//
|
||||
// index.css 把 Tailwind 的 base / components / utilities 整体包在原生 @layer 里,
|
||||
// Semi 的按需样式也由 vitePluginSemi({ cssLayer: true }) 包进 @layer semi。
|
||||
// @layer 自 Chromium 99 / Firefox 97 / Safari 15.4 才支持;更老的内核(停更的
|
||||
// Edge、Win10 LTSC 自带 Edge、各类国产壳浏览器)把它当未知 at-rule 连同块内
|
||||
// 全部规则一起丢弃 —— Tailwind 整体失效,页面只剩无尺寸约束的原图 logo。
|
||||
@@ -91,8 +71,7 @@ export function flattenCssLayers(sources) {
|
||||
roots.forEach(assertSupportedShape);
|
||||
|
||||
// 层外已有逐字相同的规则时,层内那份不必收:选择器与声明都一样、层外的又加载
|
||||
// 在后,它在旧浏览器里必然被覆盖。Semi 的 @layer 副本整份属于这种情况
|
||||
// (index.jsx 另行全量引入了层外的 semi.css),剔掉后兜底表只剩约五分之一。
|
||||
// 在后,它在旧浏览器里必然被覆盖。
|
||||
const unlayered = new Set();
|
||||
for (const root of roots) {
|
||||
root.each((node) => {
|
||||
|
||||
+121
-76
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { lazy, Suspense, useContext, useMemo } from 'react';
|
||||
import { Route, Routes, Navigate, useLocation } from 'react-router-dom';
|
||||
import {
|
||||
@@ -24,7 +5,13 @@ import {
|
||||
isMiniProgramWebView,
|
||||
} from './helpers/miniProgram';
|
||||
import Loading from './components/common/ui/Loading';
|
||||
import { AuthRedirect, PrivateRoute, AdminRoute, RootRoute } from './helpers';
|
||||
import {
|
||||
AuthRedirect,
|
||||
PrivateRoute,
|
||||
AdminRoute,
|
||||
RootRoute,
|
||||
} from './helpers/auth';
|
||||
import { PermRoute, ConsoleRoute, ConsoleIndexRoute } from './authz';
|
||||
import NotFound from './pages/NotFound';
|
||||
import Forbidden from './pages/Forbidden';
|
||||
import { StatusContext } from './context/Status';
|
||||
@@ -96,6 +83,14 @@ const Analytics = lazy(() => import('./pages/Analytics'));
|
||||
const SmartRouter = lazy(() => import('./pages/SmartRouter'));
|
||||
const Organization = lazy(() => import('./pages/Organization'));
|
||||
const AdminOrganizations = lazy(() => import('./pages/AdminOrganizations'));
|
||||
// 平台侧权限管理(菜单管理 / 平台角色 / 功能套餐 / 角色模板 / 运行模式)
|
||||
const AuthzMenuManage = lazy(() => import('./pages/Permission/MenuManage'));
|
||||
const AuthzPlatformRoles = lazy(
|
||||
() => import('./pages/Permission/PlatformRoles'),
|
||||
);
|
||||
const AuthzPackages = lazy(() => import('./pages/Permission/Packages'));
|
||||
const AuthzTemplates = lazy(() => import('./pages/Permission/Templates'));
|
||||
const AuthzRunMode = lazy(() => import('./pages/Permission/RunMode'));
|
||||
const AdminOrder = lazy(() => import('./pages/AdminOrder'));
|
||||
const AdminInvoice = lazy(() => import('./pages/AdminInvoice'));
|
||||
const Subscription = lazy(() => import('./pages/Subscription'));
|
||||
@@ -294,51 +289,51 @@ function App() {
|
||||
<Route
|
||||
path='/console/models'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.model'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<ModelPage />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/channel'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.channel'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Channel />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/token'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.admin_token'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Token />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/playground'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.playground'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Playground />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/monitor'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.monitor'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<MonitorCenter />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@@ -354,11 +349,11 @@ function App() {
|
||||
<Route
|
||||
path='/console/analytics'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.analytics'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Analytics />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@@ -385,40 +380,91 @@ function App() {
|
||||
/* 分佣管理为 Root 专属:侧边栏一直用 isRoot() 隐藏该入口,后端结算/销售/成本/
|
||||
伙伴管理各路由组也已全部 Root 收口。这里把路由守卫对齐,避免 role=10 直接
|
||||
输 URL 进到一个读得到、写按钮全 403 的半残页面。 */
|
||||
<RootRoute>
|
||||
<ConsoleRoute code='platform.commission' legacy='root'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<CommissionV2 />
|
||||
</Suspense>
|
||||
</RootRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/experience-center-audit'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.analytics'>
|
||||
<Navigate to='/console/analytics?tab=audit' replace />
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/organizations'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.org'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AdminOrganizations />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
{/* 平台侧权限管理:路由按与侧边栏相同的权限点守卫(PermRoute),接口权限由后端校验;运行模式仅 root */}
|
||||
<Route
|
||||
path='/console/authz/menus'
|
||||
element={
|
||||
<PermRoute code='platform.authz.menu.query'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AuthzMenuManage />
|
||||
</Suspense>
|
||||
</PermRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/authz/roles'
|
||||
element={
|
||||
<PermRoute code='platform.authz.role.query'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AuthzPlatformRoles />
|
||||
</Suspense>
|
||||
</PermRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/authz/packages'
|
||||
element={
|
||||
<PermRoute code='platform.authz.package.query'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AuthzPackages />
|
||||
</Suspense>
|
||||
</PermRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/authz/templates'
|
||||
element={
|
||||
<PermRoute code='platform.authz.template.query'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AuthzTemplates />
|
||||
</Suspense>
|
||||
</PermRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/authz/mode'
|
||||
element={
|
||||
<RootRoute>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AuthzRunMode />
|
||||
</Suspense>
|
||||
</RootRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/skill-platform'
|
||||
element={
|
||||
CLOUD_BRAIN_UI_ENABLED ? (
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.skill'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<SkillPlatform />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
) : (
|
||||
<Navigate to='/console' replace />
|
||||
)
|
||||
@@ -428,11 +474,11 @@ function App() {
|
||||
path='/console/expert-platform'
|
||||
element={
|
||||
CLOUD_BRAIN_UI_ENABLED ? (
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.expert'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<ExpertPlatform />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
) : (
|
||||
<Navigate to='/console' replace />
|
||||
)
|
||||
@@ -441,21 +487,21 @@ function App() {
|
||||
<Route
|
||||
path='/console/order'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.order'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AdminOrder />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/invoice'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.invoice'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<AdminInvoice />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
{/* 旧路由重定向到用户中心内的服务监控 */}
|
||||
@@ -499,31 +545,31 @@ function App() {
|
||||
<Route
|
||||
path='/console/redemption'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.redemption'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Redemption />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/user'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.user'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<User />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/subscription'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.subscription'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Subscription />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@@ -645,31 +691,37 @@ function App() {
|
||||
<Route
|
||||
path='/console/setting'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.setting'>
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<Setting />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/website-setting'
|
||||
element={
|
||||
<AdminRoute permission='website-setting'>
|
||||
<ConsoleRoute
|
||||
code='platform.setting.website_setting'
|
||||
permission='website-setting'
|
||||
>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<WebsiteSettings />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/demo-reservations'
|
||||
element={
|
||||
<AdminRoute permission='demo-reservations'>
|
||||
<ConsoleRoute
|
||||
code='platform.setting.demo_reservations'
|
||||
permission='demo-reservations'
|
||||
>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<DemoReservations />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@@ -685,49 +737,42 @@ function App() {
|
||||
<Route
|
||||
path='/console/topup'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.topup'>
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<TopUp />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/log'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.log'>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Log />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<Navigate to='/console/analytics' replace />
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route path='/console' element={<ConsoleIndexRoute />} />
|
||||
<Route
|
||||
path='/console/midjourney'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.drawing_log'>
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<Midjourney />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/console/task'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.task_log'>
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<Task />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@@ -879,11 +924,11 @@ function App() {
|
||||
<Route
|
||||
path='/console/chat/:id?'
|
||||
element={
|
||||
<AdminRoute>
|
||||
<ConsoleRoute code='platform.chat'>
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<Chat />
|
||||
</Suspense>
|
||||
</AdminRoute>
|
||||
</ConsoleRoute>
|
||||
}
|
||||
/>
|
||||
{/* 方便使用chat2link直接跳转聊天... */}
|
||||
|
||||
@@ -0,0 +1,393 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Modal } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../helpers/api';
|
||||
import {
|
||||
clearUserData,
|
||||
isOrgLoginSession,
|
||||
ORG_LOGIN_SESSION_KEY,
|
||||
USER_STORAGE_KEY,
|
||||
} from '../helpers/data';
|
||||
import {
|
||||
clearProxyExpired,
|
||||
getCurrentOrgId,
|
||||
getProxySession,
|
||||
} from '../helpers/orgContext';
|
||||
import { UserContext } from '../context/User';
|
||||
import { normalizeView } from './permLogic';
|
||||
|
||||
// 权限上下文(权限重构 §9 GET /api/authz/me):同时持有平台视图与当前企业视图。
|
||||
// 企业视图随当前企业(或代理会话)切换重新加载。有已切换模块、处于代理会话或上一次加载失败时,页面重新获得焦点
|
||||
// (10 秒内不重复)、或每 60 秒刷新一次;否则(未切换,视图只用于判断是否已切换)每 10 分钟刷新一次、获得焦点时
|
||||
// 2 分钟内不重复,不挤占按 IP 计数的全局限流,同时切换后用户切回窗口即可较快跟上。
|
||||
// 当前视图的有效内容(权限点、菜单、数据范围)发生变化且涉及已切换模块时,按 Q12 要求重新登录。
|
||||
|
||||
export const AuthzContext = createContext({
|
||||
platform: null,
|
||||
org: null,
|
||||
orgLoadedKey: null,
|
||||
platformLoadedFor: 0,
|
||||
platformLoadFailed: false,
|
||||
reload: () => {},
|
||||
});
|
||||
|
||||
const REFRESH_MS = 60 * 1000;
|
||||
// 未切换时的刷新间隔
|
||||
const IDLE_REFRESH_MS = 10 * 60 * 1000;
|
||||
// 窗口 focus 触发刷新的节流间隔:频繁切换窗口时不重复拉取
|
||||
const FOCUS_THROTTLE_MS = 10 * 1000;
|
||||
// 未切换时 focus 触发刷新的节流间隔
|
||||
const IDLE_FOCUS_THROTTLE_MS = 2 * 60 * 1000;
|
||||
|
||||
// 未登录(会话失效、其他标签页已登出):不算"加载失败",不因此转入高频刷新
|
||||
const UNAUTHORIZED = Symbol('unauthorized');
|
||||
|
||||
// 拉取视图;接口 success:false 或网络错误返回 null(调用方按"加载失败"处理),401 返回 UNAUTHORIZED
|
||||
const fetchView = async (headers) => {
|
||||
try {
|
||||
const res = await API.get('/api/authz/me', {
|
||||
headers,
|
||||
skipErrorHandler: true,
|
||||
disableDuplicate: true,
|
||||
});
|
||||
return res.data?.success ? normalizeView(res.data.data) : null;
|
||||
} catch (e) {
|
||||
return e?.response?.status === 401 ? UNAUTHORIZED : null;
|
||||
}
|
||||
};
|
||||
|
||||
// 当前企业视图的标识(企业 ID + 代理会话):企业中心据此判断企业视图是否已按当前企业加载过
|
||||
export const currentOrgViewKey = () =>
|
||||
`${getCurrentOrgId()}:${getProxySession()?.id || ''}`;
|
||||
|
||||
const orgHeaders = () => {
|
||||
const proxy = getProxySession();
|
||||
const orgId = getCurrentOrgId();
|
||||
if (!orgId) return null;
|
||||
const h = { 'X-Org-Id': String(orgId) };
|
||||
if (proxy) h['X-Proxy-Session'] = proxy.id;
|
||||
return h;
|
||||
};
|
||||
|
||||
// 视图有效内容的指纹:只取已切换模块(前后两次 enforced_modules 的并集)内的权限点、
|
||||
// 菜单(code 与 visible)与数据范围类型(全部 / 部门 / 本人);未切换模块的变化不影响页面行为,不纳入。
|
||||
// 部门个数不纳入:它是按部门树展开后的个数,新增子部门就会变化,而页面行为不变。
|
||||
// 已切换模块列表本身不纳入:模块切换(或回退)只是把页面从旧判断改为按权限点判断,界面就地更新,
|
||||
// 不属于 Q12 所说的撤权,不要求重新登录;切换前后权限点本身的变化仍会按上面的并集比较提示。
|
||||
// 不用 version:它包含目录与企业版本,改任意菜单名、角色名都会变化,会误弹重新登录。
|
||||
const viewSignature = (v, inScope) =>
|
||||
JSON.stringify([
|
||||
(v.perms || []).filter(inScope).sort(),
|
||||
(v.menus || [])
|
||||
.filter((m) => inScope(m.code))
|
||||
.map((m) => `${m.code}:${m.visible ? 1 : 0}`)
|
||||
.sort(),
|
||||
Object.entries(v.scopes || {})
|
||||
.filter(([code]) => inScope(code))
|
||||
.map(
|
||||
([code, sc]) =>
|
||||
`${code}:${sc?.all ? 1 : 0}:${sc?.depts ? 1 : 0}:${sc?.self ? 1 : 0}`,
|
||||
)
|
||||
.sort(),
|
||||
]);
|
||||
|
||||
// 有效内容变化且涉及已切换模块:权限确实影响到页面行为,需要重新登录
|
||||
const changedUnderEnforce = (prev, next) => {
|
||||
if (!prev || !next) return false;
|
||||
// 用户、企业或登录域不同都是换了会话(如个人会话改用企业入口登录),不是权限变更
|
||||
if (
|
||||
prev.user_id !== next.user_id ||
|
||||
prev.org_id !== next.org_id ||
|
||||
prev.domain !== next.domain ||
|
||||
(prev.session_domain || '') !== (next.session_domain || '')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
const modules = new Set([
|
||||
...(prev.enforced_modules || []),
|
||||
...(next.enforced_modules || []),
|
||||
]);
|
||||
if (modules.size === 0) return false;
|
||||
const moduleOf = { ...(prev.module_of || {}), ...(next.module_of || {}) };
|
||||
const inScope = (code) => modules.has(moduleOf[code]);
|
||||
return viewSignature(prev, inScope) !== viewSignature(next, inScope);
|
||||
};
|
||||
|
||||
// 视图是否涉及已切换模块(需要高频刷新以及时发现权限变更;代理会话另由调用方判断)
|
||||
const isActiveView = (v) => !!v && (v.enforced_modules || []).length > 0;
|
||||
|
||||
// 内容相同的视图不重新写入状态,避免每次刷新都让订阅方(企业中心等)重渲染
|
||||
const sameView = (a, b) => {
|
||||
if (a === b) return true;
|
||||
if (!a || !b) return false;
|
||||
try {
|
||||
return JSON.stringify(a) === JSON.stringify(b);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const AuthzProvider = ({ children }) => {
|
||||
const { t } = useTranslation();
|
||||
const [userState, userDispatch] = useContext(UserContext);
|
||||
const userId = userState?.user?.id || 0;
|
||||
const location = useLocation();
|
||||
const [platform, setPlatform] = useState(null);
|
||||
const [org, setOrg] = useState(null);
|
||||
// 最近一次企业视图加载(无论成败)对应的 currentOrgViewKey;未加载过为 null
|
||||
const [orgLoadedKey, setOrgLoadedKey] = useState(null);
|
||||
// 平台视图已为哪个用户加载过(成败均算);路由守卫据此等待视图到达,避免先按旧判断误拦
|
||||
const [platformLoadedFor, setPlatformLoadedFor] = useState(0);
|
||||
// 最近一次平台视图加载是否失败(配合 platformLoadedFor 使用):路由守卫据此显示可重试提示
|
||||
const [platformLoadFailed, setPlatformLoadFailed] = useState(false);
|
||||
const prevRef = useRef({ platform: null, org: null });
|
||||
const promptedRef = useRef(false);
|
||||
// 已弹出的"权限已变更"提示实例:其他标签页换了会话时关闭它
|
||||
const modalRef = useRef(null);
|
||||
// 最近一次开始拉取视图的时间,用于 focus 刷新节流
|
||||
const lastFetchRef = useRef(0);
|
||||
// 最近一次加载是否有视图失败:失败后按高频刷新重试,否则已切换企业首次加载失败时会按旧判断渲染最长 10 分钟
|
||||
const failedRef = useRef(false);
|
||||
// 最新的 reload:storage 事件处理里主动重新加载(事件处理只注册一次)
|
||||
const reloadRef = useRef(null);
|
||||
// 企业会话(企业域登录、或仅企业资源账号)重新登录回 /org/login,否则回 /login
|
||||
const orgOnlyRef = useRef(false);
|
||||
orgOnlyRef.current = userState?.user?.org_only_mode === true;
|
||||
const onOrgPage = location.pathname.startsWith('/org');
|
||||
const orgKey = onOrgPage ? currentOrgViewKey() : '';
|
||||
|
||||
const promptRelogin = useCallback(() => {
|
||||
if (promptedRef.current) return;
|
||||
promptedRef.current = true;
|
||||
// 只能点"重新登录":不提供关闭按钮,点遮罩与按 Esc 都不关闭
|
||||
modalRef.current = Modal.warning({
|
||||
title: t('权限已变更'),
|
||||
content: t('你的权限已变更,请重新登录。'),
|
||||
okText: t('重新登录'),
|
||||
centered: true,
|
||||
closable: false,
|
||||
keyboard: false,
|
||||
mask: { closable: false },
|
||||
onOk: async () => {
|
||||
modalRef.current = null;
|
||||
// 先判断会话域,再登出清理(清理会移除企业登录标记)
|
||||
// 以后端返回的登录域为准;老版本后端没有该字段时退回本地标记
|
||||
const view = prevRef.current.org || prevRef.current.platform;
|
||||
const orgSession = view?.session_domain
|
||||
? view.session_domain === 'org'
|
||||
: isOrgLoginSession() || orgOnlyRef.current;
|
||||
const target = orgSession ? '/org/login' : '/login';
|
||||
try {
|
||||
await API.get('/api/user/logout', {
|
||||
skipErrorHandler: true,
|
||||
disableDuplicate: true,
|
||||
});
|
||||
} catch {
|
||||
// 登出失败也继续清理本地数据并跳转登录页
|
||||
}
|
||||
clearUserData();
|
||||
userDispatch({ type: 'logout' });
|
||||
window.location.href = target;
|
||||
},
|
||||
});
|
||||
}, [t, userDispatch]);
|
||||
|
||||
const reload = useCallback(async () => {
|
||||
lastFetchRef.current = Date.now();
|
||||
const loadingKey = currentOrgViewKey();
|
||||
if (!userId) {
|
||||
setPlatform(null);
|
||||
setOrg(null);
|
||||
prevRef.current = { platform: null, org: null };
|
||||
setOrgLoadedKey(loadingKey);
|
||||
setPlatformLoadedFor(0);
|
||||
setPlatformLoadFailed(false);
|
||||
return;
|
||||
}
|
||||
const headers = onOrgPage ? orgHeaders() : null;
|
||||
const [pr, or] = await Promise.all([
|
||||
fetchView(undefined),
|
||||
headers ? fetchView(headers) : Promise.resolve(null),
|
||||
]);
|
||||
const unauthorized = pr === UNAUTHORIZED || or === UNAUTHORIZED;
|
||||
const p = pr === UNAUTHORIZED ? null : pr;
|
||||
const o = or === UNAUTHORIZED ? null : or;
|
||||
if (p) {
|
||||
if (changedUnderEnforce(prevRef.current.platform, p)) promptRelogin();
|
||||
const same = sameView(prevRef.current.platform, p);
|
||||
prevRef.current.platform = p;
|
||||
if (!same) setPlatform(p);
|
||||
} else {
|
||||
// 加载失败:保留上一份视图作比较基准;不属于当前用户的旧视图不能再用
|
||||
const kept = prevRef.current.platform;
|
||||
if (kept && kept.user_id !== userId) {
|
||||
prevRef.current.platform = null;
|
||||
setPlatform(null);
|
||||
}
|
||||
}
|
||||
setPlatformLoadFailed(!p);
|
||||
setPlatformLoadedFor(userId);
|
||||
failedRef.current = !unauthorized && (!p || (!!headers && !o));
|
||||
if (!headers) {
|
||||
prevRef.current.org = null;
|
||||
setOrg(null);
|
||||
// 不在企业页时并未加载企业视图,不能标记为已就绪(否则进入企业中心时会按旧判断先行守卫)
|
||||
setOrgLoadedKey(onOrgPage ? loadingKey : null);
|
||||
return;
|
||||
}
|
||||
if (o) {
|
||||
if (changedUnderEnforce(prevRef.current.org, o)) promptRelogin();
|
||||
const same = sameView(prevRef.current.org, o);
|
||||
prevRef.current.org = o;
|
||||
if (!same) setOrg(o);
|
||||
} else {
|
||||
// 加载失败:保留上一份视图作比较基准;只有仍属于当前用户与当前企业时才继续使用
|
||||
const kept = prevRef.current.org;
|
||||
if (
|
||||
kept &&
|
||||
(kept.user_id !== userId || kept.org_id !== getCurrentOrgId())
|
||||
) {
|
||||
prevRef.current.org = null;
|
||||
setOrg(null);
|
||||
}
|
||||
}
|
||||
setOrgLoadedKey(loadingKey);
|
||||
}, [userId, onOrgPage, promptRelogin]);
|
||||
|
||||
// 换账号、换企业(含进入 / 退出代理)都要重新加载:企业键不参与 reload 本身的计算,单独作为触发条件
|
||||
useEffect(() => {
|
||||
reloadRef.current = reload;
|
||||
}, [reload]);
|
||||
useEffect(() => {
|
||||
reload();
|
||||
}, [reload, orgKey]);
|
||||
|
||||
// 换账号(含登出):允许对新账号重新提示
|
||||
useEffect(() => {
|
||||
promptedRef.current = false;
|
||||
}, [userId]);
|
||||
|
||||
// 离开企业中心:清除本标签页的"代理已失效"标记,之后再进入 /org 按正常企业上下文解析
|
||||
useEffect(() => {
|
||||
if (!onOrgPage) clearProxyExpired();
|
||||
}, [onOrgPage]);
|
||||
|
||||
// 多标签页:其他标签页重新登录或登出(localStorage 用户数据变化)时,关闭本页已弹出的提示,
|
||||
// 避免在旧标签页点"重新登录"把新会话注销;同时丢弃旧的比较基准,下一次加载按新会话重新建立
|
||||
useEffect(() => {
|
||||
// 只看用户身份:登出(键被删)或换成另一个用户才算换会话;额度等字段刷新不算,
|
||||
// 否则会关掉仍然有效的提示并丢弃比较基准,本标签页就再也不会提示了
|
||||
const userIdOf = (raw) => {
|
||||
try {
|
||||
return raw ? JSON.parse(raw)?.id || 0 : 0;
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
const onStorage = (e) => {
|
||||
if (
|
||||
e.key !== USER_STORAGE_KEY &&
|
||||
e.key !== ORG_LOGIN_SESSION_KEY &&
|
||||
e.key !== null
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// 企业登录标记变化:同一用户在其他标签页改用企业入口(或个人入口)登录,登录域变了,按换会话处理
|
||||
if (
|
||||
e.key === USER_STORAGE_KEY &&
|
||||
e.newValue !== null &&
|
||||
userIdOf(e.oldValue) === userIdOf(e.newValue)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (modalRef.current) {
|
||||
modalRef.current.destroy();
|
||||
modalRef.current = null;
|
||||
}
|
||||
promptedRef.current = false;
|
||||
prevRef.current = { platform: null, org: null };
|
||||
// 立即按新会话重新加载:本标签页的 UserContext 不跨标签同步,不会自己触发加载;
|
||||
// 清空基准后也不再算"有已切换模块",不主动加载就要等最长 10 分钟
|
||||
if (reloadRef.current) reloadRef.current();
|
||||
};
|
||||
window.addEventListener('storage', onStorage);
|
||||
return () => window.removeEventListener('storage', onStorage);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) return undefined;
|
||||
const active = () =>
|
||||
failedRef.current ||
|
||||
isActiveView(prevRef.current.platform) ||
|
||||
isActiveView(prevRef.current.org) ||
|
||||
!!getProxySession();
|
||||
const timer = setInterval(() => {
|
||||
if (
|
||||
active() ||
|
||||
Date.now() - lastFetchRef.current >= IDLE_REFRESH_MS - 1000
|
||||
) {
|
||||
reload();
|
||||
}
|
||||
}, REFRESH_MS);
|
||||
const onFocus = () => {
|
||||
const throttle = active() ? FOCUS_THROTTLE_MS : IDLE_FOCUS_THROTTLE_MS;
|
||||
if (Date.now() - lastFetchRef.current < throttle) return;
|
||||
reload();
|
||||
};
|
||||
window.addEventListener('focus', onFocus);
|
||||
return () => {
|
||||
clearInterval(timer);
|
||||
window.removeEventListener('focus', onFocus);
|
||||
};
|
||||
}, [userId, reload]);
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
platform,
|
||||
org,
|
||||
orgLoadedKey,
|
||||
platformLoadedFor,
|
||||
platformLoadFailed,
|
||||
reload,
|
||||
}),
|
||||
[
|
||||
platform,
|
||||
org,
|
||||
orgLoadedKey,
|
||||
platformLoadedFor,
|
||||
platformLoadFailed,
|
||||
reload,
|
||||
],
|
||||
);
|
||||
return (
|
||||
<AuthzContext.Provider value={value}>{children}</AuthzContext.Provider>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { usePerm } from './usePerm';
|
||||
|
||||
// <Perm code='org.member.edit' legacy={isAdmin} fallback={null}>…</Perm>
|
||||
const Perm = ({ code, legacy, fallback = null, children }) => {
|
||||
const allowed = usePerm(code, legacy);
|
||||
return <>{allowed ? children : fallback}</>;
|
||||
};
|
||||
|
||||
export default Perm;
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Result } from 'antd';
|
||||
import Loading from '../components/common/ui/Loading';
|
||||
import { AdminRoute, PrivateRoute, RootRoute } from '../helpers/auth';
|
||||
import { isRoot } from '../helpers/utils';
|
||||
import { UserContext } from '../context/User';
|
||||
import { AuthzContext } from './AuthzProvider';
|
||||
import { usePerm } from './usePerm';
|
||||
|
||||
// 平台视图加载失败:给出可重试的提示,而不是按旧判断直接跳 /forbidden
|
||||
const LoadFailed = ({ reload }) => {
|
||||
const { t } = useTranslation();
|
||||
const [retrying, setRetrying] = useState(false);
|
||||
const retry = async () => {
|
||||
setRetrying(true);
|
||||
try {
|
||||
await reload();
|
||||
} finally {
|
||||
setRetrying(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Result
|
||||
status='warning'
|
||||
title={t('权限信息加载失败')}
|
||||
subTitle={t('请检查网络后重试')}
|
||||
extra={
|
||||
<Button type='primary' loading={retrying} onClick={retry}>
|
||||
{t('重试')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
// 会话已在其他标签页变更:刷新页面按新会话重新加载
|
||||
const SessionChanged = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Result
|
||||
status='info'
|
||||
title={t('登录状态已变化')}
|
||||
subTitle={t('你已在其他页面切换了账号,请刷新页面')}
|
||||
extra={
|
||||
<Button type='primary' onClick={() => window.location.reload()}>
|
||||
{t('刷新页面')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
// 平台视图是否已就绪。返回 null 表示就绪,否则返回等待期间应显示的内容。
|
||||
// 就绪:已有属于当前用户的平台视图(之后的刷新失败不影响);否则本用户的加载已结束且失败时提示重试。
|
||||
const useViewPending = () => {
|
||||
const [userState] = useContext(UserContext);
|
||||
const { platform, platformLoadedFor, platformLoadFailed, reload } =
|
||||
useContext(AuthzContext);
|
||||
const userId = userState?.user?.id || 0;
|
||||
const viewReady = !!platform && platform.user_id === userId;
|
||||
if (!userId || viewReady) return { pending: null, failed: false };
|
||||
if (platformLoadedFor === userId && platformLoadFailed) {
|
||||
return { pending: <LoadFailed reload={reload} />, failed: true };
|
||||
}
|
||||
// 视图已加载但属于另一个用户:其他标签页换了账号,本页的用户信息已过期,提示刷新而不是一直转圈
|
||||
if (platformLoadedFor === userId && platform) {
|
||||
return { pending: <SessionChanged />, failed: false };
|
||||
}
|
||||
return { pending: <Loading />, failed: false };
|
||||
};
|
||||
|
||||
// 按平台权限点守卫的路由:判断与侧边栏一致(usePerm(code, isRoot())),
|
||||
// 平台视图到达前显示加载中,加载失败显示可重试提示,无权限时与其它守卫一样跳 /forbidden。
|
||||
const PermGate = ({ code, children }) => {
|
||||
const allowed = usePerm(code, isRoot());
|
||||
const { pending } = useViewPending();
|
||||
if (pending) return pending;
|
||||
if (!allowed) return <Navigate to='/forbidden' replace />;
|
||||
return children;
|
||||
};
|
||||
|
||||
const PermRoute = ({ code, children }) => (
|
||||
<PrivateRoute>
|
||||
<PermGate code={code}>{children}</PermGate>
|
||||
</PrivateRoute>
|
||||
);
|
||||
|
||||
// 原有守卫:legacy='root' 为 RootRoute,否则为 AdminRoute(permission 为系统设置页签委派校验)
|
||||
const LegacyRoute = ({ legacy, permission, children }) =>
|
||||
legacy === 'root' ? (
|
||||
<RootRoute>{children}</RootRoute>
|
||||
) : (
|
||||
<AdminRoute permission={permission}>{children}</AdminRoute>
|
||||
);
|
||||
|
||||
// 控制台路由守卫(新旧双路径):code 所属模块已切到新体系时按权限点判断(持有权限点的非管理员也能进入,
|
||||
// 没有权限点的管理员进不去);未切换时完全沿用原有守卫(AdminRoute / RootRoute)。
|
||||
// 用法:<ConsoleRoute code='platform.channel'>、<ConsoleRoute code='platform.commission' legacy='root'>、
|
||||
// <ConsoleRoute code='platform.setting.website_setting' permission='website-setting'>
|
||||
export const ConsoleRoute = ({
|
||||
code,
|
||||
legacy = 'admin',
|
||||
permission,
|
||||
children,
|
||||
}) => {
|
||||
const [userState] = useContext(UserContext);
|
||||
const { platform } = useContext(AuthzContext);
|
||||
const { pending, failed } = useViewPending();
|
||||
const user = userState?.user;
|
||||
const legacyRoute = (
|
||||
<LegacyRoute legacy={legacy} permission={permission}>
|
||||
{children}
|
||||
</LegacyRoute>
|
||||
);
|
||||
// 未登录或登录态校验中:交给原有守卫(跳登录页或显示加载中)
|
||||
if (!user) return legacyRoute;
|
||||
if (pending) {
|
||||
// 视图加载失败时无从得知模块是否已切换:原判断会放行的人仍按原有守卫进入(接口权限由后端校验),
|
||||
// 避免权限接口故障把管理员挡在控制台外;其余人显示可重试提示
|
||||
const legacyRole = legacy === 'root' ? 100 : 10;
|
||||
if (failed && typeof user.role === 'number' && user.role >= legacyRole) {
|
||||
return legacyRoute;
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
const mod = platform.moduleOf[code];
|
||||
if (!mod || !platform.enforcedSet.has(mod)) return legacyRoute;
|
||||
if (!platform.permSet.has(code)) return <Navigate to='/forbidden' replace />;
|
||||
return children;
|
||||
};
|
||||
|
||||
// 控制台入口 /console:原行为是管理员进运营看板。运营看板模块已切换且当前用户没有该菜单时
|
||||
// (含持有其他平台菜单的非管理员),改进第一个已切换且持有的控制台菜单;都没有时按原有守卫处理。
|
||||
export const ConsoleIndexRoute = () => {
|
||||
const [userState] = useContext(UserContext);
|
||||
const { platform } = useContext(AuthzContext);
|
||||
const { pending, failed } = useViewPending();
|
||||
const user = userState?.user;
|
||||
const legacyRoute = (
|
||||
<AdminRoute>
|
||||
<Navigate to='/console/analytics' replace />
|
||||
</AdminRoute>
|
||||
);
|
||||
if (!user) return legacyRoute;
|
||||
if (pending) {
|
||||
if (failed && typeof user.role === 'number' && user.role >= 10) {
|
||||
return legacyRoute;
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
const enforced = (code) => platform.enforcedSet.has(platform.moduleOf[code]);
|
||||
const analyticsEnforced = enforced('platform.analytics');
|
||||
const canAnalytics = analyticsEnforced
|
||||
? platform.permSet.has('platform.analytics')
|
||||
: typeof user.role === 'number' && user.role >= 10;
|
||||
if (canAnalytics) return <Navigate to='/console/analytics' replace />;
|
||||
// view.menus 已按 sort 排好,且只含当前用户持有的节点
|
||||
const first = (platform.menus || []).find(
|
||||
(m) =>
|
||||
m.type === 'menu' &&
|
||||
m.visible &&
|
||||
typeof m.route === 'string' &&
|
||||
m.route.startsWith('/console/') &&
|
||||
enforced(m.code),
|
||||
);
|
||||
if (first) return <Navigate to={first.route} replace />;
|
||||
return legacyRoute;
|
||||
};
|
||||
|
||||
export default PermRoute;
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
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 { AuthzContext, AuthzProvider } from './AuthzProvider';
|
||||
export {
|
||||
usePerm,
|
||||
useAnyPerm,
|
||||
useAuthzView,
|
||||
useAuthzReload,
|
||||
useOrgViewReady,
|
||||
} from './usePerm';
|
||||
export { default as Perm } from './Perm';
|
||||
export {
|
||||
default as PermRoute,
|
||||
ConsoleRoute,
|
||||
ConsoleIndexRoute,
|
||||
} from './PermRoute';
|
||||
export { checkPerm, checkAnyPerm, buildMenuTree } from './permLogic';
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// 权限判断的纯逻辑(权限重构 §7.1 新旧双路径),与 React 无关,便于单测。
|
||||
// view 为 /api/authz/me 的返回;legacy 为旧判断(布尔或返回布尔的函数)。
|
||||
|
||||
export function normalizeView(data) {
|
||||
if (!data) return null;
|
||||
return {
|
||||
...data,
|
||||
permSet: new Set(data.perms || []),
|
||||
enforcedSet: new Set(data.enforced_modules || []),
|
||||
moduleOf: data.module_of || {},
|
||||
};
|
||||
}
|
||||
|
||||
const evalLegacy = (legacy) =>
|
||||
typeof legacy === 'function' ? !!legacy() : !!legacy;
|
||||
|
||||
// 模块已切到新体系(enforced):以权限点为准;否则走旧判断。未提供旧判断时按权限点判断。
|
||||
// view 尚未加载:有旧判断走旧判断,否则不放行。
|
||||
export function checkPerm(view, code, legacy) {
|
||||
if (!view) return legacy === undefined ? false : evalLegacy(legacy);
|
||||
const mod = view.moduleOf[code];
|
||||
if (mod && view.enforcedSet.has(mod)) return view.permSet.has(code);
|
||||
if (legacy === undefined) return view.permSet.has(code);
|
||||
return evalLegacy(legacy);
|
||||
}
|
||||
|
||||
// 是否持有任一权限点(同样按模块逐个走新旧路径)。
|
||||
export function checkAnyPerm(view, codes, legacy) {
|
||||
return codes.some((c) => checkPerm(view, c, legacy));
|
||||
}
|
||||
|
||||
// 视图对应的域:org.* 权限点看企业视图,其余看平台视图。
|
||||
export function viewForCode(views, code) {
|
||||
return code.startsWith('org.') ? views.org : views.platform;
|
||||
}
|
||||
|
||||
// 菜单树:按 parent 组装,同级按 sort;只保留 visible 的节点。
|
||||
export function buildMenuTree(menus) {
|
||||
const byParent = new Map();
|
||||
for (const m of menus || []) {
|
||||
if (!m.visible) continue;
|
||||
const list = byParent.get(m.parent || '') || [];
|
||||
list.push(m);
|
||||
byParent.set(m.parent || '', list);
|
||||
}
|
||||
const build = (parent) =>
|
||||
(byParent.get(parent) || [])
|
||||
.sort((a, b) => a.sort - b.sort || a.code.localeCompare(b.code))
|
||||
.map((m) => ({ ...m, children: build(m.code) }));
|
||||
return build('');
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
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 {
|
||||
normalizeView,
|
||||
checkPerm,
|
||||
checkAnyPerm,
|
||||
buildMenuTree,
|
||||
} from './permLogic.js';
|
||||
|
||||
const view = normalizeView({
|
||||
perms: ['org.member', 'org.member.query'],
|
||||
enforced_modules: ['member'],
|
||||
module_of: {
|
||||
'org.member': 'member',
|
||||
'org.member.query': 'member',
|
||||
'org.member.edit': 'member',
|
||||
'org.dept.query': 'dept',
|
||||
},
|
||||
});
|
||||
|
||||
test('enforced module follows perms, ignoring the legacy check', () => {
|
||||
assert.equal(checkPerm(view, 'org.member.query', false), true);
|
||||
assert.equal(checkPerm(view, 'org.member.edit', true), false);
|
||||
});
|
||||
|
||||
test('non-enforced module follows the legacy check', () => {
|
||||
assert.equal(checkPerm(view, 'org.dept.query', true), true);
|
||||
assert.equal(
|
||||
checkPerm(view, 'org.dept.query', () => false),
|
||||
false,
|
||||
);
|
||||
assert.equal(checkPerm(view, 'org.dept.query'), false);
|
||||
});
|
||||
|
||||
test('view not loaded yet', () => {
|
||||
assert.equal(checkPerm(null, 'org.member.query'), false);
|
||||
assert.equal(checkPerm(null, 'org.member.query', true), true);
|
||||
});
|
||||
|
||||
test('any of several perms', () => {
|
||||
assert.equal(
|
||||
checkAnyPerm(view, ['org.member.edit', 'org.member.query']),
|
||||
true,
|
||||
);
|
||||
assert.equal(checkAnyPerm(view, ['org.member.edit']), false);
|
||||
});
|
||||
|
||||
test('menu tree keeps visible nodes ordered by sort', () => {
|
||||
const tree = buildMenuTree([
|
||||
{ code: 'b', parent: '', sort: 20, visible: true },
|
||||
{ code: 'a', parent: '', sort: 10, visible: true },
|
||||
{ code: 'a.x', parent: 'a', sort: 10, visible: true },
|
||||
{ code: 'a.h', parent: 'a', sort: 5, visible: false },
|
||||
]);
|
||||
assert.deepEqual(
|
||||
tree.map((n) => n.code),
|
||||
['a', 'b'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
tree[0].children.map((n) => n.code),
|
||||
['a.x'],
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
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 { useContext, useEffect } from 'react';
|
||||
import { AuthzContext, currentOrgViewKey } from './AuthzProvider';
|
||||
import { checkPerm, checkAnyPerm, viewForCode } from './permLogic';
|
||||
|
||||
// usePerm(code, legacy):模块已切到新体系时按权限点判断,否则按 legacy(旧判断)判断。
|
||||
export function usePerm(code, legacy) {
|
||||
const ctx = useContext(AuthzContext);
|
||||
return checkPerm(viewForCode(ctx, code), code, legacy);
|
||||
}
|
||||
|
||||
// useAnyPerm(codes, legacy):持有其中任一权限点。
|
||||
export function useAnyPerm(codes, legacy) {
|
||||
const ctx = useContext(AuthzContext);
|
||||
if (!codes.length) return false;
|
||||
return checkAnyPerm(viewForCode(ctx, codes[0]), codes, legacy);
|
||||
}
|
||||
|
||||
// useAuthzView(domain):'platform' | 'org' 的原始视图(菜单树渲染等)。
|
||||
export function useAuthzView(domain) {
|
||||
const ctx = useContext(AuthzContext);
|
||||
return domain === 'org' ? ctx.org : ctx.platform;
|
||||
}
|
||||
|
||||
export function useAuthzReload() {
|
||||
return useContext(AuthzContext).reload;
|
||||
}
|
||||
|
||||
// useOrgViewReady():企业视图是否已按当前企业(含代理会话)加载过(成败均算)。
|
||||
// 企业中心在它就绪前不做路由守卫,避免新体系下持有菜单的人在视图到达前被旧判断重定向走。
|
||||
// 当前企业刚由解析器写入、Provider 尚未感知时主动触发一次加载。
|
||||
export function useOrgViewReady() {
|
||||
const ctx = useContext(AuthzContext);
|
||||
const key = currentOrgViewKey();
|
||||
const ready = ctx.orgLoadedKey === key;
|
||||
const { reload } = ctx;
|
||||
useEffect(() => {
|
||||
if (!ready) reload();
|
||||
}, [ready, key, reload]);
|
||||
return ready;
|
||||
}
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { formatPercent } from '../../helpers/safeDisplay';
|
||||
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { ChevronDown as ActionChevronDown } from '@/components/common/icons/ActionIcons';
|
||||
import React from 'react';
|
||||
import './collapsible-panel.css';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Table, Button } from '@/components/ui';
|
||||
import { IconDownload } from '@/components/ui/icons';
|
||||
@@ -199,6 +180,7 @@ const DailyStatsTable = ({ data, title, icon, t, embedded = false }) => {
|
||||
columns={columns}
|
||||
dataSource={data || []}
|
||||
pagination={{
|
||||
preservePage: true,
|
||||
pageSize: 10,
|
||||
showSizeChanger: true,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total, count: total }),
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { formatUserReference } from '../../helpers/safeDisplay';
|
||||
|
||||
import React, { useMemo, useState } from 'react';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo, useState, useEffect } from 'react';
|
||||
import { Button, Empty, Segmented, Skeleton, theme } from 'antd';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { formatIdReference, formatPercent } from '../../helpers/safeDisplay';
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { Badge, Empty, Progress, Skeleton, Tag, Tooltip, theme } from 'antd';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { formatNumber, formatPercent } from '../../helpers/safeDisplay';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { formatUserReference } from '../../helpers/safeDisplay';
|
||||
|
||||
import { Trans } from 'react-i18next';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { Trans } from 'react-i18next';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import {
|
||||
formatNumber,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card } from '@/components/ui';
|
||||
import { VChart } from '@visactor/react-vchart';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
formatIdReference,
|
||||
formatUserReference,
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { formatPercent, formatRatioPercent } from '../../helpers/safeDisplay';
|
||||
|
||||
import React, { useMemo, useState, useEffect, useCallback } from 'react';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
formatNumber,
|
||||
formatIdReference,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { Download as ActionDownload } from '@/components/common/icons/ActionIcons';
|
||||
import React from 'react';
|
||||
import {
|
||||
@@ -518,11 +499,7 @@ export const ActionCenter = ({ lists, activeTab, onTabChange, cny, t }) => (
|
||||
rowKey='org_id'
|
||||
size='small'
|
||||
scroll={{ x: 1200 }}
|
||||
pagination={
|
||||
lists[tab].length > 10
|
||||
? { pageSize: 10, showSizeChanger: false }
|
||||
: false
|
||||
}
|
||||
pagination={lists[tab].length > 10 ? { pageSize: 10 } : false}
|
||||
empty={<Empty description={t('暂无需要跟进的企业')} />}
|
||||
/>
|
||||
</TabPane>
|
||||
|
||||
Binary file not shown.
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { Trans } from 'react-i18next';
|
||||
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
|
||||
import { Download as ActionDownload } from '@/components/common/icons/ActionIcons';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { Download as ActionDownload } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useMemo } from 'react';
|
||||
import {
|
||||
@@ -142,9 +123,7 @@ export const SalesRepTable = ({ reps, cny, onSelect, t }) => {
|
||||
rowKey={(r) => r.sales_rep || '__none__'}
|
||||
size='small'
|
||||
scroll={{ x: 920 }}
|
||||
pagination={
|
||||
reps.length > 8 ? { pageSize: 8, showSizeChanger: false } : false
|
||||
}
|
||||
pagination={reps.length > 8 ? { pageSize: 10 } : false}
|
||||
empty={<Empty description={t('暂无数据')} />}
|
||||
/>
|
||||
</SectionCard>
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { Button, Card, Typography } from '@/components/ui';
|
||||
import { ActionCenter, ACTION_TABS } from './ActionCenter';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Card, Tag, Tooltip } from '@/components/ui';
|
||||
import { TrendingDown, TrendingUp } from 'lucide-react';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
formatIdReference,
|
||||
formatPercent,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { useTranslation } from 'react-i18next';
|
||||
import React from 'react';
|
||||
import { Sparkles } from 'lucide-react';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { MessageCircle as ActionMessageCircle } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Avatar } from '@/components/ui';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from 'antd';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import React, { lazy, Suspense } from 'react';
|
||||
|
||||
const AgreementModal = lazy(
|
||||
() => import('../common/DocumentRenderer/AgreementModal'),
|
||||
);
|
||||
|
||||
export default function LazyAgreementModal(props) {
|
||||
if (!props.type) return null;
|
||||
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<AgreementModal {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { ArrowRight as ActionArrowRight } from '@/components/common/icons/ActionIcons';
|
||||
import React, {
|
||||
useContext,
|
||||
@@ -72,7 +53,7 @@ import GlassCard from './GlassCard';
|
||||
import AuthCardHeader from './AuthCardHeader';
|
||||
import AuthLoginTabs from './AuthLoginTabs';
|
||||
import AuthDivider from './AuthDivider';
|
||||
import AgreementModal from '../common/DocumentRenderer/AgreementModal';
|
||||
import AgreementModal from './LazyAgreementModal';
|
||||
import {
|
||||
isMiniProgramWebView,
|
||||
withMiniProgramLogins,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useContext, useEffect } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { Copy as ActionCopy } from '@/components/common/icons/ActionIcons';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
API,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
API,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { ArrowRight as ActionArrowRight } from '@/components/common/icons/ActionIcons';
|
||||
import React, {
|
||||
useContext,
|
||||
@@ -67,7 +48,7 @@ import AuthCardHeader from './AuthCardHeader';
|
||||
import AuthLoginTabs from './AuthLoginTabs';
|
||||
import AuthDivider from './AuthDivider';
|
||||
import { Shield, Smartphone, QrCode } from 'lucide-react';
|
||||
import AgreementModal from '../common/DocumentRenderer/AgreementModal';
|
||||
import AgreementModal from './LazyAgreementModal';
|
||||
import {
|
||||
isMiniProgramWebView,
|
||||
withMiniProgramLogins,
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React from 'react';
|
||||
import TelegramLoginButton from 'react-telegram-login';
|
||||
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
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 { Trans } from 'react-i18next';
|
||||
import { API, showError } from '../../helpers';
|
||||
import { Button, Card, Divider, Form, Typography } from '@/components/ui';
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { Button, Empty, Input, Tag, Tree, theme } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Search } from '@/components/common/icons/ActionIcons';
|
||||
|
||||
// 权限授权树(平台角色、套餐、模板、企业角色共用)。nodes 为后端 GrantNode 列表:
|
||||
// { code, parent, type: 'dir'|'menu'|'button', name, sort, sensitive, grantable }。
|
||||
// value 为已勾选的权限编码数组,只会包含 grantable 的节点;grantable=false 的节点只作为祖先展示,不可勾选。
|
||||
//
|
||||
// 联动规则(PRD AC50 / AC62 / AC80):
|
||||
// - 勾选一个节点 = 勾选它和它全部可选后代,并带上可选祖先(后端本来也会补齐祖先);
|
||||
// - 取消一个节点 = 只取消它和它的后代,兄弟不受影响;祖先下已没有任何选中的后代时祖先一并取消;
|
||||
// - 祖先的显示状态由"子树内可选节点是否全部选中"推导:全部选中为勾选,部分选中为半选。
|
||||
// 半选的祖先只提交它自己的编码,不会把未选中的后代带上。
|
||||
|
||||
const TYPE_META = {
|
||||
dir: { color: 'default', label: '目录' },
|
||||
menu: { color: 'blue', label: '菜单' },
|
||||
button: { color: 'green', label: '按钮' },
|
||||
};
|
||||
|
||||
const bySort = (a, b) =>
|
||||
(a.sort || 0) - (b.sort || 0) || a.code.localeCompare(b.code);
|
||||
|
||||
// 由扁平节点建索引:parent(父编码,根为 '')、children(已排序的子编码)、
|
||||
// subtree(子树内可选的编码,含自身)、order(先序遍历的编码)。
|
||||
export const buildPermIndex = (nodes) => {
|
||||
const byCode = new Map();
|
||||
for (const n of nodes || []) byCode.set(n.code, n);
|
||||
const parent = new Map();
|
||||
const childNodes = new Map();
|
||||
for (const n of byCode.values()) {
|
||||
// parent 不在列表里的节点当作根
|
||||
const p =
|
||||
n.parent && n.parent !== n.code && byCode.has(n.parent) ? n.parent : '';
|
||||
parent.set(n.code, p);
|
||||
const list = childNodes.get(p) || [];
|
||||
list.push(n);
|
||||
childNodes.set(p, list);
|
||||
}
|
||||
const children = new Map();
|
||||
for (const [p, list] of childNodes) {
|
||||
children.set(
|
||||
p,
|
||||
list.sort(bySort).map((n) => n.code),
|
||||
);
|
||||
}
|
||||
const subtree = new Map();
|
||||
const order = [];
|
||||
const walk = (code) => {
|
||||
order.push(code);
|
||||
const own = byCode.get(code).grantable ? [code] : [];
|
||||
for (const c of children.get(code) || []) own.push(...walk(c));
|
||||
subtree.set(code, own);
|
||||
return own;
|
||||
};
|
||||
for (const c of children.get('') || []) walk(c);
|
||||
return { byCode, parent, children, subtree, order };
|
||||
};
|
||||
|
||||
// 去掉树里不存在或不可授予的编码(提交它们会被后端拒绝)。
|
||||
// 只认 subtree 里登记过的节点:父链成环而从根走不到的节点不参与勾选。
|
||||
const selectableSet = (index, value) =>
|
||||
new Set(
|
||||
(value || []).filter(
|
||||
(c) => index.subtree.has(c) && index.byCode.get(c).grantable === true,
|
||||
),
|
||||
);
|
||||
|
||||
// 可以提交给后端的勾选结果(已排序):保存前用它过一遍,避免带上树里没有的历史编码
|
||||
export const selectablePerms = (index, value) =>
|
||||
[...selectableSet(index, value)].sort();
|
||||
|
||||
// 各节点的显示状态:checked = 子树内可选节点全部选中;halfChecked = 部分选中
|
||||
export const permCheckState = (index, value) => {
|
||||
const set = selectableSet(index, value);
|
||||
const checked = [];
|
||||
const halfChecked = [];
|
||||
for (const [code, list] of index.subtree) {
|
||||
if (!list.length) continue;
|
||||
let hit = 0;
|
||||
for (const c of list) if (set.has(c)) hit += 1;
|
||||
if (hit === list.length) checked.push(code);
|
||||
else if (hit > 0) halfChecked.push(code);
|
||||
}
|
||||
return { checked, halfChecked };
|
||||
};
|
||||
|
||||
// 点击一个节点后的新勾选结果(已排序)
|
||||
export const togglePerm = (index, value, code) => {
|
||||
const set = selectableSet(index, value);
|
||||
const sub = index.subtree.get(code) || [];
|
||||
if (!sub.length) return [...set].sort();
|
||||
if (sub.every((c) => set.has(c))) {
|
||||
for (const c of sub) set.delete(c);
|
||||
for (let p = index.parent.get(code); p; p = index.parent.get(p)) {
|
||||
if (index.subtree.get(p).some((c) => c !== p && set.has(c))) break;
|
||||
set.delete(p);
|
||||
}
|
||||
} else {
|
||||
for (const c of sub) set.add(c);
|
||||
for (let p = index.parent.get(code); p; p = index.parent.get(p)) {
|
||||
if (index.byCode.get(p).grantable) set.add(p);
|
||||
}
|
||||
}
|
||||
return [...set].sort();
|
||||
};
|
||||
|
||||
// 权限摘要:已选的菜单(附其下已选按钮数)与菜单、按钮总数。用于列表里的"权限摘要"列。
|
||||
export const summarizePerms = (index, perms) => {
|
||||
const set = selectableSet(index, perms);
|
||||
const menus = [];
|
||||
let buttonCount = 0;
|
||||
for (const code of index.order) {
|
||||
if (!set.has(code)) continue;
|
||||
const n = index.byCode.get(code);
|
||||
if (n.type === 'button') {
|
||||
buttonCount += 1;
|
||||
} else if (n.type === 'menu') {
|
||||
const buttons = index.subtree
|
||||
.get(code)
|
||||
.filter(
|
||||
(c) => set.has(c) && index.byCode.get(c).type === 'button',
|
||||
).length;
|
||||
menus.push({ code, name: n.name, buttons });
|
||||
}
|
||||
}
|
||||
return { menus, menuCount: menus.length, buttonCount, total: set.size };
|
||||
};
|
||||
|
||||
const expandableKeys = (index, keep) =>
|
||||
index.order.filter(
|
||||
(c) =>
|
||||
(!keep || keep.has(c)) &&
|
||||
(index.children.get(c) || []).some((k) => !keep || keep.has(k)),
|
||||
);
|
||||
|
||||
// 搜索:保留命中的节点、它的祖先(定位用)和它的整棵子树(方便直接勾选下面的按钮)
|
||||
const matchKeys = (index, keyword) => {
|
||||
const kw = keyword.trim().toLowerCase();
|
||||
if (!kw) return null;
|
||||
const keep = new Set();
|
||||
const addSubtree = (code) => {
|
||||
keep.add(code);
|
||||
for (const c of index.children.get(code) || []) addSubtree(c);
|
||||
};
|
||||
for (const code of index.order) {
|
||||
const n = index.byCode.get(code);
|
||||
if (
|
||||
!(n.name || '').toLowerCase().includes(kw) &&
|
||||
!code.toLowerCase().includes(kw)
|
||||
)
|
||||
continue;
|
||||
addSubtree(code);
|
||||
for (let p = index.parent.get(code); p; p = index.parent.get(p))
|
||||
keep.add(p);
|
||||
}
|
||||
return keep;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {object} props
|
||||
* @param {Array} props.nodes 后端 GrantNode 列表
|
||||
* @param {string[]} [props.value] 已勾选的权限编码
|
||||
* @param {(codes: string[]) => void} [props.onChange] 勾选变化,参数为排序后的编码数组
|
||||
* @param {boolean} [props.disabled] 只读:不可勾选,仍可展开、收起与搜索
|
||||
* @param {number|string} [props.height=480] 树区域的最大高度,超出滚动
|
||||
* @param {boolean} [props.showToolbar=true] 是否显示搜索框与"全部展开 / 全部收起"
|
||||
* @param {boolean} [props.defaultExpandAll=true] 初始是否全部展开(false 时只显示根级节点)
|
||||
* @param {string} [props.className]
|
||||
*/
|
||||
const PermTree = ({
|
||||
nodes,
|
||||
value,
|
||||
onChange,
|
||||
disabled,
|
||||
height = 480,
|
||||
showToolbar = true,
|
||||
defaultExpandAll = true,
|
||||
className,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const index = useMemo(() => buildPermIndex(nodes), [nodes]);
|
||||
const [keyword, setKeyword] = useState('');
|
||||
// null = 尚未手动操作,按 defaultExpandAll 取初始值(节点异步到达后仍然生效)
|
||||
const [expandedKeys, setExpandedKeys] = useState(null);
|
||||
// 搜索期间单独记一份展开状态,清空搜索后回到原来的展开状态
|
||||
const [searchExpandedKeys, setSearchExpandedKeys] = useState(null);
|
||||
|
||||
const keep = useMemo(() => matchKeys(index, keyword), [index, keyword]);
|
||||
const allExpandable = useMemo(
|
||||
() => expandableKeys(index, keep),
|
||||
[index, keep],
|
||||
);
|
||||
const checkState = useMemo(
|
||||
() => permCheckState(index, value),
|
||||
[index, value],
|
||||
);
|
||||
|
||||
const treeData = useMemo(() => {
|
||||
const build = (parentCode) =>
|
||||
(index.children.get(parentCode) || [])
|
||||
.filter((code) => !keep || keep.has(code))
|
||||
.map((code) => {
|
||||
const n = index.byCode.get(code);
|
||||
const meta = TYPE_META[n.type];
|
||||
return {
|
||||
key: code,
|
||||
disableCheckbox: disabled || !n.grantable,
|
||||
title: (
|
||||
<span className='inline-flex flex-wrap items-center gap-1'>
|
||||
<span>{n.name}</span>
|
||||
{meta ? (
|
||||
<Tag color={meta.color} style={{ marginInlineEnd: 0 }}>
|
||||
{t(meta.label)}
|
||||
</Tag>
|
||||
) : null}
|
||||
{n.sensitive ? (
|
||||
<Tag color='error' style={{ marginInlineEnd: 0 }}>
|
||||
{t('敏感')}
|
||||
</Tag>
|
||||
) : null}
|
||||
</span>
|
||||
),
|
||||
children: build(code),
|
||||
};
|
||||
});
|
||||
return build('');
|
||||
}, [index, keep, disabled, t]);
|
||||
|
||||
const searching = keep !== null;
|
||||
const currentExpanded = searching
|
||||
? (searchExpandedKeys ?? allExpandable)
|
||||
: (expandedKeys ?? (defaultExpandAll ? allExpandable : []));
|
||||
const setCurrentExpanded = searching
|
||||
? setSearchExpandedKeys
|
||||
: setExpandedKeys;
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{showToolbar ? (
|
||||
<div className='mb-2 flex flex-wrap items-center gap-2'>
|
||||
<Input
|
||||
allowClear
|
||||
value={keyword}
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索权限')}
|
||||
aria-label={t('搜索权限')}
|
||||
style={{ flex: '1 1 180px', minWidth: 0 }}
|
||||
onChange={(e) => {
|
||||
setKeyword(e.target.value);
|
||||
// 每次改关键字都重新展开全部命中路径
|
||||
setSearchExpandedKeys(null);
|
||||
}}
|
||||
/>
|
||||
<Button onClick={() => setCurrentExpanded(allExpandable)}>
|
||||
{t('全部展开')}
|
||||
</Button>
|
||||
<Button onClick={() => setCurrentExpanded([])}>
|
||||
{t('全部收起')}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
style={{
|
||||
maxHeight: height,
|
||||
overflow: 'auto',
|
||||
padding: 8,
|
||||
border: `1px solid ${token.colorBorderSecondary}`,
|
||||
borderRadius: token.borderRadius,
|
||||
}}
|
||||
>
|
||||
{treeData.length ? (
|
||||
<Tree
|
||||
checkable
|
||||
// 联动与半选由本组件按"可选节点"自行计算;antd 自带的联动会把已保存的祖先当成全选
|
||||
checkStrictly
|
||||
selectable={false}
|
||||
treeData={treeData}
|
||||
checkedKeys={checkState}
|
||||
expandedKeys={currentExpanded}
|
||||
autoExpandParent={false}
|
||||
onExpand={(keys) => setCurrentExpanded(keys)}
|
||||
onCheck={(_, info) =>
|
||||
onChange?.(togglePerm(index, value, info.node.key))
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={searching ? t('没有匹配的权限') : t('暂无数据')}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PermTree;
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { Suspense, lazy, useContext } from 'react';
|
||||
import { StatusContext } from '../../../context/Status';
|
||||
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import './CinematicTokenFactory.css';
|
||||
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 i18next from 'i18next';
|
||||
import React from 'react';
|
||||
import Loading from './ui/Loading';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { X as ActionX } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { Modal } from '@/components/ui';
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
ChevronUp as ActionChevronUp,
|
||||
ArrowLeft as ActionArrowLeft,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
OpenAI,
|
||||
Claude,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { readFile } from 'node:fs/promises';
|
||||
import { runInNewContext } from 'node:vm';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
const MapleBackground = () => {
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { Select, Spin, Typography, Empty, Tag, Tooltip } from '@/components/ui';
|
||||
import { Lock } from 'lucide-react';
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* PageGuide —— 企业控制台页面级「使用指引」三层体系的可复用实现。
|
||||
*
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
@@ -26,6 +7,7 @@ const pageTitles = {
|
||||
'/user-center/key-management': '密钥管理',
|
||||
'/user-center/dashboard': '数据看板',
|
||||
'/user-center/usage-record': '使用记录',
|
||||
'/user-center/service-dashboard': '服务监控',
|
||||
'/user-center/topup': '在线充值',
|
||||
'/user-center/settings': '个人设置',
|
||||
'/user-center/invite': '邀请有奖',
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import UserCenterBreadcrumb from './UserCenterBreadcrumb';
|
||||
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { forwardRef } from 'react';
|
||||
import { Avatar, theme } from 'antd';
|
||||
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { forwardRef } from 'react';
|
||||
|
||||
export default forwardRef(function IconCombine(
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/*
|
||||
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 { useActualTheme } from '../../../context/Theme';
|
||||
|
||||
// Dify and Moonshot variants read the existing app theme without a second provider.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user