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 } ];