index.js 25 KB

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