1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Fixed unable to restore login button state after login failure

This commit is contained in:
2023-05-11 17:41:56 +08:00
parent d5dbc0baca
commit cfc16940a5

View File

@@ -102,6 +102,10 @@ export default {
getNewCaptcha() { getNewCaptcha() {
this.captchaSrc = getCaptchaSrc() this.captchaSrc = getCaptchaSrc()
}, },
resetLogin() {
this.getNewCaptcha()
this.loggingIn = false
},
login() { login() {
if (this.loggingIn) { if (this.loggingIn) {
return return
@@ -114,6 +118,7 @@ export default {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>用户名</strong> 为空' message: '<strong>用户名</strong> 为空'
}) })
this.loggingIn = false
return return
} }
if (!this.password) { if (!this.password) {
@@ -121,6 +126,7 @@ export default {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>密码</strong> 为空' message: '<strong>密码</strong> 为空'
}) })
this.loggingIn = false
return return
} }
if (!this.captcha) { if (!this.captcha) {
@@ -128,6 +134,7 @@ export default {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>验证码</strong> 为空' message: '<strong>验证码</strong> 为空'
}) })
this.loggingIn = false
return return
} }
if (!verifyCaptcha(this.captcha)) { if (!verifyCaptcha(this.captcha)) {
@@ -135,6 +142,7 @@ export default {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>验证码</strong> 错误' message: '<strong>验证码</strong> 错误'
}) })
this.loggingIn = false
return return
} }
login(this.userName, this.password).then((res) => { login(this.userName, this.password).then((res) => {
@@ -153,8 +161,7 @@ export default {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>用户名</strong> 或 <strong>密码</strong> 错误' message: '<strong>用户名</strong> 或 <strong>密码</strong> 错误'
}) })
this.getNewCaptcha() this.resetLogin()
this.loggingIn = false
} }
}) })
} }