function showZmdspT(data, i, project, projectName, ccUrl) {
var ad_pos = project+"_tips_1";
var currentIndex = i;
if(data.script[i].content) {
var sspConfig = JSON.parse(data.script[i].content);
var zmDsp ={
requestId:1e18*Math.random(),
slot:{
uid: ProjectConfig.getCookie(),
proj:ProjectConfig.GetQueryString('project') || 'xiaoyu',
mixData:ProjectConfig.GetQueryString('data') || '',
imageType: sspConfig.imageType || 2,
popType:'tips'
}
};
var datas = encodeURI(JSON.stringify((zmDsp)));
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 + $.base64.encode(datas);
render = false;
$.ajax({
type: "get",
url: url,
dataType: "json",
success: function (obj) {
if(obj.code == 0) {
if(obj.result.ads[0].imageType == 1) {
// 单图
var ads = obj.result.ads[0];
var readStatus = ads.readStatus || '';
$('.container').css({"width":"370px","height":"250px"});
var dom ='
'+projectName+'-广告' +
'';
$('.container').append(dom);
uploadConfig.act = 'load';
uploadConfig.dspData = JSON.stringify(ads);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
uploadConfig.act = 'show';
newUpload(uploadConfig);
uploadZhike(uploadConfig);
var page_size = '370,' + document.getElementById('ak').offsetHeight;
$('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(ads);
newUpload(uploadConfig);
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 if(obj.result.ads[0].imageType == 2) {
// 轮播
var ads = obj.result.ads;
$('.container').css({"width":"370px","height":"250px"});
var dom =' '+projectName+'-广告' +
''
$('.container').append(dom);
var adArr = [];
$.each(ads, function (i, val) {
var tem = ''
$('.swiper-wrapper').append(tem);
if(adArr.indexOf(val.planId)<0) {
uploadConfig.act = 'show';
uploadConfig.ad_pos = project+'_tips_4l_'+ (i+1);
uploadConfig.dspData = JSON.stringify(ads[i]);
adArr.push(val.planId)
newUpload(uploadConfig);
uploadZhike(uploadConfig);
}
});
$('.swiper-wrapper').on('click','.swiper-slide',function() {
uploadConfig.act = 'click';
window.open(ads[$(this).attr('data-adN')].openUrl)
uploadConfig.ad_pos = $(this).attr('data-adPos');
uploadConfig.dspData = JSON.stringify(ads[$(this).attr('data-adN')]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall("370,250");
}
var mySwiper = $('.swiper-container').swiper({
loop: true,
autoplay : 5000,
autoplayDisableOnInteraction: false,
preventLinksPropagation: false,
noSwiping : true
});
}else if(obj.result.ads[0].imageType == 3) {
// 中间两图
var ads = obj.result.ads;
$('.container').css({"width":"560px","height":"160px"});
var dom =' '+projectName+'-广告' +
''+
''
$('.container').append(dom);
var adArr = [];
$.each(ads, function(i, val) {
if(adArr.indexOf(val.planId)<0) {
uploadConfig.act = 'show';
uploadConfig.ad_pos = project+'_tips_2_'+ (i+1);
uploadConfig.dspData = JSON.stringify(ads[i]);
adArr.push(val.planId)
newUpload(uploadConfig);
uploadZhike(uploadConfig);
}
})
$('.dsp_ad1').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_2_1';
uploadConfig.dspData = JSON.stringify(ads[0]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad2').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_2_2';
uploadConfig.dspData = JSON.stringify(ads[1]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall("560,160");
}
}else if(obj.result.ads[0].imageType == 4) {
// 中间三图
var ads = obj.result.ads;
$('.container').css({"width":"800px","height":"150px"});
var dom =' '+projectName+'-广告' +
''+
''+
''
$('.container').append(dom);
var adArr = [];
$.each(ads, function(i, val) {
if(adArr.indexOf(val.planId)<0) {
uploadConfig.act = 'show';
uploadConfig.ad_pos = project+'_tips_3h_'+ (i+1);
uploadConfig.dspData = JSON.stringify(ads[i]);
adArr.push(val.planId)
newUpload(uploadConfig);
uploadZhike(uploadConfig);
}
})
$('.dsp_ad1').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_3h_1';
uploadConfig.dspData = JSON.stringify(ads[0]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad2').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_3h_2';
uploadConfig.dspData = JSON.stringify(ads[1]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad3').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_3h_3';
uploadConfig.dspData = JSON.stringify(ads[2]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall("800,150");
}
}else if(obj.result.ads[0].imageType == 5) {
// 四图横幅
var ads = obj.result.ads;
$('.container').css({"width":"845px","height":"120px"});
var dom =' '+projectName+'-广告' +
''+
''+
''+
''
$('.container').append(dom);
var adArr = [];
$.each(ads, function(i, val) {
if(adArr.indexOf(val.planId)<0) {
uploadConfig.act = 'show';
uploadConfig.ad_pos = project+'_tips_4h_'+ (i+1);
uploadConfig.dspData = JSON.stringify(ads[i]);
adArr.push(val.planId)
newUpload(uploadConfig);
uploadZhike(uploadConfig);
}
})
$('.dsp_ad1').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4h_1';
uploadConfig.dspData = JSON.stringify(ads[0]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad2').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4h_2';
uploadConfig.dspData = JSON.stringify(ads[1]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad3').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4h_3';
uploadConfig.dspData = JSON.stringify(ads[2]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad4').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4h_4';
uploadConfig.dspData = JSON.stringify(ads[3]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall("845,120");
}
}else if(obj.result.ads[0].imageType == 6) {
// 四图宫格
var ads = obj.result.ads;
$('.container').css({"width":"520px","height":"350px"});
var dom =' '+projectName+'-广告' +
''+
''+
''+
''
$('.container').append(dom);
var adArr = [];
$.each(ads, function(i, val) {
if(adArr.indexOf(val.planId)<0) {
uploadConfig.act = 'show';
uploadConfig.ad_pos = project+'_tips_4g_'+ (i+1);
uploadConfig.dspData = JSON.stringify(ads[i]);
adArr.push(val.planId)
newUpload(uploadConfig);
uploadZhike(uploadConfig);
}
})
$('.dsp_ad1').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4g_1';
uploadConfig.dspData = JSON.stringify(ads[0]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad2').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4g_2';
uploadConfig.dspData = JSON.stringify(ads[1]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad3').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4g_3';
uploadConfig.dspData = JSON.stringify(ads[2]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('.dsp_ad4').on('click',function() {
uploadConfig.act = 'click';
uploadConfig.ad_pos = project+'_tips_4g_4';
uploadConfig.dspData = JSON.stringify(ads[3]);
newUpload(uploadConfig);
uploadZhike(uploadConfig);
})
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall("520,350");
}
}
} else {
render = true;
var start = currentIndex + 1;
renderFunc(start,dataRes);
}
},
error:function () {
render = true;
var start = currentIndex + 1;
renderFunc(start,dataRes);
}
});
}
}