From 60b7df9015fea6413fcfca6c2c3354b0c7a96218 Mon Sep 17 00:00:00 2001 From: wsh5485 Date: Sat, 20 Jun 2026 22:53:37 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20add=20UI-STYLE.md=20=E2=80=94=20platfor?= =?UTF-8?q?m=20must=20reuse=20CarLog=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按用户要求「UI 统一」新建 UI 设计规范 docs/UI-STYLE.md (623 行): - §0 不做的事 (不引新 UI 库 / 不写新 CSS 变量 / 不另起设计) - §1 设计令牌 (CSS 变量速查: bg/card/text/accent/brand/green/warn/danger) - §2 工具类速查 (btn/card/input/pill/text-*/flex/gap/mt-*/mobile-only) - §3 布局组件 (AppLayout / AppHeader / StatCard / MobileCardList / ChartBlock) - §4 4 个平台 view 完整模板 (GlobalSettings / SubsystemSettings / Subsystems / Dashboard) - §5 错误 / 消息样式 - §6 标题层级 - §7 主题色使用规则 - §8 移动端注意事项 - §9 Trae 自检清单 (4 条 grep 命令) - §10 Mavis review 验收点 (12 项) DEV-PLAN.md 更新: - Task 2.4 / 2.5 / 2.6 / 2.7 顶部加 ⚠️ UI-STYLE.md 引用 + 强制要求清单 - 6.2.6b 新增「平台前端 UI 规范」子节 (12 项检查 + 3 条 grep 自检) ARCHITECTURE.md 更新: - 新增 §7.5 UI 设计原则 + 引用 UI-STYLE.md README.md: - 文档列表加 UI-STYLE.md 核心原则: 平台层新页面 = Settings.vue 的视觉风格 + 元数据驱动。 --- README.md | 2 +- docs/ARCHITECTURE.md | 24 ++ docs/DEV-PLAN.md | 72 +++++ docs/UI-STYLE.md | 623 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 720 insertions(+), 1 deletion(-) create mode 100644 docs/UI-STYLE.md diff --git a/README.md b/README.md index bfe7479..c6edefb 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ - **物理目录隔离**:subsystem 代码独立目录,加新子系统不会乱碰现有代码 - **永远向后兼容**:CarLog 的现有功能不破 -详细见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) 和 [docs/DEV-PLAN.md](docs/DEV-PLAN.md)。 +详细见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) / [docs/DEV-PLAN.md](docs/DEV-PLAN.md) / [docs/UI-STYLE.md](docs/UI-STYLE.md)(UI 规范 — 平台层 100% 复用 CarLog UI)。 ## Git 仓库 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 3703f5c..fdb1b49 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -274,6 +274,30 @@ export function tableName(name) { 4. 通用设置渲染器自动支持新子系统的 settings 5. 验证端到端流程 +## 7.5 UI 设计原则 + +**平台层 UI 100% 复用 CarLog 现有 UI,不另起设计。** + +CarLog 已经有完整设计系统: +- 设计令牌:`client/src/style.css` 顶部 `:root`(颜色 / 圆角 / 字体 / 阴影 / 响应式断点) +- 工具类:60+ 个(`.btn` / `.card` / `.input` / `.pill` / `.flex` / `.mt-3` / `.mobile-only` ...) +- 组件:`AppLayout` / `AppHeader` / `StatCard` / `ChartBlock` / `MobileCardList` / `ConfirmDangerDialog` + +**平台层新页面(GlobalSettings / SubsystemSettings / Subsystems / Dashboard)必须**: +- ✅ 用 `` 包整个页面 +- ✅ 颜色 / 字体 / 间距全部走 CSS 变量(`var(--xxx)`)或工具类 +- ✅ 复用现有组件(`StatCard` / `MobileCardList` / `ConfirmDangerDialog`) +- ✅ 跟现有 `Settings.vue` 视觉一致(卡片 + form + 按钮 + 消息) + +**禁止**: +- ❌ 引入新 UI 库(ant-design / element-plus / naive-ui / vuetify) +- ❌ 写新 CSS 变量(除非有明确理由) +- ❌ inline `style="color: ..."` +- ❌ 自定义 button / card 样式 +- ❌ 另起设计语言 + +完整规范见 [docs/UI-STYLE.md](UI-STYLE.md)(设计令牌 + 工具类速查 + 4 个平台 view 完整模板 + Mavis review 验收点)。 + ## 8. 不做的事 - ❌ JWT / SSO / 跨域 auth diff --git a/docs/DEV-PLAN.md b/docs/DEV-PLAN.md index 64b246c..9b6be6f 100644 --- a/docs/DEV-PLAN.md +++ b/docs/DEV-PLAN.md @@ -780,6 +780,26 @@ cd client && npm run dev ### Task 2.4: 前端平台层 — 总设置 UI +**⚠️ 先看 [docs/UI-STYLE.md](UI-STYLE.md) — 平台层 UI 必须 100% 复用 CarLog 现有 UI,不另起设计。** + +参考页面:`client/src/views/Settings.vue`(最接近总设置的风格) + +**强制要求**: +- ✅ 用 `` 包整个页面 +- ✅ 标题 `

` + 副标题 `

` +- ✅ loading 用 `

` +- ✅ error 用 `
` +- ✅ 按钮 `
+ +
+ + +
+``` + +### 2.4 标签 / Pill + +```html + +完成 +待办 +错误 +默认 +``` + +### 2.5 文字颜色 + +```html +

普通

+

次要

+

辅助

+

蓝色强调

+

成功

+

错误

+``` + +### 2.6 布局 + +```html +
+ + + +
+ +
+
+
+
+ +
+ + +
+``` + +| 类 | 效果 | +|---|---| +| `.flex` / `.flex-col` | flex 布局 | +| `.items-center` / `.justify-between` / `.justify-center` | flex 对齐 | +| `.gap-2` / `gap-3` / `gap-4` / `gap-6` | gap 8/12/16/24px | +| `.mt-2/3/4/6` / `.mb-2/3/4/6` | margin-top/bottom 8/12/16/24px | +| `.row` | flex 横向 + gap | + +### 2.7 响应式 + +```html +只在手机显示 +只在桌面显示 +``` + +断点(在 `style.css`): +- `--bp-sm` 480px(小屏手机) +- `--bp-md` 768px(大屏手机/小平板) +- `--bp-lg` 1024px(平板) +- `--bp-xl` 1440px(桌面) + +移动端样式(在 `style.css` 已自动处理): +- `` 自动 16px(防 iOS 缩放) +- `table.data` 自动横向滚动 +- `.container` 自动 padding 调整 + +### 2.8 表格 + +```html + + + + + + + +
列1列2
AB
+``` + +- 自动 hover 高亮(`tr:hover td`) +- 移动端自动横向滚动 + +--- + +## 3. 布局组件(必须复用) + +### 3.1 AppLayout.vue — 所有页面顶层 + +```vue + + + +``` + +**所有平台层 view 必须用 `` 包起来**(Settings.vue / WashesList.vue 等都这么做)。 + +### 3.2 AppHeader.vue — 顶栏 + +现有 AppHeader.vue 已经包含左侧菜单 + 用户信息 + 主题切换。**平台层不需要新写顶栏**,复用现有的。 + +### 3.3 MobileCardList.vue — 移动端列表 + +```vue + +``` + +平台层如有列表(Subsystems.vue),桌面端用 `table.data`,移动端用 `` 兜底(参考 `WashesList.vue` 怎么用)。 + +### 3.4 StatCard.vue — 数据卡片 + +```vue + +``` + +平台 Dashboard 用这个组件展示统计数据。 + +### 3.5 ChartBlock.vue — 图表 + +```vue + + + +``` + +平台 Dashboard 如果有图表就用这个。 + +### 3.6 ConfirmDangerDialog.vue — 危险操作确认 + +```vue + +``` + +平台层启停 / 删除子系统前用这个。 + +### 3.7 AiFallbackModal.vue — AI 失败兜底 + +平台层暂不需要(无 AI 集成)。保留供将来用。 + +--- + +## 4. 平台层 view 模板(参考 Settings.vue) + +### 4.1 GlobalSettings.vue(总设置) + +```vue + +``` + +### 4.2 SubsystemSettings.vue(通用渲染器) + +跟 GlobalSettings 同结构,**每个字段用 `
` 包 label + 控件**: + +```vue +