user.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { useMyRequest } from '~/composables/useFetchRequest'
  2. enum Api {
  3. Login = '/client-s003/s003Customer/login',
  4. UserInfo = '/client/user/userinfo',
  5. Logout = '/client/user/logout',
  6. Register = '/client/user/preRegister',
  7. ValidateRegister = '/client/user/register',
  8. ValidateEmail = '/client/user/forgetPassword',
  9. ResetOrChangePassword = '/client/user/changePassword',
  10. ValidateEmailIsExist = '/client-s003/s003Customer/lastLoginType',
  11. SendEmailCode = '/client-s003/captcha/sms/send',
  12. }
  13. /**
  14. * 验证邮箱是否存在
  15. */
  16. export async function validateEmailIsExistApi(params: any) {
  17. return await useMyRequest().get(Api.ValidateEmailIsExist, params)
  18. }
  19. /**
  20. * 验证邮箱是否存在
  21. */
  22. export async function getEmailCodeApi(params: any) {
  23. return await useMyRequest().post(Api.SendEmailCode, params)
  24. }
  25. /**
  26. * @description: user login api
  27. */
  28. export async function loginApi(params: any) {
  29. return await useMyRequest().post(Api.Login, params)
  30. }
  31. /**
  32. * 预注册
  33. * @param params
  34. * @param mode
  35. * @returns
  36. */
  37. export async function registerApi(params: any) {
  38. return await useMyRequest().post(Api.Register, params)
  39. }
  40. /**
  41. * 注册
  42. * @param params
  43. * @returns
  44. */
  45. export async function validateRegisterApi(params: any) {
  46. return await useMyRequest().post(Api.ValidateRegister, params)
  47. }
  48. /**
  49. * 忘记密码,发送邮箱
  50. * @param params
  51. * @returns
  52. */
  53. export async function validateEmailApi(params: any) {
  54. return await useMyRequest().post(Api.ValidateEmail, params)
  55. }
  56. /**
  57. * 更新用户信息
  58. * @param params
  59. * @returns
  60. */
  61. export async function updateUserInfoApi(params: any) {
  62. return await useMyRequest().post(Api.UserInfo, params)
  63. }
  64. /**
  65. * 重置密码
  66. * @param params
  67. * @returns
  68. */
  69. export async function resetOrChangePasswordApi(params: any) {
  70. return await useMyRequest().post(Api.ResetOrChangePassword, params)
  71. }
  72. /**
  73. * @description: getUserInfo
  74. */
  75. export async function getUserProfileApi() {
  76. return await useMyRequest().get(Api.UserInfo)
  77. }
  78. export async function logoutApi() {
  79. return await useMyRequest().get(Api.Logout)
  80. }