docs(wiki): 多主题系统文档更新 + .gitignore 清理
- frontend.md: 4 套主题视觉人格 + 技术架构 + 温润东方详细 token - index.md: 症状导航更新 - miniprogram.md: 小程序审计报告 - .gitignore: 排除 .logs/ plans/ playwright-report/ 临时文件
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Web 前端
|
||||
updated: 2026-04-26
|
||||
updated: 2026-04-28
|
||||
status: stable
|
||||
tags: [frontend, react, antd, vite, spa]
|
||||
---
|
||||
@@ -51,10 +51,53 @@ React 19.2.4 / Ant Design 6.3.5 / React Router 7.14.0 / Zustand 5.0.12 / Vite 8.
|
||||
|
||||
- 使用 Ant Design 组件库,不自造轮子
|
||||
- 中文优先,所有文案通过 i18n key 引用
|
||||
- 支持暗色/亮色主题切换
|
||||
- 支持 4 套主题切换:信任蓝 / 温润东方 / 深邃夜色 / 翡翠清雅
|
||||
- 侧边栏按模块分组:基础模块 / 行业模块
|
||||
- 表单验证使用 Ant Design Form 的 validateRules
|
||||
|
||||
### 2.1 多主题系统(4 套内置主题)
|
||||
|
||||
> 自 2026-04-28 起采用多主题架构。用户可在顶栏主题切换器中选择偏好主题,选择持久化到 localStorage。
|
||||
|
||||
#### 4 套主题视觉人格
|
||||
|
||||
| 主题 | 主色 | 背景 | 圆角 | 性格 |
|
||||
|------|------|------|------|------|
|
||||
| **信任蓝** (blue) | `#2563EB` | `#F8FAFC` 冷灰 | 10/12/6px | 专业·企业 |
|
||||
| **温润东方** (warm) | `#C4623A` | `#F5F0EB` 暖米 | 12/16/8px | 温润·人文 |
|
||||
| **深邃夜色** (dark) | `#60A5FA` | `#0F172A` 深蓝黑 | 10/12/6px | 护眼·专注 |
|
||||
| **翡翠清雅** (emerald) | `#5B7A5E` | `#F4F7F4` 浅绿灰 | 10/14/8px | 清新·健康 |
|
||||
|
||||
#### 技术架构
|
||||
|
||||
- **CSS 变量层** — `:root` 默认为 blue,`[data-theme='xxx']` 覆盖全部视觉 token(`apps/web/src/index.css`)
|
||||
- **Ant Design 动态主题** — `ConfigProvider` 的 `theme` prop 按 ThemeName 选择不同配置(`apps/web/src/App.tsx`)
|
||||
- **Zustand 持久化** — `useAppStore().theme` + `localStorage('hms-theme')`(`apps/web/src/stores/app.ts`)
|
||||
- **暗色检测** — `useThemeMode()` hook 从 store 读取,不再比对色值(`apps/web/src/hooks/useThemeMode.ts`)
|
||||
|
||||
#### 温润东方风详细 Token(与小程序端共享)
|
||||
|
||||
> 小程序端源文件:`apps/miniprogram/src/styles/variables.scss` + `mixins.scss`
|
||||
|
||||
| 角色 | CSS 变量 | 色值 |
|
||||
|------|----------|------|
|
||||
| 主色 | `--erp-primary` | `#C4623A` |
|
||||
| 背景 | `--erp-bg-page` | `#F5F0EB` |
|
||||
| 容器 | `--erp-bg-container` | `#FFFFFF` |
|
||||
| 主文字 | `--erp-text-primary` | `#2D2A26` |
|
||||
| 次文字 | `--erp-text-secondary` | `#7A756E` |
|
||||
| 边框 | `--erp-border` | `#E8E2DC` |
|
||||
| 成功 | `--erp-success` | `#5B7A5E` |
|
||||
| 警告 | `--erp-warning` | `#C4873A` |
|
||||
| 错误 | `--erp-error` | `#B54A4A` |
|
||||
|
||||
#### 禁止事项
|
||||
|
||||
- 禁止紫色渐变、禁止 emoji 作图标
|
||||
- 禁止左侧彩色边框卡片标示状态(改用 tag 标签)
|
||||
- 禁止无意义的渐变背景
|
||||
- 禁止装饰性 icon 遍地配
|
||||
|
||||
## 3. 关键文件 + 数据流
|
||||
|
||||
### 核心文件
|
||||
@@ -62,9 +105,11 @@ React 19.2.4 / Ant Design 6.3.5 / React Router 7.14.0 / Zustand 5.0.12 / Vite 8.
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `apps/web/src/main.tsx` | React 入口 |
|
||||
| `apps/web/src/App.tsx` | 路由定义(公开 + 受保护) |
|
||||
| `apps/web/src/layouts/MainLayout.tsx` | SaaS 后台管理布局 |
|
||||
| `apps/web/src/App.tsx` | 路由定义 + Ant Design 动态主题(4 套) |
|
||||
| `apps/web/src/layouts/MainLayout.tsx` | SaaS 后台管理布局 + ThemeSwitcher 集成 |
|
||||
| `apps/web/src/stores/` | 4 个 Zustand store |
|
||||
| `apps/web/src/components/ThemeSwitcher.tsx` | 主题选择下拉面板 |
|
||||
| `apps/web/src/hooks/useThemeMode.ts` | 暗色模式检测(从 store 读取) |
|
||||
| `apps/web/src/api/` | 28 个 API 服务文件(含 7 个健康模块 API) |
|
||||
| `apps/web/vite.config.ts` | Vite 配置 + API 代理 |
|
||||
|
||||
@@ -145,7 +190,7 @@ React 19.2.4 / Ant Design 6.3.5 / React Router 7.14.0 / Zustand 5.0.12 / Vite 8.
|
||||
|
||||
| Store | 状态 |
|
||||
|-------|------|
|
||||
| `app.ts` | theme(light/dark), sidebarCollapsed |
|
||||
| `app.ts` | theme(blue/warm/dark/emerald), sidebarCollapsed, localStorage 持久化 |
|
||||
| `auth.ts` | user, isAuthenticated, localStorage 持久化 |
|
||||
| `message.ts` | unreadCount, recentMessages, 请求去重 |
|
||||
| `plugin.ts` | plugins 列表, 动态菜单, schema 缓存, 请求去重 |
|
||||
@@ -208,6 +253,7 @@ ws://localhost:5174/ws/* → ws://localhost:3000/* (WebSocket)
|
||||
|
||||
| 日期 | 变更 |
|
||||
|------|------|
|
||||
| 2026-04-28 | 多主题系统:4 套主题(blue/warm/dark/emerald)+ CSS 变量 + Ant Design 动态主题 + ThemeSwitcher + useThemeMode 修复 |
|
||||
| 2026-04-26 | 全面更新:22 条健康路由(+12 内容/积分/统计/活动/AI)、11 个共享组件、77 个 TSX 文件 |
|
||||
| 2026-04-26 | 从 CLAUDE.md 迁移:UI 布局规范(§8) |
|
||||
| 2026-04-26 | VitalSignsChart 重设计:概览卡片条 + 点击展开详情图,5 指标独立 Y 轴 |
|
||||
|
||||
Reference in New Issue
Block a user