|
@@ -84,6 +84,7 @@ export default defineComponent({
|
|
|
if (!formRef.value) return
|
|
|
await formRef.value.validate((valid: any) => {
|
|
|
if (valid) {
|
|
|
+ state.loading.signIn = true
|
|
|
loginApi.login({ ...state.ruleForm, password: Md5.hashStr(state.ruleForm.password) }).then((res: any) => {
|
|
|
if (res.code === 2000) {
|
|
|
Session.set('token', res.data.access)
|
|
@@ -92,16 +93,19 @@ export default defineComponent({
|
|
|
// 前端控制路由,2、请注意执行顺序
|
|
|
initFrontEndControlRoutes()
|
|
|
loginSuccess()
|
|
|
+ state.loading.signIn = false
|
|
|
} else {
|
|
|
// 模拟后端控制路由,isRequestRoutes 为 true,则开启后端控制路由
|
|
|
// 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
|
|
|
initBackEndControlRoutes()
|
|
|
// 执行完 initBackEndControlRoutes,再执行 signInSuccess
|
|
|
loginSuccess()
|
|
|
+ state.loading.signIn = false
|
|
|
}
|
|
|
} else if (res.code === 4000) {
|
|
|
// 登录错误之后,刷新验证码
|
|
|
refreshCaptcha()
|
|
|
+ state.loading.signIn = false
|
|
|
}
|
|
|
})
|
|
|
} else {
|