auth.js 1.6 KB

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