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=true;//20190505 09:25因發(fā)現(xiàn)很多分享頁展示不了pdf,報pdf.js錯誤,關閉二維碼功能 if(IsShow){ var ids=(Math.random()*10000000).toString(16).substr(04)+'-'+(new Date()).getTime()+'-'+Math.random().toString().substr(25); 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(012) c_start=document.cookie.indexOf("PublicAddress"); if(c_start == -1){ $.ajax({ type:"get" url:'http://www.cebpubservice.com/oauthCenter/qrCode/'+ids data:{ "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);//過期時間1天 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); )