import Vue from 'vue'
import VueRouter from 'vue-router'

//解决重复点击导航栏报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [{
		path: '/index',
		name: '初始页',
		component: () => import( /* webpackChunkName: "index" */ '@/index'),
		redirect: "home",
		children: [{
				path: '/home',
				name: '首页',
				id: '0',
				component: () => import( /* webpackChunkName: "home" */ '@/home'),
				meta: {
					icon: 'icon-shezhi_zuzhijiagou',
					groupCode: 'home',
				}
			},
			{
				path: '/award_punish',
				name: '我奖扣的',
				component: () => import( /* webpackChunkName: "award_punish" */
					'@/views/abPoint/award_punish.vue'),
				meta: {
					icon: 'icon-shezhi_zuzhijiagou',
					groupCode: 'abPoint',
					jurisdiction: ['employee'] //什么权限隐藏
				}
			},
			{
				path: '/apply_list',
				name: '我申请的',
				component: () => import( /* webpackChunkName: "apply_list" */ '@/views/abPoint/apply_list.vue'),
				meta: {
					icon: 'icon-shezhi_zuzhijiagou',
					groupCode: 'abPoint',
					jurisdiction: ['creator']
				}
			},
			{
				path: '/my_issue',
				name: '我发布的',
				component: () => import( /* webpackChunkName: "my_issue" */ '@/views/task/my_issue.vue'),
				meta: {
					icon: 'icon-PC_gongzuotai_renwu',
					groupCode: 'task',
					jurisdiction: ['employee']
				}
			},
			{
				path: '/get_task',
				name: '领任务',
				component: () => import( /* webpackChunkName: "get_task" */ '@/views/task/get_task.vue'),
				meta: {
					icon: 'icon-PC_gongzuotai_renwu',
					groupCode: 'task',
				}
			},
			{
				path: '/my_task',
				name: '我的任务',
				component: () => import( /* webpackChunkName: "my_task" */ '@/views/task/my_task.vue'),
				meta: {
					icon: 'icon-PC_gongzuotai_renwu',
					groupCode: 'task',
					jurisdiction: ['creator']
				}
			},
			{
				path: '/myExamine',
				name: '我审批的',
				component: () => import( /* webpackChunkName: "myExamine" */ '@/views/task/myExamine'),
				meta: {
					icon: 'icon-PC_gongzuotai_renwu',
					groupCode: 'task',
					jurisdiction: ['employee'] //什么权限隐藏
				}
			},
			{
				path: '/allTask',
				name: '全部任务',
				component: () => import( /* webpackChunkName: "allTask" */ '@/views/task/allTask'),
				meta: {
					icon: 'icon-PC_gongzuotai_renwu',
					groupCode: 'task',
					jurisdiction: ['employee'] //什么权限隐藏
				}
			},
			{
				path: '/dept_rank',
				name: '阶段排名',
				component: () => import( /* webpackChunkName: "dept_rank" */ '@/views/ranking/dept_rank.vue'),
				meta: {
					icon: 'icon-shezhi_zuzhijiagou',
					groupCode: 'ranking',
				}
			},
			{
				path: '/total_rank',
				name: '累计B分排名',
				component: () => import( /* webpackChunkName: "total_rank" */ '@/views/ranking/total_rank.vue'),
				meta: {
					icon: 'icon-shezhi_jiaose',
					groupCode: 'ranking',
				}
			},
			{
				path: '/attendance_rating',
				name: '考勤分排名',
				component: () => import( /* webpackChunkName: "attendance_rating" */
					'@/views/ranking/attendance_rating.vue'),
				meta: {
					icon: 'icon-shezhi_jiaose',
					groupCode: 'ranking',
				}
			},
			{
				path: '/custom_rank',
				name: '自定义分组B分排名',
				component: () => import( /* webpackChunkName: "custom_rank" */
					'@/views/ranking/custom_rank.vue'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
				}
			},
			{
				path: '/manager_statistics',
				name: '管理者奖扣',
				component: () => import( /* webpackChunkName: "manager_statistics" */
					'@/views/ranking/manager_statistics.vue'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
					jurisdiction: ['employee']
				}
			},
			{
				path: '/integral_event',
				name: '积分事件',
				component: () => import( /* webpackChunkName: "integral_event" */
					'@/views/ranking/integral_event.vue'),
				meta: {
					icon: 'icon-shezhi_jifenguize',
					groupCode: 'ranking',
					groupName: "统计",
				}
			},
			{
				path: '/individual_statistics',
				name: '个人统计',
				component: () => import( /* webpackChunkName: "individual_statistics" */
					'@/views/ranking/individual_statistics.vue'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
				}
			},
			{
				path: '/department_statistics',
				name: '部门统计',
				component: () => import( /* webpackChunkName: "department_statistics" */
					'@/views/ranking/department_statistics.vue'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
					jurisdiction: ['employee']
				}
			},
			{
				path: '/lotteryTicket_statistics',
				name: '奖票统计',
				component: () => import( /* webpackChunkName: "lotteryTicket_statistics" */
					'@/views/ranking/lotteryTicket_statistics'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/balanceA',
				name: 'A分余额',
				component: () => import( /* webpackChunkName: "balanceA" */
					'@/views/ranking/balanceA'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'ranking',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/framework',
				name: '组织架构',
				component: () => import( /* webpackChunkName: "framework" */ '@/views/set/framework.vue'),
				meta: {
					icon: 'icon-shezhi_zuzhijiagou',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/jurisdiction',
				name: '角色权限',
				component: () => import( /* webpackChunkName: "jurisdiction" */ '@/views/set/jurisdiction.vue'),
				meta: {
					icon: 'icon-shezhi_jiaose',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/rule',
				name: '积分规则',
				component: () => import( /* webpackChunkName: "rule" */ '@/views/set/rule.vue'),
				meta: {
					icon: 'icon-shezhi_jifenguize',
					groupCode: 'set',
					groupName: "设置",
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/initialPoint',
				name: '初始分',
				component: () => import( /* webpackChunkName: "initialPoint" */ '@/views/set/initialPoint.vue'),
				meta: {
					icon: 'icon-shezhi_jichushezhi',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/check',
				name: '考勤积分',
				component: () => import( /* webpackChunkName: "check" */ '@/views/set/check.vue'),
				meta: {
					icon: 'icon-kaoqin_kaoqinyuebaobiao',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/voluntarilyPoint',
				name: '自动积分',
				component: () => import( /* webpackChunkName: "voluntarilyPoint" */
					'@/views/set/voluntarilyPoint.vue'),
				meta: {
					icon: 'icon-shezhi_zidongjifen',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/log',
				name: '日志设置',
				component: () => import( /* webpackChunkName: "log" */ '@/views/set/log.vue'),
				meta: {
					icon: 'icon-shezhi_xitongpeizhi',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/systemLayout',
				name: '系统配置',
				component: () => import( /* webpackChunkName: "systemLayout" */ '@/views/set/systemLayout.vue'),
				meta: {
					icon: 'icon-shezhi_xitongpeizhi',
					groupCode: 'set',
					jurisdiction: ['dept_manager', 'employee']
				}
			},
			{
				path: '/update_notice',
				name: '公告列表',
				component: () => import( /* webpackChunkName: "update_notice" */
					'@/views/subassembly/update_notice.vue'),
				hidden: true, //侧边栏隐藏
				meta: {
					icon: 'icon-shezhi_gongdaolbiao',
					groupCode: 'abPoint',
				}
			},
			{
				path: '/approval_list',
				name: '审批',
				component: () => import( /* webpackChunkName: "approval_list" */
					'@/views/workbench/approval_list.vue'),
				meta: {
					icon: 'icon-shezhi_gongdaolbiao',
					groupCode: 'workbench',
				}
			},
		]
	},
	{
		path: '/',
		name: '初始化',
		component: () => import( /* webpackChunkName: "init" */ '@/init'),
	},
	{
		path: '/noAccess',
		name: '无权限',
		component: () => import( /* webpackChunkName: "noAccess" */ '@/noAccess'),
	},
	{
		path: '/deptRankSwiper',
		name: '轮播',
		component: () => import( /* webpackChunkName: "deptRankSwiper" */ '@/views/ranking/deptRankSwiper.vue'),
	},
	{
		path: '/hint',
		name: '提示页',
		component: () => import( /* webpackChunkName: "hint" */ '@/hint'),
	},
	{
		path: '/dome',
		name: '虚拟列表',
		component: () => import( /* webpackChunkName: "hint" */ '@/dome'),
	},
]

const router = new VueRouter({
	// mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
