) { let link = ''; let pass = '8586'; let ck_key = "zhuoku"+'_wechat_key'; $('.get_qrcode').click(function () { if (getCookie(ck_key) != '') { window.open($(this).data('link')); } else { $('.wechat_box').show(); link = $(this).data('link') } }); $('.wechat_btn a').click(function () { let gain = $('#check').val(); if (gain === pass) { let date = new Date(); date.setTime(date.getTime() + (60 * 60 * 1000)); let expires = "expires=" + date.toGMTString(); document.cookie = ck_key+"=wechat_value; " + expires; window.open(link); } else { alert('密码错误'); } }); function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } })