auth.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import request from "@/utils/request.js";
  2. // 发送手机验证码
  3. export function sendSmsCode(mobile, scene) {
  4. return request.post('app-api/member/auth/send-sms-code', {
  5. mobile,
  6. scene
  7. }, {
  8. noAuth: true // TODO 芋艿:后续要做调整
  9. });
  10. }
  11. // 校验手机验证码
  12. export function validateSmsCode(mobile, scene, code) {
  13. return request.post('app-api/member/auth/validate-sms-code', {
  14. mobile,
  15. scene,
  16. code
  17. });
  18. }
  19. // 登出系统
  20. export function logout() {
  21. return request.post('app-api/member/auth/logout');
  22. }
  23. // 使用手机 + 密码登录
  24. export function login(data) {
  25. return request.post('app-api/member/auth/login', data, {
  26. noAuth: true // TODO 芋艿:后续要做调整
  27. });
  28. }
  29. // 使用手机 + 验证码登录
  30. export function smsLogin(data) {
  31. return request.post('app-api/member/auth/sms-login', data, {
  32. noAuth: true // TODO 芋艿:后续要做调整
  33. });
  34. }
  35. // 社交快捷登录
  36. export function socialLogin(type, code, state) {
  37. return request.post('app-api/member/auth/social-login', {
  38. type,
  39. code,
  40. state
  41. }, {
  42. noAuth: true // TODO 芋艿:后续要做调整
  43. });
  44. }
  45. // 微信小程序的一键登录登录
  46. export function weixinMiniAppLogin(phoneCode, loginCode,state) {
  47. return request.post('app-api/member/auth/weixin-mini-app-login', {
  48. phoneCode,
  49. loginCode,
  50. state
  51. }, {
  52. noAuth: true // TODO 芋艿:后续要做调整
  53. });
  54. }
  55. // 创建微信 JS SDK 初始化所需的签名
  56. export function createWeixinMpJsapiSignature(url) {
  57. return request.post("app-api/member/auth/create-weixin-jsapi-signature?url=" + url, {}, {
  58. noAuth: true // TODO 芋艿:后续要做调整
  59. });
  60. }