index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Cookies from 'js-cookie'
  4. Vue.use(VueRouter)
  5. const originalPush = VueRouter.prototype.push
  6. VueRouter.prototype.push = function push(location) {
  7. return originalPush.call(this, location).catch(err => err)
  8. }
  9. const routes = [
  10. {
  11. path: "/route",
  12. component: () => import('@/utils/model/route.vue'),
  13. },
  14. {
  15. path: "/",
  16. component: () => import('@/views/index'),
  17. },
  18. {
  19. path: '/login',
  20. name: 'Login',
  21. meta: {
  22. title: '系统登录'
  23. },
  24. component: () => import("@/views/login/index.vue")
  25. },
  26. {
  27. path: "/agreeConceal",
  28. name: 'agreeConceal',
  29. meta: {
  30. title: '用户须知'
  31. },
  32. component: () => import('@/views/login/compoments/invite/components/index.vue')
  33. },
  34. {
  35. path: "",
  36. component: () => import('@/views/layout/index.vue'),
  37. children: [
  38. {
  39. path: '/home',
  40. name: 'Home',
  41. meta: {
  42. title: '首页',
  43. sign: 'home',
  44. belong: 'home'
  45. },
  46. component: () => import('@/views/home/index.vue'),
  47. },
  48. //专利数据库
  49. {
  50. path: '/project',
  51. name: 'Project',
  52. component: { render(c) { return c('router-view') } },
  53. redirect: '/project',
  54. children: [
  55. {
  56. path: '/',
  57. meta: {
  58. title: '专利数据库',
  59. sign: 'project',
  60. belong: 'project'
  61. },
  62. component: () => import('@/views/project/index.vue'),
  63. },
  64. {
  65. path: 'patentCollection',
  66. meta: {
  67. title: '专利列表',
  68. sign: 'patentCollection',
  69. belong: 'project'
  70. },
  71. component: () => import('@/views/project/patentCollection/index.vue')
  72. },
  73. {
  74. path: '/patentDetails/:patentNo',
  75. name: 'patentDetails',
  76. meta: {
  77. title: '专利文章',
  78. sign: 'patentDetails',
  79. // belong:'project'
  80. },
  81. component: () => import('@/views/project/patentDetails/index.vue')
  82. },
  83. // 专利数据库导出专利
  84. {
  85. path: "/exportPatent",
  86. name: 'exportPatent',
  87. meta: {
  88. title: '专利数据库导出专利',
  89. sign: 'exportPatent'
  90. },
  91. component: () => import('@/views/project/patentCollection/components/export/index.vue'),
  92. },
  93. ],
  94. },
  95. //企业专利数据库
  96. // {
  97. // path: '/enterprisePatentDB',
  98. // name:'enterprisePatentDB',
  99. // component:{render(c){return c('router-view')}},
  100. // redirect:'/enterprisePatentDB',
  101. // children:[
  102. // {
  103. // path:'/',
  104. // meta: {
  105. // title: '企业专利数据库',
  106. // },
  107. // component: () => import('@/views/EnterprisePatentDatabase/index.vue'),
  108. // },
  109. // ]
  110. // },
  111. // //专利挖掘
  112. {
  113. path: '/patentMining',
  114. name: 'patentMining',
  115. component: { render(c) { return c('router-view') } },
  116. redirect: '/patentMining',
  117. children: [
  118. {
  119. path: '/',
  120. meta: {
  121. title: '专利挖掘',
  122. sign: 'patentMining',
  123. belong: 'patentMining'
  124. },
  125. component: () => import('@/views/patentMining/index.vue'),
  126. },
  127. {
  128. path: '/details',
  129. meta: {
  130. title: '专利挖掘详情',
  131. sign: 'patentMiningDetails',
  132. belong: 'patentMining'
  133. },
  134. component: () => import('@/views/patentMining/components/details/index.vue'),
  135. },
  136. {
  137. path: '/excavateTask',
  138. meta: {
  139. title: '专利挖掘任务',
  140. sign: 'patentMiningExcavateTask',
  141. belong: 'patentMining'
  142. },
  143. component: () => import('@/views/patentMining/components/excavateTask/index.vue'),
  144. },
  145. {
  146. path: '/handleExamine',
  147. meta: {
  148. title: '专利挖掘任务详情',
  149. sign: 'patentMiningHandleExamine',
  150. belong: 'patentMining'
  151. },
  152. component: () => import('@/views/patentMining/components/handleExamine/index.vue'),
  153. },
  154. ]
  155. },
  156. // // 产品
  157. {
  158. path: '/product',
  159. name: 'Product',
  160. component: { render(c) { return c('router-view') } },
  161. redirect: '/product',
  162. children: [
  163. {
  164. path: '/',
  165. name: '/',
  166. meta: {
  167. title: '产品',
  168. sign: 'product',
  169. belong: 'Product'
  170. },
  171. component: () => import('@/views/product/index.vue'),
  172. },
  173. {
  174. path: "/productDetails",
  175. name: 'productDetails',
  176. meta: {
  177. title: '详情',
  178. sign: 'productDetails',
  179. belong: 'Product'
  180. },
  181. component: () => import('@/views/product/components/details'),
  182. },
  183. // {
  184. // path: "/mindIndex",
  185. // meta: {
  186. // title: '可视化',
  187. // button: [],
  188. // },
  189. // component: () => import('@/views/product/components/jsMind'),
  190. // },
  191. {
  192. path: "/chartIndex",
  193. name: 'chartIndex',
  194. meta: {
  195. title: '趋势图',
  196. sign: 'chartIndex',
  197. belong: 'Product'
  198. },
  199. component: () => import('@/views/product/components/echarts'),
  200. },
  201. {
  202. path: "/frameworkIndex",
  203. meta: {
  204. title: '产品架构',
  205. sign: 'frameworkIndex',
  206. belong: 'Product'
  207. },
  208. component: () => import('@/views/product/components/framework/index.vue'),
  209. },
  210. {
  211. path: "/commodity",
  212. meta: {
  213. title: '产品商品化专利',
  214. sign: 'commodity',
  215. belong: 'Product'
  216. },
  217. component: () => import('@/views/product/components/commodity/index.vue'),
  218. },
  219. ],
  220. },
  221. //事件
  222. {
  223. path: '/Event',
  224. name: 'Event',
  225. component: { render(c) { return c('router-view') } },
  226. redirect: '/Event',
  227. children: [
  228. {
  229. path: '/',
  230. meta: {
  231. title: '事件',
  232. sign: 'event',
  233. belong: 'Event'
  234. },
  235. component: () => import('@/views/event/index.vue'),
  236. },
  237. //事件可视化
  238. {
  239. path: "/eventVisual",
  240. name: 'eventVisual',
  241. meta: {
  242. title: '事件可视化',
  243. sign: 'eventVisual',
  244. belong: 'Event'
  245. },
  246. component: () => import('@/views/event/components/details/visualRouter.vue'),
  247. },
  248. ],
  249. },
  250. //报告
  251. {
  252. path: '/AllReport',
  253. name: 'AllReport',
  254. component: { render(c) { return c('router-view') } },
  255. redirect: '/AllReport',
  256. children: [
  257. {
  258. path: '/',
  259. meta: {
  260. title: '报告',
  261. sign: 'report',
  262. belong: 'AllReport'
  263. },
  264. component: () => import('@/views/report/index.vue'),
  265. },
  266. {
  267. path: '/reportDetails',
  268. name: 'reportDetails',
  269. meta: {
  270. title: '报告详情',
  271. sign: 'reportDetails',
  272. belong: 'AllReport'
  273. },
  274. component: () => import('@/views/report/components/details'),
  275. },
  276. {
  277. path: '/reportPatentList',
  278. name: 'reportPatentList',
  279. meta: {
  280. title: '报告专利清单',
  281. sign: 'reportPatentList',
  282. belong: 'AllReport'
  283. },
  284. component: () => import('@/views/report/components/patentList/index.vue'),
  285. },
  286. //code码页面
  287. {
  288. path: '/identificationCode',
  289. name: "identificationCode",
  290. meta: {
  291. title: '分析系统',
  292. sign: 'identificationCode',
  293. belong: 'AllReport'
  294. },
  295. component: () => import('@/views/components/identificationCode/index.vue'),
  296. },
  297. //FTO风险排查分配任务
  298. {
  299. path: '/allocationTask',
  300. name: "allocationTask",
  301. meta: {
  302. title: '分配任务',
  303. sign: 'allocationTask',
  304. belong: 'AllReport'
  305. },
  306. component: () => import('@/views/report/components/allocationTask/index.vue'),
  307. },
  308. //侵权分析
  309. {
  310. path: '/tortIndex',
  311. name: "tortIndex",
  312. meta: {
  313. sign: 'tortIndex',
  314. belong: 'AllReport'
  315. },
  316. component: () => import('@/views/report/tort/index.vue'),
  317. },
  318. // 产品信息录入
  319. {
  320. path: '/informationEntry',
  321. name: "informationEntry",
  322. meta: {
  323. title: '产品信息录入',
  324. sign: 'informationEntry',
  325. belong: 'AllReport'
  326. },
  327. component: () => import('@/views/report/tort/components/informationEntry/index.vue'),
  328. },
  329. //回避设计
  330. {
  331. path: '/avoid',
  332. name: "avoid",
  333. meta: {
  334. title: '回避设计',
  335. sign: 'avoid',
  336. belong: 'AllReport'
  337. },
  338. component: () => import('@/views/report/avoid/index.vue'),
  339. },
  340. //无效应对
  341. {
  342. path: '/manualImport',
  343. name: "manualImport",
  344. meta: {
  345. title: '批量手动添加证据文献',
  346. sign: 'manualImport',
  347. belong: 'AllReport'
  348. },
  349. component: () => import('@/views/report/InvalidResponse/components/ManualImport/index.vue'),
  350. },
  351. //导入证据文献
  352. {
  353. path: '/evidence',
  354. name: 'evidence',
  355. meta: {
  356. title: '证据详情',
  357. sign: 'evidence',
  358. belong: 'AllReport'
  359. },
  360. component: () => import('@/views/report/InvalidResponse/components/Evidence/index.vue'),
  361. },
  362. //报告文档
  363. {
  364. path: '/reportFiles',
  365. name: 'reportFiles',
  366. meta: {
  367. title: '报告文档',
  368. sign: 'reportFiles',
  369. },
  370. component: () => import('@/views/report/components/reportFile/index.vue'),
  371. },
  372. ],
  373. },
  374. //任务模块
  375. {
  376. path: '/myTask',
  377. name: 'myTask',
  378. component: { render(c) { return c('router-view') } },
  379. redirect: '/myTask',
  380. children: [
  381. {
  382. path: '/',
  383. meta: {
  384. title: '我的任务',
  385. sign: 'myTask',
  386. belong: 'myTask'
  387. },
  388. component: () => import('@/views/task/index.vue'),
  389. },
  390. ]
  391. },
  392. //场景可视化
  393. {
  394. path: '/visual',
  395. name: 'visual',
  396. meta: {
  397. title: '场景可视化',
  398. sign: 'visual',
  399. belong: 'visual'
  400. },
  401. component: () => import('@/views/visual')
  402. },
  403. {
  404. path: '/visual/:title',
  405. name: 'flowPath',
  406. meta: {
  407. sign: 'flowPath',
  408. title: '可视化平台',
  409. belong: 'visual'
  410. },
  411. component: () => import('@/views/visual/title/index.vue')
  412. },
  413. //图表分析
  414. {
  415. path: "customChart",
  416. component: () => import('@/views/analyse/custom'),
  417. meta: {
  418. sign: 'customChart',
  419. title: '自定义分析列表'
  420. }
  421. },
  422. // {
  423. // path: "report",
  424. // component: () => import('@/views/analyse/report/create'),
  425. // meta: {
  426. // title: '一键生成报告'
  427. // }
  428. // },
  429. //查看文件
  430. {
  431. path: '/checkFile',
  432. name: '/checkFile',
  433. meta: {
  434. aside: true,
  435. sign: 'checkFile',
  436. },
  437. component: () => import('@/views/components/view/checkFile.vue'),
  438. },
  439. //excel导入
  440. {
  441. path: '/import',
  442. name: "import",
  443. meta: {
  444. title: 'excel导入',
  445. sign: 'import'
  446. },
  447. component: () => import('@/views/components/import/excelImport'),
  448. },
  449. //专利号导入
  450. {
  451. path: '/PatentNoImport',
  452. name: "PatentNoImport",
  453. meta: {
  454. title: '专利号导入',
  455. sign: 'PatentNoImport'
  456. },
  457. component: () => import('@/views/components/import/PatentNoImport'),
  458. },
  459. //检索导入
  460. {
  461. path: '/conditionImport',
  462. name: "conditionImport",
  463. meta: {
  464. title: '专利检索',
  465. sign: 'conditionImport',
  466. belong: 'conditionImport'
  467. },
  468. component: () => import('@/views/components/import/conditionImport'),
  469. },
  470. //检索结果
  471. {
  472. path: "/searchResult",
  473. meta: {
  474. title: '检索结果',
  475. // button: [],
  476. },
  477. component: () => import('@/views/components/import/conditionImport/searchResultIndex.vue'),
  478. },
  479. // //检索专利详情
  480. // {
  481. // path: "/search/patentDetail",
  482. // meta: {
  483. // title: '专利详情',
  484. // // button: [],
  485. // },
  486. // component: () => import('@/views/components/import/conditionImport/patentDetails/patentIndex.vue'),
  487. // },
  488. // 任务清单
  489. {
  490. path: "/taskList",
  491. name: 'taskList',
  492. meta: {
  493. title: '任务清单',
  494. sign: 'taskList'
  495. },
  496. component: () => import('@/views/components/import/task/index.vue'),
  497. },
  498. //标注库
  499. {
  500. path: "/indicia",
  501. meta: {
  502. title: '标注库',
  503. sign: 'indicia',
  504. },
  505. component: () => import('@/views/components/indicia/index.vue'),
  506. },
  507. //错误网页
  508. {
  509. path: '/errorPage',
  510. name: 'errorPage',
  511. component: { render(c) { return c('router-view') } },
  512. redirect: '/errorPage',
  513. children: [
  514. {
  515. path: '/401',
  516. meta: {
  517. title: '事件',
  518. sign: '401',
  519. belong: 'errorPage'
  520. },
  521. component: () => import('@/views/components/errorPage/401.vue'),
  522. },
  523. ],
  524. },
  525. ]
  526. },
  527. ]
  528. const router = new VueRouter({
  529. mode: 'history',
  530. base: '/',
  531. routes
  532. })
  533. router.beforeEach((to, from, next) => {
  534. if(to.path == '/login'){
  535. Cookies.remove("token")
  536. localStorage.removeItem('vuex')
  537. }
  538. if(from.path.indexOf('/patentDetails/')!=-1 && to.path.indexOf('/patentDetails/')==-1){
  539. sessionStorage.setItem('search', JSON.stringify({}))
  540. }
  541. if (to.path === '/login' || to.path === '/' || to.path == '/agreeConceal') {
  542. if (to.meta.title) {
  543. document.title = to.meta.title;
  544. }
  545. next()
  546. }
  547. else if (to.meta.allowPath) {
  548. if (to.meta.title) {
  549. document.title = to.meta.title;
  550. }
  551. next()
  552. }
  553. else {
  554. const tokenStr = Cookies.get('token')
  555. switch (tokenStr) {
  556. case undefined:
  557. if (to.meta.title) {
  558. document.title = to.meta.title;
  559. }
  560. next({ name: 'Login', params: { redirect: to.fullPath } })
  561. break
  562. default:
  563. if (to.meta.title) {
  564. document.title = to.meta.title;
  565. }
  566. next()
  567. break;
  568. }
  569. }
  570. })
  571. router.afterEach((to, from) => {
  572. });
  573. export default router