F2-12: amis 主题变量层落地 + 状态标签风格 + 二轮截图
- 新建 src/shell/amis-theme.css:覆盖 amis cxd 底层 token(品牌色 --colors-brand-5:#2B5CE6、圆角 --borders-radius-3:6px、字体族、 中性色),对齐 theme.css 设计 token;[data-dark="1"] 覆盖层实现 amis 区域深色模式跟随;.label-* 全局改为浅底+前置圆点样式; 查询面板密度压缩;表格行高 42px - src/main.tsx:在 theme.css 后引入 amis-theme.css - e2e/artifacts/f2-12/:工作台/待办/用户查询/角色/深色/消息 Drawer 截图 实测验证:--colors-brand-5=#2B5CE6 ✓,--borders-radius-3=6px ✓, label-success bg=#e2f5ec ✓,深色 label bg=#18352a ✓; e2e 75/75 通过,零回归。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BIN
e2e/artifacts/f2-12/01-workbench.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
e2e/artifacts/f2-12/02-todo.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
e2e/artifacts/f2-12/03-sys-user-list.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
e2e/artifacts/f2-12/04-sys-role.png
Normal file
|
After Width: | Height: | Size: 141 KiB |
BIN
e2e/artifacts/f2-12/05-sys-user-dark.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
e2e/artifacts/f2-12/06-notice-drawer.png
Normal file
|
After Width: | Height: | Size: 128 KiB |
BIN
e2e/artifacts/f2-12/07-todo-page.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
@@ -1,6 +1,7 @@
|
||||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import './shell/theme.css';
|
||||
import './shell/amis-theme.css';
|
||||
import App from './App';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
|
||||
304
src/shell/amis-theme.css
Normal file
@@ -0,0 +1,304 @@
|
||||
/* ============================================================================
|
||||
EIP4 amis 主题覆盖层 — F2-12 二轮打磨
|
||||
原理:amis 6.x SDK 的 cxd 主题通过 :root / .amis-scope .AMISCSSWrapper
|
||||
暴露设计 token,本文件在 theme.css 之后加载,用品牌色/圆角/字体/中性色
|
||||
覆盖 amis 默认值,使 amis 区域与壳层视觉一致。
|
||||
深色模式:[data-dark="1"] 下再次覆盖为暗色 token。
|
||||
============================================================================ */
|
||||
|
||||
/* ============================================================================
|
||||
1. 亮色模式 — 品牌色 token 对齐
|
||||
amis 品牌色阶 brand-5 = 主色,brand-4 = active,brand-6 = hover
|
||||
EIP4 主色 #2B5CE6,对应生成 10 级色阶
|
||||
============================================================================ */
|
||||
:root,
|
||||
.amis-scope .AMISCSSWrapper {
|
||||
/* 品牌色阶(brand-5 对齐 EIP4 --brand)*/
|
||||
--colors-brand-1: #0a1e5c;
|
||||
--colors-brand-2: #0f2b80;
|
||||
--colors-brand-3: #183ba3;
|
||||
--colors-brand-4: #2250cc; /* active */
|
||||
--colors-brand-5: #2B5CE6; /* 主色 = theme.css --brand */
|
||||
--colors-brand-6: #4a75ed; /* hover */
|
||||
--colors-brand-7: #7097f2;
|
||||
--colors-brand-8: #a3bcf7;
|
||||
--colors-brand-9: #d5e0fb;
|
||||
--colors-brand-10: #eaf0fd;
|
||||
|
||||
/* 中性色对齐 theme.css */
|
||||
--colors-neutral-text-2: #1c2128; /* --text */
|
||||
--colors-neutral-text-4: #555c66; /* --text-2 */
|
||||
--colors-neutral-text-5: #8b929c; /* --text-3 */
|
||||
--colors-neutral-text-6: #aab0b9;
|
||||
--colors-neutral-text-8: #e2e5ea; /* --line */
|
||||
--colors-neutral-text-9: #f6f7f9; /* --surface-2 */
|
||||
--colors-neutral-text-10: #f6f7f9;
|
||||
--colors-neutral-text-11: #ffffff; /* white */
|
||||
|
||||
--colors-neutral-fill-3: #f6f7f9; /* --surface-2 */
|
||||
--colors-neutral-fill-8: #e2e5ea; /* --line */
|
||||
--colors-neutral-fill-9: #f6f7f9;
|
||||
--colors-neutral-fill-10: #f6f7f9;
|
||||
--colors-neutral-fill-11: #ffffff; /* --surface */
|
||||
--colors-neutral-fill-12: #eef1fd;
|
||||
|
||||
--colors-neutral-line-7: #cdd2d9; /* --line-strong */
|
||||
--colors-neutral-line-8: #e2e5ea; /* --line */
|
||||
--colors-neutral-line-9: #f6f7f9;
|
||||
--colors-neutral-line-10: #f6f7f9;
|
||||
|
||||
/* 功能色对齐 theme.css */
|
||||
--colors-success-4: #178c55;
|
||||
--colors-success-5: #1f9e62; /* --ok */
|
||||
--colors-success-6: #28b070;
|
||||
--colors-success-10: #e2f5ec; /* --ok-soft */
|
||||
|
||||
--colors-warning-4: #c27908;
|
||||
--colors-warning-5: #d8860b; /* --warn */
|
||||
--colors-warning-6: #e8970e;
|
||||
--colors-warning-10: #faf0dc; /* --warn-soft */
|
||||
|
||||
--colors-error-4: #c03b32;
|
||||
--colors-error-5: #d1453b; /* --err */
|
||||
--colors-error-6: #de5047;
|
||||
--colors-error-10: #fbe9e7; /* --err-soft */
|
||||
|
||||
/* 圆角对齐 theme.css --radius / --radius-lg */
|
||||
--borders-radius-2: 4px;
|
||||
--borders-radius-3: 6px; /* 原 4px → 6px,对齐 --radius */
|
||||
--borders-radius-4: 6px; /* 原 6px,保持 */
|
||||
--borders-radius-5: 10px; /* 对齐 --radius-lg */
|
||||
--borders-radius-6: 10px;
|
||||
|
||||
/* 字体族对齐 theme.css */
|
||||
--fonts-base-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
|
||||
"Microsoft YaHei", "Helvetica Neue", sans-serif;
|
||||
|
||||
/* 字号对齐(fonts-size-7 = base 14px, fonts-size-8 = sm 12px) */
|
||||
--fonts-size-7: 14px;
|
||||
--fonts-size-8: 12px;
|
||||
--fonts-size-6: 16px;
|
||||
|
||||
/* 行高 */
|
||||
--fonts-lineHeight-2: 1.5;
|
||||
|
||||
/* 背景色对齐 */
|
||||
--background: #eef0f3; /* --bg */
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
2. 深色模式 token 覆盖
|
||||
[data-dark="1"] 挂在 <html> 上;amis 区域跟随宿主深色变量
|
||||
============================================================================ */
|
||||
[data-dark="1"] :root,
|
||||
[data-dark="1"],
|
||||
[data-dark="1"] .amis-scope .AMISCSSWrapper {
|
||||
/* 背景 / 表面 */
|
||||
--colors-neutral-fill-11: #1e232b; /* --surface */
|
||||
--colors-neutral-fill-10: #262c36; /* --surface-2 */
|
||||
--colors-neutral-fill-9: #262c36;
|
||||
--colors-neutral-fill-8: #323945; /* --line */
|
||||
--colors-neutral-fill-3: #323945;
|
||||
--colors-neutral-fill-12: #1e2540;
|
||||
|
||||
/* 线条 */
|
||||
--colors-neutral-line-8: #323945; /* --line */
|
||||
--colors-neutral-line-7: #424b59; /* --line-strong */
|
||||
--colors-neutral-line-9: #262c36;
|
||||
--colors-neutral-line-10: #1e232b;
|
||||
|
||||
/* 文字 */
|
||||
--colors-neutral-text-2: #e8eaee; /* --text */
|
||||
--colors-neutral-text-4: #a3aab5; /* --text-2 */
|
||||
--colors-neutral-text-5: #6d7480; /* --text-3 */
|
||||
--colors-neutral-text-6: #6d7480;
|
||||
--colors-neutral-text-8: #323945;
|
||||
--colors-neutral-text-9: #262c36;
|
||||
--colors-neutral-text-10: #1e232b;
|
||||
--colors-neutral-text-11: #ffffff;
|
||||
|
||||
/* 背景 */
|
||||
--background: #15181d; /* --bg dark */
|
||||
|
||||
/* 深色品牌色(整体加亮) */
|
||||
--colors-brand-5: #4a75ed;
|
||||
--colors-brand-4: #3a65e0;
|
||||
--colors-brand-6: #6a8ff2;
|
||||
--colors-brand-10: #1e2a4a;
|
||||
|
||||
/* 深色功能色 */
|
||||
--colors-success-5: #28b070;
|
||||
--colors-success-10: #18352a; /* --ok-soft dark */
|
||||
|
||||
--colors-warning-5: #e8970e;
|
||||
--colors-warning-10: #3a2e15; /* --warn-soft dark */
|
||||
|
||||
--colors-error-5: #de5047;
|
||||
--colors-error-10: #3c211f; /* --err-soft dark */
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
3. 状态标签风格 — amis mapping 渲染的 .label 类
|
||||
原型:浅底 + 前置色点,逼近 theme.css .tag-* 风格
|
||||
amis mapping 输出 <span class="label label-success"> 等 HTML 字符串
|
||||
============================================================================ */
|
||||
.amis-scope .label,
|
||||
.cxd-Html .label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
height: 22px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* 前置圆点 */
|
||||
.amis-scope .label::before,
|
||||
.cxd-Html .label::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* label-success → ok 绿 */
|
||||
.amis-scope .label-success,
|
||||
.cxd-Html .label-success {
|
||||
background: #e2f5ec;
|
||||
color: #1f9e62;
|
||||
}
|
||||
|
||||
/* label-warning → warn 橙 */
|
||||
.amis-scope .label-warning,
|
||||
.cxd-Html .label-warning {
|
||||
background: #faf0dc;
|
||||
color: #d8860b;
|
||||
}
|
||||
|
||||
/* label-danger → err 红 */
|
||||
.amis-scope .label-danger,
|
||||
.cxd-Html .label-danger {
|
||||
background: #fbe9e7;
|
||||
color: #d1453b;
|
||||
}
|
||||
|
||||
/* label-default / label-info → 灰 */
|
||||
.amis-scope .label-default,
|
||||
.amis-scope .label-info,
|
||||
.cxd-Html .label-default,
|
||||
.cxd-Html .label-info {
|
||||
background: #f6f7f9;
|
||||
color: #555c66;
|
||||
border: 1px solid #e2e5ea;
|
||||
}
|
||||
|
||||
/* 深色模式下标签颜色映射 */
|
||||
[data-dark="1"] .amis-scope .label-success,
|
||||
[data-dark="1"] .cxd-Html .label-success {
|
||||
background: #18352a;
|
||||
color: #4cc98a;
|
||||
}
|
||||
|
||||
[data-dark="1"] .amis-scope .label-warning,
|
||||
[data-dark="1"] .cxd-Html .label-warning {
|
||||
background: #3a2e15;
|
||||
color: #f0ad3a;
|
||||
}
|
||||
|
||||
[data-dark="1"] .amis-scope .label-danger,
|
||||
[data-dark="1"] .cxd-Html .label-danger {
|
||||
background: #3c211f;
|
||||
color: #eb6d62;
|
||||
}
|
||||
|
||||
[data-dark="1"] .amis-scope .label-default,
|
||||
[data-dark="1"] .amis-scope .label-info,
|
||||
[data-dark="1"] .cxd-Html .label-default,
|
||||
[data-dark="1"] .cxd-Html .label-info {
|
||||
background: #323945;
|
||||
color: #a3aab5;
|
||||
border-color: #424b59;
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
4. 查询面板布局密度 — 压缩 filter 区 Form 行间距
|
||||
amis filter 用 .cxd-Form--normal 渲染,item-gap 控制行间距
|
||||
============================================================================ */
|
||||
.amis-scope .cxd-Crud-filter .cxd-Form-item,
|
||||
.amis-scope .cxd-CRUD-filter .cxd-Form-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* filter 标签宽度压缩,与原型对齐(原型约 60px label) */
|
||||
.amis-scope .cxd-Crud-filter .cxd-Form-label,
|
||||
.amis-scope .cxd-CRUD-filter .cxd-Form-label {
|
||||
min-width: 56px;
|
||||
max-width: 80px;
|
||||
font-size: 13px;
|
||||
color: #555c66;
|
||||
}
|
||||
|
||||
/* 查询/重置按钮区紧凑 */
|
||||
.amis-scope .cxd-Crud-filter .cxd-Form-group--justify,
|
||||
.amis-scope .cxd-CRUD-filter .cxd-Form-group--justify {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
5. 表格密度 — 对齐 theme.css --row-h: 42px
|
||||
amis TableCell-height 默认 2.5rem(40px),微调为 42px
|
||||
============================================================================ */
|
||||
.amis-scope .cxd-Table-content .cxd-Table td,
|
||||
.amis-scope .cxd-Table-content .cxd-Table th {
|
||||
height: 42px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* 表头字号 */
|
||||
.amis-scope .cxd-Table-content .cxd-Table th {
|
||||
font-size: 12.5px;
|
||||
font-weight: 500;
|
||||
color: #555c66;
|
||||
}
|
||||
|
||||
/* 深色模式表头 */
|
||||
[data-dark="1"] .amis-scope .cxd-Table-content .cxd-Table th {
|
||||
color: #a3aab5;
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
6. amis 页面容器背景对齐 --bg
|
||||
============================================================================ */
|
||||
.amis-scope .cxd-Page {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.amis-scope .cxd-Page > .cxd-Page-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
7. 主按钮圆角对齐
|
||||
============================================================================ */
|
||||
.amis-scope .cxd-Button--primary,
|
||||
.amis-scope .cxd-Button--default {
|
||||
border-radius: var(--borders-radius-3, 6px);
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
8. 分页位置(amis footerToolbar pagination 默认 flex-end,可接受;
|
||||
headerToolbar pagination 保留原位)
|
||||
此处仅确保 footerToolbar 对齐右侧
|
||||
============================================================================ */
|
||||
.amis-scope .cxd-Crud-footToolbar {
|
||||
justify-content: flex-end;
|
||||
padding: 10px 0 4px;
|
||||
}
|
||||