user.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import request from '@/sheep/request';
  2. const UserApi = {
  3. // 获得基本信息
  4. getUserInfo: () => {
  5. return request({
  6. url: '/member/user/get',
  7. method: 'GET',
  8. custom: {
  9. showLoading: false,
  10. auth: true,
  11. },
  12. });
  13. },
  14. // 修改基本信息
  15. updateUser: (data) => {
  16. return request({
  17. url: '/member/user/update',
  18. method: 'PUT',
  19. data,
  20. custom: {
  21. auth: true,
  22. showSuccess: true,
  23. successMsg: '更新成功'
  24. },
  25. });
  26. },
  27. // 修改用户手机
  28. updateUserMobile: (data) => {
  29. return request({
  30. url: '/member/user/update-mobile',
  31. method: 'PUT',
  32. data,
  33. custom: {
  34. loadingMsg: '验证中',
  35. showSuccess: true,
  36. successMsg: '修改成功'
  37. },
  38. });
  39. },
  40. // 基于微信小程序的授权码,修改用户手机
  41. updateUserMobileByWeixin: (code) => {
  42. return request({
  43. url: '/member/user/update-mobile-by-weixin',
  44. method: 'PUT',
  45. data: {
  46. code
  47. },
  48. custom: {
  49. showSuccess: true,
  50. loadingMsg: '获取中',
  51. successMsg: '修改成功'
  52. },
  53. });
  54. },
  55. // 修改密码
  56. updateUserPassword: (data) => {
  57. return request({
  58. url: '/member/user/update-password',
  59. method: 'PUT',
  60. data,
  61. custom: {
  62. loadingMsg: '验证中',
  63. showSuccess: true,
  64. successMsg: '修改成功'
  65. },
  66. });
  67. },
  68. // 重置密码
  69. resetUserPassword: (data) => {
  70. return request({
  71. url: '/member/user/reset-password',
  72. method: 'PUT',
  73. data,
  74. custom: {
  75. loadingMsg: '验证中',
  76. showSuccess: true,
  77. successMsg: '修改成功'
  78. }
  79. });
  80. },
  81. };
  82. export default UserApi;