//检查系统是否停止使用 Added by Johns Wang ,2017-05-26
var maintaince={
dbid:null,
isStop:null,
checkSysIsExpired:function(){
if (!maintaince.dbid || maintaince.dbid == "" || maintaince.dbid == "null") {
location.reload();
return ;
}
$.post("/shopping/maintaince/maintaince.do?m=info&data_base_id="+maintaince.dbid,
function(data){
var isSystemStop = data["isstop"] ;
var redirect = data["redirect"];
//处理重定向到 login.jsp 页面
if(isSystemStop && maintaince.isStop && maintaince.isStop != isSystemStop && redirect){
location = redirect;
return ;
}
},"json")
}
}
var messagehint={
//获取系统级提示消息
popupMessageHint:function(){
$.post("/messagehint.do",
function(data){
for (i in data["warning"]) {
if (data["warning"][i]["messagetxt"]) {
var messageType = data["warning"][i]["messagetype"] ;
var myMessages = data["warning"][i]["messagetxt"] ;
//myMessages += data["warning"][i]["topic"] + "
" ;
//替换所有的制表符
myMessages = myMessages.replace(/\t/g," ");
//替换所有的换行符
myMessages = myMessages.replace(/\r\n/g,"
")
myMessages = myMessages.replace(/\n/g,"
");
//替换所有的空格(中文空格、英文空格都会被替换)
myMessages = myMessages.replace(/\s/g," ");
myMessages +="
" ;
myMessages += data["warning"][i]["createusername"] + " "
+ data["warning"][i]["createtime"] ;
/*
//显示提示框
$().toastmessage('showToast', {
inEffectDuration:600,
stayTime: 100000000, //停留10秒(10000),然后关闭 ,
text : myMessages,
sticky : false,
position : 'top-right',
type : messageType
});
*/
$.toast({
text: myMessages, // Text that is to be shown in the toast
heading: data["warning"][i]["topic"] , // Optional heading to be shown on the toast
showHideTransition: 'plain', // fade, slide or plain
allowToastClose: true, // Boolean value true or false
hideAfter: false, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
position: 'top-right', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
bgColor: '#444444', // Background color of the toast
textColor: '#eeeeee', // Text color of the toast
textAlign: 'left', // Text alignment i.e. left, right or center
loader: true, // Whether to show loader or not. True by default
loaderBg: '#9ec600', // Background color of the toast loader
beforeShow: function () {}, // will be triggered before the toast is shown
afterShown: function () {}, // will be triggered after the toat has been shown
beforeHide: function () {}, // will be triggered before the toast gets hidden
afterHidden: function () {} // will be triggered after the toast has been hidden
});
}
}
},"json")
}
}