index.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import store from '@/store/index';
  4. const jwt = require('jsonwebtoken');
  5. const originalPush = VueRouter.prototype.push;
  6. VueRouter.prototype.push = function push(location) {
  7. return originalPush.call(this, location).catch((err) => err);
  8. };
  9. Vue.use(VueRouter);
  10. // 2021-07-07
  11. // 科创资讯
  12. const scientific = [
  13. {
  14. path: '/scientific/notice/index',
  15. meta: { title: '科创资讯-通知通告' },
  16. component: () => import('../views/scientific/notice/index.vue'),
  17. },
  18. {
  19. path: '/scientific/notice/detail',
  20. meta: { title: '通知通告-详细信息' },
  21. component: () => import('../views/scientific/notice/detail.vue'),
  22. },
  23. {
  24. path: '/scientific/analysis/index',
  25. meta: { title: '科创资讯-政策信息' },
  26. component: () => import('../views/scientific/analysis/index.vue'),
  27. },
  28. {
  29. path: '/scientific/analysis/detail',
  30. meta: { title: '政策信息-详细信息' },
  31. component: () => import('../views/scientific/analysis/detail.vue'),
  32. },
  33. {
  34. path: '/scientific/industry/index',
  35. meta: { title: '科创资讯-医药资讯' },
  36. component: () => import('../views/scientific/industry/index.vue'),
  37. },
  38. {
  39. path: '/scientific/industry/detail',
  40. meta: { title: '医药资讯-详细信息' },
  41. component: () => import('../views/scientific/industry/detail.vue'),
  42. },
  43. {
  44. path: '/scientific/viewpoint/index',
  45. meta: { title: '科创资讯-智库视点' },
  46. component: () => import('../views/scientific/viewpoint/index.vue'),
  47. },
  48. {
  49. path: '/scientific/viewpoint/detail',
  50. meta: { title: '智库视点-详细信息' },
  51. component: () => import('../views/scientific/viewpoint/detail.vue'),
  52. },
  53. {
  54. path: '/scientific/navigation/index',
  55. meta: { title: '科创资讯-数据导航' },
  56. component: () => import('../views/scientific/navigation/index.vue'),
  57. },
  58. ];
  59. // 服务在线
  60. const service = [
  61. {
  62. path: '/service/contract/index',
  63. meta: { title: '服务在线-技术合同' },
  64. component: () => import('../views/service/contract/index.vue'),
  65. },
  66. {
  67. path: '/service/achieve/index',
  68. meta: { title: '服务在线-成果评价' },
  69. component: () => import('../views/service/achieve/index.vue'),
  70. },
  71. {
  72. path: '/service/achieve/detail',
  73. meta: { title: '成果评价-详细信息' },
  74. component: () => import('../views/service/achieve/detail.vue'),
  75. },
  76. {
  77. path: '/service/novelty/index',
  78. meta: { title: '服务在线-查新服务' },
  79. component: () => import('../views/service/novelty/index.vue'),
  80. },
  81. {
  82. path: '/service/patent/index',
  83. meta: { title: '服务在线-专利运营' },
  84. component: () => import('../views/service/patent/index.vue'),
  85. },
  86. {
  87. path: '/service/continue/index',
  88. meta: { title: '服务在线-高企咨询' },
  89. component: () => import('../views/service/continue/index.vue'),
  90. },
  91. ];
  92. // 交流互动
  93. const exchange = [
  94. {
  95. path: '/exchange/project/index',
  96. meta: { title: '交流互动-项目征集' },
  97. component: () => import('../views/exchange/project/index.vue'),
  98. },
  99. {
  100. path: '/exchange/question/index',
  101. meta: { title: '交流互动-调查问卷' },
  102. component: () => import('../views/exchange/question/index.vue'),
  103. },
  104. {
  105. path: '/exchange/business/index',
  106. meta: { title: '交流互动-咨询服务' },
  107. component: () => import('../views/exchange/business/index.vue'),
  108. },
  109. {
  110. path: '/exchange/business/detail',
  111. meta: { title: '咨询服务-详细信息' },
  112. component: () => import('../views/exchange/business/detail.vue'),
  113. },
  114. {
  115. path: '/exchange/center/index',
  116. meta: { title: '个人中心' },
  117. component: () => import('../views/exchange/center/index.vue'),
  118. },
  119. // 管理用户
  120. {
  121. path: '/exchange/center/adminCenter/mechanism/index',
  122. meta: { title: '机构用户' },
  123. component: () => import('../views/exchange/center/adminCenter/mechanism/index.vue'),
  124. },
  125. {
  126. path: '/exchange/center/adminCenter/mechanism/detail',
  127. meta: { title: '机构用户-详细信息' },
  128. component: () => import('../views/exchange/center/adminCenter/mechanism/detail.vue'),
  129. },
  130. {
  131. path: '/exchange/center/adminCenter/users/index',
  132. meta: { title: '平台用户' },
  133. component: () => import('../views/exchange/center/adminCenter/users/index.vue'),
  134. },
  135. {
  136. path: '/exchange/center/adminCenter/users/detail',
  137. meta: { title: '平台用户-详细信息' },
  138. component: () => import('../views/exchange/center/adminCenter/users/detail.vue'),
  139. },
  140. // 机构用户
  141. {
  142. path: '/exchange/center/mechCenter/users/index',
  143. meta: { title: '平台用户' },
  144. component: () => import('../views/exchange/center/mechCenter/users/index.vue'),
  145. },
  146. {
  147. path: '/exchange/center/mechCenter/users/detail',
  148. meta: { title: '平台用户-详细信息' },
  149. component: () => import('../views/exchange/center/mechCenter/users/detail.vue'),
  150. },
  151. // 平台用户-专利信息
  152. {
  153. path: '/exchange/center/mechCenter/patent/index',
  154. meta: { title: '专利信息' },
  155. component: () => import('../views/exchange/center/mechCenter/patent/index.vue'),
  156. },
  157. // 个人(企业)用户
  158. {
  159. path: '/exchange/center/userCenter/basic/index',
  160. meta: { title: '基本信息' },
  161. component: () => import('../views/exchange/center/userCenter/basic/index.vue'),
  162. },
  163. {
  164. path: '/exchange/center/userCenter/password/index',
  165. meta: { title: '修改密码' },
  166. component: () => import('../views/exchange/center/userCenter/password/index.vue'),
  167. },
  168. // {
  169. // path: '/exchange/center/user/index',
  170. // meta: { title: '关联用户' },
  171. // component: () => import('../views/exchange/center/user/index.vue'),
  172. // },
  173. ];
  174. //专利运营-2021-08-27
  175. const zlyy = [
  176. // 管理员-我的消息
  177. // 管理员-咨询服务
  178. {
  179. path: '/service/patent/admin/message/service',
  180. meta: { title: '咨询服务' },
  181. component: () => import('../views/service/patent/admin/message/service.vue'),
  182. },
  183. {
  184. path: '/service/patent/admin/message/service_detail',
  185. meta: { title: '咨询服务-聊天详情' },
  186. component: () => import('../views/service/patent/admin/message/service_detail.vue'),
  187. },
  188. // 管理员-通知信息
  189. {
  190. path: '/service/patent/admin/message/notice',
  191. meta: { title: '通知信息' },
  192. component: () => import('../views/service/patent/admin/message/notice.vue'),
  193. },
  194. {
  195. path: '/service/patent/admin/message/notice_create',
  196. meta: { title: '通知信息-编辑通知' },
  197. component: () => import('../views/service/patent/admin/message/notice_create.vue'),
  198. },
  199. // 管理员-审核通知
  200. {
  201. path: '/service/patent/admin/message/examine',
  202. meta: { title: '审核通知' },
  203. component: () => import('../views/service/patent/admin/message/examine.vue'),
  204. },
  205. // 管理员-专利预警
  206. {
  207. path: '/service/patent/admin/message/warning',
  208. meta: { title: '专利预警' },
  209. component: () => import('../views/service/patent/admin/message/warning.vue'),
  210. },
  211. // 管理员-专利审核
  212. {
  213. path: '/service/patent/admin/examine/patent',
  214. meta: { title: '专利申请' },
  215. component: () => import('../views/service/patent/admin/examine/patent.vue'),
  216. },
  217. // 国知局反馈消息
  218. {
  219. path: '/service/patent/admin/examine/hairmess',
  220. meta: { title: '分发消息' },
  221. component: () => import('../views/service/patent/admin/examine/hairmess.vue'),
  222. },
  223. {
  224. path: '/service/patent/admin/examine/hairmess_create',
  225. meta: { title: '分发消息-添加消息' },
  226. component: () => import('../views/service/patent/admin/examine/hairmess_create.vue'),
  227. },
  228. {
  229. path: '/service/patent/admin/examine/analysis',
  230. meta: { title: '专利分析' },
  231. component: () => import('../views/service/patent/admin/examine/analysis.vue'),
  232. },
  233. // 管理员-专利申请管理
  234. {
  235. path: '/service/patent/admin/patent/info',
  236. meta: { title: '专利信息' },
  237. component: () => import('../views/service/patent/admin/patent/info.vue'),
  238. },
  239. {
  240. path: '/service/patent/admin/patent/info_create',
  241. meta: { title: '专利信息-添加专利' },
  242. component: () => import('../views/service/patent/admin/patent/info_create.vue'),
  243. },
  244. {
  245. path: '/service/patent/admin/patent/info_import',
  246. meta: { title: '专利信息-导入专利' },
  247. component: () => import('../views/service/patent/admin/patent/info_import.vue'),
  248. },
  249. {
  250. path: '/service/patent/admin/patent/info_result',
  251. meta: { title: '专利信息-导出结果' },
  252. component: () => import('../views/service/patent/admin/patent/info_result.vue'),
  253. },
  254. // 管理员-专利评估管理
  255. {
  256. path: '/service/patent/admin/patent/assessment',
  257. meta: { title: '专利评估' },
  258. component: () => import('../views/service/patent/admin/patent/assessment.vue'),
  259. },
  260. {
  261. path: '/service/patent/admin/patent/assessment_examine',
  262. meta: { title: '专利评估-审核信息' },
  263. component: () => import('../views/service/patent/admin/patent/assessment_examine.vue'),
  264. },
  265. // 管理员-专利交易管理
  266. {
  267. path: '/service/patent/admin/patent/trans',
  268. meta: { title: '专利交易' },
  269. component: () => import('../views/service/patent/admin/patent/trans.vue'),
  270. },
  271. {
  272. path: '/service/patent/admin/patent/trans_info',
  273. meta: { title: '专利交易-详细信息' },
  274. component: () => import('../views/service/patent/admin/patent/trans_info.vue'),
  275. },
  276. // 机构用户
  277. // 机构用户-我的消息
  278. {
  279. path: '/service/patent/mech/message/unRead',
  280. meta: { title: '未读信息' },
  281. component: () => import('../views/service/patent/mech/message/unRead.vue'),
  282. },
  283. {
  284. path: '/service/patent/mech/message/read',
  285. meta: { title: '已读信息' },
  286. component: () => import('../views/service/patent/mech/message/read.vue'),
  287. },
  288. {
  289. path: '/service/patent/mech/message/notice',
  290. meta: { title: '通知信息' },
  291. component: () => import('../views/service/patent/mech/message/notice.vue'),
  292. },
  293. {
  294. path: '/service/patent/mech/message/notice_create',
  295. meta: { title: '通知信息-编辑通知' },
  296. component: () => import('../views/service/patent/mech/message/notice_create.vue'),
  297. },
  298. // 机构用户-我的审核
  299. {
  300. path: '/service/patent/mech/examine/patent',
  301. meta: { title: '专利审核' },
  302. component: () => import('../views/service/patent/mech/examine/patent.vue'),
  303. },
  304. {
  305. path: '/service/patent/mech/examine/contract',
  306. meta: { title: '合同审核' },
  307. component: () => import('../views/service/patent/mech/examine/contract.vue'),
  308. },
  309. {
  310. path: '/service/patent/mech/examine/contract_check',
  311. meta: { title: '合同审核-详细信息' },
  312. component: () => import('../views/service/patent/mech/examine/contract_check.vue'),
  313. },
  314. {
  315. path: '/service/patent/mech/examine/trans',
  316. meta: { title: '交易审核' },
  317. component: () => import('../views/service/patent/mech/examine/trans.vue'),
  318. },
  319. // 机构用户-我的专利
  320. {
  321. path: '/service/patent/mech/patent/information',
  322. meta: { title: '专利信息' },
  323. component: () => import('../views/service/patent/mech/patent/information/index.vue'),
  324. },
  325. {
  326. path: '/service/patent/mech/patent/information/detail',
  327. meta: { title: '专利信息-详细信息' },
  328. component: () => import('../views/service/patent/mech/patent/information/detail.vue'),
  329. },
  330. {
  331. path: '/service/patent/mech/patent/navigation',
  332. meta: { title: '专利分析' },
  333. component: () => import('../views/service/patent/mech/patent/navigation/index.vue'),
  334. },
  335. {
  336. path: '/service/patent/mech/patent/navigation/info',
  337. meta: { title: '专利分析-详细信息' },
  338. component: () => import('../views/service/patent/mech/patent/navigation/info.vue'),
  339. },
  340. {
  341. path: '/service/patent/mech/patent/early',
  342. meta: { title: '专利预警' },
  343. component: () => import('../views/service/patent/mech/patent/early/index.vue'),
  344. },
  345. // 机构用户-我的交易
  346. {
  347. path: '/service/patent/mech/transaction/index',
  348. meta: { title: '专利交易' },
  349. component: () => import('../views/service/patent/mech/transaction/index.vue'),
  350. },
  351. {
  352. path: '/service/patent/mech/transaction/info',
  353. meta: { title: '专利交易-详细信息' },
  354. component: () => import('../views/service/patent/mech/transaction/info.vue'),
  355. },
  356. // 用户
  357. // 用户-我的消息
  358. {
  359. path: '/service/patent/user/message/unRead',
  360. meta: { title: '未读信息查看' },
  361. component: () => import('../views/service/patent/user/message/unRead.vue'),
  362. },
  363. {
  364. path: '/service/patent/user/message/read',
  365. meta: { title: '已读信息查看' },
  366. component: () => import('../views/service/patent/user/message/read.vue'),
  367. },
  368. {
  369. path: '/service/patent/user/message/notice',
  370. meta: { title: '通知查看' },
  371. component: () => import('../views/service/patent/user/message/notice.vue'),
  372. },
  373. {
  374. path: '/service/patent/user/message/read_chat',
  375. meta: { title: '聊天' },
  376. component: () => import('../views/service/patent/user/message/read_chat.vue'),
  377. },
  378. // 用户-我的申请
  379. // 用户-专利申请
  380. {
  381. path: '/service/patent/user/apply/apply',
  382. meta: { title: '专利申请' },
  383. component: () => import('../views/service/patent/user/apply/apply/index.vue'),
  384. },
  385. {
  386. path: '/service/patent/user/apply/apply/detail',
  387. meta: { title: '专利申请-审批单' },
  388. component: () => import('../views/service/patent/user/apply/apply/detail.vue'),
  389. },
  390. {
  391. path: '/service/patent/user/apply/apply/result',
  392. meta: { title: '专利申请-审核结果' },
  393. component: () => import('../views/service/patent/user/apply/apply/result.vue'),
  394. },
  395. {
  396. path: '/service/patent/user/apply/apply/gzjDetail',
  397. meta: { title: '专利申请-国知局信息' },
  398. component: () => import('../views/service/patent/user/apply/apply/gzjDetail.vue'),
  399. },
  400. // 用户-专利分析
  401. {
  402. path: '/service/patent/user/apply/analysis',
  403. meta: { title: '专利分析' },
  404. component: () => import('../views/service/patent/user/apply/analysis/index.vue'),
  405. },
  406. {
  407. path: '/service/patent/user/apply/analysis/detail',
  408. meta: { title: '专利分析-交底书' },
  409. component: () => import('../views/service/patent/user/apply/analysis/detail.vue'),
  410. },
  411. {
  412. path: '/service/patent/user/apply/analysis/result',
  413. meta: { title: '专利分析-审核结果' },
  414. component: () => import('../views/service/patent/user/apply/analysis/result.vue'),
  415. },
  416. // 用户-专利评估
  417. {
  418. path: '/service/patent/user/apply/assessment',
  419. meta: { title: '专利评估' },
  420. component: () => import('../views/service/patent/user/apply/assessment/index.vue'),
  421. },
  422. {
  423. path: '/service/patent/user/apply/assessment/detail',
  424. meta: { title: '专利评估-申请评估' },
  425. component: () => import('../views/service/patent/user/apply/assessment/detail.vue'),
  426. },
  427. {
  428. path: '/service/patent/user/apply/assessment/result',
  429. meta: { title: '专利评估-审核结果' },
  430. component: () => import('../views/service/patent/user/apply/assessment/result.vue'),
  431. },
  432. // 用户-我的专利
  433. {
  434. path: '/service/patent/user/patent/information',
  435. meta: { title: '专利信息' },
  436. component: () => import('../views/service/patent/user/patent/information/index.vue'),
  437. },
  438. {
  439. path: '/service/patent/user/patent/information/detail',
  440. meta: { title: '专利信息-详细信息' },
  441. component: () => import('../views/service/patent/user/patent/information/detail.vue'),
  442. },
  443. {
  444. path: '/service/patent/user/patent/information/trans_create',
  445. meta: { title: '专利信息-发起交易' },
  446. component: () => import('../views/service/patent/user/patent/information/trans_create.vue'),
  447. },
  448. // 用户-专利导航
  449. {
  450. path: '/service/patent/user/patent/navigation',
  451. meta: { title: '专利导航' },
  452. component: () => import('../views/service/patent/user/patent/navigation/index.vue'),
  453. },
  454. // 用户-专利预警
  455. {
  456. path: '/service/patent/user/patent/early',
  457. meta: { title: '专利预警' },
  458. component: () => import('../views/service/patent/user/patent/early/index.vue'),
  459. },
  460. // 用户-专利交易
  461. {
  462. path: '/service/patent/user/transaction/index',
  463. meta: { title: '专利交易' },
  464. component: () => import('../views/service/patent/user/transaction/index.vue'),
  465. },
  466. {
  467. path: '/service/patent/user/transaction/info',
  468. meta: { title: '专利交易-详细信息' },
  469. component: () => import('../views/service/patent/user/transaction/info.vue'),
  470. },
  471. {
  472. path: '/service/patent/user/transaction/contract',
  473. meta: { title: '专利交易-填写合同' },
  474. component: () => import('../views/service/patent/user/transaction/contract.vue'),
  475. },
  476. // 公共专利
  477. {
  478. path: '/service/patent/market/index',
  479. meta: { title: '专利超市' },
  480. component: () => import('../views/service/patent/market/index.vue'),
  481. },
  482. {
  483. path: '/service/patent/market/detail',
  484. meta: { title: '专利超市-专利信息' },
  485. component: () => import('../views/service/patent/market/detail.vue'),
  486. },
  487. {
  488. path: '/service/patent/market/transDetail',
  489. meta: { title: '专利超市-交易信息' },
  490. component: () => import('../views/service/patent/market/transDetail.vue'),
  491. },
  492. ];
  493. const web = [
  494. {
  495. path: '/',
  496. name: 'index',
  497. meta: { title: '网站首页' },
  498. component: () => import('../views/index.vue'),
  499. },
  500. ...scientific,
  501. ...service,
  502. ...exchange,
  503. ...zlyy,
  504. {
  505. path: '/login',
  506. name: 'login',
  507. meta: { title: '登录', key: 'login' },
  508. component: () => import('../views/login.vue'),
  509. },
  510. {
  511. path: '/register',
  512. name: 'register',
  513. meta: { title: '账户注册', key: 'register' },
  514. component: () => import('../views/register.vue'),
  515. },
  516. ];
  517. const routes = [...web];
  518. const router = new VueRouter({
  519. mode: 'history',
  520. base: process.env.VUE_APP_ROUTER,
  521. routes,
  522. });
  523. router.beforeEach((to, from, next) => {
  524. // let openid = 'oFqNO6VHEEwnMB_l1AD3pooBAkHk';
  525. let openid = to.query.openid;
  526. sessionStorage.setItem('openid', openid);
  527. document.title = `${to.meta.title} `;
  528. const token = localStorage.getItem('token');
  529. // 不带参数
  530. if (to.path == '/exchange/center/index') {
  531. if (!token) {
  532. next(`/login?path=${to.path}&&type=1`);
  533. } else {
  534. let user = jwt.decode(token);
  535. store.commit('setUser', user, { root: true });
  536. next();
  537. }
  538. // 带参数
  539. // } else if (to.path == '/finance/apply') {
  540. // if (!token) {
  541. // next(`/login?path=${to.fullPath}`);
  542. // } else {
  543. // let user = jwt.decode(token);
  544. // store.commit('setUser', user, { root: true });
  545. // next();
  546. // }
  547. // // 已登录
  548. } else {
  549. let user = jwt.decode(token);
  550. store.commit('setUser', user, { root: true });
  551. next();
  552. }
  553. });
  554. export default router;