user.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import Mock from 'mockjs';
  2. import { resultSuccess } from '../_util';
  3. const Random = Mock.Random;
  4. const token = Random.string('upper', 32, 32);
  5. const adminInfo = {
  6. userId: '1',
  7. username: 'admin',
  8. realName: 'Admin',
  9. avatar: Random.image(),
  10. desc: 'manager',
  11. password: Random.string('upper', 4, 16),
  12. token,
  13. permissions: [
  14. {
  15. label: '主控台',
  16. value: 'dashboard_console',
  17. },
  18. {
  19. label: '监控页',
  20. value: 'dashboard_monitor',
  21. },
  22. {
  23. label: '工作台',
  24. value: 'dashboard_workplace',
  25. },
  26. {
  27. label: '基础列表',
  28. value: 'basic_list',
  29. },
  30. {
  31. label: '基础列表删除',
  32. value: 'basic_list_delete',
  33. },
  34. ],
  35. };
  36. export default [
  37. {
  38. url: '/api/login',
  39. timeout: 1000,
  40. method: 'post',
  41. response: () => {
  42. return resultSuccess({ token });
  43. },
  44. },
  45. {
  46. url: '/api/admin_info',
  47. timeout: 1000,
  48. method: 'get',
  49. response: () => {
  50. // const token = getRequestToken(request);
  51. // if (!token) return resultError('Invalid token');
  52. return resultSuccess(adminInfo);
  53. },
  54. },
  55. ];