1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

fix: 修改 xpack 依赖 (#4414)

This commit is contained in:
ssongliu 2024-04-07 16:29:46 +08:00 committed by GitHub
parent 646fc4e678
commit 494da3c209
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,7 +23,6 @@ import { DeviceType } from '@/enums/app';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useTheme } from '@/hooks/use-theme'; import { useTheme } from '@/hooks/use-theme';
import { getLicense, getSettingInfo, getSystemAvailable } from '@/api/modules/setting'; import { getLicense, getSettingInfo, getSystemAvailable } from '@/api/modules/setting';
import { searchXSetting } from '@/xpack/api/modules/setting';
useResize(); useResize();
const menuStore = MenuStore(); const menuStore = MenuStore();
@ -74,15 +73,31 @@ const loadDataFromDB = async () => {
}; };
const loadDataFromXDB = async () => { const loadDataFromXDB = async () => {
const res = await searchXSetting(); const xpackModules = import.meta.globEager('../xpack/api/modules/*.ts');
globalStore.themeConfig.title = res.data.title; if (xpackModules['../xpack/api/modules/setting.ts']) {
globalStore.themeConfig.logo = res.data.logo; const searchXSetting = xpackModules['../xpack/api/modules/setting.ts'].searchXSetting;
globalStore.themeConfig.logoWithText = res.data.logoWithText; if (searchXSetting) {
globalStore.themeConfig.favicon = res.data.favicon; const res = await searchXSetting();
globalStore.themeConfig.title = res.data.title;
globalStore.themeConfig.logo = res.data.logo;
globalStore.themeConfig.logoWithText = res.data.logoWithText;
globalStore.themeConfig.favicon = res.data.favicon;
} else {
resetSetting();
}
} else {
resetSetting();
}
initFavicon(); initFavicon();
}; };
const resetSetting = () => {
globalStore.themeConfig.title = '';
globalStore.themeConfig.logo = '';
globalStore.themeConfig.logoWithText = '';
globalStore.themeConfig.favicon = '';
};
const loadProductProFromDB = async () => { const loadProductProFromDB = async () => {
const res = await getLicense(); const res = await getLicense();
globalStore.isProductPro = globalStore.isProductPro =