|
@@ -0,0 +1,135 @@
|
|
|
+import Vue from 'vue';
|
|
|
+import VueRouter from 'vue-router';
|
|
|
+import store from '@/store/index';
|
|
|
+const jwt = require('jsonwebtoken');
|
|
|
+const originalPush = VueRouter.prototype.push;
|
|
|
+VueRouter.prototype.push = function push(location) {
|
|
|
+ return originalPush.call(this, location).catch((err) => err);
|
|
|
+};
|
|
|
+Vue.use(VueRouter);
|
|
|
+const web = [
|
|
|
+ {
|
|
|
+ path: '/',
|
|
|
+ redirect: '/adminCenter/homeIndex',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ name: 'login',
|
|
|
+ meta: { title: '管理登录' },
|
|
|
+ component: () => import('../views/login.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/adminCenter/homeIndex',
|
|
|
+ name: 'adminCenter',
|
|
|
+ component: () => import('@common/src/components/admin-frame/Home.vue'),
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ path: '/adminCenter/homeIndex',
|
|
|
+ name: 'admin_homeIndex',
|
|
|
+ meta: { title: '首页' },
|
|
|
+ component: () => import('../views/adminCenter/homeIndex/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system/basic',
|
|
|
+ meta: { title: '基本信息' },
|
|
|
+ component: () => import('../views/system/basic/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system/password',
|
|
|
+ meta: { title: '修改密码' },
|
|
|
+ component: () => import('../views/system/password/index.vue'),
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ path: '/menu/user',
|
|
|
+ meta: { title: '用户管理' },
|
|
|
+ component: () => import('../views/menu/user/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/type',
|
|
|
+ meta: { title: '商品类型管理' },
|
|
|
+ component: () => import('../views/menu/type/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/apply',
|
|
|
+ meta: { title: '采购申请' },
|
|
|
+ component: () => import('../views/menu/apply/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/apply_examine',
|
|
|
+ meta: { title: '采购审核' },
|
|
|
+ component: () => import('../views/menu/apply_examine/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/apply_review',
|
|
|
+ meta: { title: '采购需求信息' },
|
|
|
+ component: () => import('../views/menu/apply_review/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/market_buy',
|
|
|
+ meta: { title: '采买需求信息' },
|
|
|
+ component: () => import('../views/menu/market_buy/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/stock',
|
|
|
+ meta: { title: '库存管理' },
|
|
|
+ component: () => import('../views/menu/stock/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/stock_order',
|
|
|
+ meta: { title: '采买订单管理' },
|
|
|
+ component: () => import('../views/menu/stock_order/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system/indepot',
|
|
|
+ meta: { title: '入库管理' },
|
|
|
+ component: () => import('../views/menu/indepot/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/outdepot',
|
|
|
+ meta: { title: '出库管理' },
|
|
|
+ component: () => import('../views/menu/outdepot/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/payment',
|
|
|
+ meta: { title: '付款确认' },
|
|
|
+ component: () => import('../views/menu/payment/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/market',
|
|
|
+ meta: { title: '商品管理' },
|
|
|
+ component: () => import('../views/menu/market/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/menu/order',
|
|
|
+ meta: { title: '订单管理' },
|
|
|
+ component: () => import('../views/menu/order/index.vue'),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+];
|
|
|
+const routes = [...web];
|
|
|
+const router = new VueRouter({
|
|
|
+ mode: 'history',
|
|
|
+ base: process.env.VUE_APP_ROUTER,
|
|
|
+ routes,
|
|
|
+});
|
|
|
+// router.beforeEach((to, from, next) => {
|
|
|
+// document.title = `${to.meta.title} `;
|
|
|
+// const token = sessionStorage.getItem('token');
|
|
|
+// if (to.path == '/adminCenter/homeIndex') {
|
|
|
+// if (!token) {
|
|
|
+// next('/login');
|
|
|
+// } else {
|
|
|
+// let user = jwt.decode(token);
|
|
|
+// store.commit('setUser', user, { root: true });
|
|
|
+// next();
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// let user = jwt.decode(token);
|
|
|
+// store.commit('setUser', user, { root: true });
|
|
|
+// next();
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+export default router;
|