var common={rand:function(min,max){return Math.random()*(max-min)+min},regPhone:function(obj){reg=/^(13|15|17|18|19|14)[0-9]{9}$/;return reg.test(obj)},regCode:function(obj){if(obj.length==0||obj.length!=6){return true}return false},scrollTopDiv:function(obj){var scrollTop=$(obj).offset().top;if(scrollTop>=$(window).scrollTop()&&scrollTop<($(window).scrollTop()+$(window).height()-200)){return true}return false},regName:function(obj){var reg=/^[\u4e00-\u9fa5]{2,20}$/;return reg.test(obj)},regName:function(obj){reg=/^[\u4E00-\u9FA5A-Za-z]+$/;return reg.test(obj)},regID:function(obj){reg=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;return reg.test(obj)},btnClick:function(ele){},countDownTime:function(){isClick=false;$('.yzmBtn').addClass("enable");$('.yzmBtn').addClass("active").html('60秒后重新获取');var waitTime,currTime=59;var interval=setInterval(function(){shuwon.timeChange(currTime);currTime--;if(currTime<0){clearInterval(interval);currTime=waitTime}},1000)},timeChange:function(waitTime){if(waitTime!=0){$('.yzmBtn').html(waitTime+'秒后重新获取')}else{$('.yzmBtn').html('获取验证码').removeClass("active");isClick=true;$('.yzmBtn').removeClass("enable")}},toast:function(msg,sucess){$("._toast").addClass("active").find("span").html(msg);if(!sucess){$("._toast").addClass("warn")}else{$("._toast").removeClass("warn")}setTimeout(function(){$("._toast").removeClass("active")},1500)},getUrlParam:function(name){var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)");var r=window.location.search.substr(1).match(reg);return r?decodeURIComponent(r[2]):null},Timer:function(timer){var timeBpx={t:'',ts:0,mdhm:''};var current=Math.floor(new Date().getTime()/1000);var dd_=0,hh_=0,mm_=0,ss_=0;timeBpx.ts=timer-current;dd_=Math.floor(timeBpx.ts/(60*60*24));hh_=Math.floor(timeBpx.ts/(60*60))-(dd_*24);mm_=Math.floor(timeBpx.ts/60)-(dd_*24*60)-(hh_*60);ss_=Math.floor(timeBpx.ts)-(dd_*24*60*60)-(hh_*60*60)-(mm_*60);if(hh_<=9)hh_='0'+hh_;if(mm_<=9)mm_='0'+mm_;if(ss_<=9)ss_='0'+ss_;timeBpx.t=dd_+'天'+hh_+'小时'+mm_+'分';timeBpx.tm=dd_+'天'+hh_+'小时'+mm_+'分'+ss_+"秒";var time=new Date(timer*1000);timeBpx.mdhm=time.getMonth()+1+'月'+time.getDate()+'日'+time.getHours()+'时'+time.getMinutes()+'分';timeBpx.yyr=time.getFullYear()+'-'+(time.getMonth()+1<10?'0'+(time.getMonth()+1):time.getMonth()+1)+'-'+time.getDate();return timeBpx},getDataForApi:function(url,para,callback){$.ajax({type:"post",data:para,url:url,dataType:'json',success:function(data){callback(data)},error:function(e){console.log(e,"数据加载错误")}})},returnObj:function(el){return document.getElementById(el)}}