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