index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import {httpApi} from "../../request/httpApi";
  2. import website from "@/config/index";
  3. import md5 from 'js-md5'
  4. export default {
  5. //分页数据
  6. async userLogin({tenantId, deptId, roleId, username, password, type, key, code}) {
  7. return httpApi({
  8. url: '/api/blade-auth/oauth/token',
  9. method: 'post',
  10. headers: {
  11. 'Tenant-Id': tenantId,
  12. 'Dept-Id': (website.switchMode ? deptId : ''),
  13. 'Role-Id': (website.switchMode ? roleId : ''),
  14. 'Captcha-Key': key,
  15. 'Captcha-Code': code,
  16. },
  17. params: {
  18. tenantId,
  19. username,
  20. password: md5(password),
  21. grant_type: (website.captchaMode ? "captcha" : "password"),
  22. scope: "all",
  23. type
  24. }
  25. })
  26. },
  27. async refreshToken({token, tenantId, deptId, roleId}) {
  28. return httpApi({
  29. url: '/api/blade-auth/oauth/token',
  30. method: 'post',
  31. headers: {
  32. 'Tenant-Id': tenantId,
  33. 'Dept-Id': (website.switchMode ? deptId : ''),
  34. 'Role-Id': (website.switchMode ? roleId : ''),
  35. },
  36. params: {
  37. tenantId,
  38. refresh_token: token,
  39. grant_type: 'refresh_token',
  40. scope: 'all',
  41. },
  42. })
  43. },
  44. async queryCurrentUserData() {
  45. return httpApi({
  46. url: '/api/blade-business/userViewProjectContract/queryCurrentUserData',
  47. method: 'post',
  48. data: {},
  49. })
  50. },
  51. //更新用户信息
  52. async updateUserInfo(form) {
  53. return httpApi({
  54. url: '/api/blade-user/update-info',
  55. method: 'post',
  56. data: form,
  57. })
  58. },
  59. async appQuerYownData(form) {
  60. return httpApi({
  61. url: '/api/blade-manager/managerHomePage/appqueryowndata',
  62. method: 'post',
  63. data: form,
  64. })
  65. },
  66. //修改密码
  67. async updatePassword(form) {
  68. return httpApi({
  69. url: '/api/blade-user/update-password',
  70. method: 'post',
  71. params: form,
  72. })
  73. },
  74. //用户配置详情
  75. async userConfigInfo(form) {
  76. return httpApi({
  77. url: '/api/blade-business/defaultConfig/detail',
  78. method: 'get',
  79. params: form,
  80. })
  81. },
  82. //用户配置保存
  83. async userConfigSave(form) {
  84. return httpApi({
  85. url: '/api/blade-business/defaultConfig/saveOrUpdate',
  86. method: 'post',
  87. data: form,
  88. })
  89. },
  90. async loginByToken (form) {
  91. return httpApi({
  92. url: '/api/blade-user/loginByToken',
  93. method: 'post',
  94. params: form, // 将 params 改为 data
  95. });
  96. },
  97. // 获取租户ID
  98. async getTenantID (domain) {
  99. return httpApi({
  100. url: '/api/blade-system/tenant/info',
  101. method: 'get',
  102. params: {
  103. domain,
  104. },
  105. });
  106. }
  107. }