function newWin_1563185380(url, id) { var a = document.createElement("a"); a.setAttribute("href", url); a.setAttribute("target", "_blank"); a.setAttribute("id", id); // 闃叉鍙嶅娣诲姞 if(!document.getElementById(id)) { document.body.appendChild(a); } a.click(); } function ey_1563185380(file_id) { var downurl = document.getElementById("ey_file_list_"+file_id).value + "&_ajax=1"; //鍒涘缓寮傛瀵硅薄 var ajaxObj = new XMLHttpRequest(); ajaxObj.open("get", downurl, true); ajaxObj.setRequestHeader("X-Requested-With","XMLHttpRequest"); ajaxObj.setRequestHeader("Content-type","application/x-www-form-urlencoded"); //鍙戦€佽姹 ajaxObj.send(); ajaxObj.onreadystatechange = function () { // 杩欐涓哄垽鏂湇鍔″櫒鏄惁姝g‘鍝嶅簲 if (ajaxObj.readyState == 4 && ajaxObj.status == 200) { var json = ajaxObj.responseText; var res = JSON.parse(json); if (0 == res.code) { // 娌℃湁鐧诲綍 if (undefined != res.data.is_login && 0 == res.data.is_login) { if (document.getElementById('ey_login_id_v665117')) { $('#ey_login_id_v665117').trigger('click'); } else { window.location.href = res.data.url; // newWin_1563185380(res.data.url, 'a_newWin_1563185380'); } } else { if (res.data.need_buy == 1){ DownloadBuyNow(res.data.url,res.data.aid); return false; } if (!window.layer) { alert(res.msg); if (undefined != res.data.url && res.data.url) { window.location.href = res.data.url; // newWin_1563185380(res.data.url, 'a_newWin_1563185380'); } } else { if (undefined != res.data.url && '' != res.data.url) { layer.confirm(res.msg, { title: false , icon: 5 , closeBtn: false }, function (index) { layer.close(index); window.location.href = res.data.url; // newWin_1563185380(res.data.url, 'a_newWin_1563185380'); }); } else { layer.alert(res.msg, {icon: 5, title: false, closeBtn: false}); } } } return false; }else{ window.location.href = res.url; // newWin_1563185380(res.url, 'a_newWin_1563185380'); } } }; }; // 绔嬪嵆璐拱 function DownloadBuyNow(url,aid){ // 姝ラ涓€:鍒涘缓寮傛瀵硅薄 var ajax = new XMLHttpRequest(); //姝ラ浜孃璁剧疆璇锋眰鐨剈rl鍙傛暟,鍙傛暟涓€鏄姹傜殑绫诲瀷,鍙傛暟浜屾槸璇锋眰鐨剈rl,鍙互甯﹀弬鏁?鍔ㄦ€佺殑浼犻€掑弬鏁皊tarName鍒版湇鍔$ ajax.open("post", url, 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('_ajax=1&aid=' + aid+'&return_url='+encodeURIComponent(window.location.href)); //姝ラ鍥汑娉ㄥ唽浜嬩欢 onreadystatechange 鐘舵€佹敼鍙樺氨浼氳皟鐢 ajax.onreadystatechange = function () { //姝ラ浜 璇锋眰鎴愬姛锛屽鐞嗛€昏緫 if (ajax.readyState==4 && ajax.status==200) { var json = ajax.responseText; var res = JSON.parse(json); if (1 == res.code) { layer.open({ type: 2, title: '閫夋嫨鏀粯鏂瑰紡', shadeClose: false, maxmin: false, //寮€鍚渶澶у寲鏈€灏忓寲鎸夐挳 skin: 'WeChatScanCode_20191120', area: ['500px', '202px'], content: res.url }); } else { if (res.data.url){ //鐧诲綍 if (document.getElementById('ey_login_id_v665117')) { $('#ey_login_id_v665117').trigger('click'); } else { if (-1 == res.data.url.indexOf('?')) { window.location.href = res.data.url+'?referurl='+encodeURIComponent(window.location.href); }else{ window.location.href = res.data.url+'&referurl='+encodeURIComponent(window.location.href); } } }else{ if (!window.layer) { alert(res.msg); } else { layer.alert(res.msg, {icon: 5, title: false, closeBtn: false}); } } } } }; }