|

楼主 |
发表于 2017-3-3 10:36:56
|
显示全部楼层
- Model.prototype.modelLoad = function(event){
- this.shareWX();
- var weixinCode = this.getContext().getRequestParameter("code");
- var userData = this.comp("userData");
- if(weixinCode != "" && justep.Browser.isWeChat){
- if(weixinCode !== localStorage.getItem("wxCode")){
- justep.Baas.sendRequest({
- "url" : "/weixin/weixin",
- "action" : "userinfo",
- "async" : false,
- "params" : {code :weixinCode},
- "success" : function(wxUser) {
- userData.setFilter("filter","weixinNum='"+wxUser.openid+"'");
- userData.refreshData();
- if(userData.count()==0){
- userData.newData({
- index : 0,
- defaultValues : [ {
- "weixinNum" : wxUser.openid,
- "weixinName" : wxUser.nickname,
- "weixinImg" : wxUser.headimgurl,
- "createDate":new Date()
- } ]
- });
-
- }else{
- if(userData.val("weixinImg") != wxUser.headimgurl){
- userData.setValue("weixinImg",wxUser.headimgurl);
- }
- }
- userData.saveData({onSuccess:function() {
- userData.refreshData();
- }});
- localStorage.setItem("userId",userData.val("id"));
- }
- });
- localStorage.setItem("wxCode", weixinCode);
- }
- this.comp("windowContainer1").load();
- }else{
- // var href = window.location.href;
- // href = href.substring(0,(href.indexOf("?")== -1 ? href.indexOf("#"):href.indexOf("?")));
- var href = "http://www.1yweigou.net/onebuy/index.html";
- href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd77c4ca9419a506e&redirect_uri="+href+"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
- window.location.href = href;
- }
- this.getLocation();
- };
复制代码
我是这么写的,但是那个redirect_uri还是以前的那个版本号,我都已经重新编译资源了。 |
|