function getCookie(name) { var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return (arr[2]); return null; //删cookie function delCookie(name){ var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval = getCookie(name); if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString(); //开关 公众号二维码 var IsShow=false if(IsShow){ var ids=(Math.random()*******).toString(16).substr(0,4)+\'-\'+(new Date()).getTime()+\'-\'+Math.random().toString().substr(2,5); a=getCookie("PublicAddress"); var Id=$(\'.mian_list_03\').attr("index") var title=$(".mian_list_02 h3").html(); var string = title.replace(/[\\~|\\`|\\!|\\@|\\#|\\$|\\%|\\^|\\&|\\*|\\(|\\)|\\_|\\+|\\=|\\||\\\\|\\[|\\]|\\{|\\}|\\;|\\:|\\"|\\\'|\\,| >|\\.|\\>|\\/|\\?]/g,""); var str=string.substring(0,12) c_start=document.cookie.indexOf("PublicAddress"); if(c_start == -1){ $.ajax({ type:"get", url:\'http://www.cebpubservice.com/oauthCenter/qrCode/\'+ids+\'?bulletinId=\'+Id+\'&bulletinTitle=\'+str, //url:\'http://test.cebpubservice.com/oauthCenter/qrCode/\'+ids+\'?bulletinId=\'+id+\'&bulletinTitle=\'+str, success:function(data){ $(".PublicAddress img").attr("src",data.qrUrl) setTimeout(function(){ $(\'.close\').show() $(".time").hide() ,15000) var d=15 time=window.setInterval(function(){ d-- console.log(d) if(d==0){ window.clearInterval(time); else{ $(".time").html(\'(\'+d+\')\') ,1000) t=window.setInterval(function(){ $.ajax({ type:"get", cache: false, url:\'http://www.cebpubservice.com/oauthCenter/qrScanStatus/\'+ids, success:function(data){ if(data.scanStatus=="1"){ $(".PublicAddress").hide() var name = \'PublicAddress\'; var value = \'已登录\' var exp = new Date(); exp.setTime(exp.getTime() + 1 * 24 * 3600 * 1000);//过期时间**天 document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString()+";path=/"; window.clearInterval(t); , error:function(e){ console.log(1) return ) ,1500); , error:function(e){ var d=15 time=window.setInterval(function(){ d-- console.log(d) if(d==0){ window.clearInterval(time); else{ $(".time").html(\'(\'+d+\')\') ,1000) setTimeout(function(){ $(\'.close\').show() $(".time").hide() ,15000) return ) $(".PublicAddress").show() else{ $(".PublicAddress").hide() window.clearInterval(t); else{ $(".PublicAddress").hide() //关闭 $(\'.close a\').click(function(){ $(\'.PublicAddress\').hide() window.clearInterval(t); )