social.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import request from '@/sheep/request';
  2. const SocialApi = {
  3. // 获得社交用户
  4. getSocialUser: (type) => {
  5. return request({
  6. url: '/member/social-user/get',
  7. method: 'GET',
  8. params: {
  9. type
  10. },
  11. custom: {
  12. showLoading: false,
  13. },
  14. });
  15. },
  16. // 社交绑定
  17. socialBind: (type, code, state) => {
  18. return request({
  19. url: '/member/social-user/bind',
  20. method: 'POST',
  21. data: {
  22. type,
  23. code,
  24. state
  25. },
  26. custom: {
  27. custom: {
  28. showSuccess: true,
  29. loadingMsg: '绑定中',
  30. successMsg: '绑定成功',
  31. },
  32. },
  33. });
  34. },
  35. // 社交绑定
  36. socialUnbind: (type, openid) => {
  37. return request({
  38. url: '/member/social-user/unbind',
  39. method: 'DELETE',
  40. data: {
  41. type,
  42. openid
  43. },
  44. custom: {
  45. showLoading: false,
  46. loadingMsg: '解除绑定',
  47. successMsg: '解绑成功',
  48. },
  49. });
  50. },
  51. // 获取订阅消息模板列表
  52. getSubscribeTemplateList: () =>
  53. request({
  54. url: '/member/social-user/get-subscribe-template-list',
  55. method: 'GET',
  56. custom: {
  57. showError: false,
  58. showLoading: false,
  59. },
  60. }),
  61. // 获取微信小程序码
  62. getWxaQrcode: async (path, query) => {
  63. return await request({
  64. url: '/member/social-user/wxa-qrcode',
  65. method: 'POST',
  66. data: {
  67. scene: query,
  68. path,
  69. checkPath: false, // TODO 开发环境暂不检查 path 是否存在
  70. },
  71. });
  72. },
  73. };
  74. export default SocialApi;