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

219 lines
6.9 KiB
JavaScript
Raw Normal View History

2017-04-18 07:09:13 +00:00
import Vue from 'vue';
import Router from 'vue-router';
2017-06-21 08:58:03 +00:00
const _import = require('./_import_' + process.env.NODE_ENV);
2017-07-03 05:33:26 +00:00
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow.so only in production use Lazy Loading
2017-04-18 07:09:13 +00:00
/* layout */
2017-04-18 07:09:13 +00:00
import Layout from '../views/layout/Layout';
/* login */
2017-06-21 08:58:03 +00:00
const Login = _import('login/index');
const authRedirect = _import('login/authredirect');
/* dashboard */
2017-06-21 08:58:03 +00:00
const dashboard = _import('dashboard/index');
/* Introduction */
2017-06-21 08:58:03 +00:00
const Introduction = _import('introduction/index');
/* components */
2017-06-21 08:58:03 +00:00
const componentsIndex = _import('components/index');
const Tinymce = _import('components/tinymce');
const Markdown = _import('components/markdown');
const JsonEditor = _import('components/jsoneditor');
const DndList = _import('components/dndlist');
const AvatarUpload = _import('components/avatarUpload');
const Dropzone = _import('components/dropzone');
const Sticky = _import('components/sticky');
const SplitPane = _import('components/splitpane');
const CountTo = _import('components/countTo');
const Mixin = _import('components/mixin');
2017-07-17 07:33:21 +00:00
const BackToTop = _import('components/backToTop')
/* charts */
2017-06-21 08:58:03 +00:00
const chartIndex = _import('charts/index');
const KeyboardChart = _import('charts/keyboard');
const KeyboardChart2 = _import('charts/keyboard2');
const LineMarker = _import('charts/line');
2017-07-12 05:20:14 +00:00
const MixChart = _import('charts/mixChart');
/* error page */
2017-06-21 08:58:03 +00:00
const Err404 = _import('error/404');
const Err401 = _import('error/401');
/* error log */
2017-06-21 08:58:03 +00:00
const ErrorLog = _import('errlog/index');
/* excel */
2017-06-21 08:58:03 +00:00
const ExcelDownload = _import('excel/index');
2017-07-25 09:37:15 +00:00
const SelectExcelDownload = _import('excel/selectExcel');
/* theme */
2017-06-21 08:58:03 +00:00
const Theme = _import('theme/index');
2017-04-18 07:09:13 +00:00
2017-07-25 09:37:15 +00:00
/* example */
2017-06-21 08:58:03 +00:00
const TableLayout = _import('example/table/index');
const DynamicTable = _import('example/table/dynamictable');
const Table = _import('example/table/table');
const DragTable = _import('example/table/dragTable');
const InlineEditTable = _import('example/table/inlineEditTable');
2017-06-12 08:05:40 +00:00
2017-06-21 08:58:03 +00:00
const Form = _import('example/form');
const Tab = _import('example/tab/index');
2017-04-20 08:06:11 +00:00
2017-04-24 07:13:17 +00:00
/* permission */
2017-06-21 08:58:03 +00:00
const Permission = _import('permission/index');
2017-04-20 12:31:40 +00:00
2017-04-18 07:09:13 +00:00
Vue.use(Router);
2017-05-12 03:54:53 +00:00
/**
2017-05-16 03:08:17 +00:00
* icon : the icon show in the sidebar
* hidden : if hidden:true will not show in the sidebar
* redirect : if redirect:noredirect will not redirct in the levelbar
2017-05-12 03:54:53 +00:00
* noDropdown : if noDropdown:true will not has submenu
2017-05-16 03:08:17 +00:00
* meta : { role: ['admin'] } will control the page role
**/
2017-05-17 08:26:33 +00:00
export const constantRouterMap = [
2017-05-12 03:54:53 +00:00
{ path: '/login', component: Login, hidden: true },
{ path: '/authredirect', component: authRedirect, hidden: true },
{ path: '/404', component: Err404, hidden: true },
{ path: '/401', component: Err401, hidden: true },
2017-05-17 08:26:33 +00:00
{
path: '/',
component: Layout,
redirect: '/dashboard',
name: '首页',
hidden: true,
children: [{ path: 'dashboard', component: dashboard }]
},
{
path: '/introduction',
component: Layout,
redirect: '/introduction/index',
icon: 'xinrenzhinan',
noDropdown: true,
children: [{ path: 'index', component: Introduction, name: '简述' }]
}
]
export default new Router({
// mode: 'history', //后端支持可开
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
});
export const asyncRouterMap = [
{
path: '/permission',
component: Layout,
redirect: '/permission/index',
name: '权限测试',
icon: 'quanxian',
meta: { role: ['admin'] },
noDropdown: true,
children: [{ path: 'index', component: Permission, name: '权限测试页', meta: { role: ['admin'] } }]
},
{
path: '/components',
component: Layout,
redirect: '/components/index',
name: '组件',
icon: 'zujian',
children: [
{ path: 'index', component: componentsIndex, name: '介绍 ' },
{ path: 'tinymce', component: Tinymce, name: '富文本编辑器' },
{ path: 'markdown', component: Markdown, name: 'Markdown' },
{ path: 'jsoneditor', component: JsonEditor, name: 'JSON编辑器' },
{ path: 'dndlist', component: DndList, name: '列表拖拽' },
{ path: 'splitpane', component: SplitPane, name: 'SplitPane' },
{ path: 'avatarupload', component: AvatarUpload, name: '头像上传' },
{ path: 'dropzone', component: Dropzone, name: 'Dropzone' },
{ path: 'sticky', component: Sticky, name: 'Sticky' },
{ path: 'countto', component: CountTo, name: 'CountTo' },
2017-07-17 07:33:21 +00:00
{ path: 'mixin', component: Mixin, name: '小组件' },
{ path: 'backtotop', component: BackToTop, name: '返回顶部' }
2017-05-17 08:26:33 +00:00
]
},
{
path: '/charts',
component: Layout,
redirect: '/charts/index',
name: '图表',
icon: 'tubiaoleixingzhengchang',
children: [
{ path: 'index', component: chartIndex, name: '介绍' },
{ path: 'keyboard', component: KeyboardChart, name: '键盘图表' },
{ path: 'keyboard2', component: KeyboardChart2, name: '键盘图表2' },
{ path: 'line', component: LineMarker, name: '折线图' },
{ path: 'mixchart', component: MixChart, name: '混合图表' }
2017-05-17 08:26:33 +00:00
]
},
{
path: '/errorpage',
component: Layout,
redirect: 'noredirect',
name: '错误页面',
icon: '404',
children: [
{ path: '401', component: Err401, name: '401' },
{ path: '404', component: Err404, name: '404' }
2017-05-17 08:26:33 +00:00
]
},
{
path: '/errlog',
component: Layout,
redirect: 'noredirect',
name: 'errlog',
icon: 'bug',
noDropdown: true,
children: [{ path: 'log', component: ErrorLog, name: '错误日志' }]
},
{
path: '/excel',
component: Layout,
redirect: 'noredirect',
name: 'excel',
icon: 'EXCEL',
2017-07-25 08:51:43 +00:00
children: [
{ path: 'download', component: ExcelDownload, name: '导出excel' },
{ path: 'download2', component: SelectExcelDownload, name: '选择导出excel' }
]
2017-05-17 08:26:33 +00:00
},
{
path: '/theme',
component: Layout,
redirect: 'noredirect',
name: 'theme',
icon: 'theme',
noDropdown: true,
children: [{ path: 'index', component: Theme, name: '换肤' }]
},
{
path: '/example',
component: Layout,
redirect: 'noredirect',
name: '综合实例',
icon: 'zonghe',
children: [
2017-05-31 07:52:27 +00:00
{
2017-06-19 10:14:31 +00:00
path: '/example/table',
2017-05-31 07:52:27 +00:00
component: TableLayout,
2017-06-19 10:14:31 +00:00
redirect: '/example/table/table',
2017-06-15 06:33:02 +00:00
name: 'Table',
2017-05-31 07:52:27 +00:00
children: [
{ path: 'dynamictable', component: DynamicTable, name: '动态table' },
{ path: 'dragtable', component: DragTable, name: '拖拽table' },
{ path: 'inline_edit_table', component: InlineEditTable, name: 'table内编辑' },
{ path: 'table', component: Table, name: '综合table' }
]
},
2017-06-15 06:33:02 +00:00
{ path: 'form/edit', component: Form, name: '编辑Form', meta: { isEdit: true } },
{ path: 'form/create', component: Form, name: '创建Form' },
{ path: 'tab/index', component: Tab, name: 'Tab' }
2017-05-17 08:26:33 +00:00
]
},
{ path: '*', redirect: '/404', hidden: true }
];