third.js 990 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import request from '@/sheep/request';
  2. import { baseUrl, apiPath } from '@/sheep/config';
  3. import {
  4. t
  5. } from '@/locale';
  6. export default {
  7. // 微信相关
  8. wechat: {
  9. // 小程序订阅消息
  10. subscribeTemplate: (params) =>
  11. request({
  12. url: 'third/wechat/subscribeTemplate',
  13. method: 'GET',
  14. params: {
  15. platform: 'miniProgram',
  16. },
  17. custom: {
  18. showError: false,
  19. showLoading: false,
  20. },
  21. }),
  22. // 获取微信小程序码
  23. getWxacode: (path) =>
  24. `${baseUrl}${apiPath}third/wechat/wxacode?platform=miniProgram&payload=${encodeURIComponent(
  25. JSON.stringify({
  26. path,
  27. }),
  28. )}`,
  29. },
  30. // 苹果相关
  31. apple: {
  32. // 第三方登录
  33. login: (data) =>
  34. request({
  35. url: 'third/apple/login',
  36. method: 'POST',
  37. data,
  38. custom: {
  39. showSuccess: true,
  40. loadingMsg: t('common.logging_in'),
  41. },
  42. }),
  43. },
  44. };