user.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import request from '@/utils/request'
  2. // 查询用户列表
  3. export function listUser(query) {
  4. return request({
  5. url: '/system/user/list',
  6. method: 'get',
  7. params: query
  8. })
  9. }
  10. // 查询用户详细
  11. export function getUser(userId) {
  12. return request({
  13. url: '/system/user/' + userId,
  14. method: 'get'
  15. })
  16. }
  17. // 新增用户
  18. export function addUser(data) {
  19. return request({
  20. url: '/system/user',
  21. method: 'post',
  22. data: data
  23. })
  24. }
  25. // 修改用户
  26. export function updateUser(data) {
  27. return request({
  28. url: '/system/user',
  29. method: 'put',
  30. data: data
  31. })
  32. }
  33. // 删除用户
  34. export function delUser(userId) {
  35. return request({
  36. url: '/system/user/' + userId,
  37. method: 'delete'
  38. })
  39. }
  40. // 用户密码重置
  41. export function resetUserPwd(userId, password) {
  42. const data = {
  43. userId,
  44. password
  45. }
  46. return request({
  47. url: '/system/user/resetPwd',
  48. method: 'put',
  49. data: data
  50. })
  51. }
  52. // 用户状态修改
  53. export function changeUserStatus(userId, status) {
  54. const data = {
  55. userId,
  56. status
  57. }
  58. return request({
  59. url: '/system/user/changeStatus',
  60. method: 'put',
  61. data: data
  62. })
  63. }
  64. // 查询用户个人信息
  65. export function getUserProfile() {
  66. return request({
  67. url: '/system/user/profile',
  68. method: 'get'
  69. })
  70. }
  71. // 修改用户个人信息
  72. export function updateUserProfile(data) {
  73. return request({
  74. url: '/system/user/profile',
  75. method: 'put',
  76. data: data
  77. })
  78. }
  79. // 用户密码重置
  80. export function updateUserPwd(oldPassword, newPassword) {
  81. const data = {
  82. oldPassword,
  83. newPassword
  84. }
  85. return request({
  86. url: '/system/user/profile/updatePwd',
  87. method: 'put',
  88. params: data
  89. })
  90. }
  91. // 用户头像上传
  92. export function uploadAvatar(data) {
  93. return request({
  94. url: '/system/user/profile/avatar',
  95. method: 'post',
  96. data: data
  97. })
  98. }