From dfa5c1edd6288d76b0393673e9497f58efee2038 Mon Sep 17 00:00:00 2001
From: zhanjunhao <642307404@qq.com>
Date: Tue, 17 Nov 2026 17:47:57 +0800
Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E4=BF=AE=E5=A4=8D=E5=9B=BA=E5=AE=9A?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A4=B4=E5=B9=B6=E4=BC=98=E5=8C=96=E5=AE=98?=
=?UTF-8?q?=E7=BD=91=E6=8C=87=E6=A0=87=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/CHANGELOG.md | 16 +++
docs/standards/UI_COMPONENT_STANDARDS.md | 4 +-
src/components/console/console.css | 2 +-
.../table/models/models-vendor-tabs.css | 10 --
src/components/ui/CenterActionTable.jsx | 50 ++++----
src/components/ui/center-table.css | 24 ++--
src/components/ui/centerTablePolicy.js | 28 ++++-
src/i18n/locales/en.json | 4 +
src/i18n/locales/fr.json | 4 +
src/i18n/locales/ja.json | 4 +
src/i18n/locales/ko.json | 4 +
src/i18n/locales/ru.json | 4 +
src/i18n/locales/th.json | 4 +
src/i18n/locales/vi.json | 4 +
src/i18n/locales/zh-TW.json | 4 +
src/i18n/locales/zh.json | 4 +
src/pages/KeyManagement/key-management.css | 2 +-
src/pages/UserCenter/UsageRecord.css | 3 +-
src/pages/WebsiteSettings/README.md | 12 +-
src/pages/WebsiteSettings/WebsiteField.jsx | 107 ++++++++++++++----
src/pages/WebsiteSettings/WebsiteSettings.css | 23 +++-
src/pages/WebsiteSettings/index.jsx | 23 ++--
src/pages/WebsiteSettings/model.js | 70 +++++++++---
src/pages/WebsiteSettings/settingsApi.js | 3 +-
src/styles/org-center.css | 6 +-
src/styles/prototype.css | 2 +-
test/unit/center-table-policy.test.js | 30 +++++
test/unit/website-save-validation.test.js | 8 +-
28 files changed, 351 insertions(+), 108 deletions(-)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 1aef56e7..3cb97a00 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -10,6 +10,22 @@
## 2026-11-17
+### 调整 · 官网设置指标只填数字并实时预览官网展示
+
+- **范围**:`/console/website-setting` 的“首页”“关于微词元”指标字段(付费企业客户、平台日均 Token 调用、客户月度 AI 调用成本、团队成员、研发人员占比)及保存逻辑。
+- **变更**:指标输入只保留数字(全角自动转半角、其他字符丢弃),`+` / `%` 以不可编辑后缀展示,Token 调用用“万 / 亿”下拉并合成存储(如 `500亿`);输入框下方实时显示“官网展示”,首页团队成员同时展示研发占比;校验改为不接受 `+` / `%` 与前导零;后端改为 LONGTEXT 后移除前端 60 KiB 总大小限制。
+- **影响**:配置中的指标字段为纯数字字符串,单位由官网渲染;不兼容带单位的旧值(官网尚未对接)。接口路径与结构不变,新增文案已补齐 9 个语言包。官网仓库 `weelink-open` 的 `docs/api-integration-frontend-20261031.md` 同步了指标与动态与洞察约定。
+- **回滚**:按文件还原 `src/pages/WebsiteSettings/` 下 `model.js`、`WebsiteField.jsx`、`index.jsx`、`settingsApi.js`、`WebsiteSettings.css`、README、相关单测(含 `test/unit/website-save-validation.test.js`)及语言包新增键。
+- **关联**:`src/pages/WebsiteSettings/README.md`。
+
+### 修复 · 三中心固定列表头透字与样式对齐
+
+- **范围**:公共表格封装、列布局策略与 `center-table.css`,控制台(含聊天设置)、企业中心、用户中心的表头样式和列策略回归测试。
+- **变更**:所有表头统一在不透明容器底色上叠加页面色调,避免半透明背景透出滚动列文字;页面仅提供表头色调变量。固定单元格恢复 antd 6 动态层级,使用当前版本固定列类名覆盖正文底色、悬停与选中态;移除模型页依赖旧类名的局部补丁,统一表头不换行。异步数据加载后按可见行重新测量操作宽度,窄屏限制操作列宽并允许按钮组换行;固定区挤占时释放其他固定列,恢复宽屏后自动还原。
+- **影响**:保留原列对齐、横向滚动、操作回调、接口、权限与数据流;操作区列宽随实际内容和容器调整,浅深主题均适用,不涉及生产构建与数据迁移。
+- **回滚**:按本条涉及的组件、列策略、CSS、测试与规范差异还原,不覆盖其他修改。
+- **关联**:`docs/standards/UI_COMPONENT_STANDARDS.md` 第 5.2 节,`src/components/ui/center-table.css`。
+
### 工具 · 两项目浏览器环境与报告隔离
- **范围**:Playwright 配置、设备共享模块、公共 fixture、启动与产物校验脚本、测试命令和对应文档。
diff --git a/docs/standards/UI_COMPONENT_STANDARDS.md b/docs/standards/UI_COMPONENT_STANDARDS.md
index f9ca612c..7e506cce 100644
--- a/docs/standards/UI_COMPONENT_STANDARDS.md
+++ b/docs/standards/UI_COMPONENT_STANDARDS.md
@@ -1,6 +1,6 @@
# UI 公共组件与样式规范
-> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-16 · 版本:v2.2
+> 状态:有效 · 适用:antd 6.7.0 · 更新:2026-11-17 · 版本:v2.3
所有后台页面共用的主题与组件标准。页面规范只记录与本文不同的部分;编码约定见 `DEV_STANDARDS.md`,外壳与布局见 `GLOBAL_UI_BASELINE.md`。
@@ -152,6 +152,8 @@ html.dark .km-page {
- 操作列放在最后,按钮为 `type='link' size='small'`,危险操作加 `danger`,同一行操作间距 8–10px;用户中心、企业中心、控制台(含系统设置)的操作列统一 `fixed: 'right'`;操作较多时折叠到“更多”下拉。
- 三中心表格通过 `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` 类名补丁;表头不换行,表头与正文沿用同一列宽和对齐方式。
+- 操作列在异步数据或列变化后重新测量可见行的按钮宽度,取最大值;列宽不超过表格容器,按钮组在空间不足时换行。左右固定区总宽超过容器时,保留右侧操作列,其余固定列参与横向滚动;容器恢复足够宽度后恢复原固定配置,避免窄屏相互遮挡。
### 5.3 状态
diff --git a/src/components/console/console.css b/src/components/console/console.css
index 7f70025f..88c4aba2 100644
--- a/src/components/console/console.css
+++ b/src/components/console/console.css
@@ -230,7 +230,7 @@
margin-inline-start: auto;
}
.console-page .console-table .ant-table-thead > tr > th {
- background: var(--console-fill);
+ --center-table-head-bg: var(--console-fill);
color: var(--console-muted);
font-weight: 500;
}
diff --git a/src/components/table/models/models-vendor-tabs.css b/src/components/table/models/models-vendor-tabs.css
index 13aae4b6..df451a8c 100644
--- a/src/components/table/models/models-vendor-tabs.css
+++ b/src/components/table/models/models-vendor-tabs.css
@@ -96,16 +96,6 @@
opacity: 0.65;
}
-/* Sticky headers need an opaque surface below the translucent header tint. */
-.console-page[data-console-page='models']
- .console-table
- .ant-table-thead
- > tr
- > th.ant-table-cell-fix-right {
- background-color: var(--console-surface);
- background-image: linear-gradient(var(--console-fill), var(--console-fill));
-}
-
.models-vendor-actions {
display: flex;
flex-shrink: 0;
diff --git a/src/components/ui/CenterActionTable.jsx b/src/components/ui/CenterActionTable.jsx
index 225e8991..e2b0a1f3 100644
--- a/src/components/ui/CenterActionTable.jsx
+++ b/src/components/ui/CenterActionTable.jsx
@@ -68,29 +68,34 @@ const CenterTable = forwardRef(function CenterTable(
const cells = [...root.querySelectorAll(`td.${marker}`)].filter(
(element) => element.getBoundingClientRect().width > 0,
);
- const cell = cells.find((candidate) =>
- candidate.querySelector('button, a, [role="button"]'),
- );
- const controls = cell
- ? [...cell.querySelectorAll('button, a, [role="button"]')].filter(
- (element) => element.getBoundingClientRect().width > 0,
- )
- : [];
- const cellStyle = getComputedStyle(cell || header);
- const padding =
- (Number.parseFloat(cellStyle.paddingLeft) || 0) +
- (Number.parseFloat(cellStyle.paddingRight) || 0);
- const gap = Number.parseFloat(cellStyle.columnGap) || 8;
- const contentWidth = controls.length
- ? controls.reduce(
+ const widths = cells.map((cell) => {
+ const controls = [
+ ...cell.querySelectorAll('button, a, [role="button"]'),
+ ].filter((element) => element.getBoundingClientRect().width > 0);
+ if (!controls.length) return 0;
+ let group = controls[0].parentElement;
+ while (
+ group !== cell &&
+ !controls.every((control) => group.contains(control))
+ )
+ group = group.parentElement;
+ const cellStyle = getComputedStyle(cell);
+ const padding =
+ (Number.parseFloat(cellStyle.paddingLeft) || 0) +
+ (Number.parseFloat(cellStyle.paddingRight) || 0);
+ const gap = Number.parseFloat(getComputedStyle(group).columnGap) || 8;
+ return (
+ controls.reduce(
(total, element) => total + element.getBoundingClientRect().width,
0,
) +
- gap * Math.max(0, controls.length - 1)
- : Math.max(...cells.map((candidate) => candidate.scrollWidth), 0) -
- padding;
- next[marker.replace('center-fixed-index-', '')] =
- contentWidth + padding;
+ gap * Math.max(0, controls.length - 1) +
+ padding
+ );
+ });
+ const measured = Math.max(...widths, 0);
+ if (measured > 0)
+ next[marker.replace('center-fixed-index-', '')] = measured;
});
setMeasuredActionWidths((current) => {
const same =
@@ -101,15 +106,16 @@ const CenterTable = forwardRef(function CenterTable(
return same ? current : next;
});
};
- requestAnimationFrame(measureActionWidths);
+ const frame = requestAnimationFrame(measureActionWidths);
const observer = new ResizeObserver(update);
observer.observe(root);
return () => {
observer.disconnect();
+ cancelAnimationFrame(frame);
if (scroller && previousTabIndex === null)
scroller.removeAttribute('tabindex');
};
- }, [enabled, width]);
+ }, [enabled, width, columns, props.dataSource]);
return (
tr > .center-fixed-cell {
- z-index: 2;
+.center-action-table .ant-table-tbody > tr > .ant-table-cell-fix {
background: var(--center-table-bg);
background-clip: padding-box;
}
-.center-action-table .ant-table-thead > tr > .center-fixed-cell {
- z-index: 3;
- background: var(--ur-head-bg, var(--center-table-head-bg));
+.center-action-table .ant-table-thead > tr > .ant-table-cell {
+ /* Composite the header tint over an opaque surface, including sticky cells. */
+ background-color: var(--center-table-bg);
+ background-image: linear-gradient(
+ var(--center-table-head-bg),
+ var(--center-table-head-bg)
+ );
background-clip: padding-box;
+ white-space: nowrap;
}
-.center-action-table .ant-table-tbody > tr:hover > .center-fixed-cell {
+.center-action-table .ant-table-tbody > tr:hover > .ant-table-cell-fix {
background: var(--center-table-hover-bg);
}
.center-action-table
.ant-table-tbody
> tr.ant-table-row-selected
- > .center-fixed-cell {
+ > .ant-table-cell-fix {
background: var(--center-table-selected-bg);
}
-.center-action-table .center-fixed-cell {
+.center-action-table .ant-table-tbody > tr > .center-fixed-cell {
white-space: normal;
overflow-wrap: anywhere;
}
@@ -50,6 +54,6 @@
.admin-tokens-row-actions,
.website-insights-row-actions
) {
- flex-wrap: nowrap;
- max-width: none;
+ flex-wrap: wrap;
+ max-width: 100%;
}
diff --git a/src/components/ui/centerTablePolicy.js b/src/components/ui/centerTablePolicy.js
index 11923734..f268f7c1 100644
--- a/src/components/ui/centerTablePolicy.js
+++ b/src/components/ui/centerTablePolicy.js
@@ -89,11 +89,15 @@ const markFixedRight = (
index,
action = false,
measuredWidths = {},
+ containerWidth = 0,
) => ({
...column,
fixed: 'right',
width: action
- ? actionWidth(column, measuredWidths[index])
+ ? Math.min(
+ actionWidth(column, measuredWidths[index]),
+ containerWidth > 0 ? Math.max(56, containerWidth) : Infinity,
+ )
: columnWidth(column),
...(action ? { title: i18next.t('操作') || '操作' } : {}),
className: [
@@ -110,6 +114,22 @@ export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
const leaves = leafColumns(columns);
const last = leaves.at(-1);
const hasAction = last && isActionColumn(last);
+ const pinnedWidth = hasAction
+ ? leaves.reduce(
+ (total, column, index) =>
+ total +
+ (column === last
+ ? Math.min(
+ actionWidth(column, measuredWidths[index]),
+ width || Infinity,
+ )
+ : column.fixed
+ ? columnWidth(column)
+ : 0),
+ 0,
+ )
+ : 0;
+ const releaseOtherFixed = width > 0 && pinnedWidth > width;
const estimatedTotal = leaves.reduce(
(total, column) => total + columnWidth(column),
0,
@@ -125,8 +145,12 @@ export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
return { ...column, children: column.children.map(mapColumn) };
const columnIndex = index++;
if (hasAction && column === last)
- return markFixedRight(column, columnIndex, true, measuredWidths);
+ return markFixedRight(column, columnIndex, true, measuredWidths, width);
if (fallback.has(column)) return markFixedRight(column, columnIndex);
+ if (releaseOtherFixed && column.fixed) {
+ const { fixed: _fixed, ...scrollable } = column;
+ return scrollable;
+ }
if (column.fixed) return { ...column, width: columnWidth(column) };
return column;
});
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index ab2f96ab..efe52607 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -10710,6 +10710,10 @@
"点击图片可放大预览": "Click on the image to enlarge the preview",
"官网设置已保存": "The official website settings have been saved",
"研发人员占比": "Proportion of R & D personnel",
+ "官网展示:{{value}}": "Website display: {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · R&D ratio {{ratio}}",
+ "降幅": "reduction",
+ "首页与关于微词元共用": "shared by Home and About",
"四个页签共用一份配置,保存时将统一校验并提交。": "All four tabs share one configuration. Saving validates and submits all settings together.",
"富文本工具栏": "Rich text toolbar",
"正文段落": "Body paragraph",
diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json
index 42909abc..7ce43955 100644
--- a/src/i18n/locales/fr.json
+++ b/src/i18n/locales/fr.json
@@ -10599,6 +10599,10 @@
"点击图片可放大预览": "Cliquez sur l'image pour agrandir l'aperçu",
"官网设置已保存": "Les paramètres du site officiel sont sauvegardés",
"研发人员占比": "Proportion de personnel R & D",
+ "官网展示:{{value}}": "Affichage sur le site : {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · part R&D {{ratio}}",
+ "降幅": "baisse",
+ "首页与关于微词元共用": "partagé entre Accueil et À propos",
"四个页签共用一份配置,保存时将统一校验并提交。": "Les quatre onglets partagent une configuration et sont soumis uniformément à la vérification et à la validation lorsqu 'ils sont sauvegardés.",
"结算状态: {{label}}": "Statut du règlement: {{label}}",
"确认未生效:授权、凭据或操作内容已变化,请刷新任务后重试。": "La confirmation n'est pas effective: l'autorisation, les informations d'identification ou le contenu de l'action ont changé, veuillez actualiser la tâche et réessayer.",
diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json
index 3ab1f799..96ebed6e 100644
--- a/src/i18n/locales/ja.json
+++ b/src/i18n/locales/ja.json
@@ -10684,6 +10684,10 @@
"点击图片可放大预览": "画像をクリックしてプレビューを拡大",
"官网设置已保存": "WEB保存済みです。",
"研发人员占比": "開発スタッフの割合",
+ "官网展示:{{value}}": "公式サイト表示:{{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · 研究開発比率 {{ratio}}",
+ "降幅": "削減率",
+ "首页与关于微词元共用": "ホームと会社概要で共用",
"四个页签共用一份配置,保存时将统一校验并提交。": "4つのタブは1つの構成を共有し、保存時に均一に検証およびコミットされます。",
"富文本工具栏": "リッチテキストツールバー",
"正文段落": "本文段落",
diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json
index 6a5d56a9..561261da 100644
--- a/src/i18n/locales/ko.json
+++ b/src/i18n/locales/ko.json
@@ -10685,6 +10685,10 @@
"点击图片可放大预览": "이미지를 클릭하여 미리보기를 확대합니다.",
"官网设置已保存": "공식 웹사이트 설정이 저장되었습니다.",
"研发人员占比": "R&D 인력의 비율",
+ "官网展示:{{value}}": "웹사이트 표시: {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · R&D 비율 {{ratio}}",
+ "降幅": "감소폭",
+ "首页与关于微词元共用": "홈과 회사 소개에서 공용",
"四个页签共用一份配置,保存时将统一校验并提交。": "네 개의 탭은 구성을 공유하며, 이 구성은 저장 시 확인되고 제출됩니다.",
"富文本工具栏": "서식 있는 텍스트 도구 모음",
"正文段落": "본문 단락",
diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json
index 7338e7ae..c4384e86 100644
--- a/src/i18n/locales/ru.json
+++ b/src/i18n/locales/ru.json
@@ -10351,6 +10351,10 @@
"点击图片可放大预览": "Нажмите на изображение для увеличения предварительного просмотра",
"官网设置已保存": "Официальный сайт сохранен.",
"研发人员占比": "Доля исследователей",
+ "官网展示:{{value}}": "На сайте: {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · доля R&D {{ratio}}",
+ "降幅": "снижение",
+ "首页与关于微词元共用": "общее для главной и раздела «О нас»",
"四个页签共用一份配置,保存时将统一校验并提交。": "Четыре страницы совместно используют один экземпляр конфигурации, при сохранении будет проведена единая проверка и отправка.",
"{{count}} 处非法输入": "{{count}} неверный вход (ы)",
"{{count}} 个已验证渠道": "{{count}} верифицированные каналы",
diff --git a/src/i18n/locales/th.json b/src/i18n/locales/th.json
index 366b7a44..e54fb888 100644
--- a/src/i18n/locales/th.json
+++ b/src/i18n/locales/th.json
@@ -10684,6 +10684,10 @@
"点击图片可放大预览": "คลิกที่ภาพเพื่อดูตัวอย่าง",
"官网设置已保存": "บันทึกการตั้งค่าเว็บไซต์อย่างเป็นทางการแล้ว",
"研发人员占比": "สัดส่วนของบุคลากรด้าน R&D",
+ "官网展示:{{value}}": "แสดงบนเว็บไซต์: {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · สัดส่วน R&D {{ratio}}",
+ "降幅": "ลดลง",
+ "首页与关于微词元共用": "ใช้ร่วมกันระหว่างหน้าแรกและเกี่ยวกับเรา",
"四个页签共用一份配置,保存时将统一校验并提交。": "แท็บทั้งสี่จะใช้การกําหนดค่าร่วมกันและจะได้รับการตรวจสอบและส่งเมื่อบันทึก",
"富文本工具栏": "แถบเครื่องมือข้อความที่มีรูปแบบ",
"正文段落": "ย่อหน้าเนื้อหา",
diff --git a/src/i18n/locales/vi.json b/src/i18n/locales/vi.json
index baca608e..267bf2c7 100644
--- a/src/i18n/locales/vi.json
+++ b/src/i18n/locales/vi.json
@@ -10684,6 +10684,10 @@
"点击图片可放大预览": "Nhấp vào hình ảnh để phóng to bản xem trước",
"官网设置已保存": "Cài đặt trang web chính thức đã được lưu",
"研发人员占比": "Tỷ lệ nhân viên R & D",
+ "官网展示:{{value}}": "Hiển thị trên website: {{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · tỷ lệ R&D {{ratio}}",
+ "降幅": "mức giảm",
+ "首页与关于微词元共用": "dùng chung cho Trang chủ và Giới thiệu",
"四个页签共用一份配置,保存时将统一校验并提交。": "Bốn tab dùng chung một bản sao của bố trí và được kiểm tra và cam kết thống nhất khi bạn lưu lại.",
"富文本工具栏": "Thanh công cụ văn bản có định dạng",
"正文段落": "Đoạn văn bản",
diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json
index 35eccc48..7013dd43 100644
--- a/src/i18n/locales/zh-TW.json
+++ b/src/i18n/locales/zh-TW.json
@@ -10684,6 +10684,10 @@
"点击图片可放大预览": "點擊圖片可放大預覽",
"官网设置已保存": "官網設置已保存",
"研发人员占比": "研發人員佔比",
+ "官网展示:{{value}}": "官網展示:{{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · 研發佔比 {{ratio}}",
+ "降幅": "降幅",
+ "首页与关于微词元共用": "首頁與關於微詞元共用",
"四个页签共用一份配置,保存时将统一校验并提交。": "四個頁籤共用一份配置,保存時將統一校驗並提交。",
"富文本工具栏": "富文字工具列",
"正文段落": "內文段落",
diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json
index f55582be..ccdbe63e 100644
--- a/src/i18n/locales/zh.json
+++ b/src/i18n/locales/zh.json
@@ -10598,6 +10598,10 @@
"点击图片可放大预览": "点击图片可放大预览",
"官网设置已保存": "官网设置已保存",
"研发人员占比": "研发人员占比",
+ "官网展示:{{value}}": "官网展示:{{value}}",
+ "{{team}} · 研发占比 {{ratio}}": "{{team}} · 研发占比 {{ratio}}",
+ "降幅": "降幅",
+ "首页与关于微词元共用": "首页与关于微词元共用",
"四个页签共用一份配置,保存时将统一校验并提交。": "四个页签共用一份配置,保存时将统一校验并提交。",
"富文本工具栏": "富文本工具栏",
"正文段落": "正文段落",
diff --git a/src/pages/KeyManagement/key-management.css b/src/pages/KeyManagement/key-management.css
index 6ccee162..b05d812c 100644
--- a/src/pages/KeyManagement/key-management.css
+++ b/src/pages/KeyManagement/key-management.css
@@ -123,10 +123,10 @@ html.dark .km-page {
/* 表格:表头 46px、底色 #f8f9fc、常规字重;行分隔 #f0f0f0(middle 尺寸 12px 8px) */
.km-table .ant-table-thead > tr > th {
+ --center-table-head-bg: var(--km-head-bg);
height: 46px;
padding-block: 0;
border-bottom-color: var(--km-row-split);
- background: var(--km-head-bg);
color: var(--km-head-text);
font-weight: 400;
}
diff --git a/src/pages/UserCenter/UsageRecord.css b/src/pages/UserCenter/UsageRecord.css
index 34596e8b..599f6502 100644
--- a/src/pages/UserCenter/UsageRecord.css
+++ b/src/pages/UserCenter/UsageRecord.css
@@ -180,10 +180,10 @@ html.dark .usage-record-tabs .ant-tabs-ink-bar {
margin: 0;
}
.usage-record-table .ant-table-thead > tr > th {
+ --center-table-head-bg: var(--ur-head-bg);
height: 46px;
padding-block: 0;
border-bottom-color: var(--ur-row-split);
- background: var(--ur-head-bg);
color: var(--ur-head-text);
font-weight: 400;
}
@@ -217,7 +217,6 @@ html.dark .usage-record-consume-card {
> th {
padding-block: 0;
padding-inline: 8px;
- background: var(--ur-head-bg);
color: var(--ur-head-text);
font-size: 14px;
}
diff --git a/src/pages/WebsiteSettings/README.md b/src/pages/WebsiteSettings/README.md
index be963069..884b613b 100644
--- a/src/pages/WebsiteSettings/README.md
+++ b/src/pages/WebsiteSettings/README.md
@@ -27,9 +27,15 @@ teamMembers/researchRatio 映射 about.teamMembers/researchStaffRatio;首页
其余总部、服务网络和商务字段依联调文档映射。保存保留后端返回的未知字段。
严格检查 success === true 后才提示成功,失败保留当前编辑。提交期间防止重复请求。
-完整配置按 UTF-8 字节限制为 60 KiB,超限时提示精简内容。
-客户数和人数支持正整数及末尾 +;Token 支持正数、万/亿单位及末尾 +。
-百分比支持 0~100,最多两位小数,% 可选。上述展示值以字符串提交。
+后端以 LONGTEXT 存储完整配置,前端不再限制总大小;单篇正文由编辑器限制为 20000 字。
+
+指标字段只填数字,单位由官网展示(后台输入框右侧灰字同步显示,下方实时预览“官网展示”):
+
+- 付费企业客户、团队成员:大于 0 的整数,不含前导零,存 "300",官网显示 300+。
+- 平台日均 Token 调用:大于 0、最多两位小数的数字 + 下拉单位(万/亿,默认亿),合成存 "500亿",官网显示 500亿+。
+- 客户月度 AI 调用成本(降幅)、研发人员占比:0~100、最多两位小数,存 "20",官网显示 ↓20% / 60%。
+
+输入时全角数字与句号自动转半角,其他字符直接丢弃。官网尚未对接,不兼容带 + / % 的旧值。
## 二维码上传
diff --git a/src/pages/WebsiteSettings/WebsiteField.jsx b/src/pages/WebsiteSettings/WebsiteField.jsx
index 09cccd1f..3c6d07ab 100644
--- a/src/pages/WebsiteSettings/WebsiteField.jsx
+++ b/src/pages/WebsiteSettings/WebsiteField.jsx
@@ -17,10 +17,18 @@ along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
-import React from 'react';
+import React, { useState } from 'react';
+import { Select as AntSelect, Space } from 'antd';
import { Form, Input } from '@/components/ui';
import { useTranslation } from 'react-i18next';
-import { FIELDS } from './model';
+import {
+ AMOUNT_UNITS,
+ FIELDS,
+ joinAmount,
+ metricPreview,
+ sanitizeMetricInput,
+ splitAmount,
+} from './model';
export default function WebsiteField({
name,
@@ -29,18 +37,43 @@ export default function WebsiteField({
onChange,
onBlur,
disabled,
- labelSuffix,
+ preview,
children,
}) {
const { t } = useTranslation();
const field = FIELDS[name];
+ const metric = field.metric;
+ const amount = metric?.kind === 'amount' ? splitAmount(value) : null;
+ // Keep the chosen unit while the number is still empty (the stored value is '' then).
+ const [pendingUnit, setPendingUnit] = useState(amount?.unit);
+ const unit = amount?.number ? amount.unit : pendingUnit;
+ const previewText = preview ?? metricPreview(name, value);
+ const inputProps = {
+ id: `website-${name}`,
+ 'aria-label': t(field.label),
+ 'aria-required': true,
+ 'aria-invalid': Boolean(error),
+ 'aria-describedby': error ? `website-${name}-error` : undefined,
+ onBlur,
+ disabled,
+ placeholder: t(field.placeholder),
+ validateStatus: error ? 'error' : 'default',
+ showClear: true,
+ };
+ const unitAddon = metric ? (
+
+ {metric.suffix}
+
+ ) : null;
return (
{t(field.label)}
- {labelSuffix}
+ {field.note ? (
+ ({t(field.note)})
+ ) : null}
>
),
required: true,
@@ -50,24 +83,56 @@ export default function WebsiteField({
error: error ? t(error) : undefined,
errorMessageId: `website-${name}-error`,
}}
+ extra={
+ metric ? (
+
+ {previewText
+ ? t('官网展示:{{value}}', { value: previewText })
+ : ''}
+
+ ) : undefined
+ }
>
- {children || (
-
- )}
+ {children ||
+ (metric ? (
+
+ {
+ const number = sanitizeMetricInput(next);
+ onChange(amount ? joinAmount(number, unit) : number);
+ }}
+ />
+ {amount ? (
+ ({
+ value: item,
+ label: item,
+ }))}
+ onChange={(next) => {
+ setPendingUnit(next);
+ if (amount.number) onChange(joinAmount(amount.number, next));
+ }}
+ />
+ ) : null}
+ {unitAddon}
+
+ ) : (
+
+ ))}
);
}
diff --git a/src/pages/WebsiteSettings/WebsiteSettings.css b/src/pages/WebsiteSettings/WebsiteSettings.css
index 7aee6c1f..ddef3198 100644
--- a/src/pages/WebsiteSettings/WebsiteSettings.css
+++ b/src/pages/WebsiteSettings/WebsiteSettings.css
@@ -47,8 +47,27 @@
font-size: 13px;
}
-.website-settings-page .website-research-ratio-hint {
- opacity: 0.9;
+.website-settings-page .website-field-note {
+ color: var(--ui-color-text-2);
+ font-weight: 400;
+}
+
+.website-settings-page .website-metric-unit {
+ min-width: 40px;
+ justify-content: center;
+ color: var(--ui-color-text-2);
+}
+
+.website-settings-page .website-metric-unit-select {
+ width: 72px;
+ flex: none;
+}
+
+.website-settings-page .website-metric-preview {
+ display: block;
+ min-height: 22px;
+ color: var(--ui-color-text-2);
+ line-height: 22px;
}
.website-settings-page .website-settings-tab-description {
diff --git a/src/pages/WebsiteSettings/index.jsx b/src/pages/WebsiteSettings/index.jsx
index c2c2c476..b09d948d 100644
--- a/src/pages/WebsiteSettings/index.jsx
+++ b/src/pages/WebsiteSettings/index.jsx
@@ -32,6 +32,7 @@ import { showError, showSuccess, showWarning } from '../../helpers';
import {
TABS,
emptySettings,
+ metricPreview,
settingsFromConfig,
serializeSettings,
validateField,
@@ -91,6 +92,17 @@ export default function WebsiteSettings() {
}, [dirty]);
const tab = TABS.find((item) => item.key === activeTab);
+ // Home team card on the official site: "50+ · 研发占比60%" (ratio is edited in the about tab).
+ const teamPreview = () => {
+ const team = metricPreview('teamMembers', values.teamMembers);
+ if (!team) return '';
+ const ratio = metricPreview('researchRatio', values.researchRatio);
+ return t('{{team}} · 研发占比 {{ratio}}', {
+ team,
+ ratio: ratio || t('未配置'),
+ });
+ };
+
const change = (name, value) => {
setDirty(true);
setValues((previous) => ({ ...previous, [name]: value }));
@@ -209,13 +221,10 @@ export default function WebsiteSettings() {
>
- ({t('研发人员占比')}:
- {values.researchRatio || t('未配置')})
-
- ) : undefined
+ preview={
+ activeTab === 'home' && name === 'teamMembers'
+ ? teamPreview()
+ : undefined
}
value={values[name]}
error={errors[name]}
diff --git a/src/pages/WebsiteSettings/model.js b/src/pages/WebsiteSettings/model.js
index 6e40b598..fe2a33ff 100644
--- a/src/pages/WebsiteSettings/model.js
+++ b/src/pages/WebsiteSettings/model.js
@@ -51,31 +51,35 @@ export const TABS = [
},
];
+// Metric fields store plain numbers; the official site renders "+", "%", "万/亿" itself.
+// kind: integer = positive integer, amount = positive number + 万/亿 unit, percent = 0~100.
export const FIELDS = {
paidCustomers: {
label: '付费企业客户',
- placeholder: '请输入付费企业客户数量,例如 300+',
- help: '正整数,可带 +。',
+ placeholder: '请输入付费企业客户数量,例如 300',
+ metric: { kind: 'integer', suffix: '+' },
},
dailyTokens: {
label: '平台日均 Token 调用',
- placeholder: '请输入平台日均 Token 调用量,例如 500亿+',
- help: '支持正数及万、亿单位,可带 +。',
+ placeholder: '请输入调用量,例如 500',
+ metric: { kind: 'amount', suffix: '+' },
},
costReduction: {
label: '客户月度 AI 调用成本',
- placeholder: '请输入成本降幅,例如 20%',
- help: '填写 0~100 的百分比,官网可展示为 ↓20%。',
+ note: '降幅',
+ placeholder: '请输入成本降幅,例如 20',
+ metric: { kind: 'percent', suffix: '%', prefix: '↓' },
},
teamMembers: {
label: '团队成员',
- placeholder: '请输入团队成员数量,例如 50+',
- help: '首页与关于微词元共用此字段,正整数,可带 +。',
+ note: '首页与关于微词元共用',
+ placeholder: '请输入团队成员数量,例如 50',
+ metric: { kind: 'integer', suffix: '+' },
},
researchRatio: {
label: '研发人员占比',
- placeholder: '请输入研发人员占比,例如 60%',
- help: '填写 0~100 的百分比。',
+ placeholder: '请输入研发人员占比,例如 60',
+ metric: { kind: 'percent', suffix: '%' },
},
headquarters: {
label: '总部',
@@ -125,6 +129,39 @@ export function isAbsoluteImageUrl(value) {
}
}
+export const AMOUNT_UNITS = ['万', '亿'];
+export const DEFAULT_AMOUNT_UNIT = '亿';
+
+// Typed or pasted numbers: full-width digits / dots become half-width, everything else is dropped.
+export function sanitizeMetricInput(value) {
+ return String(value ?? '')
+ .replace(/[0-9]/g, (char) =>
+ String.fromCharCode(char.charCodeAt(0) - 0xfee0),
+ )
+ .replace(/[.。]/g, '.')
+ .replace(/[^\d.]/g, '');
+}
+
+// "500亿" -> { number: '500', unit: '亿' }; values without a unit keep the default unit.
+export function splitAmount(value) {
+ const text = String(value ?? '').trim();
+ const unit = AMOUNT_UNITS.find((item) => text.endsWith(item));
+ return {
+ number: unit ? text.slice(0, -unit.length) : text,
+ unit: unit || DEFAULT_AMOUNT_UNIT,
+ };
+}
+
+export const joinAmount = (number, unit) => (number ? `${number}${unit}` : '');
+
+// Text shown under a metric input, matching how the official site renders the value.
+export function metricPreview(key, value) {
+ const metric = FIELDS[key]?.metric;
+ if (!metric || validateField(key, value)) return '';
+ const text = String(value).trim();
+ return `${metric.prefix || ''}${text}${metric.suffix}`;
+}
+
export function validateField(key, rawValue) {
if (key === 'insights') return validateInsights(rawValue);
const value = String(rawValue ?? '').trim();
@@ -134,19 +171,20 @@ export function validateField(key, rawValue) {
: `请输入${FIELDS[key].label}`;
if (
['paidCustomers', 'teamMembers'].includes(key) &&
- !/^[1-9]\d*\+?$/.test(value)
+ !/^[1-9]\d*$/.test(value)
)
- return '请输入正整数,可在末尾添加 +';
+ return '请输入大于 0 的整数';
if (
key === 'dailyTokens' &&
- (!/^\d+(?:\.\d+)?[万亿]?\+?$/.test(value) || parseFloat(value) <= 0)
+ (!/^(?:0|[1-9]\d*)(?:\.\d{1,2})?[万亿]$/.test(value) ||
+ parseFloat(value) <= 0)
)
- return '请输入大于 0 的调用量,例如 500亿+';
+ return '请输入大于 0 的数字,最多两位小数';
if (
['costReduction', 'researchRatio'].includes(key) &&
- (!/^\d+(?:\.\d{1,2})?%?$/.test(value) || parseFloat(value) > 100)
+ (!/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/.test(value) || parseFloat(value) > 100)
)
- return '请输入 0~100 的百分比,最多两位小数';
+ return '请输入 0~100 之间的数字,最多两位小数';
if (key === 'businessPhone' && !PHONE.test(value))
return '请输入有效的手机号、固定电话或 400 电话';
if (
diff --git a/src/pages/WebsiteSettings/settingsApi.js b/src/pages/WebsiteSettings/settingsApi.js
index 953f2c4f..f2fd161a 100644
--- a/src/pages/WebsiteSettings/settingsApi.js
+++ b/src/pages/WebsiteSettings/settingsApi.js
@@ -87,8 +87,7 @@ export async function saveWebsiteSettings(configurationJson) {
}
}
configurationJson = JSON.stringify(payload);
- if (new TextEncoder().encode(configurationJson).byteLength > 60 * 1024)
- throw new Error('官网配置不能超过 60 KiB,请精简内容或减少图片');
+ // Backend stores config as LONGTEXT; article bodies are capped at ARTICLE_BODY_LIMIT in the editor.
await requestWebsite(
'post',
'/api/website/page-config',
diff --git a/src/styles/org-center.css b/src/styles/org-center.css
index 4dfe9eb3..8b7d7f76 100644
--- a/src/styles/org-center.css
+++ b/src/styles/org-center.css
@@ -106,7 +106,7 @@ html.dark .org-center .oc-page {
}
.org-center .oc-page .oc-list-card .ant-table-thead > tr > th {
- background: var(--oc-soft);
+ --center-table-head-bg: var(--oc-soft);
color: var(--oc-muted);
font-size: 12px;
font-weight: 500;
@@ -370,7 +370,7 @@ body:has(.org-center .oc-page)
}
.oc-dialog-table .ant-table-thead > tr > th {
- background: var(--oc-soft);
+ --center-table-head-bg: var(--oc-soft);
color: var(--oc-muted);
font-size: 12px;
font-weight: 500;
@@ -2443,7 +2443,7 @@ html.dark .org-center .oc-dashboard {
}
.org-center .oc-dashboard .oc-ea-detail-card .ant-table-thead .ant-table-cell {
- background: var(--oc-ea-head-bg);
+ --center-table-head-bg: var(--oc-ea-head-bg);
color: var(--oc-ea-muted);
font-size: 12px;
}
diff --git a/src/styles/prototype.css b/src/styles/prototype.css
index 4de6f14b..f00c2bed 100644
--- a/src/styles/prototype.css
+++ b/src/styles/prototype.css
@@ -521,7 +521,7 @@ body[data-ui-scope='admin'] .ant-layout {
border: 0;
}
.org-panel .ant-table-thead > tr > th {
- background: var(--ui-color-fill-0);
+ --center-table-head-bg: var(--ui-color-fill-0);
color: var(--text-secondary);
font-size: 12px;
font-weight: 500;
diff --git a/test/unit/center-table-policy.test.js b/test/unit/center-table-policy.test.js
index ebc9eccd..3ac567ec 100644
--- a/test/unit/center-table-policy.test.js
+++ b/test/unit/center-table-policy.test.js
@@ -112,3 +112,33 @@ test('recognizes translated operation headers without requiring a key', async ()
});
assert.equal(isActionColumn({ title: 'Actions', render: () => null }), true);
});
+
+test('releases competing fixed columns when the operation area would overlap them', () => {
+ const columns = [
+ { key: 'name', width: 180, fixed: 'left' },
+ { key: 'description', width: 300 },
+ { title: '操作', key: 'actions', render: () => null },
+ ];
+ const narrow = prepareCenterColumns(columns, 321, { 2: 240 });
+ assert.equal(narrow[0].fixed, undefined);
+ assert.equal(narrow[0].width, 180);
+ assert.equal(narrow[2].fixed, 'right');
+ assert.equal(narrow[2].width, 240);
+ const wide = prepareCenterColumns(columns, 900, { 2: 240 });
+ assert.equal(wide[0].fixed, 'left');
+ assert.equal(wide[2].width, 240);
+ assert.equal(columns[0].fixed, 'left');
+});
+
+test('bounds measured operation widths to the viewport and restores them after resize', () => {
+ const render = () => null;
+ const columns = [
+ { key: 'name', width: 200 },
+ { title: '操作', render },
+ ];
+ const narrow = prepareCenterColumns(columns, 280, { 1: 350 });
+ assert.equal(narrow[1].width, 280);
+ assert.equal(narrow[1].render, render);
+ assert.equal(prepareCenterColumns(columns, 900, { 1: 350 })[1].width, 350);
+ assert.equal(prepareCenterColumns(columns, 0, { 1: 350 })[1].width, 350);
+});
diff --git a/test/unit/website-save-validation.test.js b/test/unit/website-save-validation.test.js
index 71cdf9e1..6823447d 100644
--- a/test/unit/website-save-validation.test.js
+++ b/test/unit/website-save-validation.test.js
@@ -25,11 +25,11 @@ import { loadFrontendModule } from './frontend-module.js';
function validValues() {
return {
- paidCustomers: '200+',
+ paidCustomers: '200',
dailyTokens: '10亿',
- costReduction: '30%',
- teamMembers: '100+',
- researchRatio: '70%',
+ costReduction: '30',
+ teamMembers: '100',
+ researchRatio: '70',
headquarters: '珠海',
serviceNetwork: '全国',
businessPhone: '13800138000',