From 43786d6672dda47c6c3c196a7c350858b9fc8cff Mon Sep 17 00:00:00 2001
From: Huang <596417202@qq.com>
Date: Mon, 19 Sep 2022 15:13:07 +0800
Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/about/index.vue | 7 +++--
src/pages/log/index.vue | 2 +-
src/pages/login/index.vue | 11 ++++++--
src/pages/notFound/404.vue | 3 +-
src/types/router/route.d.ts | 6 +++-
src/utils/router/constant.ts | 16 +++++++++--
src/utils/router/index.ts | 9 ------
src/utils/router/navigates.ts | 52 +++++++++++++++++++++++++++++++++++
src/utils/router/routes.ts | 20 +++++++++++++-
9 files changed, 106 insertions(+), 20 deletions(-)
delete mode 100644 src/utils/router/index.ts
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 @@