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: 'userInfo' }, { path: '/index', component: () => import('@/views/userInfo/index.vue'), name: 'index' }, { 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/packageDetails', // component: () => import('@/views/marketingCard/packageDetails.vue'), // name: 'packageDetails', // meta: { // title: '礼包奖品明细', // noCache: true // } // }, { path: '/marketingCard/pickupCardSet', component: () => import('@/views/marketingCard/pickupCardSet.vue'), name: 'pickupCardSet', 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: '/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: '/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 } }] }, ...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