index.js 17 KB

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