本帖最后由 FlyInTheRain 于 2017-2-10 14:35 编辑
仿照外卖微信案例。在公众号button设置:
- WxMenuButton takeout = new WxMenuButton();
- takeout.setName("外卖");
- takeout.setType(WxConsts.BUTTON_VIEW);
- takeout.setUrl("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + this.getWxMpConfigStorage().getAppId() + "&redirect_uri=http%3A%2F%2Fwww.ccyhg.com%2Fx5%2FUI2%2Ftakeout%2Findex.w&"
- + "response_type=code&scope=snsapi_base&state=STATE#wechat_redirect");
- x5Meuns.add(takeout);
在wex5中使用: $.getJSON("/baas/weixin/userinfo?code=" + weixinCode,
function(weixinUser) { $(self.getElementByXid("photoDiv")).show(); $(self.getElementByXid("photoImage")).attr("src", weixinUser.headimgurl); self.loadUserData({ "id" : weixinUser.openid, "name" : weixinUser.nickname + "(来自微信的用户)", "address" : weixinUser.country + weixinUser.province + weixinUser.city }); });
现在 我的二维码中 信息我 http://域名+应用+index.html ,通过微信扫码进去wex5页面,在wex5页面中我该如何获取用户信息。难道我的二维码必须设置成外卖案例中button的url形式吗?不能通过wex5调用bass后台发请求吗?
|