user.ts 962 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { MockMethod } from 'vite-plugin-mock'
  2. const baseUrl = '/api/mock/user'
  3. export default [
  4. {
  5. url: `${baseUrl}/login`,
  6. method: 'post',
  7. response: () => {
  8. return {
  9. code: 20000,
  10. result: { token: '123add' },
  11. message: '登录成功'
  12. }
  13. }
  14. },
  15. {
  16. url: `${baseUrl}/getUserInfo`,
  17. method: 'get',
  18. response: () => {
  19. return {
  20. code: 20000,
  21. result: {
  22. userId: 1,
  23. userName: '微茫',
  24. roles: [
  25. { value: 's_admin', roleName: '超级管理员' },
  26. { value: 'test', roleName: '测试角色' },
  27. { value: 'test1', roleName: '测试角色1' }
  28. ]
  29. },
  30. message: '获取用户信息成功'
  31. }
  32. }
  33. },
  34. {
  35. url: `${baseUrl}/logout`,
  36. method: 'get',
  37. response: () => {
  38. return {
  39. code: 20000,
  40. result: {},
  41. message: '登出成功'
  42. }
  43. }
  44. }
  45. ] as MockMethod[]