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

237 lines
8.1 KiB
JavaScript
Raw Normal View History

2017-08-22 07:43:34 +00:00
import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
2017-08-28 14:59:09 +00:00
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
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-07-28 07:12:32 +00:00
/* layout */
2017-08-22 07:43:34 +00:00
import Layout from '../views/layout/Layout'
2017-05-17 08:26:33 +00:00
2017-07-28 07:12:32 +00:00
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
* redirect: noredirect if `redirect:noredirect` will no redirct in the levelbar
* meta : {
role: ['admin'] will control the page role
title: 'title' the name show in submenu and levelbar
icon: 'svg-name' the icon show in the sidebar,
noCache: true if fasle ,the page will no be cached(default is false)
}
2017-07-28 07:12:32 +00:00
**/
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
export const constantRouterMap = [
2017-10-26 10:27:39 +00:00
{ path: '/login', component: _import('login/index'), hidden: true },
{ path: '/authredirect', component: _import('login/authredirect'), hidden: true },
{ path: '/404', component: _import('errorPage/404'), hidden: true },
{ path: '/401', component: _import('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',
2017-10-26 10:27:39 +00:00
children: [{
path: 'dashboard',
component: _import('dashboard/index'),
name: 'dashboard',
2017-11-02 09:58:35 +00:00
meta: { title: '首页', icon: 'dashboard' }
2017-10-26 10:27:39 +00:00
}]
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: '/introduction',
component: Layout,
redirect: '/introduction/index',
2017-10-26 10:27:39 +00:00
children: [{
path: 'index',
component: _import('introduction/index'),
name: 'introduction',
meta: { title: '简述', icon: 'people' }
}]
2017-05-17 08:26:33 +00:00
}
]
export default new Router({
// mode: 'history', //后端支持可开
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',
meta: { role: ['admin'] },
2017-10-26 10:27:39 +00:00
children: [{
path: 'index',
component: _import('permission/index'),
name: 'permission',
meta: {
title: '权限测试页',
icon: 'lock',
role: ['admin']
}
}]
2017-05-17 08:26:33 +00:00
},
2017-10-26 10:27:39 +00:00
2017-08-29 09:53:41 +00:00
{
path: '/icon',
component: Layout,
2017-10-26 10:27:39 +00:00
children: [{
path: 'index',
component: _import('svg-icons/index'),
name: 'icons',
meta: { title: '图标', icon: 'icon' }
}]
2017-08-29 09:53:41 +00:00
},
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
{
path: '/components',
component: Layout,
redirect: '/components/index',
2017-10-26 10:27:39 +00:00
name: 'components',
meta: {
title: '组件',
icon: 'component'
},
2017-05-17 08:26:33 +00:00
children: [
2017-10-26 10:27:39 +00:00
{ path: 'index', component: _import('components/index'), name: 'componentIndex', meta: { title: '介绍' }},
{ path: 'tinymce', component: _import('components/tinymce'), name: 'tinymce', meta: { title: '富文本编辑器' }},
{ path: 'markdown', component: _import('components/markdown'), name: 'markdown', meta: { title: 'Markdown' }},
{ path: 'json-editor', component: _import('components/jsonEditor'), name: 'jsonEditor', meta: { title: 'JSON编辑器' }},
{ path: 'dnd-list', component: _import('components/dndList'), name: 'dndList', meta: { title: '列表拖拽' }},
{ path: 'splitpane', component: _import('components/splitpane'), name: 'splitpane', meta: { title: 'SplitPane' }},
{ path: 'avatar-upload', component: _import('components/avatarUpload'), name: 'avatar-upload', meta: { title: '头像上传' }},
{ path: 'dropzone', component: _import('components/dropzone'), name: 'dropzone', meta: { title: 'Dropzone' }},
{ path: 'sticky', component: _import('components/sticky'), name: 'sticky', meta: { title: 'Sticky' }},
{ path: 'count-to', component: _import('components/countTo'), name: 'count-to', meta: { title: 'CountTo' }},
{ path: 'mixin', component: _import('components/mixin'), name: 'componentMixin', meta: { title: '小组件' }},
{ path: 'back-to-top', component: _import('components/backToTop'), name: 'backToTop', meta: { title: '返回顶部' }}
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: '/charts',
component: Layout,
redirect: '/charts/index',
2017-10-26 10:27:39 +00:00
name: 'charts',
meta: {
title: '图表',
icon: 'chart'
},
2017-05-17 08:26:33 +00:00
children: [
2017-10-26 10:27:39 +00:00
{ path: 'index', component: _import('charts/index'), name: 'chartsIndex', meta: { title: '介绍' }},
{ path: 'keyboard', component: _import('charts/keyboard'), name: 'keyboardChart', meta: { title: '键盘图表' }},
{ path: 'keyboard2', component: _import('charts/keyboard2'), name: 'keyboardChart2', meta: { title: '键盘图表2' }},
{ path: 'line', component: _import('charts/line'), name: 'lineChart', meta: { title: '折线图' }},
2017-10-26 10:27:39 +00:00
{ path: 'mixchart', component: _import('charts/mixChart'), name: 'mixChart', meta: { title: '混合图表' }}
2017-07-28 07:12:32 +00:00
]
},
2017-10-26 10:27:39 +00:00
2017-07-28 07:12:32 +00:00
{
path: '/example',
component: Layout,
redirect: 'noredirect',
2017-10-26 10:27:39 +00:00
name: 'example',
meta: {
title: '综合实例',
icon: 'example'
},
2017-07-28 07:12:32 +00:00
children: [
{
path: '/example/table',
component: _import('example/table/index'),
redirect: '/example/table/table',
name: 'Table',
2017-10-26 10:27:39 +00:00
meta: {
title: 'Table',
icon: 'table'
},
2017-07-28 07:12:32 +00:00
children: [
2017-10-26 10:27:39 +00:00
{ path: 'dynamic-table', component: _import('example/table/dynamicTable/index'), name: 'dynamicTable', meta: { title: '动态table' }},
{ path: 'drag-table', component: _import('example/table/dragTable'), name: 'dragTable', meta: { title: '拖拽table' }},
{ path: 'inline-edit-table', component: _import('example/table/inlineEditTable'), name: 'inlineEditTable', meta: { title: 'table内编辑' }},
{ path: 'complex-table', component: _import('example/table/complexTable'), name: 'complexTable', meta: { title: '综合table' }}
2017-07-28 07:12:32 +00:00
]
},
{ path: 'tab/index', icon: 'tab', component: _import('example/tab/index'), name: 'tab', meta: { title: 'Tab' }}
]
},
{
path: '/form',
component: Layout,
redirect: 'noredirect',
name: 'form',
meta: {
title: '表单',
icon: 'form'
},
children: [
{ path: 'create-form', component: _import('form/create'), name: 'createForm', meta: { title: '创建表单', icon: 'table' }},
{ path: 'edit-form', component: _import('form/edit'), name: 'editForm', meta: { title: '编辑表单', icon: 'table' }}
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-08-22 10:47:23 +00:00
path: '/error',
2017-05-17 08:26:33 +00:00
component: Layout,
redirect: 'noredirect',
2017-10-26 10:27:39 +00:00
name: 'errorPages',
meta: {
title: '错误页面',
icon: '404'
},
2017-05-17 08:26:33 +00:00
children: [
{ path: '401', component: _import('errorPage/401'), name: 'page401', meta: { title: '401', noCache: true }},
{ path: '404', component: _import('errorPage/404'), name: 'page404', meta: { title: '404', 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',
children: [{ path: 'log', component: _import('errorLog/index'), name: 'errorLog', meta: { title: '错误日志', 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-08-22 10:47:23 +00:00
redirect: '/excel/download',
2017-05-17 08:26:33 +00:00
name: 'excel',
2017-10-26 10:27:39 +00:00
meta: {
title: 'excel',
icon: 'excel'
},
2017-07-25 08:51:43 +00:00
children: [
{ path: 'export-excel', component: _import('excel/exportExcel'), name: 'exportExcel', meta: { title: 'export excel', noCache: true }},
{ path: 'export-selected-excel', component: _import('excel/selectExcel'), name: 'selectExcel', meta: { title: 'export selected', noCache: true }},
{ path: 'upload-excel', component: _import('excel/uploadExcel'), name: 'uploadExcel', meta: { title: 'upload excel', noCache: true }}
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',
2017-10-26 10:27:39 +00:00
children: [{ path: 'download', component: _import('zip/index'), name: 'exportZip', meta: { title: 'zip', icon: 'zip' }}]
2017-09-26 05:40:07 +00:00
},
2017-10-26 10:27:39 +00:00
2017-05-17 08:26:33 +00:00
{
path: '/theme',
component: Layout,
redirect: 'noredirect',
2017-10-26 10:27:39 +00:00
children: [{ path: 'index', component: _import('theme/index'), name: 'theme', meta: { title: '换肤', 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',
children: [{ path: 'index', component: _import('clipboard/index'), name: 'clipboardDemo', meta: { title: 'clipboard', icon: 'clipboard' }}]
2017-09-27 02:03:42 +00:00
},
2017-06-15 06:33:02 +00:00
2017-05-17 08:26:33 +00:00
{ path: '*', redirect: '/404', hidden: true }
2017-08-22 07:43:34 +00:00
]