代码 如下 点击登录 可以跳转到 微信的授权界面 但是授权之后没有任何处理
Model.prototype.loginWeixinClicked = function(event) {
var self = this; if (!navigator.weixin) { justep.Util.hint("请安装最新版本(含插件)体验!"); return; } ;
var weixin = navigator.weixin;
function saveUser(data) { var user = {}; user.userid = data.openid; user.accountType = "WX"; user.name = data.nickname || "NONAME"; justep.Shell.userType.set(user.accountType); justep.Shell.userName.set(user.name); localStorage.setItem("userUUID", JSON.stringify(user)); justep.Util.hint("登录成功"); setTimeout(function() { justep.Shell.showPage("main"); }, 3000); }
weixin.ssoLogin(function() { weixin.getUserInfo(saveUser, function(reason) { justep.Util.hint("登录失败: " + JSON.stringify(reason), { "type" : "danger" }); }); }, function(reason) { justep.Util.hint("登录失败: " + JSON.stringify(reason), { "type" : "danger" }); });
};
|