index.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. const menuData = [
  2. {
  3. id: 2,
  4. parentId: null,
  5. title: '分析页',
  6. icon: 'DashboardOutlined',
  7. component: '/dashboard/analysis',
  8. path: '/dashboard/analysis',
  9. name: 'DashboardAnalysis',
  10. keepAlive: true,
  11. locale: 'menu.dashboard.analysis',
  12. },
  13. {
  14. id: 1,
  15. parentId: null,
  16. title: '仪表盘',
  17. icon: 'DashboardOutlined',
  18. component: 'RouteView',
  19. redirect: '/dashboard/analysis',
  20. path: '/dashboard',
  21. name: 'Dashboard',
  22. locale: 'menu.dashboard',
  23. },
  24. {
  25. id: 3,
  26. parentId: null,
  27. title: '表单页',
  28. icon: 'FormOutlined',
  29. component: 'RouteView',
  30. redirect: '/form/basic',
  31. path: '/form',
  32. name: 'Form',
  33. locale: 'menu.form',
  34. },
  35. {
  36. id: 5,
  37. parentId: null,
  38. title: '链接',
  39. icon: 'LinkOutlined',
  40. component: 'RouteView',
  41. redirect: '/link/iframe',
  42. path: '/link',
  43. name: 'Link',
  44. locale: 'menu.link',
  45. },
  46. {
  47. id: 6,
  48. parentId: 5,
  49. title: 'AntDesign',
  50. url: 'https://ant.design/',
  51. component: 'Iframe',
  52. path: '/link/iframe',
  53. name: 'LinkIframe',
  54. keepAlive: true,
  55. locale: 'menu.link.iframe',
  56. },
  57. {
  58. id: 7,
  59. parentId: 5,
  60. title: 'AntDesignVue',
  61. url: 'https://antdv.com/',
  62. component: 'Iframe',
  63. path: '/link/antdv',
  64. name: 'LinkAntdv',
  65. keepAlive: true,
  66. locale: 'menu.link.antdv',
  67. },
  68. {
  69. id: 8,
  70. parentId: 5,
  71. path: 'https://www.baidu.com',
  72. name: 'LinkExternal',
  73. title: '跳转百度',
  74. locale: 'menu.link.external',
  75. },
  76. {
  77. id: 9,
  78. parentId: null,
  79. title: '菜单',
  80. icon: 'BarsOutlined',
  81. component: 'RouteView',
  82. path: '/menu',
  83. redirect: '/menu/menu1',
  84. name: 'Menu',
  85. locale: 'menu.menu',
  86. },
  87. {
  88. id: 10,
  89. parentId: 9,
  90. title: '菜单1',
  91. component: '/menu/menu1',
  92. path: '/menu/menu1',
  93. name: 'MenuMenu11',
  94. keepAlive: true,
  95. locale: 'menu.menu.menu1',
  96. },
  97. {
  98. id: 11,
  99. parentId: 9,
  100. title: '菜单2',
  101. component: '/menu/menu2',
  102. path: '/menu/menu2',
  103. keepAlive: true,
  104. locale: 'menu.menu.menu2',
  105. },
  106. {
  107. id: 12,
  108. parentId: 9,
  109. path: '/menu/menu3',
  110. redirect: '/menu/menu3/menu1',
  111. title: '菜单1-1',
  112. component: 'RouteView',
  113. locale: 'menu.menu.menu3',
  114. },
  115. {
  116. id: 13,
  117. parentId: 12,
  118. path: '/menu/menu3/menu1',
  119. component: '/menu/menu-1-1/menu1',
  120. title: '菜单1-1-1',
  121. keepAlive: true,
  122. locale: 'menu.menu3.menu1',
  123. },
  124. {
  125. id: 14,
  126. parentId: 12,
  127. path: '/menu/menu3/menu2',
  128. component: '/menu/menu-1-1/menu2',
  129. title: '菜单1-1-2',
  130. keepAlive: true,
  131. locale: 'menu.menu3.menu2',
  132. },
  133. {
  134. id: 15,
  135. path: '/access',
  136. component: 'RouteView',
  137. redirect: '/access/common',
  138. title: '权限模块',
  139. name: 'Access',
  140. parentId: null,
  141. icon: 'ClusterOutlined',
  142. locale: 'menu.access',
  143. },
  144. {
  145. id: 16,
  146. parentId: 15,
  147. path: '/access/common',
  148. title: '通用权限',
  149. name: 'AccessCommon',
  150. component: '/access/common',
  151. locale: 'menu.access.common',
  152. },
  153. {
  154. id: 17,
  155. parentId: 15,
  156. path: '/access/user',
  157. title: '普通用户',
  158. name: 'AccessUser',
  159. component: '/access/user',
  160. locale: 'menu.access.user',
  161. },
  162. {
  163. id: 19,
  164. parentId: null,
  165. title: '异常页',
  166. icon: 'WarningOutlined',
  167. component: 'RouteView',
  168. redirect: '/exception/403',
  169. path: '/exception',
  170. name: 'Exception',
  171. locale: 'menu.exception',
  172. },
  173. {
  174. id: 20,
  175. parentId: 19,
  176. path: '/exception/403',
  177. title: '403',
  178. name: '403',
  179. component: '/exception/403',
  180. locale: 'menu.exception.not-permission',
  181. },
  182. {
  183. id: 21,
  184. parentId: 19,
  185. path: '/exception/404',
  186. title: '404',
  187. name: '404',
  188. component: '/exception/404',
  189. locale: 'menu.exception.not-find',
  190. },
  191. {
  192. id: 22,
  193. parentId: 19,
  194. path: '/exception/500',
  195. title: '500',
  196. name: '500',
  197. component: '/exception/500',
  198. locale: 'menu.exception.server-error',
  199. },
  200. {
  201. id: 23,
  202. parentId: null,
  203. title: '结果页',
  204. icon: 'CheckCircleOutlined',
  205. component: 'RouteView',
  206. redirect: '/result/success',
  207. path: '/result',
  208. name: 'Result',
  209. locale: 'menu.result',
  210. },
  211. {
  212. id: 24,
  213. parentId: 23,
  214. path: '/result/success',
  215. title: '成功页',
  216. name: 'ResultSuccess',
  217. component: '/result/success',
  218. locale: 'menu.result.success',
  219. },
  220. {
  221. id: 25,
  222. parentId: 23,
  223. path: '/result/fail',
  224. title: '失败页',
  225. name: 'ResultFail',
  226. component: '/result/fail',
  227. locale: 'menu.result.fail',
  228. },
  229. {
  230. id: 26,
  231. parentId: null,
  232. title: '列表页',
  233. icon: 'TableOutlined',
  234. component: 'RouteView',
  235. redirect: '/list/card-list',
  236. path: '/list',
  237. name: 'List',
  238. locale: 'menu.list',
  239. },
  240. {
  241. id: 27,
  242. parentId: 26,
  243. path: '/list/card-list',
  244. title: '卡片列表',
  245. name: 'ListCard',
  246. component: '/list/card-list',
  247. locale: 'menu.list.card-list',
  248. },
  249. {
  250. id: 28,
  251. parentId: null,
  252. title: '详情页',
  253. icon: 'ProfileOutlined',
  254. component: 'RouteView',
  255. redirect: '/profile/basic',
  256. path: '/profile',
  257. name: 'Profile',
  258. locale: 'menu.profile',
  259. },
  260. {
  261. id: 29,
  262. parentId: 28,
  263. path: '/profile/basic',
  264. title: '基础详情页',
  265. name: 'ProfileBasic',
  266. component: '/profile/basic/index',
  267. locale: 'menu.profile.basic',
  268. },
  269. {
  270. id: 30,
  271. parentId: 26,
  272. path: '/list/search-list',
  273. title: '搜索列表',
  274. name: 'SearchList',
  275. component: '/list/search-list',
  276. locale: 'menu.list.search-list',
  277. },
  278. {
  279. id: 31,
  280. parentId: 30,
  281. path: '/list/search-list/articles',
  282. title: '搜索列表(文章)',
  283. name: 'SearchListArticles',
  284. component: '/list/search-list/articles',
  285. locale: 'menu.list.search-list.articles',
  286. },
  287. {
  288. id: 32,
  289. parentId: 30,
  290. path: '/list/search-list/projects',
  291. title: '搜索列表(项目)',
  292. name: 'SearchListProjects',
  293. component: '/list/search-list/projects',
  294. locale: 'menu.list.search-list.projects',
  295. },
  296. {
  297. id: 33,
  298. parentId: 30,
  299. path: '/list/search-list/applications',
  300. title: '搜索列表(应用)',
  301. name: 'SearchListApplications',
  302. component: '/list/search-list/applications',
  303. locale: 'menu.list.search-list.applications',
  304. },
  305. {
  306. id: 34,
  307. parentId: 26,
  308. path: '/list/basic-list',
  309. title: '标准列表',
  310. name: 'BasicCard',
  311. component: '/list/basic-list',
  312. locale: 'menu.list.basic-list',
  313. },
  314. {
  315. id: 35,
  316. parentId: 28,
  317. path: '/profile/advanced',
  318. title: '高级详细页',
  319. name: 'ProfileAdvanced',
  320. component: '/profile/advanced/index',
  321. locale: 'menu.profile.advanced',
  322. },
  323. {
  324. id: 4,
  325. parentId: 3,
  326. title: '基础表单',
  327. component: '/form/basic-form/index',
  328. path: '/form/basic-form',
  329. name: 'FormBasic',
  330. keepAlive: false,
  331. locale: 'menu.form.basic-form',
  332. },
  333. {
  334. id: 36,
  335. parentId: null,
  336. title: '个人页',
  337. icon: 'UserOutlined',
  338. component: 'RouteView',
  339. redirect: '/account/center',
  340. path: '/account',
  341. name: 'Account',
  342. locale: 'menu.account',
  343. },
  344. {
  345. id: 37,
  346. parentId: 36,
  347. path: '/account/center',
  348. title: '个人中心',
  349. name: 'AccountCenter',
  350. component: '/account/center',
  351. locale: 'menu.account.center',
  352. },
  353. {
  354. id: 38,
  355. parentId: 36,
  356. path: '/account/settings',
  357. title: '个人设置',
  358. name: 'AccountSettings',
  359. component: '/account/settings',
  360. locale: 'menu.account.settings',
  361. },
  362. {
  363. id: 39,
  364. parentId: 3,
  365. title: '分步表单',
  366. component: '/form/step-form/index',
  367. path: '/form/step-form',
  368. name: 'FormStep',
  369. keepAlive: false,
  370. locale: 'menu.form.step-form',
  371. },
  372. {
  373. id: 40,
  374. parentId: 3,
  375. title: '高级表单',
  376. component: '/form/advanced-form/index',
  377. path: '/form/advanced-form',
  378. name: 'FormAdvanced',
  379. keepAlive: false,
  380. locale: 'menu.form.advanced-form',
  381. },
  382. {
  383. id: 41,
  384. parentId: 26,
  385. path: '/list/table-list',
  386. title: '查询表格',
  387. name: 'ConsultTable',
  388. component: '/list/table-list',
  389. locale: 'menu.list.consult-table',
  390. },
  391. {
  392. id: 42,
  393. parentId: 1,
  394. title: '监控页',
  395. component: '/dashboard/monitor',
  396. path: '/dashboard/monitor',
  397. name: 'DashboardMonitor',
  398. keepAlive: true,
  399. locale: 'menu.dashboard.monitor',
  400. },
  401. {
  402. id: 43,
  403. parentId: 1,
  404. title: '工作台',
  405. component: '/dashboard/workplace',
  406. path: '/dashboard/workplace',
  407. name: 'DashboardWorkplace',
  408. keepAlive: true,
  409. locale: 'menu.dashboard.workplace',
  410. },
  411. {
  412. id: 44,
  413. parentId: 26,
  414. path: '/list/crud-table',
  415. title: '增删改查表格',
  416. name: 'CrudTable',
  417. component: '/list/crud-table',
  418. locale: 'menu.list.crud-table',
  419. },
  420. {
  421. id: 45,
  422. parentId: 9,
  423. path: '/menu/menu4',
  424. redirect: '/menu/menu4/menu1',
  425. title: '菜单2-1',
  426. component: 'RouteView',
  427. locale: 'menu.menu.menu4',
  428. },
  429. {
  430. id: 46,
  431. parentId: 45,
  432. path: '/menu/menu4/menu1',
  433. component: '/menu/menu-2-1/menu1',
  434. title: '菜单2-1-1',
  435. keepAlive: true,
  436. locale: 'menu.menu4.menu1',
  437. },
  438. {
  439. id: 47,
  440. parentId: 45,
  441. path: '/menu/menu4/menu2',
  442. component: '/menu/menu-2-1/menu2',
  443. title: '菜单2-1-2',
  444. keepAlive: true,
  445. locale: 'menu.menu4.menu2',
  446. },
  447. {
  448. id: 48,
  449. parentId: null,
  450. title: '网关组管理',
  451. icon: 'ControlOutlined',
  452. component: 'RouteView',
  453. path: '/gateway',
  454. redirect: '/menu/ip-list',
  455. name: 'GatewayManagement',
  456. locale: 'menu.gateway',
  457. },
  458. {
  459. id: 49,
  460. parentId: 48,
  461. title: 'IP列表',
  462. path: '/menu/ip-list',
  463. name: 'IpList',
  464. component: '/gateway/ip-list',
  465. locale: 'menu.gateway.ip-list',
  466. hidden: true,
  467. },
  468. ]
  469. export const accessMenuData = [
  470. {
  471. id: 18,
  472. parentId: 15,
  473. path: '/access/admin',
  474. title: '管理员',
  475. name: 'AccessAdmin',
  476. component: '/access/admin',
  477. locale: 'menu.access.admin',
  478. },
  479. ]
  480. export default eventHandler((event) => {
  481. const token = getHeader(event, 'Authorization')
  482. // eslint-disable-next-line node/prefer-global/buffer
  483. const username = Buffer.from(token as any, 'base64').toString('utf-8')
  484. return {
  485. code: 200,
  486. msg: '获取成功',
  487. data: [...menuData, ...(username === 'admin' ? accessMenuData : [])],
  488. }
  489. })