auth.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * 认证相关API
  3. */
  4. import request from './request'
  5. /**
  6. * 登录
  7. */
  8. /**
  9. * 登录参数
  10. */
  11. export interface LoginParams {
  12. mobile: string
  13. password?: string
  14. code?: string
  15. }
  16. /**
  17. * 登录
  18. */
  19. export function login(data: LoginParams) {
  20. return request({
  21. url: '/app-api/member/auth/login',
  22. method: 'post',
  23. data
  24. })
  25. }
  26. /**
  27. * 退出登录
  28. */
  29. export function logout() {
  30. return request({
  31. url: '/app-api/member/auth/logout',
  32. method: 'post'
  33. })
  34. }
  35. /**
  36. * 微信登录
  37. */
  38. export function wechatLogin(code: string) {
  39. return request({
  40. url: '/app-api/member/auth/auth-wechat-login',
  41. method: 'get',
  42. params: { code }
  43. })
  44. }
  45. /**
  46. * LINE登录
  47. */
  48. export function lineLogin(token: string) {
  49. return request({
  50. url: '/app-api/member/auth/line/login',
  51. method: 'post',
  52. data: { token }
  53. })
  54. }
  55. /**
  56. * 发送验证码参数
  57. */
  58. export interface SmsParams {
  59. mobile: string
  60. scene: number // 1: 登录, 2: 注册, 3: 忘记密码
  61. }
  62. /**
  63. * 发送短信验证码
  64. */
  65. export function sendSmsCode(data: SmsParams) {
  66. return request({
  67. url: '/app-api/member/auth/send-sms-code',
  68. method: 'post',
  69. data
  70. })
  71. }