digest.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Vue from 'vue';
  2. import { getTicketFun } from '@/utils/TXApiFun';
  3. // 微信JSSDK实例
  4. const wx = Vue.prototype.wx;
  5. import { wxLogin } from '@/api/digest';
  6. export function WXdigest() {
  7. // wx.login({
  8. // suiteId: 'wwxxxxxx', //非必填,第三方应用的suiteid,自建应用不填。若第三方小程序绑定多个第三方应用时,建议填上该字段
  9. // success: function (res) {
  10. // console.log(res);
  11. // },
  12. // fail: function (res) {
  13. // console.log(res);
  14. // },
  15. // complete: function (res) {
  16. // console.log(res);
  17. // },
  18. // });
  19. getTicketFun(['getCurExternalContact'], 'agentConfig')
  20. .then((res) => {
  21. window.open(
  22. `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.appId}&redirect_uri=ssbsfatest.nipponpaint.com.cn/mobile/&response_type=code&scope=SCOPE&state=STATE#wechat_redirect`
  23. );
  24. // 获取用户code
  25. // getWeChatCode();
  26. })
  27. .catch((err) => {
  28. console.log(err);
  29. });
  30. }
  31. function getWeChatCode() {
  32. wx.invoke('getCurExternalContact', {}, (res) => {
  33. if (res.err_msg === 'getCurExternalContact:ok') {
  34. console.log(res);
  35. } else {
  36. console.log(res);
  37. }
  38. });
  39. }