weixin.js 590 B

123456789101112131415161718192021222324252627282930313233
  1. import request from '@/utils/request'
  2. import Qs from 'qs';
  3. //根据code换取openid
  4. export function getDataByCode(code) {
  5. return request({
  6. url: '/wechat/findUserInfo/' + code,
  7. params: {},
  8. method: 'get',
  9. })
  10. }
  11. //获取用户信息
  12. export function getDataByOpenId(openId) {
  13. return request({
  14. url: '/mobile/personInfoApi/findByOpenId',
  15. data: Qs.stringify({
  16. openId: openId
  17. }),
  18. method: 'post',
  19. })
  20. }
  21. //获得配置
  22. export function getConfig() {
  23. return request({
  24. url: '/wechat/getConfig',
  25. params: {
  26. url: window.location.href.split('#')[0]
  27. },
  28. method: 'get',
  29. })
  30. }