public.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import request from "@/utils/request.js";
  2. /**
  3. * 获取微信sdk配置
  4. * @returns {*}
  5. */
  6. export function getWechatConfig() {
  7. return request.get(
  8. "wechat/config",
  9. { url: document.location.href },
  10. { noAuth: true }
  11. );
  12. }
  13. /**
  14. * 获取微信sdk配置
  15. * @returns {*}
  16. */
  17. export function wechatAuth(code, spread, login_type) {
  18. return request.get(
  19. "wechat/auth",
  20. { code, spread, login_type },
  21. { noAuth: true }
  22. );
  23. }
  24. /**
  25. * 获取登录授权login
  26. *
  27. */
  28. export function getLogo()
  29. {
  30. return request.get('wechat/get_logo', {}, { noAuth : true});
  31. }
  32. /**
  33. * 小程序用户登录
  34. * @param data object 小程序用户登陆信息
  35. */
  36. export function login(data) {
  37. return request.post("wechat/mp_auth", data, { noAuth : true });
  38. }
  39. /**
  40. * 分享
  41. * @returns {*}
  42. */
  43. export function getShare() {
  44. return request.get("share", {}, { noAuth: true });
  45. }
  46. /**
  47. * 获取关注海报
  48. * @returns {*}
  49. */
  50. export function follow() {
  51. return request.get("wechat/follow", {}, { noAuth: true });
  52. }
  53. /**
  54. * 获取图片base64
  55. * @retins {*}
  56. * */
  57. export function imageBase64(image, code) {
  58. return request.post(
  59. "/image_base64",
  60. { image: image, code: code },
  61. { noAuth: true }
  62. );
  63. }