forked from github/dataease
fix: 异步加载默认登录方式
This commit is contained in:
parent
d436b5bb71
commit
3ad6dd6f28
@ -99,7 +99,8 @@ export default {
|
||||
'panel-default-tree',
|
||||
'chart-tree',
|
||||
'dataset-tree'
|
||||
]
|
||||
],
|
||||
defaultType: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -116,14 +117,10 @@ export default {
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
let p1 = null
|
||||
let p2 = null
|
||||
let p3 = null
|
||||
pluginLoaded().then(res => {
|
||||
this.isPluginLoaded = res.success && res.data
|
||||
this.isPluginLoaded && initTheme()
|
||||
this.contentShow = true
|
||||
p1 = Promise.resolve(1)
|
||||
}).catch(() => {
|
||||
this.contentShow = true
|
||||
})
|
||||
@ -132,14 +129,14 @@ export default {
|
||||
if (res.success && res.data) {
|
||||
this.loginTypes.push(1)
|
||||
}
|
||||
p2 = Promise.resolve(2)
|
||||
this.setDefaultType()
|
||||
})
|
||||
|
||||
oidcStatus().then(res => {
|
||||
if (res.success && res.data) {
|
||||
this.loginTypes.push(2)
|
||||
}
|
||||
p3 = Promise.resolve(3)
|
||||
this.setDefaultType()
|
||||
})
|
||||
getPublicKey().then(res => {
|
||||
if (res.success && res.data) {
|
||||
@ -147,17 +144,12 @@ export default {
|
||||
localStorage.setItem('publicKey', res.data)
|
||||
}
|
||||
})
|
||||
Promise.all([p1, p2, p3]).then(() => {
|
||||
defaultLoginType().then(res => {
|
||||
const result = res
|
||||
console.log('default login type is :' + res.data)
|
||||
if (result.success && result.data && this.loginTypes.includes(result.data)) {
|
||||
this.loginForm.loginType = result.data
|
||||
this.$nextTick(() => {
|
||||
this.changeLoginType(this.loginForm.loginType)
|
||||
})
|
||||
}
|
||||
})
|
||||
defaultLoginType().then(res => {
|
||||
console.log('default login type is :' + res.data)
|
||||
if (res && res.success) {
|
||||
this.defaultType = res.data
|
||||
}
|
||||
this.setDefaultType()
|
||||
})
|
||||
},
|
||||
|
||||
@ -183,6 +175,14 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
setDefaultType() {
|
||||
if (this.loginTypes.includes(this.defaultType)) {
|
||||
this.loginForm.loginType = this.defaultType
|
||||
this.$nextTick(() => {
|
||||
this.changeLoginType(this.loginForm.loginType)
|
||||
})
|
||||
}
|
||||
},
|
||||
clearOidcMsg() {
|
||||
Cookies.remove('OidcError')
|
||||
Cookies.remove('IdToken')
|
||||
|
Loading…
Reference in New Issue
Block a user