diff --git a/src/views/login/components/Login.vue b/src/views/login/components/Login.vue index 4c019b6..2e4d5a9 100644 --- a/src/views/login/components/Login.vue +++ b/src/views/login/components/Login.vue @@ -175,11 +175,14 @@ function handleSubmit(e) { localStorage.removeItem("LOGIN_FORM_PASS"); } loginSuccess.value = true; - const userInfo = await userStore.getInformation(); + const { data: userInfo } = await userStore.getInformation(); message.destroyAll(); const toPath = decodeURIComponent((route.query?.redirect || "/") as string); message.success("登录成功,即将进入系统"); - if (route.name === LOGIN_NAME) router.replace(userInfo.frontmenuTList[0]['resUrl']); + if (route.name === LOGIN_NAME) + router.replace( + userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" + ); else router.replace(toPath); } else { loginSuccess.value = false; @@ -243,11 +246,14 @@ function handleSmsSubmit(e) { loginSuccess.value = true; // const { code, message: msg } = await userStore.login(params) await userStore.setStorageToken(res.data); - const userInfo = await userStore.getInformation(); + const { data: userInfo } = await userStore.getInformation(); message.destroyAll(); const toPath = decodeURIComponent((route.query?.redirect || "/") as string); message.success("登录成功,即将进入系统"); - if (route.name === LOGIN_NAME) router.replace(userInfo.frontmenuTList[0]['resUrl']); + if (route.name === LOGIN_NAME) + router.replace( + userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" + ); else router.replace(toPath); } else { message.destroyAll();