标签:sha llb settime pre 弹出层 value log time offset
ajax: {
//返回弹出层信息
showloading:function prg_show_load_layer(msg,timeout) {
return $.layer.msg(msg,{icon:16,shade:[0.5,‘#f5f5f5‘],scrollbar:false,offset:‘auto‘,time:timeout})
},
closeloading:function prg_close_load_layer(index) {
$.layer.close(index);
},
successMes: function pre_show_tip_layer(){
$.layer.msg("处理完成",{time:300,offset:‘auto‘});
},
get: function (url, param, doFn) {
var options = {};
var exp = new Date();
exp.setTime(exp.getTime() + 40 * 60 * 1000);
options.expires = exp;
var token = gg.core.cookie.getValue("token");
gg.core.cookie.setValue("token",token ,options);
$.ajax({
type: ‘GET‘,
url: url,
data: param,
dataType: "json",
success: function (result) {
if (result.code == 200) {
if (doFn) doFn(result);
}
else if (result.code == 998) {
$.layer.alert(‘用户登录超时,请重新登录!‘, {
icon: 2,
closeBtn: 0
}, function () {
window.location = "login.html";
});
return;
}
else {
$.layer.alert(result.errMsg, {
icon: 2,
closeBtn: 0
});
return;
}
},
error: function () {
$.layer.msg("加载失败",{time:1000,offset:‘auto‘});
},
headers:{
authKey: gg.core.cookie.getValue("token"),
sessionId:gg.core.cookie.getValue("sessionId")
},
});
}
,
post: function (url, param, doFn) {
var options = {};
var exp = new Date();
exp.setTime(exp.getTime() + 40 * 60 * 1000);
options.expires = exp;
gg.core.cookie.setValue("token", gg.core.cookie.getValue("token"),options);
$.ajax({
type: ‘POST‘,
url: url,
data: param,
headers:{
authKey: gg.core.cookie.getValue("token"),
sessionId:gg.core.cookie.getValue("sessionId")
},
dataType: "json",
contentType: "application/json",
success: function (result) {
if (result.code == 200) {
if (doFn) doFn(result);
}
else if (result.code == 998) {
gg.core.cookie.deleteCookid("token")
$.layer.alert(‘用户登录超时,请重新登录!‘, {
icon: 2,
closeBtn: 0
}, function () {
window.location = "login.html";
});
return;
}
else {
$.layer.alert(result.errMsg, {
icon: 2,
closeBtn: 0
});
return;
}
},
error:function(event){
$.layer.msg("加载失败",{time:1000,offset:‘auto‘});
}
});
}
}
标签:sha llb settime pre 弹出层 value log time offset
原文地址:https://www.cnblogs.com/tuhazi/p/9777271.html