Commit ccdefd46 by 梁建民

js

parent 693d61dd
......@@ -40,8 +40,22 @@
withCredentials: true
},
success: function (data) {
typeof callback == 'function' && callback(data);
layer.close(index);
//处理token失效的情况
if (data.errcode === 501 || data.err_code === 501) {
layer.msg('登录已失效,请重新登录', {time: 600}, function () {
window.location.href = home_url + '/login';
});
} else {
typeof callback == 'function' && callback(data);
layer.close(index);
}
return false;
},
error: function () {
......@@ -91,7 +105,7 @@
//退出
$(".nav_end").on('click', function () {
layer.confirm('您确定退出系统嘛', {icon: 3, title: '提示',move:false}, function (index) {
layer.confirm('您确定退出系统嘛', {icon: 3, title: '提示', move: false}, function (index) {
opt.getData(apis.authLogout, 'POST', null, function (res) {
......@@ -99,7 +113,7 @@
Util.delCookie('token', cookieHostname);
window.location.reload();
window.location.href = home_url;
} else {
......
......@@ -2,7 +2,7 @@
window.GoodManageController = {
token: Util.getCookie('token') || '',
init: function () {
this.created(this).mounted(this).render(this, {offset: 2, p: 1, token: this.token}, 1).handleBind(this);
this.created(this).mounted(this).render(this, {offset: 10, p: 1, token: this.token}, 1).handleBind(this);
},
created: function (opt) {
......@@ -58,7 +58,7 @@
elem: 'pagination',
theme: '#1080d0',
count: res.total,
limit: 2,
limit: 10,
curr: curr,
jump: function (obj, first) {
......@@ -70,21 +70,13 @@
}
var param = $.extend({}, params, json);
GoodManageController.render(opt, param, obj.curr);
}
}
});
});
} else if (res.errcode === 501) {
layer.msg(res.errmsg, function () {
window.location.href = home_url + '/login';
});
} else if (res.errcode == 110001 || res.errcode == 103001) {
layui.laytpl(getTpl).render([], function (html) {
......@@ -107,13 +99,13 @@
var param = {
token: opt.token,
offset: 2,
offset: 10,
p: 1
};
var params = $.extend({}, data.field, param);
opt.render(this,params,1)
opt.render(this, params, 1)
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment