user.js 1.7 KB

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