fe-drone-ci/src/router/index.js

370 lines
8.7 KiB
JavaScript
Raw Normal View History

2017-08-22 07:43:34 +00:00
import Vue from 'vue'
import Router from 'vue-router'
2017-04-18 07:09:13 +00:00
2017-08-22 07:43:34 +00:00
Vue.use(Router)
2017-04-18 07:09:13 +00:00
2017-11-17 06:57:39 +00:00
/* Layout */
import Layout from '@/views/layout/Layout'
2017-05-17 08:26:33 +00:00
2018-08-15 09:29:15 +00:00
/* Router Modules */
import componentsRouter from './modules/components'
import chartsRouter from './modules/charts'
import tableRouter from './modules/table'
import nestedRouter from './modules/nested'
2018-09-03 07:03:00 +00:00
/** note: Submenu only appear when children.length>=1
2018-08-15 09:29:15 +00:00
* detail see https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
**/
2017-07-28 07:12:32 +00:00
/**
2017-11-17 06:57:39 +00:00
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
2018-01-24 06:47:20 +00:00
* alwaysShow: true if set true, will always show the root menu, whatever its child routes length
* if not set alwaysShow, only more than one route under the children
* it will becomes nested mode, otherwise not show the root menu
2018-09-03 07:03:00 +00:00
* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
2017-11-17 06:57:39 +00:00
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
roles: ['admin','editor'] will control the page roles (you can set multiple roles)
2017-11-17 06:57:39 +00:00
title: 'title' the name show in submenu and breadcrumb (recommend set)
icon: 'svg-name' the icon show in the sidebar
noCache: true if true, the page will no be cached(default is false)
breadcrumb: false if false, the item will hidden in breadcrumb(default is true)
}
2017-07-28 07:12:32 +00:00
**/
2017-05-17 08:26:33 +00:00
export const constantRouterMap = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path*',
component: () => import('@/views/redirect/index')
}
]
},
2018-08-15 09:29:15 +00:00
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
2018-09-03 07:03:00 +00:00
path: '/auth-redirect',
2018-08-15 09:29:15 +00:00
component: () => import('@/views/login/authredirect'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/errorPage/404'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/errorPage/401'),
hidden: true
},
2017-05-17 08:26:33 +00:00
{
2017-11-02 09:58:35 +00:00
path: '',
2017-05-17 08:26:33 +00:00
component: Layout,
2017-11-02 09:58:35 +00:00
redirect: 'dashboard',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
2018-08-15 09:29:15 +00:00
meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
}
]
2017-05-17 08:26:33 +00:00
},
{
2017-11-17 06:57:39 +00:00
path: '/documentation',
2017-05-17 08:26:33 +00:00
component: Layout,
2017-11-17 06:57:39 +00:00
redirect: '/documentation/index',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'index',
component: () => import('@/views/documentation/index'),
name: 'Documentation',
2018-08-15 09:29:15 +00:00
meta: { title: 'documentation', icon: 'documentation', noCache: true }
}
]
},
{
path: '/guide',
component: Layout,
redirect: '/guide/index',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'index',
component: () => import('@/views/guide/index'),
name: 'Guide',
2018-08-15 09:29:15 +00:00
meta: { title: 'guide', icon: 'guide', noCache: true }
}
]
2017-05-17 08:26:33 +00:00
}
]
export default new Router({
2018-01-05 03:38:34 +00:00
// mode: 'history', // require service support
2017-05-17 08:26:33 +00:00
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
2017-08-22 07:43:34 +00:00
})
2017-05-17 08:26:33 +00:00
export const asyncRouterMap = [
{
path: '/permission',
component: Layout,
redirect: '/permission/index',
alwaysShow: true, // will always show the root menu
meta: {
title: 'permission',
icon: 'lock',
roles: ['admin', 'editor'] // you can set roles in root nav
},
2017-05-17 08:26:33 +00:00
children: [
2018-08-15 09:29:15 +00:00
{
path: 'page',
component: () => import('@/views/permission/page'),
name: 'PagePermission',
2018-08-15 09:29:15 +00:00
meta: {
title: 'pagePermission',
roles: ['admin'] // or you can only set roles in sub nav
}
},
{
path: 'directive',
component: () => import('@/views/permission/directive'),
name: 'DirectivePermission',
2018-08-15 09:29:15 +00:00
meta: {
title: 'directivePermission'
// if do not set roles, means: this page does not require permission
}
}
2017-05-17 08:26:33 +00:00
]
},
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
{
2018-08-15 09:29:15 +00:00
path: '/icon',
2017-05-17 08:26:33 +00:00
component: Layout,
children: [
2018-08-15 09:29:15 +00:00
{
path: 'index',
component: () => import('@/views/svg-icons/index'),
name: 'Icons',
2018-08-15 09:29:15 +00:00
meta: { title: 'icons', icon: 'icon', noCache: true }
}
2017-07-28 07:12:32 +00:00
]
},
2017-10-26 10:27:39 +00:00
2018-08-15 09:29:15 +00:00
/** When your routing table is too long, you can split it into small modules**/
componentsRouter,
chartsRouter,
nestedRouter,
tableRouter,
{
path: '/example',
component: Layout,
redirect: '/example/list',
name: 'Example',
meta: {
title: 'example',
icon: 'example'
},
children: [
2018-08-15 09:29:15 +00:00
{
path: 'create',
component: () => import('@/views/example/create'),
name: 'CreateArticle',
2018-08-15 09:29:15 +00:00
meta: { title: 'createArticle', icon: 'edit' }
},
{
path: 'edit/:id(\\d+)',
component: () => import('@/views/example/edit'),
name: 'EditArticle',
2018-08-15 09:29:15 +00:00
meta: { title: 'editArticle', noCache: true },
hidden: true
},
{
path: 'list',
component: () => import('@/views/example/list'),
name: 'ArticleList',
2018-08-15 09:29:15 +00:00
meta: { title: 'articleList', icon: 'list' }
}
2017-05-17 08:26:33 +00:00
]
},
2017-10-26 10:27:39 +00:00
{
2018-08-15 09:29:15 +00:00
path: '/tab',
component: Layout,
children: [
{
2018-08-15 09:29:15 +00:00
path: 'index',
component: () => import('@/views/tab/index'),
name: 'Tab',
2018-08-15 09:29:15 +00:00
meta: { title: 'tab', icon: 'tab' }
}
]
},
2017-05-17 08:26:33 +00:00
{
2017-08-22 10:47:23 +00:00
path: '/error',
2017-05-17 08:26:33 +00:00
component: Layout,
redirect: 'noredirect',
name: 'ErrorPages',
2017-10-26 10:27:39 +00:00
meta: {
2017-11-03 10:37:49 +00:00
title: 'errorPages',
2017-10-26 10:27:39 +00:00
icon: '404'
},
2017-05-17 08:26:33 +00:00
children: [
2018-08-15 09:29:15 +00:00
{
path: '401',
component: () => import('@/views/errorPage/401'),
name: 'Page401',
2018-08-15 09:29:15 +00:00
meta: { title: 'page401', noCache: true }
},
{
path: '404',
component: () => import('@/views/errorPage/404'),
name: 'Page404',
2018-08-15 09:29:15 +00:00
meta: { title: 'page404', noCache: true }
}
2017-05-17 08:26:33 +00:00
]
},
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
{
2017-10-26 10:27:39 +00:00
path: '/error-log',
2017-05-17 08:26:33 +00:00
component: Layout,
redirect: 'noredirect',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'log',
component: () => import('@/views/errorLog/index'),
name: 'ErrorLog',
2018-08-15 09:29:15 +00:00
meta: { title: 'errorLog', icon: 'bug' }
}
]
2017-05-17 08:26:33 +00:00
},
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
{
path: '/excel',
component: Layout,
2017-11-24 07:35:38 +00:00
redirect: '/excel/export-excel',
name: 'Excel',
2017-10-26 10:27:39 +00:00
meta: {
title: 'excel',
icon: 'excel'
},
2017-07-25 08:51:43 +00:00
children: [
2018-08-15 09:29:15 +00:00
{
path: 'export-excel',
component: () => import('@/views/excel/exportExcel'),
name: 'ExportExcel',
2018-08-15 09:29:15 +00:00
meta: { title: 'exportExcel' }
},
{
path: 'export-selected-excel',
component: () => import('@/views/excel/selectExcel'),
2018-08-31 06:45:29 +00:00
name: 'SelectExcel',
2018-08-15 09:29:15 +00:00
meta: { title: 'selectExcel' }
},
{
path: 'upload-excel',
component: () => import('@/views/excel/uploadExcel'),
name: 'UploadExcel',
2018-08-15 09:29:15 +00:00
meta: { title: 'uploadExcel' }
}
2017-07-25 08:51:43 +00:00
]
2017-05-17 08:26:33 +00:00
},
2017-10-26 10:27:39 +00:00
2017-09-26 05:40:07 +00:00
{
path: '/zip',
component: Layout,
redirect: '/zip/download',
2018-01-24 06:47:20 +00:00
alwaysShow: true,
meta: { title: 'zip', icon: 'zip' },
2018-08-15 09:29:15 +00:00
children: [
{
path: 'download',
component: () => import('@/views/zip/index'),
name: 'ExportZip',
2018-08-15 09:29:15 +00:00
meta: { title: 'exportZip' }
}
]
2017-09-26 05:40:07 +00:00
},
2017-10-26 10:27:39 +00:00
2018-12-27 05:42:10 +00:00
{
path: '/pdf',
component: Layout,
redirect: '/pdf/index',
meta: { title: 'PDF', icon: 'pdf' },
children: [
{
path: 'index',
component: () => import('@/views/pdf/index'),
name: 'PDF',
meta: { title: 'PDF' }
}
]
},
{
path: '/pdf/download',
component: () => import('@/views/pdf/download'),
hidden: true
},
2017-05-17 08:26:33 +00:00
{
path: '/theme',
component: Layout,
redirect: 'noredirect',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'index',
component: () => import('@/views/theme/index'),
name: 'Theme',
2018-08-15 09:29:15 +00:00
meta: { title: 'theme', icon: 'theme' }
}
]
2017-05-17 08:26:33 +00:00
},
2017-10-26 10:27:39 +00:00
2017-09-27 02:03:42 +00:00
{
path: '/clipboard',
component: Layout,
redirect: 'noredirect',
2018-08-15 09:29:15 +00:00
children: [
{
path: 'index',
component: () => import('@/views/clipboard/index'),
name: 'ClipboardDemo',
2018-08-15 09:29:15 +00:00
meta: { title: 'clipboardDemo', icon: 'clipboard' }
}
]
2017-11-03 10:37:49 +00:00
},
{
path: '/i18n',
component: Layout,
2018-08-15 09:29:15 +00:00
children: [
{
path: 'index',
component: () => import('@/views/i18n-demo/index'),
name: 'I18n',
2018-08-15 09:29:15 +00:00
meta: { title: 'i18n', icon: 'international' }
}
]
2017-09-27 02:03:42 +00:00
},
2017-06-15 06:33:02 +00:00
{
path: 'external-link',
component: Layout,
children: [
{
path: 'https://github.com/PanJiaChen/vue-element-admin',
meta: { title: 'externalLink', icon: 'link' }
}
]
},
2017-05-17 08:26:33 +00:00
{ path: '*', redirect: '/404', hidden: true }
2017-08-22 07:43:34 +00:00
]