//检查系统是否停止使用 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
});
*/
openToast(myMessages,data["warning"][i]["topic"],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")
}
}
var maintainPay={
noticeRemind:function(){
//获取提醒数
$.ajax({//加载
url: "/Maintain/remind.do",
type: "get",
dataType: "json",
async: true,
contentType: 'application/json;charset=UTF-8',
success: function (res) {
if (res != null && res.code == 0) {
let list = res.data;
if (list != null && list > 0) {
$(".tixings").html(list);
}else{
$(".tixings").html("");
}
}
}, error: function () {
$(".tixings").html("");
}
});
}
}
//打开通知消息显示
function openToast(message,title,type){
let t=$.toast({
text: message, // 消息提示框的内容。
heading: ""+title+"
" , // 消息提示框的标题
showHideTransition: 'plain', //消息提示框的动画效果。可取值:plain,fade,slide。
allowToastClose: true, // 是否显示关闭按钮。(true 显示,false 不显示)
hideAfter: false, // 设置为false则消息提示框不自动关闭.设置为一个数值则在指定的毫秒之后自动关闭消息提框
stack: 5, // 消息栈。同时允许的提示框数量
position: 'top-right', // 消息提示框的位置:bottom-left, bottom-right,bottom-center,top-left,top-right,top-center,mid-center。
bgColor: '#444444', // 背景颜色。
textColor: '#eeeeee', // 文字颜色。
textAlign: 'left', // 文本对齐:left, right, center。
// icon:'success',//消息提示框的图标样式:success,info,error,warning
loader: true, // 是否显示加载条
loaderBg: '#9ec600', // 加载条的背景颜色。
isHied:false,//是否隐藏触发
beforeShow: function () {}, // 会在toast即将出现之前触发
afterShown: function () {}, // 会在toast出现后触发
beforeHide: function (evn) {
this.isHied=true;//是隐藏触发则为true
}, // 会在toast藏起来之前触发
afterHidden: function () {}, // 会在toast藏起来后被触发
onClick:function (evn) {//单击触发事件
if (type == "maintenanceFee" && !this.isHied) {//维护费支付类型
$(".icon-tixing").trigger("click");
evn.hide();
}
}
});
return t;
}