user.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import type { UserInfo } from '~/stores/use-transfer-store'
  2. import { post, get } from '@/utils/request';
  3. export interface LoginParams {
  4. loginName: string
  5. password: string
  6. }
  7. export interface TokenInfo {
  8. data: string
  9. }
  10. export interface RegisterParams extends LoginParams {
  11. email: string
  12. phone: string
  13. }
  14. export interface ResetPasswordParams {
  15. email: string
  16. code: string
  17. newPassword: string
  18. }
  19. export const userApi = {
  20. // 登录
  21. login: (params: LoginParams) => {
  22. return post<string>('/custom/login', params)
  23. },
  24. // 获取用户信息
  25. getUserInfo: () => {
  26. return post<UserInfo>('/custom/info')
  27. },
  28. // 获取用户信息
  29. getUserSingle: () => {
  30. return post<UserInfo>('/wasabi/api/merchant/user/single', {
  31. // uniqueId: '63dbefafc83e4b47bc2364a8f6266450',
  32. })
  33. },
  34. // 退出登录
  35. logout: () => {
  36. return post('/custom/logout', {})
  37. },
  38. // 忘记密码
  39. forgetPwd: (params: { email: string }) => {
  40. return post('/custom/update/password/send/email', params)
  41. },
  42. // 账户
  43. accountDropdown: (params = {}) => {
  44. return post('/wasabi/api/account/dropdown', params)
  45. },
  46. // 修改密码
  47. updateEmailPassword: (params = {}) => {
  48. return post('/custom/update/login/password', params)
  49. },
  50. // 获取客户经理信息
  51. getManagerInfo: () => {
  52. return post('/chat/get/manager/info', {})
  53. },
  54. // 获取APP扫描登录
  55. getAppScanLogin: () => {
  56. return post('/custom/app/scan/login/create', {})
  57. },
  58. // 扫码确认
  59. confirmAppScanLogin: (params: { scene: string }) => {
  60. return post('/custom/app/scan/login/confirm', params)
  61. },
  62. // 查询扫码状态
  63. getAppScanLoginStatus: (params: { scene: string }) => {
  64. return post('/custom/app/scan/login/status', params)
  65. },
  66. // 更新扫码状态
  67. updateAppScanLoginStatus: (params: { scene: string; status: string }) => {
  68. return post('/custom/app/scan/login/status/update', params)
  69. },
  70. }