管理后台的 uniapp 验证码,增加开关

This commit is contained in:
YunaiV
2022-09-04 17:44:26 +08:00
parent a484cd5193
commit 9715087b54
6 changed files with 23 additions and 16 deletions

View File

@ -39,7 +39,7 @@
},
data() {
return {
captchaEnabled: true,
captchaEnabled: true, // 验证码开关 TODO 芋艿:需要抽到配置里
globalConfig: getApp().globalData.config,
loginForm: {
username: "admin",
@ -66,14 +66,19 @@
} else if (this.loginForm.password === "") {
this.$modal.msgError("请输入您的密码")
} else {
this.$modal.loading("登录中,请耐心等待...")
// 显示验证码
this.$refs.verify.show()
// 显示验证码
if (this.captchaEnabled) {
this.$refs.verify.show()
} else { // 直接登录
await this.pwdLogin({})
}
}
},
// 密码登录
async pwdLogin(params) {
this.loginForm.captchaVerification = params.captchaVerification
async pwdLogin(captchaParams) {
this.$modal.loading("登录中,请耐心等待...")
// 执行登录
this.loginForm.captchaVerification = captchaParams.captchaVerification
this.$store.dispatch('Login', this.loginForm).then(() => {
this.$modal.closeLoading()
this.loginSuccess()