From 19ba371b994ba227298683eb248f8a581529fbaa Mon Sep 17 00:00:00 2001 From: Yule Date: Fri, 10 Apr 2026 08:59:33 +0800 Subject: [PATCH] =?UTF-8?q?style(webui):=20=E6=95=B4=E4=BD=93=E5=A4=96?= =?UTF-8?q?=E8=A7=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webui/src/App.vue | 27 ++++------ webui/src/components.css | 49 +++++++++++++---- webui/src/composables/useConfig.js | 45 +++++++++++++++- webui/src/style.css | 4 +- webui/src/views/ConfigView.vue | 84 +++++++++++++----------------- 5 files changed, 134 insertions(+), 75 deletions(-) diff --git a/webui/src/App.vue b/webui/src/App.vue index 5fc7e71..182dd0d 100644 --- a/webui/src/App.vue +++ b/webui/src/App.vue @@ -16,7 +16,6 @@ const NAV_ORDER = ['status', 'config', 'apps', 'log', 'about'] const currentView = ref('status') const headerEl = ref(null) const headerHidden = ref(false) -const lastScrollTops = {} const trackStyle = computed(() => { const idx = NAV_ORDER.indexOf(currentView.value) @@ -104,32 +103,28 @@ onUnmounted(() => { }) function onPageScroll(e) { + // 只响应 .page-slide 的滚动,忽略内部子滚动容器(如应用列表) + if (!e.target.classList.contains('page-slide')) return const topBlur = document.querySelector('.top-blur') - const { scrollTop, scrollHeight, clientHeight } = e.target + const { scrollTop } = e.target if (topBlur) topBlur.classList.toggle('scrolled', scrollTop > 10) - - // 根据滚动方向自动隐藏/显示 header - // nearBottom: 接近底部时不触发隐藏,防止弹性滚动引发抖动 - const nearBottom = scrollTop + clientHeight >= scrollHeight - 30 - const idx = NAV_ORDER.indexOf(currentView.value) - const last = lastScrollTops[idx] ?? 0 - if (scrollTop > last + 6 && !nearBottom) { - headerHidden.value = true - } else if (scrollTop < last - 4) { - headerHidden.value = false - } - lastScrollTops[idx] = scrollTop + headerHidden.value = scrollTop > 0 } function handleViewChange(view) { currentView.value = view headerHidden.value = false // 切换页面时恢复显示 header - // 切换页面时同步更新 top-blur 状态 + const idx = NAV_ORDER.indexOf(view) const slides = document.querySelectorAll('.page-slide') const slide = slides[idx] + + // 切换页面时回顶 + if (slide) slide.scrollTop = 0 + + // 切换后 top-blur 跟随新页面状态(已回顶故一定为 false) const topBlur = document.querySelector('.top-blur') - if (topBlur) topBlur.classList.toggle('scrolled', slide ? slide.scrollTop > 10 : false) + if (topBlur) topBlur.classList.remove('scrolled') } diff --git a/webui/src/components.css b/webui/src/components.css index 46121b9..7a96da5 100644 --- a/webui/src/components.css +++ b/webui/src/components.css @@ -92,18 +92,18 @@ /* Config Items */ .config-group { - margin-top: var(--spacing-l); - margin-bottom: var(--spacing-l); - padding: var(--spacing-m); + margin-top: 12px; + margin-bottom: 0; + padding: 12px; background-color: var(--md-sys-color-surface-container); border-radius: var(--border-radius-m); border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.05); } .group-title { - margin: 0 0 var(--spacing-m) 0; + margin: 0 0 10px 0; color: var(--md-sys-color-primary); - font-size: 0.9rem; + font-size: 0.875rem; font-weight: 600; display: flex; align-items: center; @@ -135,9 +135,9 @@ } .config-item + .config-item { - margin-top: var(--spacing-m); + margin-top: 10px; border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1); - padding-top: var(--spacing-m); + padding-top: 10px; } .config-label { @@ -175,6 +175,25 @@ background-color: var(--md-sys-color-surface); } +.config-select { + padding: 8px 12px; + background-color: var(--md-sys-color-surface-container-high); + border: 1px solid var(--md-sys-color-outline-variant); + border-radius: var(--border-radius-s); + color: var(--md-sys-color-on-surface); + font-size: 1rem; + font-family: inherit; + outline: none; + cursor: pointer; + transition: all 0.2s ease; +} + +.config-select:focus { + border-color: var(--md-sys-color-primary); + box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2); + background-color: var(--md-sys-color-surface); +} + #advanced-section .config-input { width: 100%; text-align: left; @@ -317,6 +336,7 @@ input:checked + .slider:before { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-m); + margin-top: var(--spacing-m); } .status-item { @@ -497,12 +517,23 @@ 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; + flex-shrink: 0; +} + .card-actions { display: flex; justify-content: flex-end; gap: 12px; - margin-top: var(--spacing-l); - padding-top: var(--spacing-m); + margin-top: 16px; + padding-top: 12px; border-top: 1px solid var(--md-sys-color-outline-variant); } diff --git a/webui/src/composables/useConfig.js b/webui/src/composables/useConfig.js index 1c589c5..4eac497 100644 --- a/webui/src/composables/useConfig.js +++ b/webui/src/composables/useConfig.js @@ -1,4 +1,4 @@ -import { ref } from 'vue' +import { ref, watch } from 'vue' import { runCmd, readConfig, @@ -34,6 +34,11 @@ export function useConfig() { const debugMode = ref(false) const logLevel = ref('info') + // 脸污标记 + const dirty = ref(false) + const dirtyAdvanced = ref(false) + let _silent = false + // Web UI 配置 (localStorage 持久化) const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false') const statusRefreshInterval = ref( @@ -44,9 +49,38 @@ export function useConfig() { ) const themeMode = ref(localStorage.getItem('themeMode') || 'system') + // 监听主配置字段 + watch( + [ + uiMaxBri, + maxBri, + stepsNum, + logMaxSize, + autoBriSleep, + displayHdrSleep, + sleepMode, + sleepStartH, + sleepStartM, + sleepEndH, + sleepEndM, + logLevel, + ], + () => { + if (!_silent) dirty.value = true + }, + ) + // 监听高级设置字段 + watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode], () => { + if (!_silent) dirtyAdvanced.value = true + }) + async function load() { + _silent = true const cfg = await readConfig() - if (!cfg || Object.keys(cfg).length === 0) return + if (!cfg || Object.keys(cfg).length === 0) { + _silent = false + return + } uiMaxBri.value = cfg.ui_max_bri != null ? String(cfg.ui_max_bri) : '' maxBri.value = cfg.max_bri != null ? String(cfg.max_bri) : '' @@ -75,6 +109,9 @@ export function useConfig() { } else { sleepMode.value = false } + dirty.value = false + dirtyAdvanced.value = false + _silent = false } function getSleepTimeStr() { @@ -109,6 +146,7 @@ export function useConfig() { ? '配置已保存 (下次调整时生效)' : '配置已保存 (服务未运行)', ) + dirty.value = false } async function saveAdvanced(toast, onPathsChanged) { @@ -121,6 +159,7 @@ export function useConfig() { }) onPathsChanged?.() toast('高级设置已保存,需重启服务生效') + dirtyAdvanced.value = false } async function resetToDefaults(toast) { @@ -215,6 +254,8 @@ export function useConfig() { inotifyEvents, debugMode, logLevel, + dirty, + dirtyAdvanced, autoRefresh, statusRefreshInterval, uiZoom, diff --git a/webui/src/style.css b/webui/src/style.css index 73f1ec2..2548310 100644 --- a/webui/src/style.css +++ b/webui/src/style.css @@ -49,6 +49,7 @@ html { scrollbar-width: none; /* Firefox */ -ms-overflow-style: none; /* IE/Edge */ + background-color: var(--md-sys-color-background); } html::-webkit-scrollbar { @@ -58,6 +59,7 @@ html::-webkit-scrollbar { body { margin: 0; padding: 0; + zoom: 0.95; /* insets 会在这里被 internal/insets.css 处理,我们预留顶底内边距 */ padding-top: var(--safe-area-inset-top, 0); padding-bottom: var(--safe-area-inset-bottom, 0); @@ -84,7 +86,7 @@ body::-webkit-scrollbar { margin: 0 auto; display: flex; flex-direction: column; - height: 100dvh; + height: calc(100dvh / 0.95); overflow: hidden; } diff --git a/webui/src/views/ConfigView.vue b/webui/src/views/ConfigView.vue index 22afd63..04a9563 100644 --- a/webui/src/views/ConfigView.vue +++ b/webui/src/views/ConfigView.vue @@ -82,7 +82,11 @@ function handleSaveWebUI() {
-

亮度配置

+
+

+ 亮度配置 +

+

亮度调节

@@ -134,7 +138,7 @@ function handleSaveWebUI() { 显示 HDR 内容时休眠 HDR/SDR 比率 > 1 时不提升 建议配合去温控使用。出现闪屏时可改用黑名单功能出现闪屏建议改用黑名单
@@ -212,24 +216,14 @@ function handleSaveWebUI() {
日志等级 - 低于该等级的日志不写入文件 -
-
- + 低于此级别不写入日志
+
@@ -248,7 +242,13 @@ function handleSaveWebUI() {
-

高级设置

+

+ 高级设置 +

@@ -259,9 +259,9 @@ function handleSaveWebUI() {
调试模式 - 将每个 inotify 事件及防抖触发信息写入日志 + 记录详细 inotify 事件到日志 开启后需重启服务,日志量增大。诊断完成后请关闭需重启生效,用完请关闭
@@ -270,10 +270,7 @@ function handleSaveWebUI() {
lumipro 监听事件 - 默认 c(sysfs MODIFY)。修改需重启服务 - 修改为 c 以外时建议关闭自动刷新 + 默认 c,改后需重启