发布 0.1.0:通知渠道、告警规则与多项体验修复
This commit is contained in:
+18
-1
@@ -2,6 +2,10 @@ import { defineStore } from 'pinia'
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
const DARK_KEY = 'oci-portal:dark'
|
||||
const LOGO_KEY = 'oci-portal:logo'
|
||||
|
||||
/** logo 款式:burst 星爆(现款)/ seal 波浪封印 */
|
||||
export type LogoVariant = 'burst' | 'seal'
|
||||
|
||||
function initialDark(): boolean {
|
||||
const saved = localStorage.getItem(DARK_KEY)
|
||||
@@ -9,6 +13,10 @@ function initialDark(): boolean {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
|
||||
function initialLogo(): LogoVariant {
|
||||
return localStorage.getItem(LOGO_KEY) === 'seal' ? 'seal' : 'burst'
|
||||
}
|
||||
|
||||
/** 跨页面共享的界面状态:侧栏收缩、明暗主题 */
|
||||
export const useAppStore = defineStore('app', () => {
|
||||
const sidebarCollapsed = ref(false)
|
||||
@@ -25,6 +33,11 @@ export const useAppStore = defineStore('app', () => {
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
/** logo 款式:默认星爆,设置 · 关于点击 logo 切换后按选择记忆 */
|
||||
const logoVariant = ref<LogoVariant>(initialLogo())
|
||||
|
||||
watch(logoVariant, (v) => localStorage.setItem(LOGO_KEY, v))
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarCollapsed.value = !sidebarCollapsed.value
|
||||
}
|
||||
@@ -33,5 +46,9 @@ export const useAppStore = defineStore('app', () => {
|
||||
dark.value = !dark.value
|
||||
}
|
||||
|
||||
return { sidebarCollapsed, toggleSidebar, dark, toggleDark }
|
||||
function toggleLogoVariant() {
|
||||
logoVariant.value = logoVariant.value === 'burst' ? 'seal' : 'burst'
|
||||
}
|
||||
|
||||
return { sidebarCollapsed, toggleSidebar, dark, toggleDark, logoVariant, toggleLogoVariant }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user