associatedPublicNumber.js 964 B

123456789101112131415161718192021222324252627282930313233343536
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. text: "",
  5. code: ""
  6. },
  7. onLoad(options) {
  8. if (options.code == 0) {
  9. this.setData({
  10. text: "绑定出错 请稍后再试"
  11. })
  12. } else {
  13. this.WechatServceBinding(options.code);
  14. }
  15. },
  16. WechatServceBinding(wechat_code) {
  17. _Http.basic({
  18. "classname": "common.usercenter.usercenter",
  19. "method": "WechatServceBinding",
  20. "content": {
  21. "accesstoken": wx.getStorageSync('userMsg').token,
  22. "systemclient": "wservice",
  23. wechat_code
  24. }
  25. }).then(res => {
  26. console.log("绑定公众号", res)
  27. this.setData({
  28. code: res.msg == '成功' ? "" : wechat_code
  29. })
  30. })
  31. },
  32. onShow() {
  33. this.data.code && this.WechatServceBinding(this.data.code);
  34. }
  35. })