|
楼主 |
发表于 2018-1-15 17:40:53
|
显示全部楼层
我用的3.6版本打包也是一样的错误,
这是我的登录代码
<?xml version="1.0" encoding="utf-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" component="$UI/system/components/justep/window/window" design="device:m;"
xid="window" class="window">
<div component="$UI/system/components/justep/model/model" xid="model" style="left:18px;top:83px;height:244px;"></div>
<div component="$UI/system/components/justep/panel/panel" class="x-panel x-full"
xid="panel1">
<!--头部 -->
<div class="x-panel-top" xid="top1">
<div component="$UI/system/components/justep/titleBar/titleBar" title="登录"
class="x-titlebar">
<div class="x-titlebar-left"></div>
<div class="x-titlebar-title">登录</div>
<div class="x-titlebar-right reverse"></div>
</div>
</div>
<!--主体 -->
<div class="x-panel-content" xid="content1">
<div class="content">
<div>
<img src="img/user1.png" bind-click="loginWeixinClicked"/>
<p>微信账号登录</p>
</div>
<div>
<img src="img/user2.png"/>
<p>新浪微博登录</p>
</div>
<div>
<img src="img/user3.png"/>
<p>QQ账号登录</p>
</div>
</div>
</div>
</div>
</div>
define(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
require("cordova!com.justep.cordova.plugin.weixin.v3");
var Model = function() {
this.callParent();
};
//微信登录
Model.prototype.loginWeixinClicked = function(event) {
var self = this;
if (!navigator.weixin) {
justep.Util.hint("请安装最新版本(含插件)体验!");
return;
};
var weixin = navigator.weixin;
function saveUser(data) {
alert(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("登录失败1: " + JSON.stringify(reason), {
"type" : "danger"
});
});
}, function(reason) {
justep.Util.hint("登录失败2: " + JSON.stringify(reason), {
"type" : "danger"
});
});
};
//新浪登录
// Model.prototype.loginWeiboClick = function(event) {
// var self = this;
// if (!navigator.weibo) {
// justep.Util.hint("当前版本暂不支持微博登录!");
// return;
// };
// var weibo = navigator.weibo;
// function saveUser(data){
// var user = {};
// user.userid = data.openid;
// user.accountType = "Weibo";
// user.name = data.nickname || "NONAME";
//
// justep.Shell.userType.set(user.accountType);
// justep.Shell.userName.set(user.name);
// storage.setItem("userInfo", JSON.stringify(user));
//
// justep.Util.hint("登录成功");
// setTimeout(function() {
// window.location.href = "index.w";
// }, 2000);
//
// };
// weibo.ssoLogin(function(){
// weibo.getUserInfo(saveUser,function(reason){
// justep.Util.hint("登录失败: " + JSON.stringify(reason), {
// "type" : "danger"
// });
// });
// },function(reason){
// justep.Util.hint("登录失败: " + JSON.stringify(reason), {
// "type" : "danger"
// });
// });
// };
// Model.prototype.loginQQClick = function(event) {
// var self = this;
// if (!navigator.qq) {
// justep.Util.hint("当前版本暂不支持QQ登录!");
// return;
// };
// var qq = navigator.qq;
// function saveUser(data){
// var user = {};
// user.userid = data.openid;
// user.accountType = "QQ";
// user.name = data.nickname || "NONAME";
// justep.Shell.userType.set(user.accountType);
// justep.Shell.userName.set(user.name);
// storage.setItem("userInfo", JSON.stringify(user));
// justep.Util.hint("登录成功");
// setTimeout(function() {
// window.location.href = "index.w";
// }, 2000);
// };
// qq.ssoLogin(function(){
// qq.getUserInfo(saveUser,function(reason){
// justep.Util.hint("登录失败: " + JSON.stringify(reason), {
// "type" : "danger"
// });
// });
// },function(reason){
// justep.Util.hint("登录失败: " + JSON.stringify(reason), {
// "type" : "danger"
// });
// });
// };
return Model;
});
|
|