diff --git a/src/pages/about/index.vue b/src/pages/about/index.vue index cc49dfe..db246e3 100644 --- a/src/pages/about/index.vue +++ b/src/pages/about/index.vue @@ -1,12 +1,13 @@ diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 113faed..d37be2d 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -3,12 +3,15 @@ import { useAuthStore } from '@/state/modules/auth'; import { onLoad } from '@dcloudio/uni-app'; import { Toast } from '@/utils/uniapi/prompt'; - import { router } from '@/utils/router'; + import { useRouter } from '@/hooks/router'; const redirect = ref(undefined); onLoad((query) => { - redirect.value = query.redirect || undefined; + redirect.value = query.redirect ? decodeURIComponent(query.redirect) : undefined; + console.log('login redirect', redirect.value); }); + const router = useRouter(); + const form = reactive({ email: 'uni-app@test.com', password: 'Vue3_Ts_Vite', @@ -18,6 +21,10 @@ authStore.login(e.detail.value).then(() => { Toast('登录成功', { duration: 1500 }); setTimeout(() => { + if (redirect.value) { + router.go(redirect.value, { replace: true }); + return; + } router.pushTab('/pages/about/index'); }, 1500); }); diff --git a/src/pages/notFound/404.vue b/src/pages/notFound/404.vue index f5bf345..341e4e1 100644 --- a/src/pages/notFound/404.vue +++ b/src/pages/notFound/404.vue @@ -1,10 +1,11 @@