From 6207ef85c2e03225bbdfc78ce29c136595d6de8b Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@qq.com> Date: Fri, 7 Aug 2020 20:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=B7=AF=E7=94=B1=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/src/router/constant/index.js | 40 ++------------------------- vue/src/router/constant/module/app.js | 31 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/vue/src/router/constant/index.js b/vue/src/router/constant/index.js index fe1605b..f34b062 100644 --- a/vue/src/router/constant/index.js +++ b/vue/src/router/constant/index.js @@ -2,8 +2,6 @@ * 不需要权限控制的路由表 * constant/module下的所有route都会加上noAuth:true */ -import Layout from '@/layout' -import {lazyLoadView} from '@/router/util' const modulesFiles = require.context('./module', false, /\.js$/) const modules = modulesFiles.keys().reduce((modules, modulePath) => { @@ -12,40 +10,6 @@ const modules = modulesFiles.keys().reduce((modules, modulePath) => { return modules }, []) -const routes = [ - ...modules, - { - path: '/', - component: Layout, - redirect: '/index', - children: [ - { - path: 'index', - component: lazyLoadView(import('@/view/index')), - name: 'index', - meta: {title: '首页', affix: true, icon: 'home', sort: 0} - } - ] - }, - { - path: 'https://doc.toesbieya.cn', - meta: {title: '文档', icon: 'documentation', sort: 1} - }, - { - path: '/user', - component: Layout, - redirect: '/user/index', - children: [ - { - path: 'index', - name: 'userCenter', - component: lazyLoadView(import('@/view/userCenter')), - meta: {title: '个人中心', noCache: true, icon: 'user', hidden: true}, - } - ] - } -] - function addNoAuth(routes) { routes.forEach(route => { if (!route.meta) route.meta = {} @@ -54,6 +18,6 @@ function addNoAuth(routes) { }) } -addNoAuth(routes) +addNoAuth(modules) -export default routes +export default modules diff --git a/vue/src/router/constant/module/app.js b/vue/src/router/constant/module/app.js index 092168e..6c9f1ab 100644 --- a/vue/src/router/constant/module/app.js +++ b/vue/src/router/constant/module/app.js @@ -1,21 +1,46 @@ -/*路由表:系统页面*/ +//路由表:系统页面 import Layout from '@/layout' import Redirect from '@/view/app/redirect' import Login from '@/view/app/login' import Page404 from '@/view/app/404' import Page403 from '@/view/app/403' +import {lazyLoadView} from "@/router/util" const router = [ { - path: '/redirect', + path: '/', component: Layout, + redirect: '/index', children: [ { - path: ':path(.*)', + path: 'index', + component: lazyLoadView(import('@/view/index')), + name: 'index', + meta: {title: '首页', affix: true, icon: 'home', sort: 0} + }, + { + path: 'redirect/:path(.*)', component: Redirect } ] }, + { + path: 'https://doc.toesbieya.cn', + meta: {title: '文档', icon: 'documentation', sort: 1} + }, + { + path: '/user', + component: Layout, + redirect: '/user/index', + children: [ + { + path: 'index', + name: 'userCenter', + component: lazyLoadView(import('@/view/userCenter')), + meta: {title: '个人中心', noCache: true, icon: 'user', hidden: true}, + } + ] + }, { path: '/login', alias: '/register',