From 949e50916fc785f3370ff559924fbdcfaee8437c Mon Sep 17 00:00:00 2001 From: Yule Date: Thu, 10 Sep 2026 10:28:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(webui):=20=E6=95=B4=E5=9E=8B=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E5=AD=97=E6=AE=B5=E4=B8=8E=E5=B8=83=E5=B0=94=E5=80=BC?= =?UTF-8?q?=E6=A1=A5=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit md-switch 发出布尔值,而表单里 0/1 字段存的是字符串,导致: - 「显示 HDR 内容时休眠」打开后阈值输入不展开(=== '1' 判定失效) - 保存时 parseInt(true) 得 0,会把已开启的开关写成关闭 新增 autoBriSleep / displayHdrSleep / compatibilityMode / debugMode 四个桥接 computed --- webui/src/composables/useConfig.js | 19 +++++++++++++++++++ webui/src/views/ConfigView.vue | 10 +++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/webui/src/composables/useConfig.js b/webui/src/composables/useConfig.js index d3e8883..86b7c1d 100644 --- a/webui/src/composables/useConfig.js +++ b/webui/src/composables/useConfig.js @@ -89,6 +89,21 @@ export function useConfig() { return patch } + /** 整型开关字段(0/1)与布尔值之间的桥接:md-switch 给出的是布尔值 */ + function intBool(key) { + return computed({ + get: () => Number(form[key]) === 1, + set: (on) => { + form[key] = on ? '1' : '0' + }, + }) + } + + const autoBriSleep = intBool('auto_bri_sleep') + const displayHdrSleep = intBool('display_hdr_sleep') + const compatibilityMode = intBool('compatibility_mode') + const debugMode = intBool('debug_mode') + const diffMain = computed(() => changedKeys(MAIN_KEYS)) const diffAdvanced = computed(() => changedKeys(ADVANCED_KEYS)) const dirtyMain = computed(() => Object.keys(diffMain.value).length > 0) @@ -157,6 +172,10 @@ export function useConfig() { error, dirtyMain, dirtyAdvanced, + autoBriSleep, + displayHdrSleep, + compatibilityMode, + debugMode, load, saveMain, saveAdvanced, diff --git a/webui/src/views/ConfigView.vue b/webui/src/views/ConfigView.vue index 875c332..7de5dde 100644 --- a/webui/src/views/ConfigView.vue +++ b/webui/src/views/ConfigView.vue @@ -127,13 +127,13 @@ async function confirmReset() { /> - + -
+