448 lines
16 KiB
Diff
448 lines
16 KiB
Diff
From 8b0934f6f4d5571dc05867e751eaf25cbc738d3c Mon Sep 17 00:00:00 2001
|
|
From: HenryDu8133 <813367384@qq.com>
|
|
Date: Sat, 12 Sep 2026 15:23:26 +0800
|
|
Subject: [PATCH 54/58] =?UTF-8?q?fix(ui):=20=E5=BD=BB=E5=BA=95=E4=BF=AE?=
|
|
=?UTF-8?q?=E5=A4=8D=E6=B7=B1=E6=B5=85=E8=89=B2=E4=B8=BB=E9=A2=98=E5=88=87?=
|
|
=?UTF-8?q?=E6=8D=A2=E5=8F=8A=E5=86=85=E9=83=A8=E9=A1=B5=E9=9D=A2=E6=A0=B7?=
|
|
=?UTF-8?q?=E5=BC=8F?=
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 恢复 variables.css 完整的 ClassicDark/ModernDark 等主题定义
|
|
- 恢复 nuxt.config.ts 的主题系统逻辑(默认改为 ClassicLight,保留切换能力)
|
|
- 修复 BackupManager / VotersModal / ProfileForm / LyricsModal / RequestForm / SongList / ScheduleList / StatsSlide / ArtistSlide 等数十处组件内部硬编码深色(#1a1a1a / #040e15 等)绕过主题的问题,全部改为使用 CSS 变量 (var(--bg-primary) 等)
|
|
- 这样实现了:在浅色模式下,所有页面均正确显示浅色;在深色模式下,又能正常呈现深色设计,且恢复了右上角的深浅色切换能力
|
|
---
|
|
app/assets/css/variables.css | 94 +++++++++-------------
|
|
app/components/Admin/BackupManager.vue | 8 +-
|
|
app/components/Admin/VotersModal.vue | 4 +-
|
|
app/components/Auth/ProfileForm.vue | 14 ++--
|
|
app/components/Songs/RequestForm.vue | 12 +--
|
|
app/components/Songs/ScheduleList.vue | 8 +-
|
|
app/components/Songs/SongList.vue | 8 +-
|
|
app/components/UI/LyricsModal.vue | 4 +-
|
|
app/components/year-review/ArtistSlide.vue | 2 +-
|
|
app/components/year-review/StatsSlide.vue | 2 +-
|
|
nuxt.config.ts | 34 +++-----
|
|
11 files changed, 79 insertions(+), 111 deletions(-)
|
|
|
|
diff --git a/app/assets/css/variables.css b/app/assets/css/variables.css
|
|
index 88a6536..30dce2a 100644
|
|
--- a/app/assets/css/variables.css
|
|
+++ b/app/assets/css/variables.css
|
|
@@ -1,13 +1,10 @@
|
|
-/* 全局CSS变量 - 统一配色方案(默认浅色ClassicLight,不依赖data-theme也能正常显示) */
|
|
+/* 全局CSS变量 - 统一配色方案 */
|
|
:root {
|
|
- /* 强制浅色基准值 - 即使 data-theme 缺失也保持浅色 */
|
|
- color-scheme: light;
|
|
-
|
|
/* 主色调 */
|
|
- --primary: #1e40af;
|
|
- --primary-hover: #1e3a8a;
|
|
- --primary-light: rgba(30, 64, 175, 0.08);
|
|
- --primary-border: rgba(30, 64, 175, 0.15);
|
|
+ --primary: #3b82f6;
|
|
+ --primary-hover: #2563eb;
|
|
+ --primary-light: rgba(59, 130, 246, 0.1);
|
|
+ --primary-border: rgba(59, 130, 246, 0.2);
|
|
|
|
/* 成功色 */
|
|
--success: #10b981;
|
|
@@ -33,25 +30,25 @@
|
|
--info-light: rgba(59, 130, 246, 0.1);
|
|
--info-border: rgba(59, 130, 246, 0.2);
|
|
|
|
- /* 背景色 (默认 ClassicLight 浅色) */
|
|
- --bg-primary: #ffffff;
|
|
- --bg-secondary: #f5f7fa;
|
|
- --bg-tertiary: #edf0f5;
|
|
- --bg-quaternary: #d9dee7;
|
|
- --bg-hover: #f0f3f8;
|
|
-
|
|
- /* 文字颜色 (默认 ClassicLight 浅色) */
|
|
- --text-primary: #1a2332;
|
|
- --text-secondary: #4a5568;
|
|
- --text-tertiary: #6b7280;
|
|
- --text-quaternary: #9ca3af;
|
|
- --text-disabled: #c5cbd3;
|
|
-
|
|
- /* 边框颜色 (默认 ClassicLight 浅色) */
|
|
- --border-primary: #e5e7eb;
|
|
- --border-secondary: #d1d5db;
|
|
- --border-tertiary: #9ca3af;
|
|
- --border-quaternary: #6b7280;
|
|
+ /* 背景色 */
|
|
+ --bg-primary: #111111;
|
|
+ --bg-secondary: #1a1a1a;
|
|
+ --bg-tertiary: #2a2a2a;
|
|
+ --bg-quaternary: #3a3a3a;
|
|
+ --bg-hover: #1f1f1f;
|
|
+
|
|
+ /* 文字颜色 */
|
|
+ --text-primary: #ffffff;
|
|
+ --text-secondary: #cccccc;
|
|
+ --text-tertiary: #888888;
|
|
+ --text-quaternary: #666666;
|
|
+ --text-disabled: #444444;
|
|
+
|
|
+ /* 边框颜色 */
|
|
+ --border-primary: #1f1f1f;
|
|
+ --border-secondary: #2a2a2a;
|
|
+ --border-tertiary: #3a3a3a;
|
|
+ --border-quaternary: #4a4a4a;
|
|
|
|
/* 阴影 */
|
|
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
@@ -135,16 +132,16 @@
|
|
--card-hover-border: var(--border-tertiary);
|
|
--card-shadow: var(--shadow-md);
|
|
|
|
- /* 按钮颜色 - 浅色基准 */
|
|
+ /* 按钮颜色 */
|
|
--btn-primary-bg: var(--primary);
|
|
--btn-primary-hover: var(--primary-hover);
|
|
- --btn-primary-text: #ffffff;
|
|
+ --btn-primary-text: var(--text-primary);
|
|
--btn-primary-border: var(--primary-border);
|
|
|
|
- --btn-secondary-bg: #f1f5f9;
|
|
- --btn-secondary-hover: #e2e8f0;
|
|
- --btn-secondary-text: #0f172a;
|
|
- --btn-secondary-border: #cbd5e1;
|
|
+ --btn-secondary-bg: #3a3a3a;
|
|
+ --btn-secondary-hover: #4a4a4a;
|
|
+ --btn-secondary-text: var(--text-primary);
|
|
+ --btn-secondary-border: #555555;
|
|
|
|
--btn-success-bg: var(--success);
|
|
--btn-success-hover: var(--success-hover);
|
|
@@ -164,12 +161,12 @@
|
|
--btn-disabled-bg: var(--bg-tertiary);
|
|
--btn-disabled-text: var(--text-disabled);
|
|
|
|
- /* 输入框颜色 - 浅色基准 */
|
|
- --input-bg: #ffffff;
|
|
- --input-border: #d1d5db;
|
|
+ /* 输入框颜色 */
|
|
+ --input-bg: var(--bg-tertiary);
|
|
+ --input-border: var(--border-tertiary);
|
|
--input-border-focus: var(--primary);
|
|
--input-text: var(--text-primary);
|
|
- --input-placeholder: #9ca3af;
|
|
+ --input-placeholder: var(--text-quaternary);
|
|
--input-shadow-focus: 0 0 0 3px var(--primary-light);
|
|
|
|
/* 模态框颜色 */
|
|
@@ -200,27 +197,12 @@
|
|
--spinner-primary: var(--primary);
|
|
--spinner-secondary: var(--bg-tertiary);
|
|
|
|
- /* 滚动条颜色 - 浅色基准 */
|
|
- --scrollbar-track: #f1f5f9;
|
|
- --scrollbar-thumb: #cbd5e1;
|
|
- --scrollbar-thumb-hover: #94a3b8;
|
|
-
|
|
- /* Surface 兼容别名 - 部分按钮/容器使用 surface-xxx */
|
|
- --surface-primary: var(--bg-primary);
|
|
- --surface-secondary: var(--bg-secondary);
|
|
- --surface-tertiary: var(--bg-tertiary);
|
|
- --surface-quaternary: var(--bg-quaternary);
|
|
-}
|
|
-
|
|
-/* 防深色兜底:覆盖 prefers-color-scheme: dark 对表单/根元素的自动影响 */
|
|
-@media (prefers-color-scheme: dark) {
|
|
- :root {
|
|
- color-scheme: light;
|
|
- }
|
|
+ /* 滚动条颜色 */
|
|
+ --scrollbar-track: var(--bg-tertiary);
|
|
+ --scrollbar-thumb: var(--bg-quaternary);
|
|
+ --scrollbar-thumb-hover: #4a4a4a;
|
|
}
|
|
|
|
-/* 浅色主题叠加层(与 data-theme 无关,确保始终为浅色;保留 data-theme 变量覆盖以兼容切换) */
|
|
-:root,
|
|
:root[data-theme='light'],
|
|
:root[data-theme='ClassicLight'],
|
|
:root[data-theme='ModernLight'] {
|
|
diff --git a/app/components/Admin/BackupManager.vue b/app/components/Admin/BackupManager.vue
|
|
index cb9c00a..efe60d0 100644
|
|
--- a/app/components/Admin/BackupManager.vue
|
|
+++ b/app/components/Admin/BackupManager.vue
|
|
@@ -520,8 +520,8 @@ const formatFileSize = (bytes) => {
|
|
/* 主容器 */
|
|
.backup-manager {
|
|
min-height: 100vh;
|
|
- background: #1a1a1a;
|
|
- color: #e5e5e5;
|
|
+ background: var(--bg-primary, #1a1a1a);
|
|
+ color: var(--text-primary, #e5e5e5);
|
|
padding: 2rem;
|
|
position: relative;
|
|
}
|
|
@@ -535,13 +535,13 @@ const formatFileSize = (bytes) => {
|
|
.header h3 {
|
|
font-size: 2.5rem;
|
|
font-weight: 700;
|
|
- color: #ffffff;
|
|
+ color: var(--text-primary, #ffffff);
|
|
margin: 0 0 1rem 0;
|
|
}
|
|
|
|
.header .description {
|
|
font-size: 1.125rem;
|
|
- color: #a0a0a0;
|
|
+ color: var(--text-secondary, #a0a0a0);
|
|
margin: 0;
|
|
}
|
|
|
|
diff --git a/app/components/Admin/VotersModal.vue b/app/components/Admin/VotersModal.vue
|
|
index c14b029..d7730f9 100644
|
|
--- a/app/components/Admin/VotersModal.vue
|
|
+++ b/app/components/Admin/VotersModal.vue
|
|
@@ -202,9 +202,9 @@ watch(
|
|
}
|
|
|
|
.modal-content {
|
|
- background: #1a1a1a;
|
|
+ background: var(--surface-primary, var(--bg-primary, #1a1a1a));
|
|
border-radius: 16px;
|
|
- border: 1px solid #2a2a2a;
|
|
+ border: 1px solid var(--border-primary, #2a2a2a);
|
|
width: 100%;
|
|
max-width: 500px;
|
|
max-height: 80vh;
|
|
diff --git a/app/components/Auth/ProfileForm.vue b/app/components/Auth/ProfileForm.vue
|
|
index 3c23d2d..1403f16 100644
|
|
--- a/app/components/Auth/ProfileForm.vue
|
|
+++ b/app/components/Auth/ProfileForm.vue
|
|
@@ -224,24 +224,24 @@ const handleUpdateProfile = async () => {
|
|
<style scoped>
|
|
.custom-select-profile :deep(> .flex) {
|
|
padding: 10px 16px;
|
|
- background-color: #09090b;
|
|
- border: 1px solid #27272a;
|
|
+ background-color: var(--input-bg, #09090b);
|
|
+ border: 1px solid var(--input-border, #27272a);
|
|
border-radius: 0.75rem;
|
|
- color: #f4f4f5;
|
|
+ color: var(--input-text, #f4f4f5);
|
|
font-size: 0.875rem;
|
|
line-height: 1.25rem;
|
|
height: 46px;
|
|
}
|
|
|
|
.custom-select-profile :deep(> .flex:hover) {
|
|
- border-color: #3f3f46;
|
|
+ border-color: var(--input-border-focus, #3f3f46);
|
|
}
|
|
|
|
.custom-select-profile :deep(> .border-blue-500\/50) {
|
|
- border-color: rgba(34, 197, 94, 0.5) !important;
|
|
- --tw-ring-color: rgba(34, 197, 94, 0.5);
|
|
+ border-color: var(--primary, rgba(34, 197, 94, 0.5)) !important;
|
|
+ --tw-ring-color: var(--primary-light, rgba(34, 197, 94, 0.5));
|
|
box-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
- background-color: #09090b !important;
|
|
+ background-color: var(--input-bg, #09090b) !important;
|
|
}
|
|
|
|
.custom-select-profile :deep(.text-\[11px\]) {
|
|
diff --git a/app/components/Songs/RequestForm.vue b/app/components/Songs/RequestForm.vue
|
|
index d28fc42..538f4f5 100644
|
|
--- a/app/components/Songs/RequestForm.vue
|
|
+++ b/app/components/Songs/RequestForm.vue
|
|
@@ -3194,14 +3194,14 @@ defineExpose({
|
|
}
|
|
|
|
.search-input {
|
|
- background: #040e15;
|
|
- border: 1px solid #242f38;
|
|
+ background: var(--input-bg, #040e15);
|
|
+ border: 1px solid var(--input-border, #242f38);
|
|
border-radius: 8px;
|
|
padding: 0.6rem 0.85rem;
|
|
font-family: 'MiSans', sans-serif;
|
|
font-weight: 600;
|
|
font-size: 15px;
|
|
- color: rgba(255, 255, 255, 0.6);
|
|
+ color: var(--input-text, rgba(255, 255, 255, 0.6));
|
|
flex: 1;
|
|
min-width: 100px; /* 确保输入框不会缩到太小 */
|
|
}
|
|
@@ -3484,14 +3484,14 @@ defineExpose({
|
|
|
|
.form-input,
|
|
.form-select {
|
|
- background: #040e15;
|
|
- border: 1px solid #242f38;
|
|
+ background: var(--input-bg, #040e15);
|
|
+ border: 1px solid var(--input-border, #242f38);
|
|
border-radius: 8px;
|
|
padding: 0.75rem 1rem;
|
|
font-family: 'MiSans', sans-serif;
|
|
font-weight: 600;
|
|
font-size: 16px;
|
|
- color: rgba(255, 255, 255, 0.6);
|
|
+ color: var(--input-text, rgba(255, 255, 255, 0.6));
|
|
width: 100%;
|
|
}
|
|
|
|
diff --git a/app/components/Songs/ScheduleList.vue b/app/components/Songs/ScheduleList.vue
|
|
index ffb3b5e..7df22f8 100644
|
|
--- a/app/components/Songs/ScheduleList.vue
|
|
+++ b/app/components/Songs/ScheduleList.vue
|
|
@@ -2188,9 +2188,9 @@ const vRipple = {
|
|
.custom-select:focus,
|
|
.custom-input:focus {
|
|
outline: none;
|
|
- border-color: var(--primary);
|
|
- box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
- background: #1a1a20;
|
|
+ border-color: var(--input-border-focus, var(--primary));
|
|
+ box-shadow: var(--input-shadow-focus, 0 0 0 3px rgba(102, 126, 234, 0.1));
|
|
+ background: var(--input-bg, #1a1a20);
|
|
}
|
|
|
|
.btn-icon {
|
|
@@ -3168,7 +3168,7 @@ const vRipple = {
|
|
|
|
/* 日期选择弹窗 */
|
|
.date-picker-content {
|
|
- background: #1a1a1f;
|
|
+ background: var(--surface-primary, var(--bg-primary, #1a1a1f));
|
|
border-radius: 20px 20px 0 0;
|
|
width: 100%;
|
|
max-width: 100%;
|
|
diff --git a/app/components/Songs/SongList.vue b/app/components/Songs/SongList.vue
|
|
index 7478f2d..f6134f6 100644
|
|
--- a/app/components/Songs/SongList.vue
|
|
+++ b/app/components/Songs/SongList.vue
|
|
@@ -1894,14 +1894,14 @@ const vRipple = {
|
|
}
|
|
|
|
.search-input {
|
|
- background: #040e15;
|
|
- border: 1px solid #242f38;
|
|
+ background: var(--input-bg, #040e15);
|
|
+ border: 1px solid var(--input-border, #242f38);
|
|
border-radius: 8px;
|
|
padding: 0.5rem 1rem;
|
|
padding-right: 2.5rem;
|
|
font-family: 'MiSans-Demibold', sans-serif;
|
|
font-size: 14px;
|
|
- color: rgba(255, 255, 255, 0.8);
|
|
+ color: var(--input-text, rgba(255, 255, 255, 0.8));
|
|
width: 100%;
|
|
transition: all 0.2s ease;
|
|
}
|
|
@@ -2593,7 +2593,7 @@ button:disabled {
|
|
}
|
|
|
|
.semester-dropdown {
|
|
- background: #1a1a1f;
|
|
+ background: var(--surface-primary, var(--bg-primary, #1a1a1f));
|
|
border: none;
|
|
border-radius: 12px;
|
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
|
|
diff --git a/app/components/UI/LyricsModal.vue b/app/components/UI/LyricsModal.vue
|
|
index 3451ee1..25c07ac 100644
|
|
--- a/app/components/UI/LyricsModal.vue
|
|
+++ b/app/components/UI/LyricsModal.vue
|
|
@@ -953,8 +953,8 @@ onUnmounted(() => {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
- background: #000000;
|
|
- color: #ffffff;
|
|
+ background: var(--bg-primary, #000000);
|
|
+ color: var(--text-primary, #ffffff);
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: column;
|
|
diff --git a/app/components/year-review/ArtistSlide.vue b/app/components/year-review/ArtistSlide.vue
|
|
index 27d56f1..41a2cd4 100644
|
|
--- a/app/components/year-review/ArtistSlide.vue
|
|
+++ b/app/components/year-review/ArtistSlide.vue
|
|
@@ -37,7 +37,7 @@ defineProps({
|
|
align-items: center;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
- background-color: #1a0b2e;
|
|
+ background-color: var(--surface-primary, var(--bg-primary, #1a0b2e));
|
|
}
|
|
|
|
.bg-overlay {
|
|
diff --git a/app/components/year-review/StatsSlide.vue b/app/components/year-review/StatsSlide.vue
|
|
index 9b474f1..5ab8c2e 100644
|
|
--- a/app/components/year-review/StatsSlide.vue
|
|
+++ b/app/components/year-review/StatsSlide.vue
|
|
@@ -43,7 +43,7 @@ defineProps({
|
|
align-items: center;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
- background-color: #030712; /* gray-950 */
|
|
+ background-color: var(--surface-primary, var(--bg-primary, #030712));
|
|
}
|
|
|
|
.bg-gradient {
|
|
diff --git a/nuxt.config.ts b/nuxt.config.ts
|
|
index 6964a0d..d5ff5f3 100644
|
|
--- a/nuxt.config.ts
|
|
+++ b/nuxt.config.ts
|
|
@@ -194,10 +194,6 @@ export default defineNuxtConfig({
|
|
name: 'x-default-theme',
|
|
content: process.env.NUXT_PUBLIC_DEFAULT_THEME || 'ClassicLight'
|
|
},
|
|
- {
|
|
- name: 'x-enabled-themes',
|
|
- content: process.env.NUXT_PUBLIC_ENABLED_THEMES || 'ClassicLight,ModernLight'
|
|
- },
|
|
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
|
|
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
|
|
{ name: 'apple-mobile-web-app-title', content: 'VoiceHub管理' },
|
|
@@ -210,28 +206,18 @@ export default defineNuxtConfig({
|
|
tagPosition: 'head',
|
|
children: [
|
|
`(function(){try{`,
|
|
- ` var k='voicehub:theme', d=document, r=d.documentElement, s=null, eff=null, def=null, list=[];`,
|
|
- ` try{`,
|
|
- ` var mt=d.querySelector('meta[name="x-enabled-themes"]');`,
|
|
- ` if(mt && mt.content){list=String(mt.content).split(',').map(function(x){return x.replace(/^\\s+|\\s+$/g,'')}).filter(Boolean)}`,
|
|
- ` }catch(e){list=[]}`,
|
|
- ` try{`,
|
|
- ` var md=d.querySelector('meta[name="x-default-theme"]');`,
|
|
- ` if(md && md.content){def=md.content}`,
|
|
- ` }catch(e){def=null}`,
|
|
- ` if(!def){def='ClassicLight'}`,
|
|
- ` if(list.length===0){list=['ClassicLight','ModernLight']}`,
|
|
- ` function valid(t){`,
|
|
- ` if(list.indexOf(t)!==-1){return t}`,
|
|
- ` if(list.indexOf(def)!==-1){return def}`,
|
|
- ` return list[0]`,
|
|
- ` }`,
|
|
+ ` var k='voicehub:theme', d=document, r=d.documentElement, s=null, eff=null;`,
|
|
` try{s=localStorage.getItem(k)}catch(e){s=null}`,
|
|
- ` if(!s){s=def}`,
|
|
- ` else{s=valid(s)}`,
|
|
- ` if(typeof s==='string' && (s==='System'||s==='system')){eff=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}`,
|
|
+ ` if(!s){`,
|
|
+ ` try{`,
|
|
+ ` var meta=document.querySelector('meta[name="x-default-theme"]');`,
|
|
+ ` if(meta && meta.content){s=meta.content}`,
|
|
+ ` }catch(e){s=null}`,
|
|
+ ` if(!s){s='ClassicLight'}`,
|
|
+ ` }`,
|
|
+ ` if(s==='System'||s==='system'){eff=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}`,
|
|
` else if(typeof s==='string'){eff=s.endsWith('Dark')||s==='dark'?'dark':(s.endsWith('Light')||s==='light'?'light':s)}`,
|
|
- ` else{eff='light'}`,
|
|
+ ` else{eff='dark'}`,
|
|
` r.setAttribute('data-theme', (typeof s==='string'?s:eff));`,
|
|
` if(eff==='dark'){r.classList.add('dark'); r.classList.remove('light'); r.style.colorScheme='dark'}`,
|
|
` else if(eff==='light'){r.classList.add('light'); r.classList.remove('dark'); r.style.colorScheme='light'}`,
|
|
--
|
|
2.45.1.windows.1
|
|
|