johnswang
2021-05-24 d22137f90f4a5768b4edaeffd5495760e160b24c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//检查系统是否停止使用 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"] + "<hr/>" ;
                 
                   //替换所有的制表符
                   myMessages = myMessages.replace(/\t/g,"&nbsp;&nbsp;");
                   
                   //替换所有的换行符
                   myMessages = myMessages.replace(/\r\n/g,"<br>")
                   myMessages = myMessages.replace(/\n/g,"<br>");
                   
                   //替换所有的空格(中文空格、英文空格都会被替换)
                   myMessages = myMessages.replace(/\s/g,"&nbsp;");
                   
                   myMessages +="<br/><br/><hr/>" ;
                   myMessages += data["warning"][i]["createusername"] + "&nbsp;&nbsp;" 
                      + 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")
 }
 
}