//姣旇緝鐗堟湰鍙峰ぇ灏忥紝杩斿洖鍊硷紙1锛氬墠澶т簬鍚庯紝0锛氱浉绛夛紝-1锛氬墠灏忎簬鍚庯級 function versionStringCompare(preVersion, lastVersion){ var sources = preVersion.split('.'); var dests = lastVersion.split('.'); var maxL = Math.max(sources.length, dests.length); var result = 0; for (var i = 0; i < maxL; i++) { var preValue = sources.length>i ? sources[i]:0; var preNum = isNaN(Number(preValue)) ? preValue.charCodeAt() : Number(preValue); var lastValue = dests.length>i ? dests[i]:0; var lastNum = isNaN(Number(lastValue)) ? lastValue.charCodeAt() : Number(lastValue); if (preNum < lastNum) { result = -1; break; } else if (preNum > lastNum) { result = 1; break; } } return result; } /*------------------------------鍏ㄥ眬涓撳睘 start--------------------------*/ // 璇诲彇 cookie function getCookie_1606378141(c_name) { if (document.cookie.length>0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return ""; } /*------------------------------浼氬憳娉ㄥ唽鐧诲綍鏍囩涓撳睘 start--------------------------*/ if ("undefined" != typeof tag_userinfo_json) { tag_userinfo_1608459452(tag_userinfo_json); } else { if ("undefined" != typeof tag_user_login_json) { tag_user(tag_user_login_json); } if ("undefined" != typeof tag_user_reg_json) { tag_user(tag_user_reg_json); } if ("undefined" != typeof tag_user_logout_json) { tag_user(tag_user_logout_json); } if ("undefined" != typeof tag_user_cart_json) { tag_user(tag_user_cart_json); } } if ("undefined" != typeof tag_user_collect_json) { tag_collect_1608459452(tag_user_collect_json); } if ("undefined" != typeof tag_user_info_json) { tag_user_info(tag_user_info_json); } /*----鏂版敞鍐岀櫥褰曟爣绛句笓灞 start------*/ function tag_userinfo_1608459452(result) { var users_id = getCookie_1606378141('users_id'); console.log("tag_userinfo_1608459452",users_id); // if (!users_id) { // return true; // } var before_display = ''; var htmlObj = document.getElementById(result.htmlid); if (!htmlObj) { return true; } else { before_display = htmlObj.style.display; } if (users_id > 0 && htmlObj) { htmlObj.style.display = 'none'; } /*鍥惧舰楠岃瘉鐮?/ var ey_login_vertify_display = ''; if (document.getElementById('ey_login_vertify')) { ey_login_vertify_display = document.getElementById('ey_login_vertify').style.display; document.getElementById('ey_login_vertify').style.display = 'none'; } /*end*/ /*绗笁鏂瑰揩鎹风櫥褰?/ var third_party_login_display = ''; if (document.getElementById('ey_third_party_login')) { third_party_login_display = document.getElementById('ey_third_party_login').style.display; document.getElementById('ey_third_party_login').style.display = 'none'; if (document.getElementById('ey_third_party_wxlogin')) { var third_party_wxlogin_display = ''; third_party_wxlogin_display = document.getElementById('ey_third_party_wxlogin').style.display; document.getElementById('ey_third_party_wxlogin').style.display = 'none'; } if (document.getElementById('ey_third_party_wblogin')) { var third_party_wblogin_display = ''; third_party_wblogin_display = document.getElementById('ey_third_party_wblogin').style.display; document.getElementById('ey_third_party_wblogin').style.display = 'none'; } if (document.getElementById('ey_third_party_qqlogin')) { var third_party_qqlogin_display = ''; third_party_qqlogin_display = document.getElementById('ey_third_party_qqlogin').style.display; document.getElementById('ey_third_party_qqlogin').style.display = 'none'; } } /*end*/ if (window.jQuery) { $.ajax({ type : 'post', url : result.root_dir+"/index.php?m=api&c=Diyajax&a=check_userinfo", data : {aid:ey_aid}, dataType : 'json', success : function(res){ loginafter_1610585974(res, htmlObj, before_display, ey_login_vertify_display, third_party_login_display, third_party_wxlogin_display, third_party_wblogin_display, third_party_qqlogin_display); } }); } else { //姝ラ涓€:鍒涘缓寮傛瀵硅薄 var ajax = new XMLHttpRequest(); //姝ラ浜孃璁剧疆璇锋眰鐨剈rl鍙傛暟,鍙傛暟涓€鏄姹傜殑绫诲瀷,鍙傛暟浜屾槸璇锋眰鐨剈rl,鍙互甯﹀弬鏁?鍔ㄦ€佺殑浼犻€掑弬鏁皊tarName鍒版湇鍔$ ajax.open("post", result.root_dir+"/index.php?m=api&c=Diyajax&a=check_userinfo", true); // 缁欏ご閮ㄦ坊鍔燼jax淇℃伅 ajax.setRequestHeader("X-Requested-With","XMLHttpRequest"); // 濡傛灉闇€瑕佸儚 HTML 琛ㄥ崟閭f牱 POST 鏁版嵁锛岃浣跨敤 setRequestHeader() 鏉ユ坊鍔 HTTP 澶淬€傜劧鍚庡湪 send() 鏂规硶涓瀹氭偍甯屾湜鍙戦€佺殑鏁版嵁锛 ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded"); //姝ラ涓堹鍙戦€佽姹?鏁版嵁 ajax.send("aid="+ey_aid); //姝ラ鍥汑娉ㄥ唽浜嬩欢 onreadystatechange 鐘舵€佹敼鍙樺氨浼氳皟鐢 ajax.onreadystatechange = function () { //姝ラ浜 濡傛灉鑳藉杩涘埌杩欎釜鍒ゆ柇 璇存槑 鏁版嵁 瀹岀編鐨勫洖鏉ヤ簡,骞朵笖璇锋眰鐨勯〉闈㈡槸瀛樺湪鐨 if (ajax.readyState==4 && ajax.status==200) { var json = ajax.responseText; var res = JSON.parse(json); loginafter_1610585974(res, htmlObj, before_display, ey_login_vertify_display, third_party_login_display, third_party_wxlogin_display, third_party_wblogin_display, third_party_qqlogin_display); 銆€} } } } function loginafter_1610585974(res, htmlObj, before_display, ey_login_vertify_display, third_party_login_display, third_party_wxlogin_display, third_party_wblogin_display, third_party_qqlogin_display) { if (htmlObj) { htmlObj.style.display = before_display; } if (1 == res.code) { if (1 == res.data.ey_is_login) { if (htmlObj) { htmlObj.innerHTML = res.data.html; try { executeScript_1610585974(res.data.html); } catch (e) {} } } else { /*鍥惧舰楠岃瘉鐮?/ if (1 == res.data.ey_login_vertify && document.getElementById('ey_login_vertify')) { document.getElementById('ey_login_vertify').style.display = ey_login_vertify_display; } /*end*/ /*绗笁鏂瑰揩鎹风櫥褰?/ if (1 == res.data.ey_third_party_login && document.getElementById('ey_third_party_login')) { document.getElementById('ey_third_party_login').style.display = third_party_login_display; if (1 == res.data.ey_third_party_wxlogin && document.getElementById('ey_third_party_wxlogin')) { document.getElementById('ey_third_party_wxlogin').style.display = third_party_wxlogin_display; } if (1 == res.data.ey_third_party_wblogin && document.getElementById('ey_third_party_wblogin')) { document.getElementById('ey_third_party_wblogin').style.display = third_party_wblogin_display; } if (1 == res.data.ey_third_party_qqlogin && document.getElementById('ey_third_party_qqlogin')) { document.getElementById('ey_third_party_qqlogin').style.display = third_party_qqlogin_display; } } /*end*/ } } } /** * 鎵цAJAX杩斿洖HTML鐗囨涓殑JavaScript鑴氭湰 * 灏唄tml閲岀殑js浠g爜鎶藉彇鍑烘潵锛岀劧鍚庨€氳繃eval鍑芥暟鎵ц瀹 * @param {[type]} html [description] * @return {[type]} [description] */ function executeScript_1610585974(html) { var reg = /]*>([^\x00]+)$/i; //瀵规暣娈礖TML鐗囨鎸堻\/script>鎷嗗垎 var htmlBlock = html.split("<\/script>"); for (var i in htmlBlock) { var blocks;//鍖归厤姝e垯琛ㄨ揪寮忕殑鍐呭鏁扮粍锛宐locks[1]灏辨槸鐪熸鐨勪竴娈佃剼鏈唴瀹癸紝鍥犱负鍓嶉潰reg瀹氫箟鎴戜滑鐢ㄤ簡鎷彿杩涜浜嗘崟鑾峰垎缁 if (blocks = htmlBlock[i].match(reg)) { //娓呴櫎鍙兘瀛樺湪鐨勬敞閲婃爣璁帮紝瀵逛簬娉ㄩ噴缁撳熬-->鍙互蹇界暐澶勭悊锛宔val涓€鏍疯兘姝e父宸ヤ綔 var code = blocks[1].replace(/