From df9fd2ae6552f12203a8ea3d6ef652d86354f45b Mon Sep 17 00:00:00 2001 From: Hooray <304327508@qq.com> Date: Sun, 5 Mar 2023 18:05:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AF=BC=E8=88=AA=E8=8F=9C=E5=8D=95=E5=92=8C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=9D=83=E9=99=90=EF=BC=8C=E6=97=A0=E9=9C=80=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=A1=B5=E9=9D=A2=E6=88=96=E8=80=85=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构了路由注册的逻辑,无权限的路由也会被注册,在访问页面时候进行权限控制 --- src/App.vue | 5 + .../NotAllowed/index.vue} | 13 +- src/router/index.ts | 5 - src/store/modules/route.ts | 150 ++++++------------ src/types/components.d.ts | 1 + src/utils/composables/useAuth.ts | 11 +- 6 files changed, 64 insertions(+), 121 deletions(-) rename src/{views/403.vue => components/NotAllowed/index.vue} (82%) diff --git a/src/App.vue b/src/App.vue index c568fdf6..b7a88e4f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,10 @@ import hotkeys from 'hotkeys-js' import eventBus from './utils/eventBus' import useSettingsStore from '@/store/modules/settings' +const route = useRoute() + const settingsStore = useSettingsStore() +const { auth } = useAuth() const buttonConfig = ref({ autoInsertSpace: true, @@ -62,11 +65,13 @@ import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole() diff --git a/src/views/403.vue b/src/components/NotAllowed/index.vue similarity index 82% rename from src/views/403.vue rename to src/components/NotAllowed/index.vue index 1652375c..ed0b521a 100644 --- a/src/views/403.vue +++ b/src/components/NotAllowed/index.vue @@ -1,8 +1,3 @@ - -meta: - enabled: false - -