index.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /**
  7. * Note: 路由配置项
  8. *
  9. * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
  10. * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
  11. * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
  12. * // 若你想不管路由下面的 children 声明的个数都显示你的根路由
  13. * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
  14. * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
  15. * name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  16. * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
  17. * roles: ['admin', 'common'] // 访问路由的角色权限
  18. * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
  19. * meta : {
  20. noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  21. title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
  22. icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
  23. breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
  24. activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
  25. }
  26. */
  27. // 公共路由
  28. export const constantRoutes = [{
  29. path: '/redirect',
  30. component: Layout,
  31. hidden: true,
  32. children: [{
  33. path: '/redirect/:path(.*)',
  34. component: () => import('@/views/redirect')
  35. }]
  36. },
  37. {
  38. path: '/login',
  39. component: () => import('@/views/login'),
  40. hidden: true
  41. },
  42. {
  43. path: '/register',
  44. component: () => import('@/views/register'),
  45. hidden: true
  46. },
  47. {
  48. path: '/404',
  49. component: () => import('@/views/error/404'),
  50. hidden: true
  51. },
  52. {
  53. path: '/401',
  54. component: () => import('@/views/error/401'),
  55. hidden: true
  56. },
  57. {
  58. path: '',
  59. component: Layout,
  60. redirect: 'index',
  61. children: [{
  62. path: 'index',
  63. component: () => import('@/views/index'),
  64. name: 'Index',
  65. meta: {
  66. title: '首页',
  67. icon: 'home',
  68. affix: true
  69. }
  70. }]
  71. },
  72. {
  73. path: '/user',
  74. component: Layout,
  75. hidden: true,
  76. redirect: 'noredirect',
  77. children: [{
  78. path: 'profile',
  79. component: () => import('@/views/system/user/profile/index'),
  80. name: 'Profile',
  81. meta: {
  82. title: '个人中心',
  83. icon: 'user'
  84. }
  85. }]
  86. }
  87. ]
  88. // 动态路由,基于用户权限动态去加载
  89. export const dynamicRoutes = [{
  90. path: '/system/user-auth',
  91. component: Layout,
  92. hidden: true,
  93. permissions: ['system:user:edit'],
  94. children: [{
  95. path: 'role/:userId(\\d+)',
  96. component: () => import('@/views/system/user/authRole'),
  97. name: 'AuthRole',
  98. meta: {
  99. title: '分配角色',
  100. activeMenu: '/system/user'
  101. }
  102. }]
  103. },
  104. {
  105. path: '/system/role-auth',
  106. component: Layout,
  107. hidden: true,
  108. permissions: ['system:role:edit'],
  109. children: [{
  110. path: 'user/:roleId(\\d+)',
  111. component: () => import('@/views/system/role/authUser'),
  112. name: 'AuthUser',
  113. meta: {
  114. title: '分配用户',
  115. activeMenu: '/system/role'
  116. }
  117. }]
  118. },
  119. {
  120. path: '/system/dict-data',
  121. component: Layout,
  122. hidden: true,
  123. permissions: ['system:dict:list'],
  124. children: [{
  125. path: 'index/:dictId(\\d+)',
  126. component: () => import('@/views/system/dict/data'),
  127. name: 'Data',
  128. meta: {
  129. title: '字典数据',
  130. activeMenu: '/system/dict'
  131. }
  132. }]
  133. },
  134. {
  135. path: '/monitor/job-log',
  136. component: Layout,
  137. hidden: true,
  138. permissions: ['monitor:job:list'],
  139. children: [{
  140. path: 'index',
  141. component: () => import('@/views/monitor/job/log'),
  142. name: 'JobLog',
  143. meta: {
  144. title: '调度日志',
  145. activeMenu: '/monitor/job'
  146. }
  147. }]
  148. },
  149. {
  150. path: '/tool/gen-edit',
  151. component: Layout,
  152. hidden: true,
  153. permissions: ['tool:gen:edit'],
  154. children: [{
  155. path: 'index/:tableId(\\d+)',
  156. component: () => import('@/views/tool/gen/editTable'),
  157. name: 'GenEdit',
  158. meta: {
  159. title: '修改生成配置',
  160. activeMenu: '/tool/gen'
  161. }
  162. }]
  163. },
  164. // 内容管理
  165. // 视频管理
  166. {
  167. path: '/content',
  168. component: Layout,
  169. hidden: true,
  170. permissions: ['content:video:list'],
  171. name: 'videoList',
  172. children: [{
  173. path: 'video/detail',
  174. component: () => import('@/views/content/video/detail'),
  175. name: 'videoDetail',
  176. meta: {
  177. title: '视频详情',
  178. activeMenu: '/content/video'
  179. }
  180. }]
  181. },
  182. // 文章管理
  183. {
  184. path: '/content',
  185. component: Layout,
  186. hidden: true,
  187. permissions: ['content:articleList:list'],
  188. name: 'articleList',
  189. children: [{
  190. path: 'articleList/detail',
  191. component: () => import('@/views/content/article/detail'),
  192. name: 'articleDetail',
  193. meta: {
  194. title: '文章详情',
  195. activeMenu: '/content/articleList'
  196. }
  197. }]
  198. },
  199. // 设备管理
  200. // 设备列表
  201. {
  202. path: '/device',
  203. component: Layout,
  204. hidden: true,
  205. permissions: ['device:list:list'],
  206. name: 'deviceList',
  207. children: [{
  208. path: 'deviceList/detail',
  209. component: () => import('@/views/device/list/detail'),
  210. name: 'deviceListDetail',
  211. meta: {
  212. title: '设备详情',
  213. activeMenu: '/device/deviceList'
  214. }
  215. }]
  216. },
  217. {
  218. path: '/device',
  219. component: Layout,
  220. hidden: true,
  221. permissions: ['device:class:list'],
  222. name: 'class',
  223. children: [{
  224. path: 'class/detail',
  225. component: () => import('@/views/device/class/detail'),
  226. name: 'classDetail',
  227. meta: {
  228. title: '大类详情',
  229. activeMenu: '/device/class'
  230. }
  231. }]
  232. },
  233. // 设备升级
  234. {
  235. path: '/device',
  236. component: Layout,
  237. hidden: true,
  238. permissions: ['device:version:list'],
  239. children: [{
  240. path: 'version/detail',
  241. component: () => import('@/views/device/version/detail'),
  242. name: 'deviceVersionDetail',
  243. meta: {
  244. title: '设备升级详情',
  245. activeMenu: '/device/version'
  246. }
  247. }]
  248. },
  249. // 设备文章
  250. {
  251. path: '/device',
  252. component: Layout,
  253. hidden: true,
  254. permissions: ['device:article:list'],
  255. name: 'article',
  256. children: [{
  257. path: 'article/detail',
  258. component: () => import('@/views/device/article/detail'),
  259. name: 'devArticleDetail',
  260. meta: {
  261. title: '文章详情',
  262. activeMenu: '/device/article'
  263. }
  264. }]
  265. },
  266. // 音频管理
  267. // 歌手
  268. {
  269. path: "/music",
  270. component: Layout,
  271. hidden: true,
  272. permissions: ['music:singer:list'],
  273. name: 'singer',
  274. children: [{
  275. path: 'singer/detail',
  276. component: () => import('@/views/music/singer/detail'),
  277. name: 'musicSingerDetail',
  278. meta: {
  279. title: `歌手详情`,
  280. activeMenu: '/music/singer'
  281. }
  282. }]
  283. },
  284. // 歌曲
  285. {
  286. path: '/music',
  287. component: Layout,
  288. hidden: true,
  289. permissions: ['music:list:list'],
  290. name: 'musicList',
  291. children: [{
  292. path: 'musicList/detail',
  293. component: () => import('@/views/music/list/detail'),
  294. name: 'musicListDetail',
  295. meta: {
  296. title: `歌曲详情`,
  297. activeMenu: '/music/musicList'
  298. }
  299. }]
  300. },
  301. // 歌单
  302. {
  303. path: '/music',
  304. component: Layout,
  305. hidden: true,
  306. permissions: ['music:menu:list'],
  307. name: 'musicMenu',
  308. children: [{
  309. path: 'menu/detail',
  310. component: () => import('@/views/music/menu/detail'),
  311. name: 'menu',
  312. meta: {
  313. title: `歌单详情`,
  314. activeMenu: '/music/musicMenu'
  315. }
  316. }]
  317. },
  318. // 音乐专辑
  319. {
  320. path: '/music',
  321. component: Layout,
  322. hidden: true,
  323. permissions: ['music:album:list'],
  324. name: 'album',
  325. children: [{
  326. path: 'album/detail',
  327. component: () => import('@/views/music/album/detail'),
  328. name: 'albumDetail',
  329. meta: {
  330. title: '专辑详情',
  331. activeMenu: '/music/album'
  332. }
  333. }]
  334. },
  335. // 播客专辑
  336. {
  337. path: '/music',
  338. component: Layout,
  339. hidden: true,
  340. permissions: ['music:blog:list'],
  341. name: 'blog',
  342. children: [{
  343. path: 'blog/detail',
  344. component: () => import('@/views/music/blog/detail'),
  345. name: 'blogDetail',
  346. meta: {
  347. title: `播客详情`,
  348. activeMenu: '/music/blog'
  349. }
  350. }]
  351. },
  352. // 节目
  353. {
  354. path: '/music',
  355. component: Layout,
  356. hidden: true,
  357. permissions: ['music:program:list'],
  358. name: 'program',
  359. children: [{
  360. path: 'program/detail',
  361. component: () => import('@/views/music/program/detail'),
  362. name: 'programDetail',
  363. meta: {
  364. title: `节目详情`,
  365. activeMenu: '/music/program'
  366. }
  367. }]
  368. },
  369. // 主播
  370. {
  371. path: '/music',
  372. component: Layout,
  373. hidden: true,
  374. permissions: ['music:anchor:list'],
  375. name: 'anchor',
  376. children: [{
  377. path: 'anchor/detail',
  378. component: () => import('@/views/music/anchor/detail'),
  379. name: 'anchorDetail',
  380. meta: {
  381. title: '主播详情',
  382. activeMenu: '/music/anchor'
  383. }
  384. }]
  385. },
  386. // 广播电台
  387. {
  388. path: '/music',
  389. component: Layout,
  390. hidden: true,
  391. permissions: ['music:radio:list'],
  392. name: 'radio',
  393. children: [{
  394. path: 'radio/detail',
  395. component: () => import('@/views/music/radio/detail'),
  396. name: 'radioDetail',
  397. meta: {
  398. title: `电台详情`,
  399. activeMenu: '/music/radio'
  400. }
  401. }]
  402. },
  403. // 猫王精选电台
  404. {
  405. path: '/music',
  406. component: Layout,
  407. hidden: true,
  408. permissions: ['music:choiceness:list'],
  409. name: 'choiceness',
  410. children: [{
  411. path: 'choiceness/detail',
  412. component: () => import('@/views/music/choiceness/detail'),
  413. name: 'choicenessDetail',
  414. meta: {
  415. title: '猫王精选详情',
  416. activeMenu: '/music/choiceness'
  417. }
  418. }]
  419. },
  420. // 项目管理
  421. // 项目列表
  422. {
  423. path: '/project',
  424. component: Layout,
  425. hidden: true,
  426. permissions: ['project:list:list'],
  427. children: [{
  428. path: 'projectList/detail',
  429. component: () => import('@/views/project/list/detail'),
  430. name: 'projectListDetail',
  431. meta: {
  432. title: `项目详情`,
  433. activeMenu: '/project/projectList'
  434. }
  435. }]
  436. },
  437. // 运营管理
  438. // 启动页
  439. {
  440. path: '/operation',
  441. component: Layout,
  442. hidden: true,
  443. permissions: ['operation:startPage:list'],
  444. children: [{
  445. path: 'startPage/detail',
  446. component: () => import('@/views/operation/startPage/detail'),
  447. name: 'startPageDetail',
  448. meta: {
  449. title: '启动页详情',
  450. activeMenu: '/operation/startPage'
  451. }
  452. }]
  453. },
  454. // 推荐管理
  455. {
  456. path: '/operation',
  457. component: Layout,
  458. hidden: true,
  459. permissions: ['operation:recommend:list'],
  460. children: [{
  461. path: 'homePage/recommend/detail',
  462. component: () => import('@/views/operation/recommend/detail'),
  463. name: 'recommendDetail',
  464. meta: {
  465. title: '推荐详情',
  466. activeMenu: '/operation/homePage/operationRecommend'
  467. }
  468. }]
  469. },
  470. // 定制频道
  471. {
  472. path: '/operation',
  473. component: Layout,
  474. hidden: true,
  475. permissions: ['operation:channel:list'],
  476. name: 'channel',
  477. children: [{
  478. path: 'channel/detail',
  479. component: () => import('@/views/operation/channel/detail'),
  480. name: 'channelDetail',
  481. meta: {
  482. title: `频道详情`,
  483. activeMenu: '/operation/channel'
  484. }
  485. }]
  486. },
  487. // 多频多台
  488. {
  489. path: '/operation',
  490. component: Layout,
  491. hidden: true,
  492. permissions: ['operation:channels:list'],
  493. name: 'channels',
  494. children: [{
  495. path: 'channels/detail',
  496. component: () => import('@/views/operation/channels/detail'),
  497. name: 'channelsDetail',
  498. meta: {
  499. title: `频道详情`,
  500. activeMenu: '/operation/channels'
  501. }
  502. }]
  503. },
  504. // 标签分类
  505. {
  506. path: '/operation',
  507. component: Layout,
  508. hidden: true,
  509. permissions: ['operation:tag:list'],
  510. name: 'tag',
  511. children: [{
  512. path: 'tag/detail',
  513. component: () => import('@/views/operation/tag/detail'),
  514. name: 'tagDetail',
  515. meta: {
  516. title: '标签详情',
  517. activeMenu: '/operation/tag'
  518. }
  519. }]
  520. },
  521. // 唤醒音
  522. {
  523. path: '/operation',
  524. component: Layout,
  525. hidden: true,
  526. permissions: ['operation:waken:list'],
  527. name: 'waken',
  528. children: [{
  529. path: 'waken/detail',
  530. component: () => import('@/views/operation/waken/detail'),
  531. name: 'wakenDetail',
  532. meta: {
  533. title: '唤醒音详情',
  534. activeMenu: '/operation/waken'
  535. }
  536. }]
  537. },
  538. // 场景专区
  539. {
  540. path: '/operation',
  541. component: Layout,
  542. hidden: true,
  543. permissions: ['operation:scene:list'],
  544. name: 'scene',
  545. children: [{
  546. path: 'scene/detail',
  547. component: () => import('@/views/operation/scene/detail'),
  548. name: 'sceneDetail',
  549. meta: {
  550. title: '场景专区详情',
  551. activeMenu: '/operation/scene'
  552. }
  553. }]
  554. },
  555. // 协议管理
  556. {
  557. path: '/operation',
  558. component: Layout,
  559. hidden: true,
  560. permissions: ['operation:agreement:list'],
  561. name: 'agreement',
  562. children: [{
  563. path: 'agreement/detail',
  564. component: () => import('@/views/operation/agreement/detail'),
  565. name: 'agreementDetail',
  566. meta: {
  567. title: '协议详情',
  568. activeMenu: '/operation/agreement'
  569. }
  570. }]
  571. },
  572. // 活动管理
  573. {
  574. path: '/operation',
  575. component: Layout,
  576. hidden: true,
  577. permissions: ['operation:activity:list'],
  578. name: 'activity',
  579. children: [{
  580. path: 'activity/detail',
  581. component: () => import('@/views/operation/activity/detail'),
  582. name: 'activityDetail',
  583. meta: {
  584. title: '活动详情',
  585. activeMenu: '/operation/activity'
  586. }
  587. }]
  588. },
  589. // 反馈列表
  590. {
  591. path: '/operation',
  592. component: Layout,
  593. hidden: true,
  594. permissions: ['operation:feedbacklist:list'],
  595. name: 'feedbacklist',
  596. children: [{
  597. path: 'feedback/feedbacklist/detail',
  598. component: () => import('@/views/operation/feedbacklist/detail'),
  599. name: 'feedbacklistDetail',
  600. meta: {
  601. title: '反馈详情',
  602. activeMenu: '/operation/feedback/feedbacklist'
  603. }
  604. }]
  605. },
  606. // 门店管理
  607. {
  608. path: '/operation',
  609. component: Layout,
  610. hidden: true,
  611. permissions: ['operation:map:list'],
  612. name: 'map',
  613. children: [{
  614. path: 'map/detail',
  615. component: () => import('@/views/operation/map/detail'),
  616. name: 'mapDetail',
  617. meta: {
  618. title: '门店详情',
  619. activeMenu: '/opertaion/map'
  620. }
  621. }]
  622. },
  623. // 商品管理
  624. // 商品推荐
  625. {
  626. path: '/goods',
  627. component: Layout,
  628. hidden: true,
  629. permissions: ['goods:list:list'],
  630. children: [{
  631. path: 'goodsList/detail',
  632. component: () => import('@/views/goods/list/detail'),
  633. name: 'goodsListDetail',
  634. meta: {
  635. title: '商品详情',
  636. activeMenu: '/goods/goodsList'
  637. }
  638. }]
  639. },
  640. // 服务管理
  641. // 音乐套餐 / 流量套餐
  642. {
  643. path: '/service',
  644. component: Layout,
  645. hidden: true,
  646. permissions: ['service:package:list'],
  647. children: [{
  648. path: 'package/detail',
  649. component: () => import('@/views/service/package/detail'),
  650. name: 'packageDetail',
  651. meta: {
  652. title: '套餐详情'
  653. }
  654. }]
  655. },
  656. // 签到管理
  657. // 抽奖配置
  658. {
  659. path: '/registration',
  660. component: Layout,
  661. hidden: true,
  662. permissions: ['registration:lotteryConfig:list'],
  663. children: [{
  664. path: 'lotteryConfig/detail',
  665. component: () => import('@/views/registration/lottery/detail'),
  666. name: 'lotteryConfigDetail',
  667. meta: {
  668. title: '配置详情',
  669. activeMenu: '/registration/lotteryConfig'
  670. }
  671. }]
  672. },
  673. // 内容配置
  674. {
  675. path: '/registration',
  676. component: Layout,
  677. hidden: true,
  678. permissions: ['registration:contentConfig:list'],
  679. children: [{
  680. path: 'contentConfig/detail',
  681. component: () => import('@/views/registration/content/detail'),
  682. name: 'contentConfigDetail',
  683. meta: {
  684. title: '配置详情',
  685. activeMenu: '/registration/contentConfig'
  686. }
  687. }]
  688. },
  689. // 兑换配置
  690. {
  691. path: '/registration',
  692. component: Layout,
  693. hidden: true,
  694. permissions: ['registration:exchangeConfig:list'],
  695. children: [{
  696. path: 'exchangeConfig/detail',
  697. component: () => import('@/views/registration/exchange/detail'),
  698. name: 'exchangeConfigDetail',
  699. meta: {
  700. title: '配置详情',
  701. activeMenu: '/registration/exchangeConfig'
  702. }
  703. }]
  704. },
  705. // App升级
  706. {
  707. path: '/push',
  708. component: Layout,
  709. hidden: true,
  710. permissions: ['push:update:list'],
  711. children: [{
  712. path: 'update/detail',
  713. component: () => import('@/views/push/update/detail'),
  714. name: 'updateDetail',
  715. meta: {
  716. title: '升级详情',
  717. activeMenu: '/push/update'
  718. }
  719. }]
  720. },
  721. // 推送弹窗
  722. {
  723. path: '/push',
  724. component: Layout,
  725. hidden: true,
  726. permissions: ['push:dialog:list'],
  727. children: [{
  728. path: 'pushDialog/detail',
  729. component: () => import('@/views/push/dialog/detail'),
  730. name: 'dialogDetail',
  731. meta: {
  732. title: '弹窗详情',
  733. activeMenu: '/push/pushDialog'
  734. }
  735. }]
  736. }
  737. ]
  738. export default new Router({
  739. mode: 'history', // 去掉url中的#
  740. scrollBehavior: () => ({
  741. y: 0
  742. }),
  743. routes: constantRoutes
  744. })