解决登录后用户权限加载的问题

This commit is contained in:
季圣华
2019-01-17 00:13:20 +08:00
parent 4afc188b73
commit 3df03ef910
6 changed files with 132 additions and 4 deletions

View File

@@ -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("后台访问错误,请联系管理员!");
}
});
}
}
},