function showZmdsp(data,i,project,projectName,ccUrl){ var ad_pos = project+"_tips_1" // 展盟dsp精准 var currentIndex = i; if(data.script[i].content){ var sspConfig = JSON.parse(data.script[i].content); var zmDsp = { index:ProjectConfig.GetQueryString('product_category') || '48', project:ProjectConfig.GetQueryString('project') || project, tck:ProjectConfig.GetQueryString('tck') || "" // tck:ProjectConfig.GetQueryString('tck') || "C977D0BBEE6B17C5E795BED36686097526F885BF79C84C6D0CEAC3A3F402CD10" }; window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:ad_pos, ad_type:'dsp_zm', strategy_id:data.script[i].strategy_id, idea_id:data.script[i].idea_id, plan_id:data.script[i].plan_id, product_category:data.script[i].product_category }; var url = sspConfig.url+"?v="+new Date().getTime(); render = false; $.ajax({ url: url, type: 'get', data: zmDsp, dataType: 'json', success: function (obj) { if(obj.code == 0){ // 一大三小 if(obj.result.idea_type == 4){ var idea = obj.result.idea || ""; if(idea){ $('.container').css({"width":"370px","height":"400px"}); var dom = '
' + '
不感兴趣
' + '
关闭
' + '
' + ''+projectName+'-广告'+ '' + '' + '' + '' + '' + '' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
'; $('.container').append(dom); var next = 1; for(var i =0;i< 3;i++){ uploadConfig.act = 'show'; uploadConfig.ad_pos = ad_pos+'_'+ (i+1); uploadZhike(uploadConfig); } $('.close1').on('click', function () { uploadConfig.act = 'click'; uploadConfig.ad_pos = ad_pos+'_'+next; $('.panel > a').removeClass('active'); switch(next){ case 1: next = 2; window.open(idea.landing_page) $('.close1 img').attr('src',idea['main_img_2']); break; case 2: next = 3; window.open(idea.landing_page_2) $('.close1 img').attr('src',idea['main_img_3']); break; case 3: next = 1; window.open(idea.landing_page_3) $('.close1 img').attr('src',idea['main_img']); break; } $(".close" + (next+1)).addClass('active'); uploadZhike(uploadConfig); }); $('.close2').on('click', function () { next = 2; uploadConfig.act = 'click'; uploadConfig.ad_pos = ad_pos+'_1'; $('.panel > a').removeClass('active'); $('.close1 img').attr('src',idea.main_img_2); $(".close3").addClass('active'); uploadZhike(uploadConfig); }); $('.close3').on('click', function () { next = 3; uploadConfig.act = 'click'; uploadConfig.ad_pos = ad_pos+'_2'; $('.panel > a').removeClass('active'); $('.close1 img').attr('src',idea.main_img_3); $(".close4").addClass('active'); uploadZhike(uploadConfig); }); $('.close4').on('click', function () { next = 1; uploadConfig.act = 'click'; uploadConfig.ad_pos = ad_pos+'_3'; $('.panel > a').removeClass('active'); $('.close1 img').attr('src',idea.main_img); $(".close2").addClass('active'); uploadZhike(uploadConfig); }); $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall("340,390"); } } }else{ //单图 var idea = obj.result.idea; var readStatus = obj.result.readStatus || ''; var pageW = idea.main_img_w,pageH = idea.main_img_h; $('.container').css({"width":pageW+"px","height":pageH+"px"}); var dom ='
不感兴趣
关闭
'+projectName+'-广告' + ''; $('.container').append(dom); uploadConfig.act = 'load'; uploadConfig.dspData = JSON.stringify(idea); uploadZhike(uploadConfig); var page_size = pageW+','+pageH; document.getElementById("ak").onload = function () { uploadConfig.act = 'show'; uploadZhike(uploadConfig); $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } }; $('.dsp_ad').on('click', function () { uploadConfig.act = 'click'; uploadConfig.dspData = JSON.stringify(idea); uploadZhike(uploadConfig); }); if(readStatus == 1){ // swpiw 1用阅读器打开 $('head').append(''); }else{ $('head').append(''); } if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } } }else{ var uploadUrl = '&ad_type=dsp' + '&ad_pos='+'heinote_tips_1'+'&baidu_id='+ data.baidu_id +'&strategy_id='+data.script[currentIndex].strategy_id+'&idea_id='+data.script[currentIndex].idea_id+'&plan_id='+data.script[currentIndex].plan_id+'&product_category='+data.script[currentIndex].product_category; var openUrl = ccUrl+"?" + location.search.split('?')[1] + uploadUrl; window.external.RedirectUrl(openUrl); } }, error:function () { var uploadUrl = '&ad_type=dsp' + '&ad_pos='+'heinote_tips_1'+'&baidu_id='+ data.baidu_id +'&strategy_id='+data.script[currentIndex].strategy_id+'&idea_id='+data.script[currentIndex].idea_id+'&plan_id='+data.script[currentIndex].plan_id+'&product_category='+data.script[currentIndex].product_category; var openUrl = ccUrl+"?" + location.search.split('?')[1] + uploadUrl; window.external.RedirectUrl(openUrl); } }); } }