complte model

main
old易 2024-10-08 14:29:07 +08:00
parent c4d421c410
commit d4f7f15a89
1 changed files with 29 additions and 8 deletions

View File

@ -81,8 +81,8 @@ export default {
if (response.data.code === 200 && response.data.result?.img) {
state.captchaImage = 'data:image/png;base64,' + response.data.result.img;
state.codeId = response.data.result.id;
console.log('Response data:', response.data);
console.log(state.captchaImage);
// console.log('Response data:', response.data);
// console.log(state.captchaImage);
} else {
console.error('Invalid response data:', response.data);
}
@ -181,7 +181,7 @@ export default {
startCountdown(); //
} else {
console.log('验证码发送失败:', response.data);
phoneError.value = response.data.message;
phoneError.value = response.data.message.replace(/^\[\w+\]\s*/, '');
}
})
.catch(error => {
@ -232,6 +232,18 @@ export default {
return true;
});
const isPwdCode=computed(()=>{
if (!captchaCode.value) {
captchaError.value = '请输入验证码';
return false;
} else if (captchaCode.value.includes(' ')) {
captchaError.value = '验证码不能包含空格';
return false;
}
captchaError.value = ''; //
return true;
});
//
onMounted(() => {
getReferer(); //
@ -272,7 +284,7 @@ export default {
// startCountdown(); //
} else {
console.log('登录失败:', response.data);
phoneError.value = response.data.message;
phoneError.value = response.data.message.replace(/^\[\w+\]\s*/, '');
}
})
.catch(error => {
@ -284,6 +296,7 @@ export default {
//
const login = () => {
console.log(captchaCode);
if (!isUsernameValid.value) {
alert('请检查手机号');
return;
@ -292,8 +305,12 @@ export default {
alert('请检查密码');
return;
}
if(!isPwdCode.value){
alert('请检查验证码');
return;
}
axios.post('https://api.sso.ycymedu.com/api/syswechat/pwdlogin', {
phoneNumber: phone.value,
phoneNumber: username.value,
password: password.value,
redirect_uri: referer.value,
code: captchaCode.value,
@ -306,7 +323,7 @@ export default {
// startCountdown(); //
} else {
console.log('登录失败:', response.data);
captchaError.value = response.data.message;
captchaError.value = response.data.message.replace(/^\[\w+\]\s*/, '');
}
})
.catch(error => {
@ -337,6 +354,8 @@ export default {
isPasswordValid,
login,
refreshCaptcha,
captchaCode,
captchaError,
state
};
},
@ -473,8 +492,8 @@ button:disabled {
margin-top: -10px;
margin-bottom: 10px;
}
}
.captcha-row {
.captcha-row {
display: flex;
align-items: center;
margin-bottom: 10px;
@ -492,4 +511,6 @@ button:disabled {
border-radius: 4px;
border: 1px solid #ccc;
}
}
</style>