Skip to content

Commit 0cb368d

Browse files
author
piexl
committed
修复登录页验证码校验的bug
1 parent 296fd65 commit 0cb368d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

web/src/view/login/index.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,13 @@ const checkPassword = (rule, value, callback) => {
141141
142142
// 获取验证码
143143
const loginVerify = () => {
144-
captcha({}).then((ele) => {
145-
rules.captcha[1].max = ele.data.captchaLength
146-
rules.captcha[1].min = ele.data.captchaLength
144+
captcha({}).then(async(ele) => {
145+
rules.captcha.push({
146+
max: ele.data.captchaLength,
147+
min: ele.data.captchaLength,
148+
message: `请输入${ele.data.captchaLength}位验证码`,
149+
trigger: 'blur',
150+
})
147151
picPath.value = ele.data.picPath
148152
loginFormData.captchaId = ele.data.captchaId
149153
})
@@ -168,7 +172,6 @@ const rules = reactive({
168172
username: [{ validator: checkUsername, trigger: 'blur' }],
169173
password: [{ validator: checkPassword, trigger: 'blur' }],
170174
captcha: [
171-
{ required: true, message: '请输入验证码', trigger: 'blur' },
172175
{
173176
message: '验证码格式不正确',
174177
trigger: 'blur',

0 commit comments

Comments
 (0)