From ac4491da438ef54e002f9a89dd6c6d73232c698d Mon Sep 17 00:00:00 2001 From: liwenqiang Date: Mon, 25 Dec 2023 08:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E7=94=B1=E5=92=8C?= =?UTF-8?q?=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/system/dictionaries.ts | 2 +- src/router/index.ts | 13 +++---------- src/router/routes.ts | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/mock/system/dictionaries.ts b/src/mock/system/dictionaries.ts index f3cfb59..85ff030 100644 --- a/src/mock/system/dictionaries.ts +++ b/src/mock/system/dictionaries.ts @@ -11,7 +11,7 @@ const pagation: Pagation = { } const datas: Array = []; -for (let i = 0; i < 30090; i++) { +for (let i = 0; i < 390; i++) { datas.push({ id: Random.increment(), dictionaryName: Random.cword(), diff --git a/src/router/index.ts b/src/router/index.ts index 044bd34..3de30c0 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,6 @@ -import { createRouter, createWebHistory, RouteLocationNormalized } from 'vue-router'; +import { createRouter, createWebHistory, RouteLocationNormalized, NavigationGuardNext } from 'vue-router'; import routes from './routes'; import ProgressBar from "@badrap/bar-of-progress"; -import { getCookie } from '~/composables/cookies'; const progress = new ProgressBar(); @@ -11,15 +10,9 @@ const router = createRouter({ }); /* 路由之前 */ -router.beforeEach(async (to: RouteLocationNormalized, _from: RouteLocationNormalized, next) => { +router.beforeEach(async (to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => { progress.start() - const username = getCookie("username") - const isAuthenticated = username && username.length > 0; - if (to.meta.requiresAuth && !isAuthenticated) { - window.location.href = '/api/auth/' - } else { - next() - } + next() }) router.afterEach(() => { diff --git a/src/router/routes.ts b/src/router/routes.ts index 41e58d5..6b4d830 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -113,12 +113,12 @@ const routes: Array = [ { path: '/signin', name: 'SignIn', - component: () => import('/src/views/sign/SignIn.vue'), + component: () => import('~/views/sign/SignIn.vue'), }, { path: '/signup', name: 'Signup', - component: () => import('/src/views/sign/SignUp.vue'), + component: () => import('~/views/sign/SignUp.vue'), }, { path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound } ];