From 7ebbfaf24bfc674fef86f266443057ab97caa7b8 Mon Sep 17 00:00:00 2001 From: Yule Date: Tue, 8 Sep 2026 23:25:31 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E9=85=8D=E7=BD=AE=E9=A1=B5=E6=9C=AA?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=8A=B6=E6=80=81=E6=94=B9=E6=98=BE=E5=BC=8F?= =?UTF-8?q?=E5=BE=BD=E6=A0=87=EF=BC=8C=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=B9=B6=E5=85=A5=E9=AB=98=E7=BA=A7=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 亮度配置/高级设置 header 的圆点指示改为右侧「未保存/已保存」徽标 - 系统管理组 (日志大小/等级) 迁入高级设置折叠区,随「保存设置」写入 - useConfig 同步字段归属:dirtyAdvanced 监听与 saveAdvanced 写入,恢复默认时同时保存两部分 --- webui/src/components.css | 25 +++++++--- webui/src/composables/useConfig.js | 13 +++-- webui/src/views/ConfigView.vue | 78 +++++++++++++++--------------- 3 files changed, 61 insertions(+), 55 deletions(-) diff --git a/webui/src/components.css b/webui/src/components.css index 4c4b89d..8344cfc 100644 --- a/webui/src/components.css +++ b/webui/src/components.css @@ -501,15 +501,24 @@ input:checked + .slider:before { } /* Actions */ -.unsaved-dot { - display: inline-block; - width: 7px; - height: 7px; - border-radius: 50%; - background: var(--md-sys-color-error); - margin-left: 6px; - vertical-align: middle; +.save-badge { + margin-left: auto; flex-shrink: 0; + padding: 2px 10px; + border-radius: 999px; + font-size: 0.75rem; + font-weight: 600; + line-height: 1.5; +} + +.save-badge.unsaved { + color: var(--color-warning); + background: color-mix(in srgb, var(--color-warning) 15%, transparent); +} + +.save-badge.saved { + color: #2f9e63; + background: rgba(47, 158, 99, 0.14); } .card-actions { diff --git a/webui/src/composables/useConfig.js b/webui/src/composables/useConfig.js index 684a512..f560b36 100644 --- a/webui/src/composables/useConfig.js +++ b/webui/src/composables/useConfig.js @@ -16,7 +16,6 @@ export function useConfig() { const uiMaxBri = ref('') const maxBri = ref('') const stepsNum = ref('50') - const logMaxSize = ref('500') // 执行策略 const autoBriSleep = ref(false) @@ -34,6 +33,7 @@ export function useConfig() { const inotifyEvents = ref('c') const debugMode = ref(false) const logLevel = ref('info') + const logMaxSize = ref('500') // 脸污标记 const dirty = ref(false) @@ -56,7 +56,6 @@ export function useConfig() { uiMaxBri, maxBri, stepsNum, - logMaxSize, autoBriSleep, displayHdrSleep, compatibilityMode, @@ -65,14 +64,13 @@ export function useConfig() { sleepStartM, sleepEndH, sleepEndM, - logLevel, ], () => { if (!_silent) dirty.value = true }, ) - // 监听高级设置字段 - watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode], () => { + // 监听高级设置字段 (系统管理的日志项也随「保存设置」写入) + watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode, logLevel, logMaxSize], () => { if (!_silent) dirtyAdvanced.value = true }) @@ -136,12 +134,10 @@ export function useConfig() { ui_max_bri: parseInt(uiMaxBri.value) || 0, max_bri: parseInt(maxBri.value) || 0, steps_num: parseInt(stepsNum.value) || 50, - log_max_size: parseInt(logMaxSize.value) || 500, auto_bri_sleep: autoBriSleep.value ? 1 : 0, display_hdr_sleep: displayHdrSleep.value ? 1 : 0, compatibility_mode: compatibilityMode.value ? 1 : 0, sleep_time: getSleepTimeStr(), - log_level: logLevel.value, }) await runCmd(`rm -f "${FLAG_FILE}"`) const pidRes = await runCmd(`cat "${PID_FILE}"`) @@ -160,6 +156,8 @@ export function useConfig() { max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE, inotify_events: inotifyEvents.value || 'c', debug_mode: debugMode.value ? 1 : 0, + log_max_size: parseInt(logMaxSize.value) || 500, + log_level: logLevel.value, }) onPathsChanged?.() toast('高级设置已保存,需重启模块生效') @@ -212,6 +210,7 @@ export function useConfig() { sleepEndM.value = '00' } await save(toast) + await saveAdvanced(toast) } function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) { diff --git a/webui/src/views/ConfigView.vue b/webui/src/views/ConfigView.vue index f7c8a3e..476d29d 100644 --- a/webui/src/views/ConfigView.vue +++ b/webui/src/views/ConfigView.vue @@ -83,9 +83,10 @@ function handleSaveWebUI() {
-

- 亮度配置 -

+

亮度配置

+ + {{ config.dirty.value ? '未保存' : '已保存' }} +
@@ -208,36 +209,6 @@ function handleSaveWebUI() {
-
-

系统管理

-
-
- 日志大小限制 - 单位: KB -
- -
- -
-
- 日志等级 - 低于此级别不写入日志 -
- -
-
-
+
+

系统管理

+
+
+ 日志大小限制 + 单位: KB +
+ +
+ +
+
+ 日志等级 + 低于此级别不写入日志 +
+ +
+
+