From 3ad6dd6f286f80cf6f44878da4d162b505227a36 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 12 May 2022 16:28:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=99=BB=E5=BD=95=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/login/index.vue | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index fde59f6a7a..41a773e541 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -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')