login.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * @Author:
  3. * @Date: 2023-09-27 14:33:29
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2024-01-03 14:16:53
  6. * @Description: kxs files
  7. * @filePath:
  8. */
  9. // 根据角色动态生成路由
  10. import { MockMethod } from "vite-plugin-mock";
  11. export default [
  12. {
  13. url: "/login",
  14. method: "post",
  15. response: () => {
  16. return {
  17. status: '1',
  18. data: {
  19. SysAdminId: "1",
  20. realName: "admin",
  21. // 一个用户可能有多个角色
  22. roles: ["1"],
  23. accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
  24. refreshToken: "eyJhbGciOiJIUzUxMiJ9.adm inRefresh",
  25. expires: "2023/10/30 00:00:00",
  26. rightList: [],
  27. }
  28. };
  29. }
  30. },
  31. {
  32. url: "/refreshtoken",
  33. method: "post",
  34. response: () => {
  35. return {
  36. status: '1',
  37. data: {
  38. SysAdminId: "1",
  39. realName: "admin",
  40. // 一个用户可能有多个角色
  41. roles: ["1"],
  42. accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
  43. refreshToken: "eyJhbGciOiJIUzUxMiJ9.adm inRefresh",
  44. expires: "2023/10/30 00:00:00",
  45. rightList: [],
  46. }
  47. };
  48. }
  49. }
  50. ] as MockMethod[];