mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-09 20:57:17 +08:00
fix: 修复保存网站配置之后网站标题、LOGO 不同步更改问题
* Merge remote-tracking branch 'origin/dev' into dev * fix: 修复保存网站配置之后网站标题、LOGO 不同步更改问题 * feat: 新增系统配置
This commit is contained in:
@@ -9,19 +9,19 @@ const storeSetup = () => {
|
|||||||
// App配置
|
// App配置
|
||||||
const settingConfig = reactive({ ...defaultSettings }) as App.SettingConfig
|
const settingConfig = reactive({ ...defaultSettings }) as App.SettingConfig
|
||||||
// 系统配置
|
// 系统配置
|
||||||
let webConfig = {} as BasicConfigRecordResp
|
const webConfig = reactive({}) as BasicConfigRecordResp
|
||||||
|
|
||||||
const getLogo = () => {
|
const getLogo = () => {
|
||||||
return webConfig.site_logo;
|
return webConfig.site_logo;
|
||||||
}
|
}
|
||||||
const getFavicon = () => {
|
const getFavicon = () => {
|
||||||
return webConfig?.site_favicon
|
return webConfig.site_favicon
|
||||||
}
|
}
|
||||||
const getTitle = () => {
|
const getTitle = () => {
|
||||||
return webConfig?.site_title
|
return webConfig.site_title
|
||||||
}
|
}
|
||||||
const getCopyright = () => {
|
const getCopyright = () => {
|
||||||
return webConfig?.site_copyright
|
return webConfig.site_copyright
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化系统配置
|
// 初始化系统配置
|
||||||
@@ -33,12 +33,10 @@ const storeSetup = () => {
|
|||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
resMap.set(item.label, item.value)
|
resMap.set(item.label, item.value)
|
||||||
})
|
})
|
||||||
webConfig = {
|
webConfig.site_title=resMap.get('site_title');
|
||||||
site_title: resMap.get('site_title'),
|
webConfig.site_copyright=resMap.get('site_copyright');
|
||||||
site_copyright: resMap.get('site_copyright'),
|
webConfig.site_logo=resMap.get('site_logo');
|
||||||
site_logo: resMap.get('site_logo'),
|
webConfig.site_favicon=resMap.get('site_favicon');
|
||||||
site_favicon: resMap.get('site_logo')
|
|
||||||
}
|
|
||||||
document.title = resMap.get('site_title')
|
document.title = resMap.get('site_title')
|
||||||
document
|
document
|
||||||
.querySelector('link[rel="shortcut icon"]')
|
.querySelector('link[rel="shortcut icon"]')
|
||||||
@@ -48,7 +46,7 @@ const storeSetup = () => {
|
|||||||
|
|
||||||
// 保存系统配置
|
// 保存系统配置
|
||||||
const saveWebConfig = (config: BasicConfigRecordResp) => {
|
const saveWebConfig = (config: BasicConfigRecordResp) => {
|
||||||
webConfig = config
|
Object.assign(webConfig,config)
|
||||||
document.title = config.site_title || ''
|
document.title = config.site_title || ''
|
||||||
document
|
document
|
||||||
.querySelector('link[rel="shortcut icon"]')
|
.querySelector('link[rel="shortcut icon"]')
|
||||||
@@ -104,6 +102,7 @@ const storeSetup = () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(settingConfig),
|
...toRefs(settingConfig),
|
||||||
|
...toRefs(webConfig),
|
||||||
transitionName,
|
transitionName,
|
||||||
themeCSSVar,
|
themeCSSVar,
|
||||||
toggleTheme,
|
toggleTheme,
|
||||||
@@ -119,4 +118,4 @@ const storeSetup = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useAppStore = defineStore('app', storeSetup, {})
|
export const useAppStore = defineStore('app', storeSetup, {persist: true})
|
||||||
|
Reference in New Issue
Block a user