index.js 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /* Router Modules */
  7. import componentsRouter from './modules/components'
  8. import chartsRouter from './modules/charts'
  9. import tableRouter from './modules/table'
  10. import nestedRouter from './modules/nested'
  11. import dangyunlong from './modules/dangyunlong'
  12. /**
  13. * Note: sub-menu only appear when route children.length >= 1
  14. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  15. *
  16. * hidden: true if set true, item will not show in the sidebar(default is false)
  17. * alwaysShow: true if set true, will always show the root menu
  18. * if not set alwaysShow, when item has more than one children route,
  19. * it will becomes nested mode, otherwise not show the root menu
  20. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  21. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  22. * meta : {
  23. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  24. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  25. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  26. noCache: true if set true, the page will no be cached(default is false)
  27. affix: true if set true, the tag will affix in the tags-view
  28. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  29. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  30. }
  31. */
  32. /**
  33. * constantRoutes
  34. * a base page that does not have permission requirements
  35. * all roles can be accessed
  36. */
  37. export const constantRoutes = [
  38. ...dangyunlong,
  39. {
  40. path: '/redirect',
  41. component: Layout,
  42. hidden: true,
  43. children: [
  44. {
  45. path: '/redirect/:path(.*)',
  46. component: () => import('@/views/redirect/index')
  47. }
  48. ]
  49. },
  50. {
  51. path: '/login',
  52. component: () => import('@/views/login/index'),
  53. hidden: true
  54. },
  55. {
  56. path: '/auth-redirect',
  57. component: () => import('@/views/login/auth-redirect'),
  58. hidden: true
  59. },
  60. {
  61. path: '/404',
  62. component: () => import('@/views/error-page/404'),
  63. hidden: true
  64. },
  65. {
  66. path: '/401',
  67. component: () => import('@/views/error-page/401'),
  68. hidden: true
  69. },
  70. {
  71. path: '/',
  72. component: Layout,
  73. redirect: '/dashboard', //访问/的时候会跳转到dashboard
  74. children: [
  75. {
  76. path: 'dashboard',
  77. component: () => import('@/views/dashboard/index'),
  78. name: '首页',
  79. meta: {
  80. title: '首页',
  81. icon: require('@/assets/public/sidebar/default/index.png'),
  82. selected_icon: require('@/assets/public/sidebar/select/index.png'),
  83. affix: true,
  84. }
  85. }
  86. ]
  87. },
  88. //增加新的路由 站点列表
  89. //注意必须含有component:Layout项目否则会导致页面找不到模板
  90. //必须含有children中的path且两个path必须一致
  91. {
  92. path: '/website',
  93. component: Layout,
  94. children: [
  95. {
  96. name: '', //直接就是根目录所以为空
  97. path: '',
  98. component: () => import('@/views/website/WebsiteList'),
  99. meta: {
  100. title: '网站管理', // 设置菜单和面包屑显示的标题
  101. hidden: true, // 不在侧边菜单显示
  102. breadcrumb: true // 强制在面包屑中显示
  103. }
  104. }
  105. ]
  106. },
  107. {
  108. path: '/addWebsite',
  109. component: Layout,
  110. children: [
  111. {
  112. name: '', //直接就是根目录所以为空
  113. path: '',
  114. component: () => import('@/views/website/addWebsite'),
  115. meta: {
  116. title: '添加网站', // 设置菜单和面包屑显示的标题
  117. hidden: true, // 不在侧边菜单显示
  118. breadcrumb: true // 强制在面包屑中显示
  119. }
  120. }
  121. ]
  122. },
  123. {
  124. path: '/categoryList',
  125. component: Layout,
  126. children: [
  127. {
  128. name: '',
  129. path: '',
  130. component: () => import('@/views/website/categoryList'),
  131. meta: {
  132. title: '栏目名称',
  133. hidden: true,
  134. breadcrumb: true
  135. }
  136. }
  137. ]
  138. },
  139. {
  140. path: '/websiteColumn',
  141. component: Layout,
  142. children: [
  143. {
  144. name: '',
  145. path: '',
  146. component: () => import('@/views/website/websiteColumn'),
  147. meta: {
  148. title: '栏目分配',
  149. hidden: true,
  150. breadcrumb: true
  151. }
  152. }
  153. ]
  154. },
  155. {
  156. path: '/editNavigation',
  157. component: Layout,
  158. children: [
  159. {
  160. name: '',
  161. path: '',
  162. component: () => import('@/views/website/editNavigation'),
  163. meta: {
  164. title: '栏目详情',
  165. hidden: true,
  166. breadcrumb: true
  167. }
  168. }
  169. ]
  170. },
  171. {
  172. path: '/articleList',
  173. component: Layout,
  174. children: [
  175. {
  176. name: '',
  177. path: '',
  178. component: () => import('@/views/news/NewList'),
  179. meta: {
  180. title: '资讯列表',
  181. hidden: true,
  182. breadcrumb: true
  183. }
  184. }
  185. ]
  186. },
  187. {
  188. path: '/examine',
  189. component: Layout,
  190. children: [
  191. {
  192. name: '',
  193. path: '',
  194. component: () => import('@/views/news/examine'),
  195. meta: {
  196. title: '待审核列表',
  197. hidden: true,
  198. breadcrumb: true
  199. }
  200. }
  201. ]
  202. },
  203. {
  204. path: '/creatNews',
  205. component: Layout,
  206. children: [
  207. {
  208. name: '',
  209. path: '',
  210. component: () => import('@/views/news/creatNews'),
  211. meta: {
  212. title: '添加资讯',
  213. hidden: true,
  214. breadcrumb: true
  215. }
  216. }
  217. ]
  218. },
  219. {
  220. path: '/menuList',
  221. component: Layout,
  222. children: [
  223. {
  224. name: '',
  225. path: '',
  226. component: () => import('@/views/menu/menulist'),
  227. meta: {
  228. title: '菜单列表',
  229. hidden: true,
  230. breadcrumb: true
  231. }
  232. }
  233. ]
  234. },
  235. {
  236. path: '/complaintList',
  237. component: Layout,
  238. children: [
  239. {
  240. name: '',
  241. path: '',
  242. component: () => import('@/views/complaint/complaintList'),
  243. meta: {
  244. title: '投诉举报',
  245. hidden: true,
  246. breadcrumb: true
  247. }
  248. }
  249. ]
  250. },
  251. {
  252. path: '/roleList',
  253. component: Layout,
  254. children: [
  255. {
  256. name: '',
  257. path: '',
  258. component: () => import('@/views/role/roleList'),
  259. meta: {
  260. title: '角色管理',
  261. hidden: true,
  262. breadcrumb: true
  263. }
  264. }
  265. ]
  266. },
  267. {
  268. path: '/userList',
  269. component: Layout,
  270. children: [
  271. {
  272. name: '',
  273. path: '',
  274. component: () => import('@/views/role/userList'),
  275. meta: {
  276. title: '用户管理',
  277. hidden: true,
  278. breadcrumb: true
  279. }
  280. }
  281. ]
  282. },
  283. {
  284. path: '/creatUser',
  285. component: Layout,
  286. children: [
  287. {
  288. name: '',
  289. path: '',
  290. component: () => import('@/views/role/creatUser'),
  291. meta: {
  292. title: '添加用户',
  293. hidden: true,
  294. breadcrumb: true
  295. }
  296. }
  297. ]
  298. },
  299. {
  300. path: '/department',
  301. component: Layout,
  302. children: [
  303. {
  304. name: '',
  305. path: '',
  306. component: () => import('@/views/menu/department'),
  307. meta: {
  308. title: '行政职能',
  309. hidden: true,
  310. breadcrumb: true
  311. }
  312. }
  313. ]
  314. },
  315. {
  316. path: '/hall',
  317. component: Layout,
  318. children: [
  319. {
  320. name: '',
  321. path: '',
  322. component: () => import('@/views/chat/hall'),
  323. meta: {
  324. title: '聊天',
  325. hidden: true,
  326. breadcrumb: true
  327. }
  328. }
  329. ]
  330. },
  331. {
  332. path: '/creatWebsite',
  333. component: Layout,
  334. children: [
  335. {
  336. name: '',
  337. path: '',
  338. component: () => import('@/views/website/creatWebsite'),
  339. meta: {
  340. title: '搭建网站',
  341. hidden: true,
  342. breadcrumb: true
  343. }
  344. }
  345. ]
  346. },
  347. {
  348. path: '/contacts',
  349. component: Layout,
  350. children: [
  351. {
  352. name: '',
  353. path: '',
  354. component: () => import('@/views/chat/contacts'),
  355. meta: {
  356. title: '通讯录',
  357. hidden: true,
  358. breadcrumb: true
  359. }
  360. }
  361. ]
  362. },
  363. {
  364. path: '/webCrawler',
  365. component: Layout,
  366. children: [
  367. {
  368. name: '',
  369. path: '',
  370. component: () => import('@/views/crawler/webCrawler'),
  371. meta: {
  372. title: '建立网站',
  373. hidden: true,
  374. breadcrumb: true
  375. }
  376. }
  377. ]
  378. },
  379. // ----fr-课题分类
  380. {
  381. path: '/topicType',
  382. component: Layout,
  383. children: [
  384. {
  385. name: '',
  386. path: '',
  387. component: () => import('@/views/chat/topicType'),
  388. meta: {
  389. title: '课题分类',
  390. hidden: true,
  391. breadcrumb: true
  392. }
  393. }
  394. ]
  395. },
  396. {
  397. path: '/surveyList',
  398. component: Layout,
  399. children: [
  400. {
  401. name: '',
  402. path: '',
  403. component: () => import('@/views/news/surveyList'),
  404. meta: {
  405. title: '投票列表',
  406. hidden: true,
  407. breadcrumb: true
  408. }
  409. }
  410. ]
  411. },
  412. ,
  413. {
  414. path: '/jobRecruitingList',
  415. component: Layout,
  416. children: [
  417. {
  418. name: '',
  419. path: '',
  420. component: () => import('@/views/job/jobRecruitingList'),
  421. meta: {
  422. title: '招聘列表',
  423. hidden: true,
  424. breadcrumb: true
  425. }
  426. }
  427. ]
  428. },
  429. {
  430. path: '/checkjobRecruitingList',
  431. component: Layout,
  432. children: [
  433. {
  434. name: '',
  435. path: '',
  436. component: () => import('@/views/job/checkjobRecruitingList'),
  437. meta: {
  438. title: '招聘审核列表',
  439. hidden: true,
  440. breadcrumb: true
  441. }
  442. }
  443. ]
  444. },
  445. {
  446. path: '/creatJob',
  447. component: Layout,
  448. children: [
  449. {
  450. name: '',
  451. path: '',
  452. component: () => import('@/views/job/creatJob'),
  453. meta: {
  454. title: '发布职位',
  455. hidden: true,
  456. breadcrumb: true
  457. }
  458. }
  459. ]
  460. },
  461. // -----------fr---------
  462. // ----------liuj------------
  463. {
  464. path: '/goodList',
  465. component: Layout,
  466. children: [
  467. {
  468. name: '',
  469. path: '',
  470. component: () => import('@/views/news/GoodList'),
  471. meta: {
  472. title: '商品列表',
  473. hidden: true,
  474. breadcrumb: true
  475. }
  476. }
  477. ]
  478. },
  479. {
  480. path: '/goodListApply',
  481. component: Layout,
  482. children: [
  483. {
  484. name: '',
  485. path: '',
  486. component: () => import('@/views/news/GoodListApply'),
  487. meta: {
  488. title: '商品待审核列表',
  489. hidden: true,
  490. breadcrumb: true
  491. }
  492. }
  493. ]
  494. },
  495. {
  496. path: '/addGood',
  497. component: Layout,
  498. children: [
  499. {
  500. name: '',
  501. path: '',
  502. component: () => import('@/views/news/addGood'),
  503. meta: {
  504. title: '添加商品',
  505. hidden: true,
  506. breadcrumb: true
  507. }
  508. }
  509. ]
  510. },
  511. {
  512. path: '/jobHuntingList',
  513. component: Layout,
  514. children: [
  515. {
  516. name: '',
  517. path: '',
  518. component: () => import('@/views/news/jobHuntingList'),
  519. meta: {
  520. title: '求职信息',
  521. hidden: true,
  522. breadcrumb: true
  523. }
  524. }
  525. ]
  526. },
  527. {
  528. path: '/jobHuntingListApply',
  529. component: Layout,
  530. children: [
  531. {
  532. name: '',
  533. path: '',
  534. component: () => import('@/views/news/jobHuntingListApply'),
  535. meta: {
  536. title: '求职信息',
  537. hidden: true,
  538. breadcrumb: true
  539. }
  540. }
  541. ]
  542. },
  543. {
  544. path: '/addJobHunting',
  545. component: Layout,
  546. children: [
  547. {
  548. name: '',
  549. path: '',
  550. component: () => import('@/views/news/addJobHunting'),
  551. meta: {
  552. title: '添加求职',
  553. hidden: true,
  554. breadcrumb: true
  555. }
  556. }
  557. ]
  558. },
  559. {
  560. path: '/addNotice',
  561. component: Layout,
  562. children: [
  563. {
  564. name: '',
  565. path: '',
  566. component: () => import('@/views/news/addNotice'),
  567. meta: {
  568. title: '添加通知',
  569. hidden: true,
  570. breadcrumb: true
  571. }
  572. }
  573. ]
  574. },
  575. {
  576. path: '/noticeList',
  577. component: Layout,
  578. children: [
  579. {
  580. name: '',
  581. path: '',
  582. component: () => import('@/views/news/noticeList'),
  583. meta: {
  584. title: '行政通知列表',
  585. hidden: true,
  586. breadcrumb: true
  587. }
  588. }
  589. ]
  590. },
  591. {
  592. path: '/noticeListApply',
  593. component: Layout,
  594. children: [
  595. {
  596. name: '',
  597. path: '',
  598. component: () => import('@/views/news/noticeListApply'),
  599. meta: {
  600. title: '行政通知审核列表',
  601. hidden: true,
  602. breadcrumb: true
  603. }
  604. }
  605. ]
  606. },
  607. {
  608. path: '/ncomplaintList',
  609. component: Layout,
  610. children: [
  611. {
  612. name: '',
  613. path: '',
  614. component: () => import('@/views/news/ncomplaintList'),
  615. meta: {
  616. title: '投诉举报',
  617. hidden: true,
  618. breadcrumb: true
  619. }
  620. }
  621. ]
  622. },
  623. {
  624. path: '/ncomplaintListApply',
  625. component: Layout,
  626. children: [
  627. {
  628. name: '',
  629. path: '',
  630. component: () => import('@/views/news/ncomplaintListApply'),
  631. meta: {
  632. title: '投诉举报',
  633. hidden: true,
  634. breadcrumb: true
  635. }
  636. }
  637. ]
  638. },
  639. {
  640. path: '/addNcomplaint',
  641. component: Layout,
  642. children: [
  643. {
  644. name: '',
  645. path: '',
  646. component: () => import('@/views/news/addNcomplaint'),
  647. meta: {
  648. title: '添加投诉举报',
  649. hidden: true,
  650. breadcrumb: true
  651. }
  652. }
  653. ]
  654. },
  655. // ----------liuj------------
  656. {
  657. path: '/topic',
  658. component: Layout,
  659. children: [
  660. {
  661. name: '',
  662. path: '',
  663. component: () => import('@/views/chat/topic'),
  664. meta: {
  665. title: '课题',
  666. hidden: true,
  667. breadcrumb: true
  668. }
  669. }
  670. ]
  671. },
  672. {
  673. path: '/webRule',
  674. component: Layout,
  675. children: [
  676. {
  677. name: '',
  678. path: '',
  679. component: () => import('@/views/crawler/webRule'),
  680. meta: {
  681. title: '规则列表',
  682. hidden: true,
  683. breadcrumb: true
  684. }
  685. }
  686. ]
  687. },
  688. {
  689. path: '/creatTopic',
  690. component: Layout,
  691. children: [
  692. {
  693. name: '',
  694. path: '',
  695. component: () => import('@/views/chat/creatTopic'),
  696. meta: {
  697. title: '编辑课题',
  698. hidden: true,
  699. breadcrumb: true
  700. }
  701. }
  702. ]
  703. },
  704. {
  705. path: '/webCrawlerList',
  706. component: Layout,
  707. children: [
  708. {
  709. name: '',
  710. path: '',
  711. component: () => import('@/views/crawler/webCrawlerList'),
  712. meta: {
  713. title: '采集列表',
  714. hidden: true,
  715. breadcrumb: true
  716. }
  717. }
  718. ]
  719. },
  720. {
  721. path: '/webCrawlerListEdit',
  722. component: Layout,
  723. children: [
  724. {
  725. name: '',
  726. path: '',
  727. component: () => import('@/views/crawler/webCrawlerListEdit'),
  728. meta: {
  729. title: '编辑资讯',
  730. hidden: true,
  731. breadcrumb: true
  732. }
  733. }
  734. ]
  735. },
  736. {
  737. path: '/adList',
  738. component: Layout,
  739. children: [
  740. {
  741. name: '',
  742. path: '',
  743. component: () => import('@/views/advertise/advertiseList.vue'),
  744. meta: {
  745. title: '广告列表',
  746. hidden: true,
  747. breadcrumb: true
  748. }
  749. }
  750. ]
  751. },
  752. {
  753. path: '/adPlaceList',
  754. component: Layout,
  755. children: [
  756. {
  757. name: '',
  758. path: '',
  759. component: () => import('@/views/advertise/adPlaceList'),
  760. meta: {
  761. title: '广告位管理',
  762. hidden: true,
  763. breadcrumb: true
  764. }
  765. }
  766. ]
  767. },
  768. {//站点标识
  769. path: '/websiteTag',
  770. component: Layout,
  771. children: [
  772. {
  773. name: '',
  774. path: '',
  775. component: () => import('@/views/website/websiteTag'),
  776. meta: {
  777. title: '网站分组',
  778. hidden: true,
  779. breadcrumb: true
  780. }
  781. }
  782. ]
  783. },
  784. {
  785. path: '/adPlaceDetail',
  786. component: Layout,
  787. children: [
  788. {
  789. name: '',
  790. path: '',
  791. component: () => import('@/views/advertise/adPlaceDetail'),
  792. meta: {
  793. title: '广告位详情',
  794. hidden: true,
  795. breadcrumb: true
  796. }
  797. }
  798. ]
  799. },
  800. {
  801. path: '/blogroll',
  802. component: Layout,
  803. children: [
  804. {
  805. name: '',
  806. path: '',
  807. component: () => import('@/views/website/blogroll.vue'),
  808. meta: {
  809. title: '友情链接',
  810. hidden: true,
  811. breadcrumb: true
  812. }
  813. }
  814. ]
  815. },
  816. {
  817. path: '/blackWordList',
  818. component: Layout,
  819. children: [
  820. {
  821. name: '',
  822. path: '',
  823. component: () => import('@/views/website/blackWordList.vue'),
  824. meta: {
  825. title: '违禁词',
  826. hidden: true,
  827. breadcrumb: true
  828. }
  829. }
  830. ]
  831. },
  832. {
  833. path: '/tabbar',
  834. component: Layout,
  835. children: [
  836. {
  837. name: '',
  838. path: '',
  839. component: () => import('@/views/tabbar/tabbar.vue'),
  840. meta: {
  841. title: '单页',
  842. hidden: true,
  843. breadcrumb: true
  844. }
  845. }
  846. ]
  847. },
  848. {
  849. path: '/tabbarDetail',
  850. component: Layout,
  851. children: [
  852. {
  853. name: '',
  854. path: '',
  855. component: () => import('@/views/tabbar/tabbarDetail.vue'),
  856. meta: {
  857. title: '单页详情',
  858. hidden: true,
  859. breadcrumb: true
  860. }
  861. }
  862. ]
  863. },
  864. // {
  865. // path: '/documentation',
  866. // component: Layout,
  867. // children: [
  868. // {
  869. // path: 'index',
  870. // component: () => import('@/views/documentation/index'),
  871. // name: 'Documentation',
  872. // meta: { title: 'documentation', icon: 'documentation', affix: true }
  873. // }
  874. // ]
  875. // },
  876. // {
  877. // path: '/guide',
  878. // component: Layout,
  879. // redirect: '/guide/index',
  880. // children: [
  881. // {
  882. // path: 'index',
  883. // component: () => import('@/views/guide/index'),
  884. // name: 'Guide',
  885. // meta: { title: 'guide', icon: 'guide', noCache: true }
  886. // }
  887. // ]
  888. // },
  889. {
  890. path: '/profile',
  891. component: Layout,
  892. redirect: '/profile/index',
  893. hidden: true,
  894. children: [
  895. {
  896. path: 'index',
  897. component: () => import('@/views/profile/index'),
  898. name: 'Profile',
  899. meta: {
  900. title: '个人中心',
  901. hidden: true,
  902. breadcrumb: true
  903. }
  904. }
  905. ]
  906. }
  907. ]
  908. /**
  909. * asyncRoutes
  910. * the routes that need to be dynamically loaded based on user roles
  911. */
  912. export const asyncRoutes = [
  913. {
  914. path: '/permission',
  915. component: Layout,
  916. redirect: '/permission/page',
  917. alwaysShow: true, // will always show the root menu
  918. name: 'Permission',
  919. meta: {
  920. title: 'permission',
  921. icon: 'lock',
  922. roles: ['admin', 'editor'] // you can set roles in root nav
  923. },
  924. children: [
  925. {
  926. path: 'page',
  927. component: () => import('@/views/permission/page'),
  928. name: 'PagePermission',
  929. meta: {
  930. title: 'pagePermission',
  931. roles: ['admin'] // or you can only set roles in sub nav
  932. }
  933. },
  934. {
  935. path: 'directive',
  936. component: () => import('@/views/permission/directive'),
  937. name: 'DirectivePermission',
  938. meta: {
  939. title: 'directivePermission'
  940. // if do not set roles, means: this page does not require permission
  941. }
  942. },
  943. {
  944. path: 'role',
  945. component: () => import('@/views/permission/role'),
  946. name: 'RolePermission',
  947. meta: {
  948. title: 'rolePermission',
  949. roles: ['admin']
  950. }
  951. }
  952. ]
  953. },
  954. {
  955. path: '/icon',
  956. component: Layout,
  957. children: [
  958. {
  959. path: 'index',
  960. component: () => import('@/views/icons/index'),
  961. name: 'Icons',
  962. meta: { title: 'icons', icon: 'icon', noCache: true }
  963. }
  964. ]
  965. },
  966. /** when your routing map is too long, you can split it into small modules **/
  967. componentsRouter,
  968. chartsRouter,
  969. nestedRouter,
  970. tableRouter,
  971. {
  972. path: '/example',
  973. component: Layout,
  974. redirect: '/example/list',
  975. name: 'Example',
  976. meta: {
  977. title: 'example',
  978. icon: 'el-icon-s-help'
  979. },
  980. children: [
  981. {
  982. path: 'create',
  983. component: () => import('@/views/example/create'),
  984. name: 'CreateArticle',
  985. meta: { title: 'createArticle', icon: 'edit' }
  986. },
  987. {
  988. path: 'edit/:id(\\d+)',
  989. component: () => import('@/views/example/edit'),
  990. name: 'EditArticle',
  991. meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' },
  992. hidden: true
  993. },
  994. {
  995. path: 'list',
  996. component: () => import('@/views/example/list'),
  997. name: 'ArticleList',
  998. meta: { title: 'articleList', icon: 'list' }
  999. }
  1000. ]
  1001. },
  1002. {
  1003. path: '/tab',
  1004. component: Layout,
  1005. children: [
  1006. {
  1007. path: 'index',
  1008. component: () => import('@/views/tab/index'),
  1009. name: 'Tab',
  1010. meta: { title: 'tab', icon: 'tab' }
  1011. }
  1012. ]
  1013. },
  1014. {
  1015. path: '/error',
  1016. component: Layout,
  1017. redirect: 'noRedirect',
  1018. name: 'ErrorPages',
  1019. meta: {
  1020. title: 'errorPages',
  1021. icon: '404'
  1022. },
  1023. children: [
  1024. {
  1025. path: '401',
  1026. component: () => import('@/views/error-page/401'),
  1027. name: 'Page401',
  1028. meta: { title: 'page401', noCache: true }
  1029. },
  1030. {
  1031. path: '404',
  1032. component: () => import('@/views/error-page/404'),
  1033. name: 'Page404',
  1034. meta: { title: 'page404', noCache: true }
  1035. }
  1036. ]
  1037. },
  1038. {
  1039. path: '/error-log',
  1040. component: Layout,
  1041. children: [
  1042. {
  1043. path: 'log',
  1044. component: () => import('@/views/error-log/index'),
  1045. name: 'ErrorLog',
  1046. meta: { title: 'errorLog', icon: 'bug' }
  1047. }
  1048. ]
  1049. },
  1050. {
  1051. path: '/excel',
  1052. component: Layout,
  1053. redirect: '/excel/export-excel',
  1054. name: 'Excel',
  1055. meta: {
  1056. title: 'excel',
  1057. icon: 'excel'
  1058. },
  1059. children: [
  1060. {
  1061. path: 'export-excel',
  1062. component: () => import('@/views/excel/export-excel'),
  1063. name: 'ExportExcel',
  1064. meta: { title: 'exportExcel' }
  1065. },
  1066. {
  1067. path: 'export-selected-excel',
  1068. component: () => import('@/views/excel/select-excel'),
  1069. name: 'SelectExcel',
  1070. meta: { title: 'selectExcel' }
  1071. },
  1072. {
  1073. path: 'export-merge-header',
  1074. component: () => import('@/views/excel/merge-header'),
  1075. name: 'MergeHeader',
  1076. meta: { title: 'mergeHeader' }
  1077. },
  1078. {
  1079. path: 'upload-excel',
  1080. component: () => import('@/views/excel/upload-excel'),
  1081. name: 'UploadExcel',
  1082. meta: { title: 'uploadExcel' }
  1083. }
  1084. ]
  1085. },
  1086. {
  1087. path: '/zip',
  1088. component: Layout,
  1089. redirect: '/zip/download',
  1090. alwaysShow: true,
  1091. name: 'Zip',
  1092. meta: { title: 'zip', icon: 'zip' },
  1093. children: [
  1094. {
  1095. path: 'download',
  1096. component: () => import('@/views/zip/index'),
  1097. name: 'ExportZip',
  1098. meta: { title: 'exportZip' }
  1099. }
  1100. ]
  1101. },
  1102. {
  1103. path: '/pdf',
  1104. component: Layout,
  1105. redirect: '/pdf/index',
  1106. children: [
  1107. {
  1108. path: 'index',
  1109. component: () => import('@/views/pdf/index'),
  1110. name: 'PDF',
  1111. meta: { title: 'pdf', icon: 'pdf' }
  1112. }
  1113. ]
  1114. },
  1115. {
  1116. path: '/pdf/download',
  1117. component: () => import('@/views/pdf/download'),
  1118. hidden: true
  1119. },
  1120. {
  1121. path: '/theme',
  1122. component: Layout,
  1123. children: [
  1124. {
  1125. path: 'index',
  1126. component: () => import('@/views/theme/index'),
  1127. name: 'Theme',
  1128. meta: { title: 'theme', icon: 'theme' }
  1129. }
  1130. ]
  1131. },
  1132. {
  1133. path: '/clipboard',
  1134. component: Layout,
  1135. children: [
  1136. {
  1137. path: 'index',
  1138. component: () => import('@/views/clipboard/index'),
  1139. name: 'ClipboardDemo',
  1140. meta: { title: 'clipboardDemo', icon: 'clipboard' }
  1141. }
  1142. ]
  1143. },
  1144. {
  1145. path: '/i18n',
  1146. component: Layout,
  1147. children: [
  1148. {
  1149. path: 'index',
  1150. component: () => import('@/views/i18n-demo/index'),
  1151. name: 'I18n',
  1152. meta: { title: 'i18n', icon: 'international' }
  1153. }
  1154. ]
  1155. },
  1156. {
  1157. path: 'external-link',
  1158. component: Layout,
  1159. children: [
  1160. {
  1161. path: 'https://github.com/PanJiaChen/vue-element-admin',
  1162. meta: { title: 'externalLink', icon: 'link' }
  1163. }
  1164. ]
  1165. },
  1166. // 404 page must be placed at the end !!!
  1167. { path: '*', redirect: '/404', hidden: true }
  1168. ]
  1169. const createRouter = () => new Router({
  1170. // mode: 'history', // require service support
  1171. scrollBehavior: () => ({ y: 0 }),
  1172. routes: constantRoutes
  1173. })
  1174. const router = createRouter()
  1175. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  1176. export function resetRouter() {
  1177. const newRouter = createRouter()
  1178. router.matcher = newRouter.matcher // reset router
  1179. }
  1180. export default router