|
请问下面这段代码中的:
justep.Shell.userType.set(userData.getValue("type"));
justep.Shell.userId.set(userData.getValue("id"));
这两行代码是做什么用的?谢谢!
Model.prototype.loginPhoneBtn = function(event) {
var phoneInput = this.comp("nameInput").val();
var passwordInput = this.comp("passwordInput").val();
var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
if (!reg.test(phoneInput)) {
return;
}
var userData = this.comp("userData");
userData.clear();
userData.filters.setVar("mobile_phone", phoneInput);
userData.filters.setVar("password", passwordInput);
userData.refreshData();
if (userData.count() > 0) {
justep.Util.hint("登录成功");
justep.Shell.userType.set(userData.getValue("type"));
justep.Shell.userId.set(userData.getValue("id"));
localStorage.removeItem("userUUID");
localStorage.setItem("userId", userData.getValue("id"));
localStorage.setItem("userType", userData.getValue("type"));
localStorage.setItem("userNick", userData.getValue("nick"));
localStorage.setItem("userPhone", phoneInput);
setTimeout(function() {
justep.Shell.closePage();
}, 3000);
} else {
justep.Util.hint("用户或密码有误!", {
"type" : "danger"
});
}
}; |
|