|
发表于 2017-1-3 14:40:30
|
显示全部楼层
我按照这个案例来处理的 可以跳转到 微信的授权页面 但是 没有执行回调函数
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"
});
});
}; |
|