index.js 17 KB

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