index.js 18 KB

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