account.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { MockMethod } from 'vite-plugin-mock';
  2. import { resultSuccess, resultError } from '../_util';
  3. import { ResultEnum } from '../../src/enums/httpEnum';
  4. const userInfo = {
  5. name: 'Vben',
  6. userid: '00000001',
  7. email: 'test@gmail.com',
  8. signature: '海纳百川,有容乃大',
  9. introduction: '微笑着,努力着,欣赏着',
  10. title: '交互专家',
  11. group: '某某某事业群-某某平台部-某某技术部-UED',
  12. tags: [
  13. {
  14. key: '0',
  15. label: '很有想法的',
  16. },
  17. {
  18. key: '1',
  19. label: '专注设计',
  20. },
  21. {
  22. key: '2',
  23. label: '辣~',
  24. },
  25. {
  26. key: '3',
  27. label: '大长腿',
  28. },
  29. {
  30. key: '4',
  31. label: '川妹子',
  32. },
  33. {
  34. key: '5',
  35. label: '海纳百川',
  36. },
  37. ],
  38. notifyCount: 12,
  39. unreadCount: 11,
  40. country: 'China',
  41. address: 'Xiamen City 77',
  42. phone: '0592-268888888',
  43. };
  44. export default [
  45. {
  46. url: '/basic-api/account/getAccountInfo',
  47. timeout: 1000,
  48. method: 'get',
  49. response: () => {
  50. return resultSuccess(userInfo);
  51. },
  52. },
  53. {
  54. url: '/basic-api/user/sessionTimeout',
  55. method: 'post',
  56. statusCode: 401,
  57. response: () => {
  58. return resultError();
  59. },
  60. },
  61. {
  62. url: '/basic-api/user/tokenExpired',
  63. method: 'post',
  64. statusCode: 200,
  65. response: () => {
  66. return resultError('Token Expired!', { code: ResultEnum.TIMEOUT as number });
  67. },
  68. },
  69. ] as MockMethod[];