associatedPublicNumber.js 837 B

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