auth.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import request from '@/sheep/request';
  2. const AuthUtil = {
  3. // 使用手机 + 验证码登录
  4. smsLogin: (data) => {
  5. return request({
  6. url: '/app-api/member/auth/sms-login',
  7. method: 'POST',
  8. data,
  9. custom: {
  10. showSuccess: true,
  11. loadingMsg: '登录中',
  12. successMsg: '登录成功',
  13. },
  14. });
  15. },
  16. // 发送手机验证码
  17. sendSmsCode: (mobile, scene) => {
  18. return request({
  19. url: '/app-api/member/auth/send-sms-code',
  20. method: 'POST',
  21. data: {
  22. mobile,
  23. scene,
  24. },
  25. custom: {
  26. loadingMsg: '发送中',
  27. showSuccess: true,
  28. successMsg: '发送成功',
  29. },
  30. });
  31. },
  32. // 登出系统
  33. logout: () => {
  34. return request({
  35. url: '/app-api/member/auth/logout',
  36. method: 'POST',
  37. });
  38. },
  39. // 创建微信 JS SDK 初始化所需的签名
  40. createWeixinMpJsapiSignature: (url) => {
  41. return request({
  42. url: '/app-api/member/auth/create-weixin-jsapi-signature',
  43. method: 'POST',
  44. params: {
  45. url
  46. },
  47. custom: {
  48. showError: false,
  49. showLoading: false,
  50. },
  51. })
  52. },
  53. };
  54. export default AuthUtil;