feat(webui): 重构WebUI样式并默认启用暗色主题

This commit is contained in:
congsh
2026-02-06 14:15:40 +08:00
parent f919487506
commit 87f3cbd8df
5 changed files with 753 additions and 564 deletions

View File

@@ -2,7 +2,16 @@
"permissions": { "permissions": {
"allow": [ "allow": [
"Bash(dir:*)", "Bash(dir:*)",
"Bash(tree:*)" "Bash(tree:*)",
"Bash(git checkout:*)",
"Bash(/home/congsh/.claude/plugins/cache/claude-plugins-official/ralph-loop/f1be96f0fb58/scripts/setup-ralph-loop.sh:*)",
"Bash(python3:*)",
"Bash(pip3 install:*)",
"Bash(playwright install:*)",
"mcp__plugin_playwright_playwright__browser_navigate",
"mcp__plugin_playwright_playwright__browser_install",
"Bash(./:*)",
"Bash(npx playwright install:*)"
] ]
} }
} }

View File

@@ -45,19 +45,19 @@ services:
redis: redis:
condition: service_healthy condition: service_healthy
# ==================== Web TUI 服务 ==================== # ==================== Web UI 服务 ====================
webtui: webui:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: minenasai-webtui container_name: minenasai-webui
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${WEBTUI_PORT:-8080}:8080" - "${WEBUI_PORT:-8080}:8080"
environment: environment:
- MINENASAI_ENV=production - MINENASAI_ENV=production
- MINENASAI_WEBTUI_HOST=0.0.0.0 - MINENASAI_WEBUI_HOST=0.0.0.0
- MINENASAI_WEBTUI_PORT=8080 - MINENASAI_WEBUI_PORT=8080
volumes: volumes:
- /volume2/docker/mineNasAi/data:/app/data - /volume2/docker/mineNasAi/data:/app/data
- /volume2/docker/mineNasAi/logs:/app/logs - /volume2/docker/mineNasAi/logs:/app/logs

File diff suppressed because it is too large Load Diff

View File

@@ -4,10 +4,18 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MineNASAI - 控制台</title> <title>MineNASAI - 控制台</title>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet">
<!-- Element Plus CSS --> <!-- Element Plus CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"> <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
<!-- xterm.js CSS --> <!-- xterm.js CSS -->
<link rel="stylesheet" href="https://unpkg.com/xterm@5.3.0/css/xterm.css"> <link rel="stylesheet" href="https://unpkg.com/xterm@5.3.0/css/xterm.css">
<!-- 自定义样式 --> <!-- 自定义样式 -->
<link rel="stylesheet" href="/webui/css/webui.css"> <link rel="stylesheet" href="/webui/css/webui.css">
</head> </head>
@@ -25,9 +33,6 @@
:default-active="activeMenu" :default-active="activeMenu"
:collapse="isCollapsed" :collapse="isCollapsed"
:collapse-transition="false" :collapse-transition="false"
:background-color="theme === 'dark' ? '#1a1b26' : '#ffffff'"
:text-color="theme === 'dark' ? '#c0caf5' : '#303133'"
active-text-color="#7aa2f7"
@select="handleMenuSelect" @select="handleMenuSelect"
> >
<el-menu-item index="dashboard"> <el-menu-item index="dashboard">

View File

@@ -54,8 +54,8 @@ const api = {
// 创建 Vue 应用 // 创建 Vue 应用
app = createApp({ app = createApp({
setup() { setup() {
// 主题状态 // 主题状态 - 默认暗色模式
const theme = ref(localStorage.getItem('minenasai-theme') || 'light'); const theme = ref(localStorage.getItem('minenasai-theme') || 'dark');
// 组件状态 // 组件状态
const isCollapsed = ref(false); const isCollapsed = ref(false);
@@ -218,14 +218,31 @@ app = createApp({
} }
} }
// 应用主题到全局html/body确保 Element Plus 弹层与透明容器生效
function applyThemeClass(value) {
const root = document.documentElement;
const body = document.body;
if (value === 'light') {
root.classList.add('theme-light');
body.classList.add('theme-light');
} else {
root.classList.remove('theme-light');
body.classList.remove('theme-light');
}
}
// 切换主题 // 切换主题
function toggleTheme() { function toggleTheme() {
theme.value = theme.value === 'dark' ? 'light' : 'dark'; theme.value = theme.value === 'dark' ? 'light' : 'dark';
localStorage.setItem('minenasai-theme', theme.value); localStorage.setItem('minenasai-theme', theme.value);
applyThemeClass(theme.value);
} }
// 初始化 // 初始化
onMounted(() => { onMounted(() => {
// 根据存储应用主题到全局
applyThemeClass(theme.value);
loadConfig(); loadConfig();
loadStats(); loadStats();
loadAgents(); loadAgents();