feat: add shared PostgreSQL fnOS service and refresh UI

This commit is contained in:
2026-08-02 20:14:39 +08:00
parent de9f5ae110
commit e5b50ea85c
52 changed files with 3577 additions and 338 deletions
+3 -13
View File
@@ -28,7 +28,7 @@ const route = useRoute();
const authStore = useAuthStore();
const { isMobile } = useViewport();
const { backendUnavailable, backendMessage, backendLastChangedAt } = useBackendStatus();
const { sidebarCollapsed, toggleSidebarCollapsed } = useUiPreferences();
const { resolvedTheme, sidebarCollapsed, cycleThemeMode, toggleSidebarCollapsed } = useUiPreferences();
const mobileNavVisible = ref(false);
@@ -78,14 +78,6 @@ const navigationGroups = [
const userDisplayName = computed(() => authStore.user?.displayName || authStore.user?.username || "管理员");
const userAvatarText = computed(() => userDisplayName.value.trim().slice(0, 1).toUpperCase() || "录");
const isDark = ref(false);
try { isDark.value = localStorage.getItem("lr-theme") === "dark"; } catch { /* noop */ }
function toggleTheme() {
isDark.value = !isDark.value;
document.documentElement.dataset.theme = isDark.value ? "dark" : "light";
try { localStorage.setItem("lr-theme", isDark.value ? "dark" : "light"); } catch { /* noop */ }
}
function isNavItemActive(index: string) {
return route.path === index || route.path.startsWith(`${index}/`);
}
@@ -120,8 +112,6 @@ function closeMobileNav() { mobileNavVisible.value = false; }
watch(() => route.fullPath, () => { mobileNavVisible.value = false; });
// sync dark class on mount
watch(isDark, (v) => { document.documentElement.dataset.theme = v ? "dark" : "light"; }, { immediate: true });
</script>
<template>
@@ -203,8 +193,8 @@ watch(isDark, (v) => { document.documentElement.dataset.theme = v ? "dark" : "li
<div class="app-topbar__spacer" />
<button class="app-topbar__icon-btn" title="切换主题" @click="toggleTheme">
<el-icon :size="17"><component :is="isDark ? Sunny : Moon" /></el-icon>
<button class="app-topbar__icon-btn" title="切换主题" @click="cycleThemeMode">
<el-icon :size="17"><component :is="resolvedTheme === 'dark' ? Sunny : Moon" /></el-icon>
</button>
<button class="app-topbar__icon-btn" @click="router.push({ name: 'logs' })">
<el-icon :size="17"><Bell /></el-icon>