fix: 登录后重定向页面

This commit is contained in:
TsMask
2024-05-10 14:19:30 +08:00
parent f44cc44a1b
commit 4ca700092a

View File

@@ -14,10 +14,6 @@ const appStore = useAppStore();
const router = useRouter();
const route = useRoute();
/**登录后重定向页面 */
const redirectPath =
(route.query && (route.query.redirect as string)) || '/index';
let state = reactive({
/**表单属性 */
from: {
@@ -52,7 +48,9 @@ function fnFinish() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.login.loginSuccess'), 3);
router.push({ path: redirectPath });
/**登录后重定向页面 */
const redirectPath = route.query?.redirect || '/index';
router.push({ path: redirectPath as string });
} else {
message.error(`${res.msg}`, 3);
}