user.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import http from './interface'
  2. //手机号登录
  3. export const login = (data) => {
  4. return http.request({
  5. url: '/home/v1/login',
  6. method:'POST',
  7. data,
  8. })
  9. }
  10. //退出登录
  11. export const logout = () => {
  12. return http.request({
  13. url: '/home/v1/logout',
  14. method:'GET',
  15. })
  16. }
  17. //使用手机号注册账户
  18. export const phoneReg = (data) => {
  19. return http.request({
  20. url: '/home/v1/reg/phone',
  21. method:'POST',
  22. data,
  23. })
  24. }
  25. /**
  26. * 修改密码
  27. * oldPwd 原密码
  28. * newPwd 新密码
  29. */
  30. export const updatePassword = (data) => {
  31. return http.request({
  32. url: '/home/v1/password/update',
  33. method:'POST',
  34. data,
  35. })
  36. }
  37. /**
  38. * 密码验证
  39. * oldPwd 原密码
  40. * newPwd 新密码
  41. */
  42. export const passwordValidation = (data) => {
  43. return http.request({
  44. url: '/home/v1/password/validation',
  45. method:'POST',
  46. data,
  47. })
  48. }
  49. /**
  50. * 检查是否登录
  51. * oldPwd 原密码
  52. * newPwd 新密码
  53. */
  54. export const hasLogin = () => {
  55. return http.request({
  56. url: '/home/v1/user/islogin',
  57. method:'GET'
  58. })
  59. }
  60. /**
  61. * 更新手机号
  62. * phone 手机号
  63. * code 手机验证码
  64. */
  65. export const updatePhone = (data) =>{
  66. return http.request({
  67. url: '/home/v1/user/phone/update',
  68. method:'POST',
  69. data,
  70. })
  71. }
  72. export default {
  73. login,
  74. logout,
  75. phoneReg,
  76. updatePassword,
  77. passwordValidation,
  78. updatePhone,
  79. hasLogin
  80. }