Merge pull request #2901 from dataease/pr@dev@fix_uiinfo

fix(系统管理-外观配置): uiinfo过大导致存储在前端cookie失效
This commit is contained in:
fit2cloud-chenyw 2022-08-23 11:26:31 +08:00 committed by GitHub
commit 7911158ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View File

@ -334,8 +334,11 @@ export default {
}
},
loadUiInfo() {
this.$store.dispatch('user/getUI').then(() => {
this.$store.dispatch('user/getUI').then((res) => {
this.uiInfo = getSysUI()
if (!this.uiInfo || Object.keys(this.uiInfo).length === 0) {
this.uiInfo = res
}
if (this.uiInfo['ui.logo'] && this.uiInfo['ui.logo'].paramValue) {
this.logoUrl = '/system/ui/image/' + this.uiInfo['ui.logo'].paramValue
}

View File

@ -46,7 +46,7 @@ const routeBefore = (callBack) => {
})
} else {
document.title = getPageTitle()
if (uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
if (!!uiInfo && uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
const faviconUrl = '/system/ui/image/' + uiInfo['ui.favicon'].paramValue
changeFavicon(faviconUrl)
}

View File

@ -1,6 +1,6 @@
import Cookies from 'js-cookie'
import Config from '@/settings'
import store from '@/store'
const TokenKey = Config.TokenKey
const IdTokenKey = Config.IdTokenKey
@ -48,7 +48,7 @@ export function setSysUI(uiInfo) {
export function getSysUI() {
const json = Cookies.get('sysUiInfo')
return json ? JSON.parse(json) : null
return json ? JSON.parse(json) : store.getters.uiInfo
}
export function getTimeOut() {

View File

@ -164,9 +164,9 @@ export default {
},
created() {
this.$store.dispatch('user/getUI').then(() => {
this.$store.dispatch('user/getUI').then((res) => {
this.axiosFinished = true
this.showLoginImage()
this.showLoginImage(res)
}).catch(err => {
console.error(err)
})
@ -191,8 +191,11 @@ export default {
Cookies.remove('OidcError')
Cookies.remove('IdToken')
},
showLoginImage() {
showLoginImage(uiInfo) {
this.uiInfo = getSysUI()
if (!this.uiInfo || Object.keys(this.uiInfo).length === 0) {
this.uiInfo = uiInfo
}
if (this.uiInfo['ui.loginImage'] && this.uiInfo['ui.loginImage'].paramValue) {
this.loginImageUrl = '/system/ui/image/' + this.uiInfo['ui.loginImage'].paramValue
}