|
@@ -7,6 +7,45 @@ VueRouter.prototype.push = function push(location) {
|
|
|
return originalPush.call(this, location).catch((err) => err);
|
|
|
};
|
|
|
Vue.use(VueRouter);
|
|
|
+const market = [
|
|
|
+ {
|
|
|
+ path: '/market/patentInfo/index',
|
|
|
+ meta: { title: '专利超市-专利展示' },
|
|
|
+ component: () => import('../views/market/patentInfo/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/market/transfer/index',
|
|
|
+ meta: { title: '专利超市-专利转让' },
|
|
|
+ component: () => import('../views/market/transfer/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/market/demand/index',
|
|
|
+ meta: { title: '专利超市-专利需求' },
|
|
|
+ component: () => import('../views/market/demand/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/market/navigation/index',
|
|
|
+ meta: { title: '专利超市-专利导航' },
|
|
|
+ component: () => import('../views/market/navigation/index.vue'),
|
|
|
+ },
|
|
|
+];
|
|
|
+const service = [
|
|
|
+ {
|
|
|
+ path: '/service/notice/index',
|
|
|
+ meta: { title: '咨询服务-政策资讯' },
|
|
|
+ component: () => import('../views/service/notice/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/service/law/index',
|
|
|
+ meta: { title: '咨询服务-法律法规' },
|
|
|
+ component: () => import('../views/service/law/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/service/interflow/index',
|
|
|
+ meta: { title: '咨询服务-交流互动' },
|
|
|
+ component: () => import('../views/service/interflow/index.vue'),
|
|
|
+ },
|
|
|
+];
|
|
|
const web = [
|
|
|
{
|
|
|
path: '/',
|
|
@@ -14,18 +53,20 @@ const web = [
|
|
|
meta: { title: '网站首页' },
|
|
|
component: () => import('../views/index.vue'),
|
|
|
},
|
|
|
- // {
|
|
|
- // path: '/login',
|
|
|
- // name: 'login',
|
|
|
- // meta: { title: '登录', key: 'login' },
|
|
|
- // component: () => import('../views/login.vue'),
|
|
|
- // },
|
|
|
- // {
|
|
|
- // path: '/register',
|
|
|
- // name: 'register',
|
|
|
- // meta: { title: '账户注册', key: 'register' },
|
|
|
- // component: () => import('../views/register.vue'),
|
|
|
- // },
|
|
|
+ ...market,
|
|
|
+ ...service,
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ name: 'login',
|
|
|
+ meta: { title: '登录', key: 'login' },
|
|
|
+ component: () => import('../views/login.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/register',
|
|
|
+ name: 'register',
|
|
|
+ meta: { title: '账户注册', key: 'register' },
|
|
|
+ component: () => import('../views/register.vue'),
|
|
|
+ },
|
|
|
];
|
|
|
const routes = [...web];
|
|
|
const router = new VueRouter({
|
|
@@ -34,30 +75,18 @@ const router = new VueRouter({
|
|
|
routes,
|
|
|
});
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- // let openid = 'oFqNO6VHEEwnMB_l1AD3pooBAkHk';
|
|
|
let openid = to.query.openid;
|
|
|
sessionStorage.setItem('openid', openid);
|
|
|
document.title = `${to.meta.title} `;
|
|
|
const token = localStorage.getItem('token');
|
|
|
- // 不带参数
|
|
|
- if (to.path == '/exchange/center/index') {
|
|
|
+ if (to.path == '/account/index') {
|
|
|
if (!token) {
|
|
|
- next(`/login?path=${to.path}&&type=1`);
|
|
|
+ next(`/login?path=${to.path}`);
|
|
|
} else {
|
|
|
let user = jwt.decode(token);
|
|
|
store.commit('setUser', user, { root: true });
|
|
|
next();
|
|
|
}
|
|
|
- // 带参数
|
|
|
- // } else if (to.path == '/finance/apply') {
|
|
|
- // if (!token) {
|
|
|
- // next(`/login?path=${to.fullPath}`);
|
|
|
- // } 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 });
|