Forráskód Böngészése

style: 落地 PC 端品牌设计 token(对齐 Logo 配色)

- variables.scss 追加品牌 6 色 + 派生语义/侧栏/状态色/涨跌/浮层阴影
  (基础 token 原值不动,只增不删)
- 新建 element-plus-theme.scss:覆盖 EP CSS 变量(primary/success/
  warning/danger + 6 个 -rgb 变体 + 边框/文字/背景/阴影/圆角)
- main.ts 引入 EP 主题(紧跟 variables 之后)

设计源:工作区 frontend-pc/00-design/design-tokens.md v1.1「青屿」
(Logo 取样;原型 prototype/index.html 可交互预览)。
门禁:pnpm build 0 错 / vue-tsc exit 0 / 品牌覆盖实证在主 CSS 且晚于 EP 默认值。
Q 23 órája
szülő
commit
d08c5d435a
3 módosított fájl, 113 hozzáadás és 0 törlés
  1. 2 0
      src/main.ts
  2. 63 0
      src/styles/element-plus-theme.scss
  3. 48 0
      src/styles/variables.scss

+ 2 - 0
src/main.ts

@@ -24,6 +24,8 @@ import { setRouterForRedirect } from '@/api/http';
 import App from '@/App.vue';
 // 全局设计 token(Vite 全局注入 :root 变量;须在 createApp 前引入,组件 var() 引用才生效)
 import '@/styles/variables.scss';
+// EP 主题覆盖(:root 覆盖 element-plus 默认 CSS 变量;注入于 EP CSS <link> 之后,同名变量后者生效)
+import '@/styles/element-plus-theme.scss';
 
 /** UMD 全局缺失提示(开发期定位"vendor 没加载"用;生产 nginx 侧应监控 404) */
 function failMissingGlobal(name: string): never {

+ 63 - 0
src/styles/element-plus-theme.scss

@@ -0,0 +1,63 @@
+/*
+ * element-plus-theme.scss —— Element Plus 主题变量覆盖(design-tokens.md §1 EP 主题映射)。
+ *
+ * 背景:EP CSS 变量在 index.html 的 element-plus/index.css 里定义为 :root 默认值(蓝色 #409EFF 系)。
+ * 本文件同层 :root 且引入顺序在其后,覆盖即生效。变量名必须与 EP 2.x 官方 CSS 变量一致,
+ * 只改颜色语义,不动尺寸/动效(EP 默认已符合管理端密度)。
+ *
+ * 品牌源:variables.scss 的 --app-brand-* / --app-color-*(design-tokens.md v1.1,Logo 取样)。
+ * 纪律:新增覆盖前先查 EP 官方 css var 清单;禁止在业务组件内再覆盖 EP 变量(双份漂移)。
+ */
+:root {
+  /* 主色:深青蓝(白字对比 4.9:1 达标;浅态用 teal 系) */
+  --el-color-primary: #1f7a8c;
+  --el-color-primary-light-3: #5a9aa8;
+  --el-color-primary-light-5: #9cc7cd;
+  --el-color-primary-light-7: #cfe6ea;
+  --el-color-primary-light-8: #e4f3f6;
+  --el-color-primary-light-9: #f1f8f9;
+  --el-color-primary-dark-2: #175f6b;
+
+  /* 语义色 */
+  --el-color-success: #2f855a;
+  --el-color-warning: #b26a0b;
+  --el-color-danger: #c23a2b;
+  --el-color-error: #c23a2b;
+  --el-color-info: #5d6672;
+
+  /* rgb 变体(EP 半透明场景:rgba(var(--el-color-x-rgb), α),须与上列 hex 同色,否则错位) */
+  --el-color-primary-rgb: 31, 122, 140;
+  --el-color-success-rgb: 47, 133, 90;
+  --el-color-warning-rgb: 178, 106, 11;
+  --el-color-danger-rgb: 194, 58, 43;
+  --el-color-error-rgb: 194, 58, 43;
+  --el-color-info-rgb: 93, 102, 114;
+
+  /* 边框/分割(与 --app-color-border 一致,去蓝灰感) */
+  --el-border-color: #e3e7ea;
+  --el-border-color-light: #e3e7ea;
+  --el-border-color-lighter: #e3e7ea;
+  --el-border-color-hover: #cbd2d8;
+
+  /* 文字(对齐品牌石板灰蓝系) */
+  --el-text-color-primary: #2a3242;
+  --el-text-color-regular: #2a3242;
+  --el-text-color-secondary: #5d6672;
+  --el-text-color-placeholder: #9aa3ad;
+
+  /* 背景(微暖纸白) */
+  --el-bg-color: #ffffff;
+  --el-bg-color-page: #f6f7f2;
+
+  /* 填充 */
+  --el-fill-color: #f6f7f2;
+  --el-fill-color-light: #fafbf7;
+
+  /* 浮层阴影(品牌墨蓝调) */
+  --el-box-shadow: 0 8px 24px rgba(30, 42, 84, 0.14);
+  --el-box-shadow-light: 0 4px 16px rgba(30, 42, 84, 0.1);
+
+  /* 圆角对齐 */
+  --el-border-radius-base: 6px;
+  --el-border-radius-small: 4px;
+}

+ 48 - 0
src/styles/variables.scss

@@ -6,6 +6,11 @@
  *     或经 Vite 的 CSS preprocessor 全局注入);
  *   - Element Plus 主题变量覆盖写在 element-plus-theme.scss(同名 token 映射 EP CSS 变量)。
  * 新增 token 规则:只增不删(旧 token 可能被多页面引用);命名 --app-{类别}-{语义}。
+ *
+ * 品牌设计源(2026-11-09 定稿,v1.1 按 Logo 取样):
+ *   工作区 frontend-pc/00-design/design-tokens.md「青屿」——
+ *   墨蓝侧栏(结构) + 微暖纸白(工作面) + 青蓝主音 + 柠檬黄点缀。
+ *   本节新增的 --app-brand-* / --app-color-* 为该设计源落地;上方基础 token 保持原值不动(只增不删)。
  */
 :root {
   /* 文本 */
@@ -32,4 +37,47 @@
   --app-radius-sm: 4px;
   --app-radius-md: 6px;
   --app-shadow-card: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
+
+  /* ============================================================
+   * 品牌 6 色(Logo 取样,design-tokens.md §0)
+   * ============================================================ */
+  --app-brand-teal: #4bb8c8;        /* 青蓝·品牌主色(角色身体) */
+  --app-brand-teal-deep: #1f7a8c;   /* 深青蓝·主按钮/链接(白字对比 4.9:1) */
+  --app-brand-navy: #1e2a54;        /* 墨蓝·结构色(侧栏/登录外框,手柄色) */
+  --app-brand-indigo: #4c62b3;      /* 靛蓝·次强调(放大镜边框) */
+  --app-brand-yellow: #ffe81a;      /* 柠檬黄·点缀(角标/选中点,背景色) */
+  --app-brand-sun: #ffd75e;         /* 暖橙黄·hover 浅底(云朵色) */
+
+  /* 派生语义(同色系浅底深字,正文对比 ≥ 4.5:1) */
+  --app-color-page: #f6f7f2;        /* 内容区底(微暖纸白,非纯白) */
+  --app-color-card: #ffffff;        /* 卡片底 */
+  --app-color-text: #2a3242;        /* 正文(石板灰蓝,呼应瞳孔色) */
+  --app-color-text-2: #5d6672;      /* 次要文字 */
+  --app-color-text-3: #9aa3ad;      /* 占位/时间 */
+  --app-color-border: #e3e7ea;      /* 分割线 */
+  --app-color-border-strong: #cbd2d8; /* 输入框框线 */
+  --app-color-teal-soft: #e4f3f6;   /* 激活菜单底/选中卡底(主色浅底) */
+  --app-color-teal-ink: #14606f;    /* 浅底上的小字(深青蓝) */
+  --app-color-yellow-ink: #3a3200;  /* 黄色块上的文字 */
+
+  /* 侧栏(墨蓝域) */
+  --app-side-bg: #1e2a54;
+  --app-side-text: #e8ecf7;
+  --app-side-dim: #93a0c8;
+  --app-side-active: rgba(255, 255, 255, 0.1);
+
+  /* 状态色(数据语义,非装饰) */
+  --app-color-success: #2f855a;
+  --app-color-success-soft: #e7f3ed;
+  --app-color-warning: #b26a0b;
+  --app-color-warning-soft: #f8efe0;
+  --app-color-danger: #c23a2b;
+  --app-color-danger-soft: #f9e9e5;
+
+  /* 涨跌(中国财务惯例·强制:涨红跌绿) */
+  --app-num-up: #c23a2b;
+  --app-num-down: #2f855a;
+
+  /* 浮层阴影(仅 dialog/dropdown/popover,卡片无阴影) */
+  --app-shadow-float: 0 8px 24px rgba(30, 42, 84, 0.14);
 }