import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' /* 所有角色可以访问/没有权限要求的基页 */ import codemenu from './modules/codemenu' export const constantRoutes = [ { path: '/', redirect: 'login' }, { path: '/login', component: () => import('@/views/login/login.vue'), name: 'login' }, // { // path: '/', // redirect: 'userInfo/index' // }, // { // path: '/index', // component: () => import('@/views/userInfo/index.vue'), // name: 'index' // }, { path: '/index', component: Layout, redirect: '/index', children: [{ path: '/index', component: () => import('@/views/index.vue'), name: 'index', meta: { title: '主页', noCache: true, affix: true } }] }, { path: '/userInfo', component: Layout, redirect: null, meta: { title: '用户信息' }, children: [{ path: '/userInfo/index', component: () => import('@/views/userInfo/index.vue'), name: 'index', meta: { title: '用户信息列表' } }, ] }, { path: '/marketingCard', component: Layout, redirect: '/marketingCard/index', children: [{ path: '/marketingCard/index', component: () => import('@/views/marketingCard/index.vue'), name: 'index', meta: { title: '礼包设置', noCache: true } }, { path: '/marketingCard/pickupCardSet', component: () => import('@/views/marketingCard/pickupCardSet.vue'), name: 'pickupCardSet', meta: { title: '提货卡设置', noCache: true } }, { path: '/marketingCard/corporateCardSet', component: () => import('@/views/marketingCard/corporateCardSet.vue'), name: 'corporateCardSet', meta: { title: '企业卡设置', noCache: true } }, // { // path: '/marketingCard/grantRecords', // component: () => import('@/views/marketingCard/grantRecords.vue'), // name: 'grantRecords', // meta: { // title: '发放记录', // noCache: true // } // }, // { // path: '/marketingCard/carList', // component: () => import('@/views/marketingCard/carList.vue'), // name: 'carList', // meta: { // title: '提货卡列表', // noCache: true // } // }, ] },{ path: '/pickupPoint', component: Layout, redirect: '/pickupPoint/index', children: [{ path: '/pickupPoint/index', component: () => import('@/views/pickupPoint/index.vue'), name: 'index', meta: { title: '提货点信息' } },] }, { path: '/network', component: Layout, redirect: '/network/index', children: [{ path: '/network/index', component: () => import('@/views/network/index.vue'), name: 'index', meta: { title: '支行管理' } },] }, { path: '/commodity', component: Layout, redirect: '/commodity/index', children: [{ path: '/commodity/index', component: () => import('@/views/commodity/index.vue'), name: 'index', meta: { title: '商品信息' } },] }, { path: '/order', component: Layout, redirect: '/order/index', children: [{ path: '/order/index', component: () => import('@/views/order/index.vue'), name: 'index', meta: { title: '订单统计' } },{ path: '/order/distributionCount', component: () => import('@/views/order/distributionCount.vue'), name: 'distributionCount', meta: { title: '网点配货统计' } },{ path: '/order/subBranch', component: () => import('@/views/order/subBranch.vue'), name: 'subBranch', meta: { title: '支行配货统计' } }, { path: '/order/allDistributionCount', component: () => import('@/views/order/allDistributionCount.vue'), name: 'allDistributionCount', meta: { title: '总配货统计' } }] },{ path: '/statisticalReport', component: Layout, redirect: '/statisticalReport/index', children: [{ path: '/statisticalReport/index', component: () => import('@/views/statisticalReport/index.vue'), name: 'index', meta: { title: '提货卡汇总', noCache: true } }, { path: '/statisticalReport/collectionSummary', component: () => import('@/views/statisticalReport/collectionSummary.vue'), name: 'collectionSummary', meta: { title: '提货汇总', noCache: true } }, { path: '/statisticalReport/deliveryDetails', component: () => import('@/views/statisticalReport/deliveryDetails.vue'), name: 'deliveryDetails', meta: { title: '客户提货明细', noCache: true } }] }, { path: '/print', component: Layout, redirect: '/print/index', children: [{ path: '/print/index', component: () => import('@/views/print/index.vue'), name: 'index', meta: { title: '打印电子卡' } },] }, ...codemenu, { path: '/404', component: () => import('@/views/404'), hidden: true } // 404 page must be placed at the end !!! // { path: '*', redirect: '/404', hidden: true } ] const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) const router = createRouter() // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter() { const newRouter = createRouter() router.matcher = newRouter.matcher // reset router } export default router