1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: 解决面板主题跟随系统失效的问题 (#5547)

Refs #5527
This commit is contained in:
ssongliu 2024-06-24 13:54:43 +08:00 committed by GitHub
parent 97b790a092
commit 419343364d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,10 @@
import { getLicenseStatus, getSettingInfo } from '@/api/modules/setting'; import { getLicenseStatus, getSettingInfo } from '@/api/modules/setting';
import { useTheme } from '@/hooks/use-theme'; import { useTheme } from '@/hooks/use-theme';
import { GlobalStore } from '@/store'; import { GlobalStore } from '@/store';
import { computed } from 'vue';
const globalStore = GlobalStore(); const globalStore = GlobalStore();
const { switchTheme } = useTheme(); const { switchTheme } = useTheme();
const themeConfig = computed(() => globalStore.themeConfig);
export function resetXSetting() { export function resetXSetting() {
globalStore.themeConfig.title = ''; globalStore.themeConfig.title = '';
@ -43,14 +45,6 @@ export async function getXpackSetting() {
} }
} }
const loadDataFromDB = async () => {
const res = await getSettingInfo();
document.title = res.data.panelName;
globalStore.entrance = res.data.securityEntrance;
globalStore.setDefaultNetwork(res.data.defaultNetwork);
globalStore.setOpenMenuTabs(res.data.menuTabs === 'enable');
};
export async function loadProductProFromDB() { export async function loadProductProFromDB() {
const res = await getLicenseStatus(); const res = await getLicenseStatus();
if (!res.data) { if (!res.data) {
@ -64,9 +58,16 @@ export async function loadProductProFromDB() {
globalStore.productProExpires = Number(res.data.productPro); globalStore.productProExpires = Number(res.data.productPro);
} }
} }
const res2 = await getSettingInfo();
document.title = res2.data.panelName;
globalStore.entrance = res2.data.securityEntrance;
globalStore.setDefaultNetwork(res2.data.defaultNetwork);
globalStore.setOpenMenuTabs(res2.data.menuTabs === 'enable');
globalStore.updateLanguage(res2.data.language);
globalStore.setThemeConfig({ ...themeConfig.value, theme: res2.data.theme, panelName: res2.data.panelName });
switchTheme(); switchTheme();
initFavicon(); initFavicon();
loadDataFromDB();
} }
export async function getXpackSettingForTheme() { export async function getXpackSettingForTheme() {