social.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import request from '@/sheep/request';
  2. import {
  3. t
  4. } from '@/locale';
  5. const SocialApi = {
  6. // 获得社交用户
  7. getSocialUser: (type) => {
  8. return request({
  9. url: '/member/social-user/get',
  10. method: 'GET',
  11. params: {
  12. type
  13. },
  14. custom: {
  15. showLoading: false,
  16. },
  17. });
  18. },
  19. // 社交绑定
  20. socialBind: (type, code, state) => {
  21. return request({
  22. url: '/member/social-user/bind',
  23. method: 'POST',
  24. data: {
  25. type,
  26. code,
  27. state
  28. },
  29. custom: {
  30. custom: {
  31. showSuccess: true,
  32. loadingMsg: t('common.binding'),
  33. successMsg: t('common.bind_success'),
  34. },
  35. },
  36. });
  37. },
  38. // 社交绑定
  39. socialUnbind: (type, openid) => {
  40. return request({
  41. url: '/member/social-user/unbind',
  42. method: 'DELETE',
  43. data: {
  44. type,
  45. openid
  46. },
  47. custom: {
  48. showLoading: false,
  49. loadingMsg: t('common.unbind'),
  50. successMsg: t('common.unbind_success'),
  51. },
  52. });
  53. },
  54. };
  55. export default SocialApi;