2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 20:57:19 +08:00
Files
panel/web/src/main.ts
Copilot f2d3911266 feat: 支持隐藏菜单和自定义Logo长期保存 (#1200)
* Initial plan

* feat: 支持隐藏菜单和自定义Logo长期保存

- 后端:在 SettingPanel 结构体中添加 HiddenMenu 和 CustomLogo 字段
- 后端:在 GetPanel 和 UpdatePanel 方法中处理新字段的获取和保存
- 后端:修改 Panel 接口返回 hidden_menu 和 custom_logo 给前端初始化
- 前端:在基本设置页面添加隐藏菜单和自定义 Logo 设置项
- 前端:从侧边栏设置组件中移除弹窗,只保留菜单折叠按钮
- 前端:初始化时从服务端获取并应用隐藏菜单和自定义 Logo 设置
- 前端:调整 store 的 persist 配置,不再将这两个设置保存到本地存储

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* 代码审查完成

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: 优化样式

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
2026-01-09 05:49:09 +08:00

54 lines
1.3 KiB
Go

import '@/styles/index.scss'
import '@/styles/reset.css'
import 'virtual:uno.css'
import { createApp } from 'vue'
import App from './App.vue'
import { setupRouter } from '@/router'
import { setupStore, usePermissionStore, useThemeStore } from '@/store'
import { gettext, setCurrent, setupNaiveDiscreteApi } from '@/utils'
import home from '@/api/panel/home'
async function setupApp() {
const app = createApp(App)
await setupStore(app)
await setupNaiveDiscreteApi()
await setupPanel().then(() => {
app.use(gettext)
})
await setupRouter(app)
app.mount('#app')
}
const setupPanel = async () => {
const themeStore = useThemeStore()
const permissionStore = usePermissionStore()
setCurrent(themeStore.locale)
return new Promise<void>((resolve) => {
useRequest(home.panel, {
initialData: {
name: import.meta.env.VITE_APP_TITLE,
locale: 'en',
hidden_menu: [],
custom_logo: ''
}
}).onSuccess(async ({ data }: { data: any }) => {
setCurrent(data.locale)
themeStore.setLocale(data.locale)
themeStore.setName(data.name)
// 设置隐藏菜单和自定义 Logo
themeStore.setLogo(data.custom_logo || '')
permissionStore.setHiddenRoutes(data.hidden_menu || [])
resolve()
})
})
}
setupApp()