index.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. }