调整查询失败处理
parent
a81d722bd1
commit
35d838e0f7
|
|
@ -82,6 +82,26 @@ function init(){
|
|||
"type":"get",
|
||||
"data":function(d){
|
||||
d.type = $("#type").val();
|
||||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -88,7 +88,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -94,7 +94,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -104,7 +104,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -99,7 +99,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -109,7 +109,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
|
|
@ -98,7 +98,23 @@ function init(){
|
|||
},
|
||||
"error":function(xhr, textStatus, errorThrown){
|
||||
var msg = xhr.responseText;
|
||||
console.log(msg)
|
||||
console.log(msg);
|
||||
var response = JSON.parse(msg);
|
||||
var code = response.code;
|
||||
var message = response.message;
|
||||
if (code == 400) {
|
||||
layer.msg(message);
|
||||
} else if (code == 401) {
|
||||
localStorage.removeItem("token");
|
||||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
|
||||
location.href = '/login.html';
|
||||
});
|
||||
} else if (code == 403) {
|
||||
console.log("未授权:" + message);
|
||||
layer.msg('未授权');
|
||||
} else if (code == 500) {
|
||||
layer.msg('系统错误:' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",
|
||||
|
|
|
|||
Loading…
Reference in New Issue