// zhike样式判定 function zhikeRender(data,i,product_category_url){ if(data.script[i].idea_type == 25){ //轮播 var specialList = getSpecialList(data,i,product_category_url); loadZhikeLoop(data,specialList); }else{ //单图 var specialList = []; specialList.push(data.script[i]); loadZhikeOne(data,specialList); } } // 数据筛选 function getSpecialList(data,i,product_category){ var arr = []; for(var j = i; j < data.script.length;j ++){ if (data.script[j].product_category == product_category && data.script[j].idea_type == data.script[i].idea_type) { arr.push(data.script[j]); } } return arr; } //单图 function loadZhikeOne(data,specialList){ var orderType='zhike'; var closeImg='zhike'; var bg_color=specialList[0].idea.bg_color?bg_color:"#585050"; var font_color=specialList[0].idea.font_color?font_color:"#fff"; $(".ad").css({"background":bg_color,"color":font_color}); window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:project_ad_pos+'_tnews_1', ad_type:orderType, strategy_id:specialList[0].strategy_id, idea_id:specialList[0].idea_id, plan_id:specialList[0].plan_id, product_category:specialList[0].product_category }; //加载 uploadConfig.act = 'load'; uploadZhike(uploadConfig); var dom='' $('.container').append(dom); $(".close_big").html(''); getNews(); render = false; var height=260+144; var width=390; var page_size =''+width+','+height+''; if(specialList[0].mini_reader == 1){ // swpiw 1用阅读器打开 $('head').append(''); }else{ $('head').append(''); } if (typeof window.external != 'undefined' && "SetLayout" in window.external) { var rows = 1, //行数 columns = 1, //列数 row_space = 0, //行间距 column_space = 0, //列间距 status = 1; window.external.SetLayout(rows,columns,row_space,column_space,status); } if (typeof window.external != 'undefined' && "CppCall" in window.external) { window.external.CppCall(); } $("body").on('click','#ak',function(){ uploadConfig.act = 'click'; uploadZhike(uploadConfig); }) uploadConfig.act = 'show'; uploadZhike(uploadConfig); } //轮播 function loadZhikeLoop(data,specialList){ if (specialList.length > 0) { if(specialList.length == 1) { loadZhikeOne(data,specialList); //单图 }else{ var domstr = ""; $.each(specialList,function (index,ele) { domstr += ''; }) var swiperDom = '
'+ '
'+ '
'+domstr +'
'+ '
'+ '
'; swiperDom += '' function showReport(index){ //show上报 var ele = specialList[index]; window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:project_ad_pos+'_tnews_1', ad_type:'zhike', strategy_id:ele.strategy_id, idea_id:ele.idea_id, plan_id:ele.plan_id, product_category:ele.product_category }; uploadConfig.act = 'show'; uploadConfig.ad_pos = project_ad_pos+'_tnews_1_lo_'+ (index+1); uploadZhike(uploadConfig); } var activeIndex = 0; $('.container').append(swiperDom); $(".close_big").html(''); showReport(0); getNews(); render = false; var height=250+144; var width=370; var page_size =''+width+','+height+''; $('head').append(''); var mySwiper = new Swiper('.swiper-container', { autoplay : 5000, speed:1000, onlyExternal : true, loop : true, onSlideNext: function(swiper){ if(activeIndex+1 < specialList.length){ activeIndex ++; showReport(activeIndex); } } }); $.each(specialList,function (index,ele) { $(".container").on('click','#ak'+ (index+1),function () { window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:project_ad_pos+'_tnews_1', ad_type:'zhike', strategy_id:ele.strategy_id, idea_id:ele.idea_id, plan_id:ele.plan_id, product_category:ele.product_category }; uploadConfig.act = 'click'; uploadConfig.ad_pos = project_ad_pos+'_tnews_1_lo_'+ (index+1); uploadZhike(uploadConfig); }); }) if (typeof window.external != 'undefined' && "SetLayout" in window.external) { var rows = 1, //行数 columns = 1, //列数 row_space = 0, //行间距 column_space = 0, //列间距 status = 1; window.external.SetLayout(rows,columns,row_space,column_space,status); } if (typeof window.external != 'undefined' && "CppCall" in window.external) { window.external.CppCall(); } } render = false; } }