From 885f35851a3fbbfbe1d849600d1a367dd6e49f16 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 11 Jun 2021 11:35:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E9=99=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 877f0ae..1d83abc 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -173,26 +173,19 @@ export default class extends Vue { }) } - private handleLogin() { - (this.$refs.loginForm as ElForm).validate(async(valid: boolean) => { - if (valid) { - this.loading = true - await UserModule.Login(this.loginForm) - this.$router.push({ - path: this.redirect || '/', - query: this.otherQuery - }).catch(err => { - // console.warn(err) - this.loading = false - }) - // Just to simulate the time of the request - setTimeout(() => { - this.loading = false - }, 0.5 * 1000) - } else { - return false - } - }) + private async handleLogin() { + try { + await (this.$refs.loginForm as ElForm).validate() + this.loading = true + await UserModule.Login(this.loginForm) + await this.$router.push({ + path: this.redirect || '/', + query: this.otherQuery + }) + } catch (err) { + console.warn(err) + this.loading = false + } } private getOtherQuery(query: Dictionary) {