auth.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * 用户名登录
  3. */
  4. export function usernameLogin(data: AnyObject) {
  5. return request.get('login', data)
  6. }
  7. /**
  8. * 手机验证码登录
  9. */
  10. export function mobileLogin(data: AnyObject) {
  11. return request.post('login/mobile', data)
  12. }
  13. /**
  14. * 获取登录配置
  15. */
  16. export function getConfig() {
  17. return request.get('login/config')
  18. }
  19. /**
  20. * 退出登录
  21. */
  22. export function logout() {
  23. return request.put('auth/logout')
  24. }
  25. /**
  26. * 用户名注册
  27. */
  28. export function usernameRegister(data: AnyObject) {
  29. let url = 'register'
  30. data.pid && (url += `?pid=${data.pid}`)
  31. return request.post(url, data)
  32. }
  33. /**
  34. * 手机号注册
  35. */
  36. export function mobileRegister(data: AnyObject) {
  37. let url = 'register/mobile'
  38. data.pid && (url += `?pid=${data.pid}`)
  39. return request.post(url, data)
  40. }
  41. /**
  42. * 微信公众号授权登录
  43. */
  44. export function wechatLogin(data: AnyObject) {
  45. return request.post('wechat/login', data)
  46. }
  47. /**
  48. * 微信公众号授权登录
  49. */
  50. export function weappLogin(data: AnyObject) {
  51. return request.post('weapp/login', data)
  52. }
  53. /**
  54. * 绑定手机号
  55. */
  56. export function bind(data: AnyObject) {
  57. let url = 'bind'
  58. data.pid && (url += `?pid=${data.pid}`)
  59. return request.post(url, data)
  60. }
  61. /**
  62. * 扫码登录
  63. */
  64. export function scanlogin() {
  65. return request.post('wechat/scanlogin')
  66. }
  67. /**
  68. * 校验扫码信息
  69. */
  70. export function checkscan(data: AnyObject) {
  71. return request.get('checkscan', data)
  72. }
  73. /**
  74. * 校验扫码信息
  75. */
  76. export function wechatCheck() {
  77. return request.get('wechat/check')
  78. }