$(function(){ //百度统计代码 // var _hmt = _hmt || []; // (function() { // var hm = document.createElement("script"); // // hm.src = "//hm.baidu.com/hm.js?91b01d42eaf4c5ca613835cc49228ac5";//旧的 // hm.src = "https://hm.baidu.com/hm.js?f6c21e471ebb14cd85d3d6277c8f25e0";//2022.8.6 更新 // var s = document.getElementsByTagName("script")[0]; // s.parentNode.insertBefore(hm, s); // })(); //百度主动提交链接的代码 (function(){ var bp = document.createElement('script'); bp.src = '//push.zhanzhang.baidu.com/push.js'; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); })//--ready //functions.js var fun={ post:function(url,data,fn){ if(typeof data=="function"){ fn=data; data={}; } data.token=getCookie("token")?getCookie("token"):""; var _this=this; if(!data.token){ if(getCookie("gtoken")){ data.gtoken=getCookie("gtoken"); }else{ var gtoken=_this.get_tk(); setCookie("gtoken",gtoken); data.gtoken=gtoken; } } var req=$.ajax({ url:url, data:data, dataType:"json", type:"POST", success:function(d){ if(d.info=="请先登录"){ location.href="http://"+location.host+"/Reg/logout"; }else{ fn&&fn(d); } }, error:function(e){ console.log(e); alert("网络异常,请稍候再试"); } }) return req; }, log:function(d){ console.log(d); }, two:function(d){ return d.length==1?"0"+d:d; }, rand:function(min,max){ return Math.ceil(Math.random()*(max-min))+min; }, get_tk:function(){ return "tk"+new Date().getTime()+fun.rand(100000,999999) } } ///背景遮挡 function setBack(status){ if(status){$(".backgray").css("height",0);}else{ var h=window.innerHeight; $(".backgray").css("height",h); } } //myalert function myalert(text,time){ if(!text){$(".alert").hide();return;} $(".alert p").html(text); $(".alert").show(); var time=time?time:60000; clearTimeout(t); var t=setTimeout(function(){ $(".alert").hide(500); },time) } //判断是不是手机号码 function isPhoneNum(num){ var myreg = /^1\d{10}$/; if(myreg.test(num)){ return true; } return false; } //浮点数 function isfloat(num){ var r=/^\d+\.\d+$/; num=num.toString(); if(num.match(r)){ return true; } return false; } //js代码 function getCookie(name){ var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)){ return unescape(arr[2]); } return false; } function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toString())+";path=/"; } function mycookie(name,value,expire){ if(value||value==null){ return setCookie(name,value,expire); } return getCookie(name); } function IEVersion() { var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; if(isIE) { var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); reIE.test(userAgent); var fIEVersion = parseFloat(RegExp["$1"]); if(fIEVersion == 7) { return 7; } else if(fIEVersion == 8) { return 8; } else if(fIEVersion == 9) { return 9; } else if(fIEVersion == 10) { return 10; } else { return 6;//IE版本<=7 } } else if(isEdge) { return 'edge';//edge } else if(isIE11) { return 11; //IE11 }else{ return -1;//不是ie浏览器 } } function base64_decode(str){ var c1, c2, c3, c4; var base64DecodeChars = new Array( -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 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, -1, -1, -1, -1, -1, -1, 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, -1, -1, -1, -1, -1 ); var i=0, len = str.length, string = ''; while (i < len){ do{ c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff] } while ( i < len && c1 == -1 ); if (c1 == -1) break; do{ c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff] } while ( i < len && c2 == -1 ); if (c2 == -1) break; string += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); do{ c3 = str.charCodeAt(i++) & 0xff; if (c3 == 61) return string; c3 = base64DecodeChars[c3] } while ( i < len && c3 == -1 ); if (c3 == -1) break; string += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); do{ c4 = str.charCodeAt(i++) & 0xff; if (c4 == 61) return string; c4 = base64DecodeChars[c4] } while ( i < len && c4 == -1 ); if (c4 == -1) break; string += String.fromCharCode(((c3 & 0x03) << 6) | c4) } return string; }