index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. import { canIShow } from '@/permission'
  5. import Layout from '@/layout'
  6. export const constantRoutes = [
  7. {
  8. path: '/',
  9. component: Layout,
  10. redirect: '/login',
  11. meta: { title: '首页' },
  12. children: [
  13. {
  14. path: 'dashboard',
  15. component: () => import('@/views/dashboard/index'),
  16. name: 'Dashboard',
  17. meta: {
  18. title: '首页看板',
  19. icon: 'el-icon-house',
  20. roles: 'dashboard',
  21. func: [
  22. {
  23. name: '头部概览',
  24. roles: 'dashboard.head'
  25. }
  26. ]
  27. }
  28. },
  29. {
  30. path: 'audience',
  31. component: () => import('@/views/audienceManage/index'),
  32. name: 'audienceManage',
  33. meta: {
  34. title: '观众管理',
  35. icon: 'el-icon-user',
  36. roles: 'audience',
  37. func: [
  38. {
  39. name: '搜索观众',
  40. roles: 'audience.search'
  41. },
  42. {
  43. name: '按展会筛选',
  44. roles: 'audience.select'
  45. },
  46. {
  47. roles: 'audience.sendInvite',
  48. name: '发送邀请函'
  49. },
  50. {
  51. roles: 'audience.changePage',
  52. name: '观众换页'
  53. },
  54. {
  55. name: '观众导入',
  56. roles: 'audience.import'
  57. }
  58. ]
  59. }
  60. },
  61. {
  62. path: 'preRegister',
  63. component: () => import('@/views/preRegManage/index'),
  64. name: 'preRegManage',
  65. meta: {
  66. title: '预登记表单',
  67. icon: 'el-icon-tickets',
  68. roles: 'preReg'
  69. },
  70. redirect: '/preRegister/list',
  71. children: [
  72. {
  73. path: 'list',
  74. component: () => import('@/views/preRegManage/list'),
  75. name: 'preRegManageList',
  76. meta: {
  77. title: '表单管理',
  78. icon: 'el-icon-edit',
  79. roles: 'preReg.list',
  80. collapse: false,
  81. func: [
  82. {
  83. roles: 'preReg.creat',
  84. name: '创建表单'
  85. },
  86. {
  87. roles: 'preReg.search',
  88. name: '搜索表单'
  89. },
  90. {
  91. roles: 'preReg.handelEdit',
  92. name: '表单编辑'
  93. },
  94. {
  95. roles: 'preReg.handelDisable',
  96. name: '表单禁用'
  97. },
  98. {
  99. roles: 'preReg.handelDelete',
  100. name: '表单删除'
  101. },
  102. {
  103. roles: 'preReg.changePage',
  104. name: '表单换页'
  105. }
  106. ]
  107. }
  108. },
  109. {
  110. path: 'edit/:id',
  111. component: () => import('@/views/preRegManage/edit.vue'),
  112. name: 'preRegManagEdit',
  113. meta: {
  114. title: '表单编辑',
  115. icon: 'el-icon-edit',
  116. hidden: true,
  117. roles: 'preReg.edit',
  118. collapse: true,
  119. func: [
  120. {
  121. roles: 'preReg.save',
  122. name: '表单保存'
  123. },
  124. {
  125. roles: 'preReg.copy',
  126. name: '表单复制'
  127. },
  128. {
  129. roles: 'preReg.editEdit',
  130. name: '表单内容编辑'
  131. },
  132. {
  133. roles: 'preReg.editName',
  134. name: '表单名称编辑'
  135. },
  136. {
  137. roles: 'preReg.editDesc',
  138. name: '表单描述编辑'
  139. },
  140. {
  141. roles: 'preReg.saveCompEdit',
  142. name: '保存组件'
  143. }
  144. ]
  145. }
  146. },
  147. {
  148. path: 'add',
  149. component: () => import('@/views/preRegManage/edit'),
  150. name: 'preRegManagAdd',
  151. meta: {
  152. title: '表单新增',
  153. icon: 'el-icon-document-add',
  154. roles: 'preReg.addNew',
  155. collapse: true
  156. }
  157. },
  158. {
  159. path: 'comp',
  160. component: () => import('@/views/preRegManage/compEdit.vue'),
  161. name: 'preRegManagcomp',
  162. meta: {
  163. title: '我的组件',
  164. icon: 'el-icon-menu',
  165. roles: 'preReg.comp',
  166. func: [
  167. {
  168. roles: 'preReg.saveComp',
  169. name: '保存组件'
  170. }, {
  171. roles: 'preReg.copyComp',
  172. name: '复制组件'
  173. }, {
  174. roles: 'preReg.addComp',
  175. name: '新增组件'
  176. }
  177. ]
  178. }
  179. }
  180. ]
  181. },
  182. {
  183. path: 'exhibitor',
  184. component: () => import('@/views/exhibitorManage/index'),
  185. name: 'ExhibitorManage',
  186. meta: {
  187. title: '展会管理',
  188. icon: 'el-icon-office-building',
  189. roles: 'exhibitor'
  190. },
  191. redirect: '/exhibitor/list',
  192. children: [
  193. {
  194. component: () => import('@/views/exhibitorManage/exhibitorList'),
  195. path: 'list',
  196. name: 'exhibitorManageList',
  197. meta: {
  198. title: '展会管理',
  199. icon: 'el-icon-edit',
  200. roles: 'exhibitor.list',
  201. func: [
  202. {
  203. roles: 'exhibitor.addList',
  204. name: '添加展会'
  205. },
  206. {
  207. roles: 'exhibitor.search',
  208. name: '搜索展会'
  209. },
  210. {
  211. roles: 'exhibitor.handelView',
  212. name: '预览展会'
  213. },
  214. {
  215. roles: 'exhibitor.copyLink',
  216. name: '复制表单连接'
  217. },
  218. {
  219. roles: 'exhibitor.handelEdit',
  220. name: '编辑展会'
  221. },
  222. {
  223. roles: 'exhibitor.handelDisable',
  224. name: '禁用展会'
  225. },
  226. {
  227. roles: 'exhibitor.handelDelete',
  228. name: '删除展会'
  229. },
  230. {
  231. roles: 'exhibitor.handel',
  232. name: '展会翻页'
  233. }
  234. ] }
  235. },
  236. {
  237. component: () => import('@/views/exhibitorManage/exhibitorSetting'),
  238. name: 'exhibitorEdit',
  239. path: 'edit/:id',
  240. meta: {
  241. title: '配置展会',
  242. icon: 'el-icon-setting',
  243. roles: 'exhibitor.setting',
  244. hidden: true,
  245. func: [
  246. {
  247. roles: 'exhibitor.save',
  248. name: '保存展会'
  249. },
  250. {
  251. roles: 'exhibitor.copyright',
  252. name: '是否显示底部信息开关'
  253. }
  254. ]
  255. }
  256. },
  257. {
  258. component: () => import('@/views/exhibitorManage/exhibitorSetting'),
  259. name: 'exhibitorAdd',
  260. path: 'add',
  261. meta: {
  262. title: '添加展会',
  263. icon: 'el-icon-document-add',
  264. roles: 'exhibitor.add'
  265. }
  266. }
  267. ]
  268. },
  269. {
  270. path: 'invitation',
  271. component: () => import('@/views/invitationManage/index'),
  272. name: 'invitationManage',
  273. meta: {
  274. title: '邀请函模板管理',
  275. icon: 'el-icon-files',
  276. roles: 'invitation'
  277. },
  278. redirect: '/invitation/list',
  279. children: [{
  280. path: 'list',
  281. component: () => import('@/views/invitationManage/list'),
  282. name: 'invitationManageList',
  283. meta: {
  284. title: '邀请函模板管理',
  285. icon: 'el-icon-edit',
  286. roles: 'invitation.index',
  287. collapse: false,
  288. func: [
  289. {
  290. roles: 'invitation.addList',
  291. name: '添加邀请函模板'
  292. },
  293. {
  294. roles: 'invitation.goto',
  295. name: '点击进入模板'
  296. },
  297. {
  298. roles: 'invitation.changePage',
  299. name: '邀请函模板翻页'
  300. }
  301. ]
  302. }
  303. },
  304. {
  305. path: 'add',
  306. component: () => import('@/views/invitationManage/edit'),
  307. name: 'invitationAdd',
  308. meta: {
  309. title: '邀请函模板新增',
  310. icon: 'el-icon-document-add',
  311. roles: 'invitation.add',
  312. collapse: true
  313. }
  314. },
  315. {
  316. path: 'edit/:id',
  317. component: () => import('@/views/invitationManage/edit'),
  318. name: 'invitationEdit',
  319. meta: {
  320. title: '邀请函模板编辑',
  321. icon: 'el-icon-edit',
  322. hidden: true,
  323. roles: 'invitation.edit',
  324. collapse: true,
  325. func: [
  326. {
  327. roles: 'invitation.save',
  328. name: '修改邀请函模板'
  329. },
  330. {
  331. roles: 'invitation.desc',
  332. name: '修改邀请函描述'
  333. },
  334. {
  335. roles: 'invitation.rename',
  336. name: '重命名邀请函模板'
  337. },
  338. {
  339. roles: 'invitation.select',
  340. name: '选择展会'
  341. },
  342. {
  343. roles: 'invitation.editor',
  344. name: '允许操作编辑器'
  345. }
  346. ]
  347. }
  348. }
  349. ]
  350. },
  351. {
  352. path: 'setting',
  353. component: () => import('@/views/setting/index'),
  354. name: 'setting',
  355. meta: {
  356. title: '信息与配置',
  357. icon: 'el-icon-setting',
  358. roles: 'setting'
  359. },
  360. redirect: '/setting/exhibitor',
  361. children: [
  362. {
  363. path: 'account',
  364. component: () => import('@/views/setting/accountSetting'),
  365. name: 'accountSetting',
  366. meta: {
  367. title: '系统账号管理',
  368. icon: 'el-icon-user',
  369. roles: 'setting.account',
  370. func: [
  371. {
  372. name: '添加账号',
  373. roles: 'setting.account.add'
  374. },
  375. {
  376. name: '操作账号',
  377. roles: 'setting.account.handel'
  378. },
  379. {
  380. name: '搜索账号',
  381. roles: 'setting.account.search'
  382. },
  383. {
  384. name: '账号翻页',
  385. roles: 'setting.account.changePage'
  386. }
  387. ]
  388. }
  389. },
  390. {
  391. path: 'roles',
  392. component: () => import('@/views/setting/rolesSetting.vue'),
  393. name: 'accountRoles',
  394. meta: {
  395. title: '系统角色管理',
  396. icon: 'el-icon-suitcase-1',
  397. roles: 'setting.roles',
  398. func: [
  399. {
  400. name: '添加角色',
  401. roles: 'setting.roles.add'
  402. }, {
  403. name: '操作角色',
  404. roles: 'setting.roles.handel'
  405. },
  406. {
  407. name: '搜索角色',
  408. roles: 'setting.roles.search'
  409. },
  410. {
  411. name: '角色翻页',
  412. roles: 'setting.roles.changePage'
  413. },
  414. {
  415. name: '角色权限配置',
  416. roles: 'setting.roles.permission'
  417. },
  418. {
  419. name: '角色权限保存',
  420. roles: 'setting.roles.save'
  421. }
  422. ]
  423. }
  424. },
  425. {
  426. path: 'system',
  427. component: () => import('@/views/setting/systemSetting'),
  428. name: 'systemSetting',
  429. meta: {
  430. title: '系统信息配置',
  431. icon: 'el-icon-setting',
  432. roles: 'setting.system',
  433. func: [
  434. {
  435. name: '修改发件邮箱地址',
  436. roles: 'setting.system.sentEmailAddress'
  437. },
  438. {
  439. name: '修改发件邮箱密码/授权码',
  440. roles: 'setting.system.sentEmailPassword'
  441. },
  442. {
  443. name: '修改发件邮箱服务器地址',
  444. roles: 'setting.system.sentEmailServer'
  445. },
  446. {
  447. name: '修改发件邮箱SMTP端口号',
  448. roles: 'setting.system.sentEmailPort'
  449. },
  450. {
  451. name: '修改发件邮箱SSL加密',
  452. roles: 'setting.system.sentEmailSSL'
  453. }, {
  454. name: '保存设置',
  455. roles: 'setting.system.save'
  456. }
  457. ]
  458. }
  459. }
  460. ]
  461. },
  462. {
  463. path: '404',
  464. component: () => import('@/views/errorPage/404'),
  465. name: '404',
  466. meta: {
  467. title: '页面不存在哦',
  468. icon: 'el-icon-delete-location',
  469. hidden: true,
  470. roles: '404'
  471. }
  472. },
  473. {
  474. path: '401',
  475. component: () => import('@/views/errorPage/401'),
  476. name: '401',
  477. meta: {
  478. title: '页面无权限哦',
  479. icon: 'el-icon-delete-location',
  480. hidden: true,
  481. roles: '401'
  482. }
  483. }
  484. ]
  485. },
  486. {
  487. path: '/login',
  488. name: 'login',
  489. component: () => import('@/views/login/index'),
  490. hidden: true,
  491. meta: {
  492. title: '登录',
  493. icon: 'el-icon-user',
  494. hidden: true,
  495. roles: 'login'
  496. }
  497. },
  498. {
  499. path: '/user/form/:url',
  500. name: 'userForm',
  501. component: () => import('@/views/user/form.vue'),
  502. hidden: true,
  503. meta: {
  504. title: '用户表单',
  505. icon: 'el-icon-user',
  506. hidden: true,
  507. roles: 'user.form'
  508. }
  509. },
  510. {
  511. path: '/user/register',
  512. name: 'userRegister',
  513. component: () => import('@/views/user/register.vue'),
  514. hidden: true,
  515. meta: {
  516. title: '用户注册',
  517. icon: 'el-icon-user',
  518. hidden: true,
  519. roles: 'user.register'
  520. }
  521. },
  522. { path: '*', redirect: '/404', hidden: true }
  523. ]
  524. const createRouter = () => new Router({
  525. mode: 'history', // require service support
  526. scrollBehavior: () => ({ y: 0 }),
  527. routes: constantRoutes
  528. })
  529. const router = createRouter()
  530. router.beforeEach((to, from, next) => {
  531. canIShow(to.meta.roles).then((res) => {
  532. if (res) {
  533. next()
  534. } else {
  535. next({
  536. name: '401'
  537. })
  538. }
  539. })
  540. })
  541. export default router