feat: ✨ 登录页面,自动刷新验证码
This commit is contained in:
@@ -121,9 +121,10 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const loginClick = async () => {
|
const loginClick = async () => {
|
||||||
loginApi.login({ ...state.ruleForm, password: Md5.hashStr(state.ruleForm.password) }).then((ret: any) => {
|
loginApi.login({ ...state.ruleForm, password: Md5.hashStr(state.ruleForm.password) }).then((res: any) => {
|
||||||
Session.set('token', ret.data.access);
|
if (res.code === 2000) {
|
||||||
Cookies.set('username', ret.data.name);
|
Session.set('token', res.data.access);
|
||||||
|
Cookies.set('username', res.data.name);
|
||||||
if (!themeConfig.value.isRequestRoutes) {
|
if (!themeConfig.value.isRequestRoutes) {
|
||||||
// 前端控制路由,2、请注意执行顺序
|
// 前端控制路由,2、请注意执行顺序
|
||||||
initFrontEndControlRoutes();
|
initFrontEndControlRoutes();
|
||||||
@@ -135,6 +136,10 @@ export default defineComponent({
|
|||||||
// 执行完 initBackEndControlRoutes,再执行 signInSuccess
|
// 执行完 initBackEndControlRoutes,再执行 signInSuccess
|
||||||
loginSuccess();
|
loginSuccess();
|
||||||
}
|
}
|
||||||
|
} else if (res.code === 4000) {
|
||||||
|
// 登录错误之后,刷新验证码
|
||||||
|
refreshCaptcha();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const getUserInfo = () => {
|
const getUserInfo = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user