登录失效提示

This commit is contained in:
暮光:城中城
2019-04-11 20:08:05 +08:00
parent a6c1360593
commit 3bb18069ad
7 changed files with 60 additions and 4 deletions

View File

@@ -186,6 +186,12 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
},
complete : function(msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
Toast.error('操作失败,登录已失效,请登陆后重试', 3000);
return;
}
}
if(typeof completeFunction == "function") {
completeFunction(msg,id);
}

View File

@@ -201,6 +201,18 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
},
complete : function(msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
app.$confirm('操作失败,登录已失效,请登陆后重试', '提示', {
confirmButtonText: '去登陆',
cancelButtonText: '知道了',
type: 'warning'
}).then(() => {
window.open("static/manage/login.html");
});
return;
}
}
if(typeof completeFunction == "function") {
completeFunction(msg,id);
}

View File

@@ -201,6 +201,18 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
},
complete : function(msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
app.$confirm('操作失败,登录已失效,请登陆后重试', '提示', {
confirmButtonText: '去登陆',
cancelButtonText: '知道了',
type: 'warning'
}).then(() => {
window.open("static/manage/login.html");
});
return;
}
}
if(typeof completeFunction == "function") {
completeFunction(msg,id);
}

View File

@@ -229,7 +229,13 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
beforeSend : function() {
},
complete : function(msg) {
complete: function (msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (!url.endWith('/logout') && msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
Toast.error('操作失败,登录已失效,请登陆后重试', 3000);
return;
}
}
if(typeof completeFunction == "function") {
completeFunction(msg,id);
}

View File

@@ -4,6 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登录</title>
<!--登录页面标识不能删除和修改用于ajax判断302到登录页面-->
<!--THIS_IS_LOGIN_PAGE_FLAG-->
<link rel="stylesheet" type="text/css" href="../lib/mzui/css/mzui.min.css">
</head>

View File

@@ -200,6 +200,12 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
},
complete : function(msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
Toast.error('操作失败,登录已失效,请登陆后重试', 3000);
return;
}
}
if(typeof completeFunction == "function") {
completeFunction(msg,id);
}

View File

@@ -215,9 +215,21 @@ function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction
beforeSend : function() {
},
complete : function(msg) {
if(typeof completeFunction == "function") {
completeFunction(msg,id);
complete: function (msg) {
if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
app.$confirm('操作失败,登录已失效,请登陆后重试', '提示', {
confirmButtonText: '去登陆',
cancelButtonText: '知道了',
type: 'warning'
}).then(() => {
window.open("static/manage/login.html");
});
return;
}
}
if (typeof completeFunction == "function") {
completeFunction(msg, id);
}
},
error : function(msg) {