index.ts 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. import { config } from '@/config/axios/config'
  2. import { MockMethod } from 'vite-plugin-mock'
  3. const { result_code } = config
  4. const timeout = 0
  5. const adminList = [
  6. {
  7. path: '/dashboard',
  8. component: '#',
  9. redirect: '/dashboard/analysis',
  10. name: 'Dashboard',
  11. meta: {
  12. title: '首页',
  13. icon: 'ant-design:dashboard-filled',
  14. alwaysShow: true
  15. },
  16. children: [
  17. {
  18. path: 'analysis',
  19. component: 'views/Dashboard/Analysis',
  20. name: 'Analysis',
  21. meta: {
  22. title: 'router.analysis',
  23. noCache: true
  24. }
  25. },
  26. {
  27. path: 'workplace',
  28. component: 'views/Dashboard/Workplace',
  29. name: 'Workplace',
  30. meta: {
  31. title: 'router.workplace',
  32. noCache: true
  33. }
  34. }
  35. ]
  36. },
  37. {
  38. path: '/example',
  39. component: '#',
  40. redirect: '/example/example-page',
  41. name: 'Example',
  42. meta: {
  43. title: '示例',
  44. icon: 'ep:management',
  45. alwaysShow: true
  46. },
  47. children: [
  48. {
  49. path: 'example-page',
  50. component: 'views/Example/Page/ExamplePage',
  51. name: 'ExamplePage',
  52. meta: {
  53. title: 'router.examplePage'
  54. }
  55. },
  56. {
  57. path: 'example-add',
  58. component: 'views/Example/Page/ExampleAdd',
  59. name: 'ExampleAdd',
  60. meta: {
  61. title: 'router.exampleAdd',
  62. noTagsView: true,
  63. noCache: true,
  64. hidden: true,
  65. canTo: true,
  66. activeMenu: '/example/example-page'
  67. }
  68. },
  69. {
  70. path: 'example-edit',
  71. component: 'views/Example/Page/ExampleEdit',
  72. name: 'ExampleEdit',
  73. meta: {
  74. title: 'router.exampleEdit',
  75. noTagsView: true,
  76. noCache: true,
  77. hidden: true,
  78. canTo: true,
  79. activeMenu: '/example/example-page'
  80. }
  81. },
  82. {
  83. path: 'example-detail',
  84. component: 'views/Example/Page/ExampleDetail',
  85. name: 'ExampleDetail',
  86. meta: {
  87. title: 'router.exampleDetail',
  88. noTagsView: true,
  89. noCache: true,
  90. hidden: true,
  91. canTo: true,
  92. activeMenu: '/example/example-page'
  93. }
  94. }
  95. ]
  96. },
  97. {
  98. path: '/manage',
  99. component: '#',
  100. redirect: '/manage/news',
  101. name: 'Manage',
  102. meta: {
  103. title: '模块管理',
  104. icon: 'ep:menu',
  105. alwaysShow: true
  106. },
  107. children: [
  108. {
  109. path: 'news-page',
  110. component: 'views/Manage/News/NewsPage',
  111. name: 'NewsPage',
  112. meta: {
  113. title: '新闻管理'
  114. }
  115. },
  116. {
  117. path: 'news-add',
  118. component: 'views/Manage/News/NewsAdd',
  119. name: 'NewsAdd',
  120. meta: {
  121. title: '新闻新增',
  122. noTagsView: true,
  123. noCache: true,
  124. hidden: true,
  125. canTo: true,
  126. activeMenu: '/manage/news-page'
  127. }
  128. },
  129. {
  130. path: 'news-edit',
  131. component: 'views/Manage/News/NewsEdit',
  132. name: 'NewsEdit',
  133. meta: {
  134. title: '新闻编辑',
  135. noTagsView: true,
  136. noCache: true,
  137. hidden: true,
  138. canTo: true,
  139. activeMenu: '/manage/news-page'
  140. }
  141. },
  142. {
  143. path: 'news-detail',
  144. component: 'views/Manage/News/NewsDetail',
  145. name: 'NewsDetail',
  146. meta: {
  147. title: '新闻详情',
  148. noTagsView: true,
  149. noCache: true,
  150. hidden: true,
  151. canTo: true,
  152. activeMenu: '/manage/news-page'
  153. }
  154. },
  155. {
  156. path: 'product-page',
  157. component: 'views/Manage/Product/ProductPage',
  158. name: 'ProductPage',
  159. meta: {
  160. title: '产品管理',
  161. activeMenu: '/manage/product-page'
  162. }
  163. },
  164. {
  165. path: 'product-add',
  166. component: 'views/Manage/Product/ProductAdd',
  167. name: 'ProductAdd',
  168. meta: {
  169. title: '产品新增',
  170. noTagsView: true,
  171. noCache: true,
  172. hidden: true,
  173. canTo: true,
  174. activeMenu: '/manage/product-page'
  175. }
  176. },
  177. {
  178. path: 'product-edit',
  179. component: 'views/Manage/Product/ProductEdit',
  180. name: 'ProductEdit',
  181. meta: {
  182. title: '产品编辑',
  183. noTagsView: true,
  184. noCache: true,
  185. hidden: true,
  186. canTo: true,
  187. activeMenu: '/manage/product-page'
  188. }
  189. },
  190. {
  191. path: 'product-detail',
  192. component: 'views/Manage/Product/ProductDetail',
  193. name: 'ProductDetail',
  194. meta: {
  195. title: '产品详情',
  196. noTagsView: true,
  197. noCache: true,
  198. hidden: true,
  199. canTo: true,
  200. activeMenu: '/manage/product-page'
  201. }
  202. },
  203. ]
  204. },
  205. {
  206. path: '/setting',
  207. component: '#',
  208. redirect: '/setting/menu',
  209. name: 'Setting',
  210. meta: {
  211. title: '系统设置',
  212. icon: 'ep:setting',
  213. alwaysShow: true
  214. },
  215. children: [
  216. {
  217. path: 'menu-page',
  218. component: 'views/Setting/Menu/MenuPage',
  219. name: 'MenuPage',
  220. meta: {
  221. title: '菜单管理'
  222. }
  223. },
  224. {
  225. path: 'menu-add',
  226. component: 'views/Setting/Menu/MenuAdd',
  227. name: 'MenuAdd',
  228. meta: {
  229. title: '菜单新增',
  230. noTagsView: true,
  231. noCache: true,
  232. hidden: true,
  233. canTo: true,
  234. activeMenu: '/setting/menu-page'
  235. }
  236. },
  237. {
  238. path: 'menu-edit',
  239. component: 'views/Setting/Menu/MenuEdit',
  240. name: 'MenuEdit',
  241. meta: {
  242. title: '菜单编辑',
  243. noTagsView: true,
  244. noCache: true,
  245. hidden: true,
  246. canTo: true,
  247. activeMenu: '/setting/menu-page'
  248. }
  249. },
  250. {
  251. path: 'menu-detail',
  252. component: 'views/Setting/Menu/MenuDetail',
  253. name: 'MenuDetail',
  254. meta: {
  255. title: '菜单详情',
  256. noTagsView: true,
  257. noCache: true,
  258. hidden: true,
  259. canTo: true,
  260. activeMenu: '/setting/menu-page'
  261. }
  262. },
  263. {
  264. path: 'user-page',
  265. component: 'views/Setting/User/UserPage',
  266. name: 'UserPage',
  267. meta: {
  268. title: '用户管理',
  269. activeMenu: '/setting/user-page'
  270. }
  271. },
  272. {
  273. path: 'user-add',
  274. component: 'views/Setting/User/UserAdd',
  275. name: 'UserAdd',
  276. meta: {
  277. title: '用户新增',
  278. noTagsView: true,
  279. noCache: true,
  280. hidden: true,
  281. canTo: true,
  282. activeMenu: '/setting/user-page'
  283. }
  284. },
  285. {
  286. path: 'user-edit',
  287. component: 'views/Setting/User/UserEdit',
  288. name: 'UserEdit',
  289. meta: {
  290. title: '用户编辑',
  291. noTagsView: true,
  292. noCache: true,
  293. hidden: true,
  294. canTo: true,
  295. activeMenu: '/setting/user-page'
  296. }
  297. },
  298. {
  299. path: 'user-detail',
  300. component: 'views/Setting/User/UserDetail',
  301. name: 'UserDetail',
  302. meta: {
  303. title: '用户详情',
  304. noTagsView: true,
  305. noCache: true,
  306. hidden: true,
  307. canTo: true,
  308. activeMenu: '/setting/user-page'
  309. }
  310. },
  311. ]
  312. }
  313. ]
  314. const testList: string[] = [
  315. '/dashboard',
  316. '/dashboard/analysis',
  317. '/dashboard/workplace',
  318. 'external-link',
  319. 'https://element-plus-admin-doc.cn/',
  320. '/guide',
  321. '/guide/index',
  322. '/components',
  323. '/components/form',
  324. '/components/form/default-form',
  325. '/components/form/use-form',
  326. '/components/form/ref-form',
  327. '/components/table',
  328. '/components/table/default-table',
  329. '/components/table/use-table',
  330. '/components/table/ref-table',
  331. '/components/editor-demo',
  332. '/components/editor-demo/editor',
  333. '/components/search',
  334. '/components/descriptions',
  335. '/components/image-viewer',
  336. '/components/dialog',
  337. '/components/icon',
  338. '/components/echart',
  339. '/components/count-to',
  340. '/components/qrcode',
  341. '/components/highlight',
  342. '/components/infotip',
  343. '/Components/InputPassword',
  344. '/Components/Sticky',
  345. '/hooks',
  346. '/hooks/useWatermark',
  347. '/hooks/useCrudSchemas',
  348. '/level',
  349. '/level/menu1',
  350. '/level/menu1/menu1-1',
  351. '/level/menu1/menu1-1/menu1-1-1',
  352. '/level/menu1/menu1-2',
  353. '/level/menu2',
  354. '/example',
  355. '/example/example-dialog',
  356. '/example/example-page',
  357. '/example/example-add',
  358. '/example/example-edit',
  359. '/example/example-detail',
  360. '/error',
  361. '/error/404-demo',
  362. '/error/403-demo',
  363. '/error/500-demo'
  364. ]
  365. export default [
  366. // 列表接口
  367. {
  368. url: '/role/list',
  369. method: 'get',
  370. timeout,
  371. response: ({ query }) => {
  372. const { roleName } = query
  373. return {
  374. code: result_code,
  375. data: roleName === 'admin' ? adminList : testList
  376. }
  377. }
  378. }
  379. ] as MockMethod[]