function showMsg(param,options){ if(options==undefined){ toastr.options = { "closeButton": true, "debug": true, "newestOnTop": false, "progressBar": true, "positionClass": "toast-top-center", "preventDuplicates": false, "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } }else{ toastr.options=options; } if(param.type==undefined){ param.type="success"; }else{ switch(param.type){ case "warning": toastr.warning(param.content, param.title); break; case "error":toastr.error(param.content, param.title); break; case "success":toastr.success(param.content, param.title); break; case "info":toastr.info(param.content, param.title); break; default: toastr.info(param.content, param.title); } } } function openAjaxLoading (){ $.messager.progress({ title:'请等待..', msg:'正在处理中...', text:'' }); } function closeAjaxLoading (){ $.messager.progress('close'); } function showMask(){ $("#mask").css("height",$(document).height());      $("#mask").css("width",$(document).width());      $("#mask").show();      } function hideMask(){ $("#mask").hide(); } $.extend({ setupAjaxSettings:function(href){ $.ajaxSetup({ type: "POST", error: function(jqXHR, textStatus, errorThrown){ if(jqXHR.status=='401'){ parent.showMsg({"title":"异常","type":"error","content":jqXHR.status+' - 登录超时,请重新登录..'}); parent.showMask(); setTimeout(function(){ top.location.href = href; },3000); } } }); } }); $.fn.serializeObject = function() { var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [ o[this.name] ]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; } String.prototype.endWith = function(s) { if (s == null || s == "" || this.length == 0 || s.length > this.length) return false; if (this.substring(this.length - s.length) == s) return true; else return false; return true; } String.prototype.startWith = function(s) { if (s == null || s == "" || this.length == 0 || s.length > this.length) return false; if (this.substr(0, s.length) == s) return true; else return false; return true; }