const _Http = getApp().globalData.http; Page({ data: { text: "", code: "" }, onLoad(options) { if (options.code == 0) { this.setData({ text: "绑定出错 请稍后再试" }) } else { this.WechatServceBinding(options.code); } getApp().globalData.Language.getLanguagePackage(this, '关联公众号'); }, WechatServceBinding(wechat_code) { _Http.basic({ "classname": "common.usercenter.usercenter", "method": "WechatServceBinding", "content": { "accesstoken": wx.getStorageSync('userMsg').token, "systemclient": "wservice", wechat_code } }).then(res => { console.log("绑定公众号", res) this.setData({ code: res.code == '1' ? "" : wechat_code }) }) }, onShow() { this.data.code && this.WechatServceBinding(this.data.code); } })