平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

103 lines
1.7 KiB

  1. import http from '@/http/api.js'
  2. // 获取token
  3. const token = (tenantId, username, password, type) => {
  4. return http.request({
  5. url: '/api/blade-auth/oauth/token',
  6. method: 'POST',
  7. header: {
  8. 'Tenant-Id': tenantId
  9. },
  10. params: {
  11. tenantId,
  12. username,
  13. password,
  14. grant_type: "password",
  15. scope: "all",
  16. type
  17. }
  18. })
  19. }
  20. const getTenantId = (params) => {
  21. return http.request({
  22. url: '/api/blade-auth/oauth/getTenantId',
  23. method: 'get',
  24. params: {
  25. ...params
  26. }
  27. })
  28. }
  29. const refreshToken = (refresh_token, tenantId) => {
  30. return http.request({
  31. url: '/api/blade-auth/oauth/token',
  32. method: 'post',
  33. header: {
  34. 'Tenant-Id': tenantId
  35. },
  36. params: {
  37. tenantId,
  38. refresh_token,
  39. grant_type: "refresh_token",
  40. scope: "all",
  41. }
  42. })
  43. }
  44. // 获取用户信息
  45. const userInfo = () => {
  46. return http.request({
  47. url: '/api/blade-user/info',
  48. method: 'GET',
  49. })
  50. }
  51. // 获取用户信息
  52. export const getUser = (id) => {
  53. return http.request({
  54. url: '/api/blade-user/detail',
  55. method: 'GET',
  56. params: { id }
  57. })
  58. }
  59. export const getUserInfo = () => {
  60. return http.request({
  61. url: '/api/blade-user/info',
  62. method: 'get',
  63. })
  64. }
  65. /* 修改用户信息 */
  66. const updateInfo = (row) => {
  67. return http.request({
  68. url: '/api/blade-user/update-info',
  69. method: 'post',
  70. data: row
  71. })
  72. }
  73. // 修改密码
  74. const updatePassword = (data) => {
  75. return http.request({
  76. url: '/api/blade-user/update-password',
  77. method: 'post',
  78. params: data
  79. })
  80. }
  81. // 修改密码
  82. const passwordCheck = (data) => {
  83. return http.request({
  84. url: '/api/blade-user/passwordCheck',
  85. method: 'post',
  86. params: data
  87. })
  88. }
  89. export default {
  90. token,
  91. userInfo,
  92. refreshToken,
  93. getTenantId,
  94. updatePassword,
  95. updateInfo,
  96. passwordCheck
  97. }