diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index caa4875664..f580b1a2c3 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -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 } diff --git a/frontend/src/permission.js b/frontend/src/permission.js index 92430d23ef..8b983c5449 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -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) } diff --git a/frontend/src/utils/auth.js b/frontend/src/utils/auth.js index b5d3ed9f7f..680a502d86 100644 --- a/frontend/src/utils/auth.js +++ b/frontend/src/utils/auth.js @@ -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() { diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index f86ab4e39a..d606534438 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -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 }