修改服务注册地址
This commit is contained in:
parent
1815b37547
commit
acd2ed7b7f
|
|
@ -39,7 +39,12 @@ public class JwtUtils
|
|||
*/
|
||||
public static Claims parseToken(String token)
|
||||
{
|
||||
try{
|
||||
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
|
||||
}catch (Exception e){
|
||||
System.err.println("token不正确--->"+token);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
let Authorization = localStorage.getItem("smz-token");
|
||||
|
||||
|
||||
$(document).ajaxSuccess(function (event, xhr, settings, data) {
|
||||
if(data.code===401){
|
||||
localStorage.removeItem("smz-token");
|
||||
top.location.href = ctxPath + '/login.html';
|
||||
}
|
||||
return data;
|
||||
});
|
||||
|
||||
$.ajaxSetup({
|
||||
cache : false,
|
||||
headers : {
|
||||
|
|
@ -18,12 +27,12 @@ $.ajaxSetup({
|
|||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
if (code === 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
} else if (code === 401) {
|
||||
localStorage.removeItem("smz-token");
|
||||
location.href = '/login.html';
|
||||
} else if (code == 403) {
|
||||
top.location.href = ctxPath + '/login.html';
|
||||
} else if (code === 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ function initMenu() {
|
|||
location.href = ctxPath + '/login.html';
|
||||
return;
|
||||
}
|
||||
if (data.code==401) {
|
||||
//redis的token未获取到权限
|
||||
// alert("权限已过期,请重新登录");
|
||||
location.href = ctxPath + '/login.html';
|
||||
return;
|
||||
}
|
||||
var menu = $("#menu");
|
||||
$.each(data, function (i, item) {
|
||||
var a = $("<a href='javascript:;'></a>");
|
||||
|
|
@ -48,6 +54,9 @@ function initMenu() {
|
|||
setChild(li, item.child)
|
||||
|
||||
});
|
||||
},
|
||||
error : function (e){
|
||||
location.href = ctxPath + '/login.html';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -93,6 +102,12 @@ function showLoginInfo() {
|
|||
},
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.code==401) {
|
||||
//redis的token未获取到权限
|
||||
// alert("权限已过期,请重新登录");
|
||||
location.href = ctxPath + '/login.html';
|
||||
return;
|
||||
}
|
||||
$(".admin-header-user span").text(data.nickname);
|
||||
|
||||
var pro = window.location.protocol;
|
||||
|
|
@ -130,8 +145,17 @@ function logout() {
|
|||
"Authorization": token
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code==401) {
|
||||
//redis的token未获取到权限
|
||||
// alert("权限已过期,请重新登录");
|
||||
location.href = ctxPath + '/login.html';
|
||||
return;
|
||||
}
|
||||
localStorage.removeItem("smz-token");
|
||||
location.href = ctxPath + '/login.html';
|
||||
},
|
||||
error : function (e){
|
||||
location.href = ctxPath + '/login.html';
|
||||
}
|
||||
});
|
||||
// var userAgent = navigator.userAgent.toLowerCase();
|
||||
|
|
|
|||
Loading…
Reference in New Issue