index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Cookies from 'js-cookie'
  4. import Permission from '@/utils/permissions'
  5. import {stringifyQuery,parseQuery} from '@/utils/query'
  6. Vue.use(VueRouter)
  7. const originalPush = VueRouter.prototype.push
  8. VueRouter.prototype.push = function push(location) {
  9. return originalPush.call(this, location).catch(err => err)
  10. }
  11. const routes = [
  12. {
  13. path: "/route",
  14. component: () => import('@/utils/model/route.vue'),
  15. },
  16. {
  17. path: "/",
  18. component: () => import('@/views/index'),
  19. },
  20. {
  21. path: '/login',
  22. name: 'Login',
  23. meta: {
  24. title: '系统登录'
  25. },
  26. component: () => import("@/views/login/index.vue")
  27. },
  28. {
  29. path: "/agreeConceal",
  30. name: 'agreeConceal',
  31. meta: {
  32. title: '用户须知'
  33. },
  34. component: () => import('@/views/login/compoments/invite/components/index.vue')
  35. },
  36. {
  37. path: "",
  38. component: () => import('@/views/layout/index.vue'),
  39. children: [
  40. {
  41. path: '/home',
  42. name: 'Home',
  43. meta: {
  44. title: '首页',
  45. sign: 'home',
  46. belong: 'home'
  47. },
  48. component: () => import('@/views/home/index.vue'),
  49. },
  50. //专利数据库
  51. {
  52. path: '/project',
  53. name: 'Project',
  54. component: { render(c) { return c('router-view') } },
  55. redirect: '/project',
  56. children: [
  57. {
  58. path: '/',
  59. meta: {
  60. title: '专利数据库',
  61. sign: 'project',
  62. belong: 'project',
  63. permission:'xiaoshi/project'
  64. },
  65. component: () => import('@/views/project/index.vue'),
  66. },
  67. {
  68. path: '/updateCriteria',
  69. meta: {
  70. title: '更新条件',
  71. sign: 'updateCriteria',
  72. belong: 'project',
  73. // permission:'xiaoshi/project'
  74. },
  75. component: () => import('@/views/project/components/updateCriteria/index.vue'),
  76. },
  77. {
  78. path: 'patentCollection',
  79. meta: {
  80. title: '专利列表',
  81. sign: 'patentCollection',
  82. belong: 'project',
  83. keepAlive:true
  84. },
  85. component: () => import('@/views/project/patentCollection/index.vue')
  86. },
  87. {
  88. path: '/patentDetails/:patentNo',
  89. name: 'patentDetails',
  90. meta: {
  91. title: '专利文章',
  92. sign: 'patentDetails',
  93. notReturn:true,
  94. // belong:'project'
  95. },
  96. component: () => import('@/views/project/patentDetails/index.vue')
  97. },
  98. // 专利数据库导出专利
  99. {
  100. path: "/exportPatent",
  101. name: 'exportPatent',
  102. meta: {
  103. title: '专利数据库导出专利',
  104. sign: 'exportPatent'
  105. },
  106. component: () => import('@/views/project/patentCollection/components/export/index.vue'),
  107. },
  108. // 专利数据库导出专利
  109. {
  110. path: "/patentWorth",
  111. name: 'patentWorth',
  112. meta: {
  113. title: '价值曲线',
  114. sign: 'patentWorth'
  115. },
  116. component: () => import('@/views/project/patentDetails/components/patentMessage/history/echarts/index.vue'),
  117. },
  118. ],
  119. },
  120. //企业专利数据库
  121. // {
  122. // path: '/enterprisePatentDB',
  123. // name:'enterprisePatentDB',
  124. // component:{render(c){return c('router-view')}},
  125. // redirect:'/enterprisePatentDB',
  126. // children:[
  127. // {
  128. // path:'/',
  129. // meta: {
  130. // title: '企业专利数据库',
  131. // },
  132. // component: () => import('@/views/EnterprisePatentDatabase/index.vue'),
  133. // },
  134. // ]
  135. // },
  136. // //专利挖掘
  137. {
  138. path: '/patentMining',
  139. name: 'patentMining',
  140. component: { render(c) { return c('router-view') } },
  141. redirect: '/patentMining',
  142. children: [
  143. {
  144. path: '/',
  145. meta: {
  146. title: '专利挖掘',
  147. sign: 'patentMining',
  148. belong: 'patentMining',
  149. permission:'xiaoshi/patentMining'
  150. },
  151. component: () => import('@/views/patentMining/index.vue'),
  152. },
  153. {
  154. path: '/details',
  155. meta: {
  156. title: '专利挖掘详情',
  157. sign: 'patentMiningDetails',
  158. belong: 'patentMining'
  159. },
  160. component: () => import('@/views/patentMining/components/details/index.vue'),
  161. },
  162. {
  163. path: '/excavateTask',
  164. meta: {
  165. title: '专利挖掘任务',
  166. sign: 'patentMiningExcavateTask',
  167. belong: 'patentMining'
  168. },
  169. component: () => import('@/views/patentMining/components/excavateTask/index.vue'),
  170. },
  171. {
  172. path: '/handleExamine',
  173. meta: {
  174. title: '专利挖掘任务详情',
  175. sign: 'patentMiningHandleExamine',
  176. belong: 'patentMining'
  177. },
  178. component: () => import('@/views/patentMining/components/handleExamine/index.vue'),
  179. },
  180. ]
  181. },
  182. // // 产品
  183. {
  184. path: '/product',
  185. name: 'Product',
  186. component: { render(c) { return c('router-view') } },
  187. redirect: '/product',
  188. children: [
  189. {
  190. path: '/',
  191. name: '/',
  192. meta: {
  193. title: '产品/技术',
  194. sign: 'product',
  195. belong: 'Product',
  196. permission:'xiaoshi/product'
  197. },
  198. component: () => import('@/views/product/index.vue'),
  199. },
  200. {
  201. path: "/productDetails",
  202. name: 'productDetails',
  203. meta: {
  204. title: '详情',
  205. sign: 'productDetails',
  206. belong: 'Product'
  207. },
  208. component: () => import('@/views/product/components/details'),
  209. },
  210. {
  211. path: "/mindIndex",
  212. meta: {
  213. title: '可视化',
  214. sign: 'mindIndex',
  215. belong: 'Product'
  216. },
  217. component: () => import('@/views/product/components/jsMind'),
  218. },
  219. {
  220. path: "/chartIndex",
  221. name: 'chartIndex',
  222. meta: {
  223. title: '趋势图',
  224. sign: 'chartIndex',
  225. belong: 'Product'
  226. },
  227. component: () => import('@/views/product/components/echarts'),
  228. },
  229. {
  230. path: "/frameworkIndex",
  231. meta: {
  232. title: '产品架构',
  233. sign: 'frameworkIndex',
  234. belong: 'Product'
  235. },
  236. component: () => import('@/views/product/components/framework/index.vue'),
  237. },
  238. {
  239. path: "/commodity",
  240. meta: {
  241. title: '产品商品化专利',
  242. sign: 'commodity',
  243. belong: 'Product'
  244. },
  245. component: () => import('@/views/product/components/commodity/index.vue'),
  246. },
  247. ],
  248. },
  249. //事件
  250. {
  251. path: '/Event',
  252. name: 'Event',
  253. component: { render(c) { return c('router-view') } },
  254. redirect: '/Event',
  255. children: [
  256. {
  257. path: '/',
  258. meta: {
  259. title: '事件',
  260. sign: 'event',
  261. belong: 'Event',
  262. permission:'xiaoshi/event'
  263. },
  264. component: () => import('@/views/event/index.vue'),
  265. },
  266. //事件可视化
  267. {
  268. path: "/eventVisual",
  269. name: 'eventVisual',
  270. meta: {
  271. title: '事件可视化',
  272. sign: 'eventVisual',
  273. belong: 'Event'
  274. },
  275. component: () => import('@/views/event/components/details/visualRouter.vue'),
  276. },
  277. ],
  278. },
  279. //报告
  280. {
  281. path: '/AllReport',
  282. name: 'AllReport',
  283. component: { render(c) { return c('router-view') } },
  284. redirect: '/AllReport',
  285. children: [
  286. {
  287. path: '/',
  288. name:'AllReport/',
  289. meta: {
  290. title: '报告',
  291. sign: 'report',
  292. belong: 'AllReport',
  293. permission:'xiaoshi/report'
  294. },
  295. component: () => import('@/views/report/index.vue'),
  296. },
  297. {
  298. path: '/reportDetails',
  299. name: 'reportDetails',
  300. meta: {
  301. title: '报告详情',
  302. sign: 'reportDetails',
  303. belong: 'AllReport',
  304. keepAlive:true
  305. },
  306. component: () => import('@/views/report/components/details'),
  307. },
  308. {
  309. path: '/reportPatentList',
  310. name: 'reportPatentList',
  311. meta: {
  312. title: '报告专利清单',
  313. sign: 'reportPatentList',
  314. },
  315. component: () => import('@/views/report/components/patentList/index.vue'),
  316. },
  317. //code码页面
  318. {
  319. path: '/identificationCode',
  320. name: "identificationCode",
  321. meta: {
  322. title: '分析系统',
  323. sign: 'identificationCode',
  324. belong: 'AllReport'
  325. },
  326. component: () => import('@/views/components/identificationCode/index.vue'),
  327. },
  328. //FTO风险排查分配任务
  329. {
  330. path: '/allocationTask',
  331. name: "allocationTask",
  332. meta: {
  333. title: '分配任务',
  334. sign: 'allocationTask',
  335. },
  336. component: () => import('@/views/report/components/allocationTask/index.vue'),
  337. },
  338. //侵权分析
  339. {
  340. path: '/tortIndex',
  341. name: "tortIndex",
  342. meta: {
  343. sign: 'tortIndex',
  344. belong: 'AllReport'
  345. },
  346. component: () => import('@/views/report/tort/index.vue'),
  347. },
  348. // 产品信息录入
  349. {
  350. path: '/informationEntry',
  351. name: "informationEntry",
  352. meta: {
  353. title: '产品信息录入',
  354. sign: 'informationEntry',
  355. belong: 'AllReport'
  356. },
  357. component: () => import('@/views/report/tort/components/informationEntry/index.vue'),
  358. },
  359. //回避设计
  360. {
  361. path: '/avoid',
  362. name: "avoid",
  363. meta: {
  364. title: '回避设计',
  365. sign: 'avoid',
  366. belong: 'AllReport'
  367. },
  368. component: () => import('@/views/report/avoid/index.vue'),
  369. },
  370. //无效应对
  371. {
  372. path: '/manualImport',
  373. name: "manualImport",
  374. meta: {
  375. title: '批量手动添加证据文献',
  376. sign: 'manualImport',
  377. belong: 'AllReport'
  378. },
  379. component: () => import('@/views/report/InvalidResponse/components/ManualImport/index.vue'),
  380. },
  381. //导入证据文献
  382. {
  383. path: '/evidence',
  384. name: 'evidence',
  385. meta: {
  386. title: '证据详情',
  387. sign: 'evidence',
  388. belong: 'AllReport'
  389. },
  390. component: () => import('@/views/report/InvalidResponse/components/Evidence/index.vue'),
  391. },
  392. //报告文档
  393. {
  394. path: '/reportFiles',
  395. name: 'reportFiles',
  396. meta: {
  397. title: '报告文档',
  398. sign: 'reportFiles',
  399. },
  400. component: () => import('@/views/report/components/reportFile/index.vue'),
  401. },
  402. //检索记录
  403. {
  404. path: '/searchRecord',
  405. name: 'searchRecord',
  406. meta: {
  407. title: '检索记录',
  408. sign: 'searchRecord',
  409. },
  410. component: () => import('@/views/report/analysisAndOpinion/components/searchRecords/index.vue'),
  411. },
  412. ],
  413. },
  414. //查新检索库
  415. {
  416. path: '/noveltySearchDB',
  417. name: 'noveltySearchDB',
  418. meta: {
  419. title: '查新检索标注库',
  420. sign: 'noveltySearchDB',
  421. belong: 'noveltySearchDB',
  422. keepAlive:true
  423. },
  424. component: () => import('@/views/components/noveltySearch/index.vue'),
  425. },
  426. //查新检索
  427. {
  428. path: '/noveltySearch',
  429. name: 'noveltySearch',
  430. component: { render(c) { return c('router-view') } },
  431. redirect: '/noveltySearch',
  432. children: [
  433. {
  434. path: '/',
  435. name:'noveltySearch',
  436. meta: {
  437. title: '查新检索',
  438. sign: 'noveltySearch',
  439. belong: 'AllReport',
  440. permission:'xiaoshi/noveltySearch'
  441. },
  442. component: () => import('@/views/noveltySearch/index.vue'),
  443. },
  444. {
  445. path: '/noveltySearchDetails',
  446. name: 'noveltySearchDetails',
  447. meta: {
  448. title: '查新检索详情',
  449. sign: 'noveltySearchDetails',
  450. belong: 'AllReport',
  451. keepAlive:true
  452. },
  453. component: () => import('@/views/noveltySearch/components/details/index.vue'),
  454. },
  455. // 检索记录
  456. {
  457. path: '/noveltySearchRecord',
  458. name: 'noveltySearchRecord',
  459. meta: {
  460. title: '查新检索记录',
  461. sign: 'noveltySearchRecord',
  462. belong: 'AllReport',
  463. },
  464. component: () => import('@/views/noveltySearch/components/details/components/contrastRecords/index.vue'),
  465. },
  466. // 对比文件
  467. {
  468. path: '/noveltySearchFile',
  469. name: 'noveltySearchFile',
  470. meta: {
  471. title: '查新对比文件',
  472. sign: 'noveltySearchFile',
  473. belong: 'AllReport',
  474. },
  475. component: () => import('@/views/noveltySearch/components/details/components/contrastFile/index.vue'),
  476. },
  477. // 导出报告
  478. {
  479. path: '/exportReport',
  480. name: 'exportReport',
  481. meta: {
  482. title: '导出报告',
  483. sign: 'exportReport',
  484. belong: 'AllReport',
  485. },
  486. component: () => import('@/views/noveltySearch/components/exportReport/index.vue'),
  487. },
  488. // 导出报告2
  489. {
  490. path: '/exportReportByFile',
  491. name: 'exportReportByFile',
  492. meta: {
  493. title: '导出报告',
  494. sign: 'exportReportByFile',
  495. belong: 'AllReport',
  496. },
  497. component: () => import('@/views/noveltySearch/components/exportReport/otherTemplate/index.vue'),
  498. },
  499. // 复用结果
  500. {
  501. path: '/reuseResults',
  502. name: 'reuseResults',
  503. meta: {
  504. title: '复用结果',
  505. sign: 'reuseResults',
  506. belong: 'AllReport',
  507. },
  508. component: () => import('@/views/noveltySearch/components/reuseResults/index.vue'),
  509. },
  510. ]
  511. },
  512. //任务模块
  513. {
  514. path: '/myTask',
  515. name: 'myTask',
  516. component: { render(c) { return c('router-view') } },
  517. redirect: '/myTask',
  518. children: [
  519. {
  520. path: '/',
  521. name:'myTask/',
  522. meta: {
  523. title: '我的任务',
  524. sign: 'myTask',
  525. belong: 'myTask'
  526. },
  527. component: () => import('@/views/task/index.vue'),
  528. },
  529. ]
  530. },
  531. //场景可视化
  532. {
  533. path: '/visual',
  534. name: 'visual',
  535. meta: {
  536. title: '场景可视化',
  537. sign: 'visual',
  538. belong: 'visual'
  539. },
  540. component: () => import('@/views/visual')
  541. },
  542. {
  543. path: '/visual/:title',
  544. name: 'flowPath',
  545. meta: {
  546. sign: 'flowPath',
  547. title: '可视化平台',
  548. belong: 'visual'
  549. },
  550. component: () => import('@/views/visual/title/index.vue')
  551. },
  552. //图表分析
  553. {
  554. path: "customChart",
  555. name:'customChart',
  556. component: () => import('@/views/analyse/custom'),
  557. meta: {
  558. sign: 'customChart',
  559. title: '自定义分析列表'
  560. }
  561. },
  562. // {
  563. // path: "report",
  564. // component: () => import('@/views/analyse/report/create'),
  565. // meta: {
  566. // title: '一键生成报告'
  567. // }
  568. // },
  569. //查看文件
  570. {
  571. path: '/checkFile',
  572. name: '/checkFile',
  573. meta: {
  574. aside: true,
  575. sign: 'checkFile',
  576. },
  577. component: () => import('@/views/components/view/checkFile.vue'),
  578. },
  579. //excel导入
  580. {
  581. path: '/import',
  582. name: "import",
  583. meta: {
  584. title: 'excel导入',
  585. sign: 'import'
  586. },
  587. component: () => import('@/views/components/import/excelImport'),
  588. },
  589. //专利号导入
  590. {
  591. path: '/PatentNoImport',
  592. name: "PatentNoImport",
  593. meta: {
  594. title: '专利号导入',
  595. sign: 'PatentNoImport'
  596. },
  597. component: () => import('@/views/components/import/PatentNoImport'),
  598. },
  599. //检索导入
  600. {
  601. path: '/conditionImport',
  602. name: "conditionImport",
  603. meta: {
  604. title: '专利检索',
  605. sign: 'conditionImport',
  606. belong: 'conditionImport',
  607. permission:'xiaoshi/patentSearch'
  608. },
  609. component: () => import('@/views/components/import/conditionImport'),
  610. },
  611. //检索历史
  612. {
  613. path: "/searchHistory",
  614. name:'searchHistory',
  615. meta: {
  616. title: '检索历史',
  617. sign:'searchHistory',
  618. belong: 'conditionImport',
  619. },
  620. component: () => import('@/views/components/import/conditionImport/components/searchHistory/index.vue'),
  621. },
  622. //检索结果
  623. {
  624. path: "/searchResult",
  625. name:'searchResult',
  626. meta: {
  627. title: '检索结果',
  628. // button: [],
  629. },
  630. component: () => import('@/views/components/import/conditionImport/searchResultIndex.vue'),
  631. },
  632. // 任务清单
  633. {
  634. path: "/taskList",
  635. name: 'taskList',
  636. meta: {
  637. title: '任务清单',
  638. sign: 'taskList'
  639. },
  640. component: () => import('@/views/components/import/task/index.vue'),
  641. },
  642. //标注库
  643. {
  644. path: "/indicia",
  645. name:'indicia',
  646. meta: {
  647. title: '标注库',
  648. sign: 'indicia',
  649. permission:'xiaoshi/annotationLibrary'
  650. },
  651. component: () => import('@/views/components/indicia/index.vue'),
  652. },
  653. //错误网页
  654. {
  655. path: '/errorPage',
  656. name: 'errorPage',
  657. component: { render(c) { return c('router-view') } },
  658. redirect: '/errorPage',
  659. children: [
  660. {
  661. path: '/403',
  662. name:'/403',
  663. meta: {
  664. title: '无权限',
  665. sign: '403',
  666. belong: 'errorPage'
  667. },
  668. component: () => import('@/views/components/errorPage/403.vue'),
  669. },
  670. ],
  671. },
  672. //onlyoffice在线编辑
  673. {
  674. path: '/onlyOffice',
  675. name: 'onlyOffice',
  676. component: { render(c) { return c('router-view') } },
  677. redirect: '/onlyOffice',
  678. children: [
  679. {
  680. path: '/onlyOffice',
  681. name:'onlyOffice',
  682. meta: {
  683. title: '在线编辑',
  684. sign: 'onlyOffice',
  685. belong: 'onlyOffice'
  686. },
  687. component: () => import('@/views/components/onlyOffice/index.vue'),
  688. },
  689. ],
  690. },
  691. ]
  692. },
  693. ]
  694. const router = new VueRouter({
  695. mode: 'history',
  696. base: '/',
  697. stringifyQuery: stringifyQuery, // 序列化query参数
  698. parseQuery: parseQuery, // 反序列化query参数
  699. routes
  700. })
  701. function savePreviousRoute(to){
  702. if(to.meta.notReturn || to.path == '/login' || to.path == '/'){
  703. return
  704. }
  705. var redirectUrl = {
  706. userName:localStorage.getItem('username'),
  707. path:to.path,
  708. query:to.query,
  709. params:to.params
  710. }
  711. localStorage.setItem('redirectUrl',JSON.stringify(redirectUrl))
  712. }
  713. router.beforeEach((to, from, next) => {
  714. savePreviousRoute(to)
  715. if(to.path == '/login'){
  716. Cookies.remove("token")
  717. localStorage.removeItem('vuex')
  718. }
  719. if(from.path.indexOf('/patentDetails/')!=-1 && to.path.indexOf('/patentDetails/')==-1){
  720. sessionStorage.setItem('search', JSON.stringify({}))
  721. }
  722. if (to.path === '/login' || to.path === '/' || to.path == '/agreeConceal') {
  723. if (to.meta.title) {
  724. document.title = to.meta.title;
  725. }
  726. next()
  727. }
  728. else if(to.meta.permission && !Permission.FunPermissions(to.meta.permission)){
  729. next({ path: '/403' })
  730. }
  731. else if (to.meta.allowPath) {
  732. if (to.meta.title) {
  733. document.title = to.meta.title;
  734. }
  735. next()
  736. }
  737. else {
  738. const tokenStr = Cookies.get('token')
  739. switch (tokenStr) {
  740. case undefined:
  741. if (to.meta.title) {
  742. document.title = to.meta.title;
  743. }
  744. // if(to.matched && to.matched.length>0){
  745. // var path = to.path
  746. // var redirectUrl = null
  747. // for(var i = to.matched.length-1;i>=0;i--){
  748. // var item = to.matched[i]
  749. // if(item.meta.notReturn){
  750. // continue
  751. // }
  752. // redirectUrl = {
  753. // userName:localStorage.getItem('username'),
  754. // path:to.path,
  755. // query:to.query,
  756. // params:to.params
  757. // }
  758. // break;
  759. // }
  760. // if(to.matched.findIndex(item=>{ return item.path == path}) !=-1){
  761. // var redirectUrl = {
  762. // userName:localStorage.getItem('username'),
  763. // path:to.path,
  764. // query:to.query,
  765. // params:to.params
  766. // }
  767. // localStorage.setItem('redirectUrl',JSON.stringify(redirectUrl))
  768. // }
  769. // }
  770. next({ name: 'Login' })
  771. break
  772. default:
  773. if (to.meta.title) {
  774. document.title = to.meta.title;
  775. }
  776. next()
  777. break;
  778. }
  779. }
  780. })
  781. router.afterEach((to, from) => {
  782. });
  783. export default router