function loadDspAd(e) { if(renderStatus == 0){ uploadConfig.act = 'songheng_'+e.data.length; uploadZhike(uploadConfig); if (e.data && e.data.length > 0) { var data = e.data[0]; if( data.adtype && data.miniimg.length > 0){ //广告类型adtype及图片资源miniimg是否存在 if(data.adtype == 103 && data.miniimg.length == 4){ //四图广告类型adtype及图片资源miniimg是否正常 $('.container').empty(); uploadConfig.act = 'load'; uploadZhike(uploadConfig); var topicArr = []; if(data.topic){ topicArr = data.topic.split("&&"); } var topicItem0 = topicArr[0] || "",topicItem1 = topicArr[1] || "",topicItem2 = topicArr[2] || "",topicItem3 = topicArr[3] || ""; $('.container').append('
不感兴趣
关闭
' +' ' +''+uploadConfig.project_cn+'-广告由嵩恒广告提供' +'' +'
'+topicItem0+'
' +'
'+topicItem1+'
' +'
'+topicItem2+'
' +'
'+topicItem3+'
' +'
'); $('.image-wrapper')[0].href = data.url; var imgError = 0; document.getElementById("ak").onerror = function () { imgError ++; if(imgError == 1){ ProjectConfig.loadBase(); } }; document.getElementById("ak1").onerror = function () { imgError ++; if(imgError == 1){ ProjectConfig.loadBase(); } }; document.getElementById("ak2").onerror = function () { imgError ++; if(imgError == 1){ ProjectConfig.loadBase(); } }; document.getElementById("ak3").onerror = function () { imgError ++; if(imgError == 1){ ProjectConfig.loadBase(); } }; var imgFlag = 0; function popBox(){ var page_size = "655,481"; $(".container").css({"width":"655px","height":"481px"}); $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } // 渲染 ProjectConfig.uploadUrl(data.showbackurls[0]); uploadConfig.act = 'show'; uploadZhike(uploadConfig); } document.getElementById("ak").onload = function () { imgFlag ++ if(imgFlag == 4 && imgError == 0){ popBox() } }; document.getElementById("ak1").onload = function () { imgFlag ++ if(imgFlag == 4 && imgError == 0){ popBox() } }; document.getElementById("ak2").onload = function () { imgFlag ++ if(imgFlag == 4 && imgError == 0){ popBox() } }; document.getElementById("ak3").onload = function () { imgFlag ++ if(imgFlag == 4 && imgError == 0){ popBox() } }; //进入可视区s域上报 if (data.isinviewbackurl) { ProjectConfig.uploadUrl(data.inviewbackurls[0]); } //关闭上报 $('.close').on('click', function () { ProjectConfig.uploadUrl(data.closebackurls[0]) }); //点击上报 $('.image-wrapper').on('click', function () { ProjectConfig.uploadUrl(data.clickbackurls[0]); uploadConfig.act = 'click'; uploadZhike(uploadConfig); }) }else{ renderDsp(data); //返回接口存在广告类型adtype及图片资源miniimg但类型为非4图取第一张图片资源 } }else{ ProjectConfig.loadBase() } } else { ProjectConfig.loadBase() } } }; function renderDsp(data){ $('.container').empty(); uploadConfig.act = 'load'; uploadZhike(uploadConfig); $('.container').append('
不感兴趣
关闭
'+uploadConfig.project_cn+'-广告由嵩恒广告提供'); $('.image-wrapper > img')[0].src = data.miniimg[0].src; $('.image-wrapper')[0].href = data.url; document.getElementById("ak0").onerror = function () { ProjectConfig.loadBase(); }; document.getElementById("ak0").onload = function () { var page_size_w = document.getElementById('ak0').offsetWidth; var page_size_h = document.getElementById('ak0').offsetHeight; var page_size = page_size_w+"," + page_size_h; $(".container").css({"width":page_size_w,"height":page_size_h}); $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } // 渲染 ProjectConfig.uploadUrl(data.showbackurls[0]); uploadConfig.act = 'show'; uploadZhike(uploadConfig); }; //进入可视区s域上报 if (data.isinviewbackurl) { ProjectConfig.uploadUrl(data.inviewbackurls[0]); } //关闭上报 $('.close').on('click', function () { ProjectConfig.uploadUrl(data.closebackurls[0]) }); //点击上报 $('.image-wrapper').on('click', function () { ProjectConfig.uploadUrl(data.clickbackurls[0]); uploadConfig.act = 'click'; uploadZhike(uploadConfig); }) }