解决登录后用户权限加载的问题
This commit is contained in:
@@ -14,7 +14,8 @@ HROS.app = (function(){
|
||||
HROS.app.get();
|
||||
},
|
||||
get : function(){
|
||||
$.getJSON('../../app/findDesk', function (sc) {
|
||||
var userId = sessionStorage.getItem("userId");
|
||||
$.getJSON('../../app/findAppByUserId?userId=' + userId, function (sc) {
|
||||
HROS.VAR.dock = sc['dock'];
|
||||
HROS.VAR.desk = sc['desk'];
|
||||
//输出桌面应用
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
});
|
||||
|
||||
//登录按钮绑定处理事件
|
||||
$('#btn_login').bind({
|
||||
click: checkUserInput
|
||||
$('#btn_login').off("click").on("click", function () {
|
||||
checkUserInput();
|
||||
});
|
||||
|
||||
//检测用户输入数据
|
||||
@@ -123,7 +123,24 @@
|
||||
}
|
||||
//跳转到用户管理界面
|
||||
else if (loginInfoTip.indexOf("user can login") != -1 || loginInfoTip == "user already login") {
|
||||
window.location.href = "/";
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/user/getUserSession",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data.user) {
|
||||
var user = res.data.user;
|
||||
sessionStorage.setItem("userId", user.id);
|
||||
window.location.href = "/";
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
alert("后台访问错误,请联系管理员!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user