123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- import Vue from "vue";
- import Router from "vue-router";
- Vue.use(Router);
- /* Layout */
- import Layout from "@/layout";
- /**
- * Note: sub-menu only appear when route children.length >= 1
- * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
- *
- * hidden: true if set true, item will not show in the sidebar(default is false)
- * alwaysShow: true if set true, will always show the root menu
- * if not set alwaysShow, when item has more than one children route,
- * it will becomes nested mode, otherwise not show the root menu
- * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
- * name:'router-name' the name is used by <keep-alive> (must set!!!)
- * meta : {
- roles: ['admin','editor'] control the page roles (you can set multiple roles)
- title: 'title' the name show in sidebar and breadcrumb (recommend set)
- icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
- breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
- activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
- }
- */
- /**
- * constantRoutes
- * a base page that does not have permission requirements
- * all roles can be accessed
- */
- export const constantRoutes = [
- {
- path: "/login",
- component: () => import("@/views/login/index"),
- hidden: true,
- },
- {
- path: "/external/open_engin",
- name: "open_engin",
- component: () => import("@/views/external/open_engin"),
- hidden: true,
- },
- {
- path: "/404",
- component: () => import("@/views/404"),
- hidden: true,
- },
- {
- path: "/return_goods",
- component: Layout,
- children: [
- {
- path: "new_apply",
- name: "new_apply",
- component: () => import("@/views/supply/apply/new_apply"),
- meta: { title: "零售退货申请", icon: "" },
- },
- {
- path: "new_engin",
- name: "new_apply",
- component: () => import("@/views/supply/apply/new_engin"),
- meta: { title: "工程退货申请", icon: "" },
- },
- ],
- },
- // {
- // path: '/goods',
- // component: Layout,
- // name: 'goods',
- // meta: { title: '商品管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'goods_index',
- // name: 'goods_index',
- // component: () => import('@/views/goods/goods_index'),
- // meta: { title: '商品列表', icon: 'form' }
- // },
- // {
- // path: 'goods_add',
- // name: 'goods_add',
- // hidden: true,
- // component: () => import('@/views/goods/goods_add'),
- // meta: { title: '添加商品', icon: 'form', parent:{ name:'goods_index' }}
- // },
- // {
- // path: 'classify_index',
- // name: 'classify',
- // component: () => import('@/views/goods/classify_index'),
- // meta: { title: '分类管理', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/order',
- // component: Layout,
- // name: 'order',
- // meta: { title: '订单管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'order_list',
- // name: 'order_list',
- // component: () => import('@/views/order/order_list'),
- // meta: { title: '订单列表', icon: 'form'}
- // },
- // {
- // path: 'detail',
- // name: 'detail',
- // hidden: true,
- // component: () => import('@/views/order/detail'),
- // meta: { title: '订单详情', parent:{ name:'order_list' } },
- // },
- // {
- // path: 'order_refund',
- // name: 'order_refund',
- // component: () => import('@/views/order/order_refund'),
- // meta: { title: '维权订单', icon: 'form'},
- // },
- // {
- // path: 'order_refund/order_refund_detail',
- // name: 'order_refund_detail',
- // hidden: true,
- // component: () => import('@/views/order/order_refund_detail'),
- // meta: { title: '维权详情', parent:{ name:'order_refund' } }
- // },
- // {
- // path: 'invoice',
- // name: 'invoice',
- // component: () => import('@/views/order/invoice'),
- // meta: { title: '开发票', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/activity',
- // component: Layout,
- // name: 'activity',
- // meta: { title: '活动管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'seckill_index',
- // name: 'seckill_index',
- // component: () => import('@/views/activity/seckill_index'),
- // meta: { title: '秒杀活动', icon: 'form' }
- // },
- // {
- // path: 'seckill_add',
- // name: 'seckill_add',
- // hidden: true,
- // component: () => import('@/views/activity/seckill_add'),
- // meta: { title: '添加商品', icon: 'form', parent:{ name:'seckill_index' }}
- // },
- // {
- // path: 'coupon_index',
- // name: 'coupon',
- // component: () => import('@/views/activity/coupon_index'),
- // meta: { title: '优惠券设置', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/member',
- // component: Layout,
- // name: 'member',
- // meta: { title: '会员管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'index',
- // name: 'index',
- // component: () => import('@/views/member/index'),
- // meta: { title: '会员管理', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/settlement',
- // component: Layout,
- // name: 'settlement',
- // meta: { title: '结算管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'index',
- // name: 'settlement_index',
- // component: () => import('@/views/settlement/index'),
- // meta: { title: '结算管理', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/freight',
- // component: Layout,
- // name: 'freight',
- // meta: { title: '配送管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'index',
- // name: 'freight_index',
- // component: () => import('@/views/freight/index'),
- // meta: { title: '配送管理', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/storage',
- // component: Layout,
- // name: 'storage',
- // meta: { title: '仓储管理', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'index',
- // name: 'storage_index',
- // component: () => import('@/views/storage/index'),
- // meta: { title: '仓储管理', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/notice',
- // component: Layout,
- // name: 'notice',
- // meta: { title: '消息中心', icon: 'el-icon-s-help' },
- // children: [
- // {
- // path: 'index',
- // name: 'notice_index',
- // component: () => import('@/views/notice/index'),
- // meta: { title: '消息列表', icon: 'form' }
- // }
- // ]
- // },
- // {
- // path: '/setting',
- // component: Layout,
- // name: 'Setting',
- // meta: { title: '系统设置', icon: 'el-icon-s-tools' },
- // alwaysShow: true,
- // children: [
- // {
- // path: 'personal',
- // name: 'personal',
- // component: () => import('@/views/setting/personal'),
- // meta: { title: '个人信息', icon: 'table' }
- // },
- // {
- // path: 'account',
- // name: 'account',
- // component: () => import('@/views/setting/account'),
- // meta: { title: '账户管理', icon: 'table' }
- // },
- // {
- // path: 'role',
- // name: 'role',
- // component: () => import('@/views/setting/role'),
- // meta: { title: '权限管理', icon: 'table' }
- // },
- // {
- // path: 'oplog',
- // name: 'oplog',
- // component: () => import('@/views/setting/oplog'),
- // meta: { title: '操作日志', icon: 'table' }
- // },
- // {
- // path: 'banner',
- // name: 'banner',
- // component: () => import('@/views/setting/banner'),
- // meta: { title: '轮播图管理', icon: 'table' }
- // }
- // ]
- // },
- // 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;
|