xinyb
2024-09-19 18ffbca9acaccd5099a7a63652f52210f59a7e40
提交 | 用户 | age
a6a76f 1 //检查系统是否停止使用 Added by Johns Wang ,2017-05-26
F 2 var maintaince={
bd5ba7 3     dbid:null,
X 4     isStop:null,
5     checkSysIsExpired:function(){
6         if (!maintaince.dbid || maintaince.dbid == "" || maintaince.dbid == "null") {
7             location.reload();
8             return ;
9         }
10         $.post("/shopping/maintaince/maintaince.do?m=info&data_base_id="+maintaince.dbid,
11             function(data){
12                 var isSystemStop = data["isstop"] ;
13                 var redirect = data["redirect"];
14                 //处理重定向到 login.jsp 页面
15                 if(isSystemStop && maintaince.isStop && maintaince.isStop != isSystemStop && redirect){
16                     location = redirect;
17                     return ;
18                 }
19
20
21
22             },"json")
a6a76f 23     }
F 24 }
25 var messagehint={
26 //获取系统级提示消息
bd5ba7 27     popupMessageHint:function(){
X 28         $.post("/messagehint.do",
29             function(data){
30                 for (i in data["warning"]) {
31                     if (data["warning"][i]["messagetxt"]) {
32                         var messageType = data["warning"][i]["messagetype"] ;
33                         var myMessages = data["warning"][i]["messagetxt"]  ;
34                         //myMessages += data["warning"][i]["topic"] + "<hr/>" ;
35
36                         //替换所有的制表符
37                         myMessages = myMessages.replace(/\t/g,"&nbsp;&nbsp;");
38
39                         //替换所有的换行符
40                         myMessages = myMessages.replace(/\r\n/g,"<br>")
41                         myMessages = myMessages.replace(/\n/g,"<br>");
42
43                         //替换所有的空格(中文空格、英文空格都会被替换)
029de3 44                         // myMessages = myMessages.replace(/\s/g,"&nbsp;");
bd5ba7 45
X 46                         myMessages +="<br/><br/><hr/>" ;
47                         myMessages += data["warning"][i]["createusername"] + "&nbsp;&nbsp;"
48                             + data["warning"][i]["createtime"] ;
49                         /*
50                         //显示提示框
51                         $().toastmessage('showToast', {
52                              inEffectDuration:600,
53                              stayTime:  100000000,   //停留10秒(10000),然后关闭 ,
54                              text     : myMessages,
55                              sticky   : false,
56                              position : 'top-right',
57                              type     : messageType
58                          });
59                         */
edf548 60                         openToast(myMessages,data["warning"][i]["topic"],messageType);
dff633 61                         // $.toast({
X 62                         //     text: myMessages, // Text that is to be shown in the toast
63                         //     heading: data["warning"][i]["topic"] , // Optional heading to be shown on the toast
64                         //
65                         //     showHideTransition: 'plain', // fade, slide or plain
66                         //     allowToastClose: true, // Boolean value true or false
67                         //     hideAfter: false, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
68                         //     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
69                         //     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
70                         //
71                         //     bgColor: '#444444',  // Background color of the toast
72                         //     textColor: '#eeeeee',  // Text color of the toast
73                         //     textAlign: 'left',  // Text alignment i.e. left, right or center
74                         //     loader: true,  // Whether to show loader or not. True by default
75                         //     loaderBg: '#9ec600',  // Background color of the toast loader
76                         //     beforeShow: function () {}, // will be triggered before the toast is shown
77                         //     afterShown: function () {}, // will be triggered after the toat has been shown
78                         //     beforeHide: function () {}, // will be triggered before the toast gets hidden
79                         //     afterHidden: function () {}  // will be triggered after the toast has been hidden
80                         // });
bd5ba7 81
X 82                     }
83                 }
84             },"json")
85     }
dff633 86 }
X 87 var maintainPay={
88     noticeRemind:function(){
89         //获取提醒数
90         $.ajax({//加载
91             url: "/Maintain/remind.do",
92             type: "get",
93             dataType: "json",
94             async: true,
95             contentType: 'application/json;charset=UTF-8',
96             success: function (res) {
97                 if (res != null && res.code == 0) {
98                     let list = res.data;
99                     if (list != null && list > 0) {
100                         $(".tixings").html(list);
101                     }else{
102                         $(".tixings").html("");
103                     }
104                 }
105             }, error: function () {
106                 $(".tixings").html("");
107             }
108         });
109     }
110 }
111 //打开通知消息显示
edf548 112 function openToast(message,title,type){
dff633 113     let t=$.toast({
X 114         text: message, // 消息提示框的内容。
115         heading: "<div style='text-align: center'>"+title+"</div>" , // 消息提示框的标题
116         showHideTransition: 'plain', //消息提示框的动画效果。可取值:plain,fade,slide。
117         allowToastClose: true, // 是否显示关闭按钮。(true 显示,false 不显示)
118         hideAfter: false, // 设置为false则消息提示框不自动关闭.设置为一个数值则在指定的毫秒之后自动关闭消息提框
f35416 119         stack: 2, // 消息栈。同时允许的提示框数量
dff633 120         position: 'top-right', // 消息提示框的位置:bottom-left, bottom-right,bottom-center,top-left,top-right,top-center,mid-center。
X 121         bgColor: '#444444',  // 背景颜色。
122         textColor: '#eeeeee',  // 文字颜色。
123         textAlign: 'left',  // 文本对齐:left, right, center。
124         // icon:'success',//消息提示框的图标样式:success,info,error,warning
125         loader: true,  // 是否显示加载条
126         loaderBg: '#9ec600',  // 加载条的背景颜色。
edf548 127         isHied:false,//是否隐藏触发
dff633 128         beforeShow: function () {}, // 会在toast即将出现之前触发
X 129         afterShown: function () {}, // 会在toast出现后触发
edf548 130         beforeHide: function (evn) {
X 131             this.isHied=true;//是隐藏触发则为true
132         }, // 会在toast藏起来之前触发
dff633 133         afterHidden: function () {}, // 会在toast藏起来后被触发
X 134         onClick:function (evn) {//单击触发事件
edf548 135             if (type == "maintenanceFee" && !this.isHied) {//维护费支付类型
dff633 136                 $(".icon-tixing").trigger("click");
X 137                 evn.hide();
138             }
139         }
140     });
141     return t;
a6a76f 142 }