From 45d34e76d13f9223ea44ce4e5a2d1197dfb7447c Mon Sep 17 00:00:00 2001 From: wanghanlin <1533525126@qq.com> Date: Sat, 15 Aug 2026 08:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF=E9=85=8D?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/main.ts | 1 + frontend/src/styles/shared.css | 17 ++-- frontend/src/styles/tokens.css | 75 ++++++++++++++++ frontend/src/utils/palette.ts | 57 +++++++++++++ frontend/src/views/ApiKeyManager.vue | 4 +- frontend/src/views/AuditLogManager.vue | 4 +- frontend/src/views/CategoryManager.vue | 10 +-- frontend/src/views/ChatPanel.vue | 6 +- frontend/src/views/ConversationManager.vue | 2 +- frontend/src/views/DashboardPanel.vue | 9 +- frontend/src/views/DocDetail.vue | 34 ++++---- frontend/src/views/DocSearch.vue | 2 +- frontend/src/views/DocUpload.vue | 6 +- frontend/src/views/FeedbackOps.vue | 6 +- frontend/src/views/LogViewer.vue | 10 +-- frontend/src/views/LoginPage.vue | 10 +-- frontend/src/views/McpServerManager.vue | 4 +- frontend/src/views/ModelConfigManager.vue | 94 ++++++++++----------- frontend/src/views/PipelineFlow.vue | 63 +++++++------- frontend/src/views/SensitiveWordManager.vue | 5 +- 20 files changed, 280 insertions(+), 139 deletions(-) create mode 100644 frontend/src/styles/tokens.css create mode 100644 frontend/src/utils/palette.ts diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 9b418c5..6dfdc5c 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -6,6 +6,7 @@ import { createApp } from 'vue' import { createPinia } from 'pinia' import TDesign from 'tdesign-vue-next' import 'tdesign-vue-next/es/style/index.css' +import './styles/tokens.css' import './styles/shared.css' import App from './App.vue' import router from './router' diff --git a/frontend/src/styles/shared.css b/frontend/src/styles/shared.css index ca6c073..e70f549 100644 --- a/frontend/src/styles/shared.css +++ b/frontend/src/styles/shared.css @@ -1,6 +1,9 @@ /** * 全局共享 CSS 工具类 * 替代各页面中重复的行内样式和 scoped 样式 + * + * 颜色统一引用 `tokens.css` 定义的语义 token(--color-*), + * 不再散落硬编码 hex,保证全站配色一致。 */ /* ====== 工具栏 ====== */ @@ -23,27 +26,27 @@ /* ====== 统计提示文字 ====== */ .total-hint { font-size: 13px; - color: #666; + color: var(--color-text-secondary); } /* ====== 卡片容器(圆角边框) ====== */ .card-box { padding: 12px; - background: #fafafa; - border: 1px solid #e7e7e7; - border-radius: 8px; + background: var(--color-bg-subtle); + border: 1px solid var(--color-border); + border-radius: var(--radius-card); } /* ====== 描述性文字 ====== */ .desc-text { font-size: 13px; - color: #999; + color: var(--color-text-tertiary); } /* ====== 代码标签/键名展示 ====== */ .code-tag { font-size: 12px; - background: #f3f4f6; + background: var(--color-bg-code); padding: 2px 6px; - border-radius: 4px; + border-radius: var(--radius-sm); } diff --git a/frontend/src/styles/tokens.css b/frontend/src/styles/tokens.css new file mode 100644 index 0000000..0b56a27 --- /dev/null +++ b/frontend/src/styles/tokens.css @@ -0,0 +1,75 @@ +/** + * 全局设计 token 层 + * + * 统一项目的颜色 / 圆角 / 间距 / 阴影来源: + * - 语义色(主色 / 成功 / 警告 / 错误)与文本、边框、背景色全部对齐 TDesign 主题变量(--td-*), + * 保证全站与 TDesign 组件同一套主色与语义色。 + * - 图表 / 分类等多色区分的「系列色」不走语义色,统一收敛到 `utils/palette.ts`。 + * + * 引入顺序:必须在 `tdesign-vue-next/es/style/index.css` 之后、`shared.css` 之前。 + */ + +:root { + /* ===== 品牌主色(对齐 TDesign,默认蓝 #0052d9;换主色只需改此一处) ===== */ + --color-primary: var(--td-brand-color); + --color-primary-hover: var(--td-brand-color-hover); + --color-primary-active: var(--td-brand-color-active); + --color-primary-light: var(--td-brand-color-light); + + /* ===== 语义状态色 ===== */ + --color-success: var(--td-success-color); + --color-warning: var(--td-warning-color); + --color-error: var(--td-error-color); + + /* ===== 状态色阶(统计卡片/提示条四档:bg 浅 / border / text 主 / text 深) ===== */ + --color-success-bg: var(--td-success-color-1); + --color-success-border: var(--td-success-color-3); + --color-success-text: var(--td-success-color-5); + --color-success-text-strong: var(--td-success-color-8); + + --color-error-bg: var(--td-error-color-1); + --color-error-border: var(--td-error-color-3); + --color-error-text: var(--td-error-color-6); + --color-error-text-strong: var(--td-error-color-8); + + --color-warning-bg: var(--td-warning-color-1); + --color-warning-border: var(--td-warning-color-3); + --color-warning-text: var(--td-warning-color-5); + --color-warning-text-strong: var(--td-warning-color-8); + + --color-info-bg: var(--td-brand-color-1); + --color-info-border: var(--td-brand-color-3); + --color-info-text: var(--td-brand-color-7); + --color-info-text-strong: var(--td-brand-color-8); + + /* ===== 文本色 ===== */ + --color-text-primary: var(--td-text-color-primary); + --color-text-secondary: var(--td-text-color-secondary); /* 次要文字,原 #666 */ + --color-text-tertiary: var(--td-text-color-placeholder); /* 弱化文字,原 #999 */ + --color-text-disabled: var(--td-text-color-disabled); + --color-text-link: var(--td-text-color-link); + + /* ===== 边框色 ===== */ + --color-border: var(--td-border-level-1-color); /* 常规边框,原 #e7e7e7 */ + --color-border-strong: var(--td-border-level-2-color); + + /* ===== 背景色 ===== */ + --color-bg-page: var(--td-bg-color-page); + --color-bg-subtle: var(--td-bg-color-secondarycontainer); /* 浅灰底,原 #fafafa */ + --color-bg-code: var(--td-bg-color-component); /* 代码/标签底,原 #f3f4f6 */ + + /* ===== 代码块(深色主题,VS Code 风格,独立于浅色语义色) ===== */ + --color-code-block-bg: #1e1e1e; + --color-code-block-text: #d4d4d4; + + /* ===== 圆角 ===== */ + --radius-sm: var(--td-radius-small); /* 4px */ + --radius-md: var(--td-radius-medium); /* 6px */ + --radius-lg: var(--td-radius-large); /* 9px */ + --radius-card: 8px; /* 卡片容器圆角(shared.css .card-box 原值) */ + + /* ===== 阴影 ===== */ + --shadow-sm: var(--td-shadow-1); + --shadow-md: var(--td-shadow-2); + --shadow-lg: var(--td-shadow-3); +} diff --git a/frontend/src/utils/palette.ts b/frontend/src/utils/palette.ts new file mode 100644 index 0000000..5db65a9 --- /dev/null +++ b/frontend/src/utils/palette.ts @@ -0,0 +1,57 @@ +/** + * 数据可视化 / 分类系列色常量 + * + * 统一图表(Chart.js)、流程图(mermaid)、分类标签等多色区分场景的颜色来源。 + * 与 `styles/tokens.css` 的语义色(成功/警告/错误)互补: + * - 语义状态色 → 走 CSS 变量(`var(--color-success)` 等) + * - 多色区分的系列色 → 走本常量 + * + * 每个系列色同时提供 hex 与 rgb 字符串(rgb 用于 `rgba(..., 0.1)` 填充背景)。 + */ + +export const palette = { + // ===== 系列色(数据可视化 / 分类) ===== + blue: '#3b82f6', + blueRgb: '59, 130, 246', + purple: '#8b5cf6', + purpleRgb: '139, 92, 246', + green: '#10b981', + greenRgb: '16, 185, 129', + red: '#ef4444', + redRgb: '239, 68, 68', + orange: '#f59e0b', + orangeRgb: '245, 158, 11', + indigo: '#6366f1', + indigoRgb: '99, 102, 241', + pink: '#e83e8c', + pinkRgb: '232, 62, 140', + gray: '#6c757d', + grayRgb: '108, 117, 125', + + // ===== 中性灰阶(流程图文本 / 边框 / 线条) ===== + neutralText: '#1f2937', + neutralLine: '#6b7280', + neutralBorder: '#d1d5db', +} as const + +/** 系列色浅色底(图表填充 / 流程图节点背景) */ +export const paletteBg = { + blue: '#dbeafe', + green: '#d1fae5', + orange: '#fef3c7', + red: '#fee2e2', + indigo: '#e0e7ff', + pink: '#fce7f3', + gray: '#f3f4f6', +} as const + +/** 系列色浅色描边(流程图节点边框,浅一档用于区分背景) */ +export const paletteBorder = { + blue: '#3b82f6', + green: '#10b981', + orange: '#f59e0b', + red: '#ef4444', + indigo: '#a5b4fc', + pink: '#f9a8d4', + gray: '#d1d5db', +} as const diff --git a/frontend/src/views/ApiKeyManager.vue b/frontend/src/views/ApiKeyManager.vue index 9585a60..dcf55b5 100644 --- a/frontend/src/views/ApiKeyManager.vue +++ b/frontend/src/views/ApiKeyManager.vue @@ -13,7 +13,7 @@ @@ -110,7 +110,7 @@
+ background: testResult.success ? 'var(--color-success-text)' : 'var(--color-error-text)' }">
{{ testResult.success ? '✅ 连接成功' : '❌ 连接失败' }}
延迟:{{ testResult.latencyMs }}ms · 维度:{{ testResult.dimensions }}
{{ testResult.errorMessage }}
@@ -124,7 +124,7 @@ :footer="false" :close-on-overlay-click="false" > -
💡 核心三要素:API Key + API 地址 + 模型名称,填入即可使用
+
💡 核心三要素:API Key + API 地址 + 模型名称,填入即可使用
@@ -142,7 +142,7 @@ {{ showApiKey ? '🙈 隐藏' : '👁️ 显示' }} @@ -151,9 +151,9 @@ @@ -167,7 +167,7 @@ @keydown.enter.prevent="onDropdownKeyDown('enter')" @keydown.escape="modelDropdownOpen = false">
+ style="position:relative;top:100%;left:0;right:0;z-index:100;background:white;border:1px solid var(--color-border);border-radius:8px;max-height:240px;overflow-y:auto;margin-top:4px;box-shadow:0 4px 12px rgba(0,0,0,0.12);">
+ borderBottom: idx < filteredModels.length - 1 ? '1px solid var(--color-bg-code)' : 'none', + background: idx === modelDropdownHighlight ? 'var(--color-info-bg)' : 'white' }">
{{ m.id }}
-
{{ m.owned_by }}
+
{{ m.owned_by }}
@@ -228,7 +228,7 @@ @@ -236,7 +236,7 @@ @@ -276,10 +276,10 @@ -
+
导入预览
共 {{ importPreview.configs.length }} 条配置
-
+
· {{ c.name }} ({{ c.appType || c.app_type }}) - {{ c.modelName || c.model_name }}
@@ -287,7 +287,7 @@
+ :style="{ background: importResult.errors?.length ? 'var(--color-error-bg)' : 'var(--color-success-bg)' }">
导入完成
新增 {{ importResult.added }} · 覆盖 {{ importResult.overwritten }} · 跳过 {{ importResult.skipped }}
@@ -713,7 +713,7 @@ onUnmounted(() => { clearInterval(healthTimer); clearTimeout(testResultTimer); d diff --git a/frontend/src/views/PipelineFlow.vue b/frontend/src/views/PipelineFlow.vue index 345bc8b..795555c 100644 --- a/frontend/src/views/PipelineFlow.vue +++ b/frontend/src/views/PipelineFlow.vue @@ -10,13 +10,10 @@
-
用户请求 / 入口
-
决策分支
-
处理步骤
-
RAG 检索
-
Advisor 链
-
最终输出
-
LLM 调用
+
+ + {{ item.label }} +
@@ -36,18 +33,30 @@