|
@@ -139,15 +139,44 @@ const user = [
|
|
|
component: () => import('../views/user/account/index.vue'),
|
|
|
},
|
|
|
];
|
|
|
+const organization = [
|
|
|
+ {
|
|
|
+ path: '/user/organization/basic/index',
|
|
|
+ meta: { title: '企业用户-基本信息' },
|
|
|
+ component: () => import('../views/user/organization/basic/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/user/organization/product/index',
|
|
|
+ meta: { title: '企业用户-信息发布' },
|
|
|
+ component: () => import('../views/user/organization/product/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/user/organization/password/index',
|
|
|
+ meta: { title: '企业用户-修改密码' },
|
|
|
+ component: () => import('../views/user/organization/password/index.vue'),
|
|
|
+ },
|
|
|
+];
|
|
|
const routes = [
|
|
|
{
|
|
|
path: '/',
|
|
|
meta: { title: '首页' },
|
|
|
component: () => import('../views/index.vue'),
|
|
|
},
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ meta: { title: '登录', isleftarrow: true },
|
|
|
+ component: () => import('../views/login.vue'),
|
|
|
+ },
|
|
|
+ // 图文直播编辑
|
|
|
+ {
|
|
|
+ path: '/detailPW',
|
|
|
+ meta: { title: '图文直播', isleftarrow: true },
|
|
|
+ component: () => import('../views/detailPW.vue'),
|
|
|
+ },
|
|
|
...onLive,
|
|
|
...market,
|
|
|
...user,
|
|
|
+ ...organization,
|
|
|
];
|
|
|
|
|
|
const router = new VueRouter({
|
|
@@ -155,23 +184,22 @@ const router = new VueRouter({
|
|
|
base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
|
|
|
routes,
|
|
|
});
|
|
|
-// router.beforeEach((to, from, next) => {
|
|
|
-// document.title = `${to.meta.title} `;
|
|
|
-// let token = localStorage.getItem('token');
|
|
|
-// console.log(token);
|
|
|
-// if (to.path == '/account/index') {
|
|
|
-// if (token == null) {
|
|
|
-// 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();
|
|
|
-// }
|
|
|
-// });
|
|
|
+router.beforeEach((to, from, next) => {
|
|
|
+ document.title = `${to.meta.title} `;
|
|
|
+ let token = localStorage.getItem('token');
|
|
|
+ if (to.path == '/user/account/index') {
|
|
|
+ if (token == null) {
|
|
|
+ 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;
|