系统路由位置修改

master
toesbieya 6 years ago
parent 378ca55758
commit 6207ef85c2
  1. 40
      vue/src/router/constant/index.js
  2. 31
      vue/src/router/constant/module/app.js

@ -2,8 +2,6 @@
* 不需要权限控制的路由表 * 不需要权限控制的路由表
* constant/module下的所有route都会加上noAuth:true * constant/module下的所有route都会加上noAuth:true
*/ */
import Layout from '@/layout'
import {lazyLoadView} from '@/router/util'
const modulesFiles = require.context('./module', false, /\.js$/) const modulesFiles = require.context('./module', false, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => { const modules = modulesFiles.keys().reduce((modules, modulePath) => {
@ -12,40 +10,6 @@ const modules = modulesFiles.keys().reduce((modules, modulePath) => {
return modules 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) { function addNoAuth(routes) {
routes.forEach(route => { routes.forEach(route => {
if (!route.meta) route.meta = {} if (!route.meta) route.meta = {}
@ -54,6 +18,6 @@ function addNoAuth(routes) {
}) })
} }
addNoAuth(routes) addNoAuth(modules)
export default routes export default modules

@ -1,21 +1,46 @@
/*路由表:系统页面*/ //路由表:系统页面
import Layout from '@/layout' import Layout from '@/layout'
import Redirect from '@/view/app/redirect' import Redirect from '@/view/app/redirect'
import Login from '@/view/app/login' import Login from '@/view/app/login'
import Page404 from '@/view/app/404' import Page404 from '@/view/app/404'
import Page403 from '@/view/app/403' import Page403 from '@/view/app/403'
import {lazyLoadView} from "@/router/util"
const router = [ const router = [
{ {
path: '/redirect', path: '/',
component: Layout, component: Layout,
redirect: '/index',
children: [ 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 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', path: '/login',
alias: '/register', alias: '/register',

Loading…
Cancel
Save