提交 35780b47 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

fix: 修复登录以及首页logo图片闪烁

上级 c027f324
<template> <template>
<div class="top-nav" :style="{'background-color': '#f1f3f8'}"> <div class="top-nav" :style="{'background-color': '#f1f3f8'}">
<div class="log"> <div v-loading="!axiosFinished" class="log">
<!-- <img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="140" alt="" style="padding-top: 10px;">--> <!-- <img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="140" alt="" style="padding-top: 10px;">-->
<svg-icon v-if="!logoUrl" icon-class="DataEase" custom-class="top-nav-logo-icon" /> <svg-icon v-if="!logoUrl && axiosFinished" icon-class="DataEase" custom-class="top-nav-logo-icon" />
<img v-else :src="logoUrl" width="140" alt="" style="padding-top: 10px;"> <img v-else :src="logoUrl && axiosFinished" width="140" alt="" style="padding-top: 10px;">
</div> </div>
<el-menu <el-menu
:active-text-color="variables.topMenuActiveText" :active-text-color="variables.topMenuActiveText"
...@@ -92,7 +92,8 @@ export default { ...@@ -92,7 +92,8 @@ export default {
data() { data() {
return { return {
uiInfo: null, uiInfo: null,
logoUrl: null logoUrl: null,
axiosFinished: false
} }
}, },
...@@ -137,6 +138,7 @@ export default { ...@@ -137,6 +138,7 @@ export default {
if (this.uiInfo['ui.logo'] && this.uiInfo['ui.logo'].paramValue) { if (this.uiInfo['ui.logo'] && this.uiInfo['ui.logo'].paramValue) {
this.logoUrl = '/system/ui/image/' + this.uiInfo['ui.logo'].paramValue this.logoUrl = '/system/ui/image/' + this.uiInfo['ui.logo'].paramValue
} }
this.axiosFinished = true
}) })
}, },
methods: { methods: {
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
</div> </div>
</el-form> </el-form>
</el-col> </el-col>
<el-col :span="12"> <el-col v-loading="!axiosFinished" :span="12">
<div v-if="!loginImageUrl" class="login-image" /> <div v-if="!loginImageUrl && axiosFinished" class="login-image" />
<div v-else class="login-image-de" :style="{background:'url(' + loginImageUrl + ') no-repeat', 'backgroundSize':'cover'}" /> <div v-if="loginImageUrl && axiosFinished" class="login-image-de" :style="{background:'url(' + loginImageUrl + ') no-repeat', 'backgroundSize':'contain'}" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
...@@ -95,7 +95,8 @@ export default { ...@@ -95,7 +95,8 @@ export default {
redirect: undefined, redirect: undefined,
uiInfo: null, uiInfo: null,
loginImageUrl: null, loginImageUrl: null,
loginLogoUrl: null loginLogoUrl: null,
axiosFinished: false
} }
}, },
computed: { computed: {
...@@ -115,6 +116,14 @@ export default { ...@@ -115,6 +116,14 @@ export default {
this.$store.dispatch('user/getUI').then(() => { this.$store.dispatch('user/getUI').then(() => {
// const uiLists = this.$store.state.user.uiInfo // const uiLists = this.$store.state.user.uiInfo
// this.uiInfo = format(uiLists) // this.uiInfo = format(uiLists)
this.axiosFinished = true
this.showLoginImage()
}).catch(err => {
console.error(err)
})
},
methods: {
showLoginImage() {
this.uiInfo = getSysUI() this.uiInfo = getSysUI()
if (this.uiInfo['ui.loginImage'] && this.uiInfo['ui.loginImage'].paramValue) { if (this.uiInfo['ui.loginImage'] && this.uiInfo['ui.loginImage'].paramValue) {
this.loginImageUrl = '/system/ui/image/' + this.uiInfo['ui.loginImage'].paramValue this.loginImageUrl = '/system/ui/image/' + this.uiInfo['ui.loginImage'].paramValue
...@@ -122,11 +131,7 @@ export default { ...@@ -122,11 +131,7 @@ export default {
if (this.uiInfo['ui.loginLogo'] && this.uiInfo['ui.loginLogo'].paramValue) { if (this.uiInfo['ui.loginLogo'] && this.uiInfo['ui.loginLogo'].paramValue) {
this.loginLogoUrl = '/system/ui/image/' + this.uiInfo['ui.loginLogo'].paramValue this.loginLogoUrl = '/system/ui/image/' + this.uiInfo['ui.loginLogo'].paramValue
} }
}).catch(err => { },
console.error(err)
})
},
methods: {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论