user.ts 2.3 KB

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