Commit 9becb750 authored by zjz1994's avatar zjz1994

广告enable和img图片的影响

parent 4c72c1fe
......@@ -995,15 +995,16 @@ export class DataManager extends ABDataManager {
//新增广告处理
solveAdvertData(data){
var enable = data.enable;
var rdata = JSON.parse(JSON.stringify(data));
if(enable){//配置了,没东西处理下
var advertList = data.advertList;
if(advertList){
var newAdlist = new Array();
for(var i=0;i<advertList.length;i++){
var iadata = advertList[i];
var iadimg = iadata.img;
var iadurl = iadata.url;
var iadapsClickUrl = iadata.apsClickUrl;
var iadimg = iadata.img||"";
var iadurl = iadata.url||"";
var iadapsClickUrl = iadata.apsClickUrl||"";
if(iadimg&&iadimg.length>2){
newAdlist.push({
img:iadimg,
......@@ -1013,25 +1014,27 @@ export class DataManager extends ABDataManager {
}
}
if(newAdlist.length>0){
return {
rdata = {
enable:true,
advertList:newAdlist
}
}else{
return {
rdata = {
enable:false
}
}
}else{
data.enable = false;
return {
rdata = {
enable:false
}
}
}else{
return {
rdata = {
enable:false
}
}
// console.log("广告处理",rdata);
return rdata;
}
}
\ No newline at end of file
......@@ -21,6 +21,8 @@ export default class AdSmallComp extends ComponentBase {
let { popupAdvert } = data;
if (popupAdvert == null)
popupAdvert = { enable: false, advertList: [] }
popupAdvert = DataManager.ins.solveAdvertData(popupAdvert);
this.visible = popupAdvert.enable;
if (popupAdvert.enable) {
......@@ -35,13 +37,16 @@ export default class AdSmallComp extends ComponentBase {
});
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (data.logid)
NetManager.ins.clickLog1(getlogItem(data.logid));
snpmAdStatic.snpmAdReport("click","bottom",result);
wait(50).then(() => {
if (result.url != 0) window.location.href = decodeURI(result.url);
});
if(result.url.length>2){
if (data.logid){
NetManager.ins.clickLog1(getlogItem(data.logid));
}
snpmAdStatic.snpmAdReport("click","bottom",result);
wait(50).then(() => {
window.location.href = decodeURI(result.url);
});
}
}, this);
}
......
......@@ -192,6 +192,7 @@ export default class MapScene extends Scene {
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) {
......@@ -1037,6 +1038,10 @@ export default class MapScene extends Scene {
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
//
mapAdvert = DataManager.ins.solveAdvertData(mapAdvert);
this['adBtn'].visible = mapAdvert.enable;
if (this['adBtn'].visible) {
NetManager.ins.showLog(getlogItem(32));
......@@ -1051,9 +1056,10 @@ export default class MapScene extends Scene {
snpmAdStatic.snpmAdReport("show","icon",result);
this['adBtn'].source = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog1(getlogItem(32));
snpmAdStatic.snpmAdReport("click","icon",result);
if(result.url!=0){
if(result.url.length>2){
NetManager.ins.clickLog1(getlogItem(32));
snpmAdStatic.snpmAdReport("click","icon",result);
window.location.href = decodeURI(result.url);
}
}, this);
......@@ -1409,7 +1415,8 @@ export default class MapScene extends Scene {
*/
getInviteInfo() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
const { mapAdvert } = hc_advert;
let { mapAdvert } = hc_advert;
mapAdvert = DataManager.ins.solveAdvertData(mapAdvert);
// tslint:disable-next-line: cyclomatic-complexity
NetManager.ins.getInviteInfo((success, res) => {
if (!success || !res.data) {
......
......@@ -6,5 +6,6 @@ export default () => {
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
mapAdvert = DataManager.ins.solveAdvertData(mapAdvert);
return mapAdvert.enable;
}
......@@ -12,7 +12,8 @@ export default class ADPanel extends Panel {
let result;
const hc_advert = DataManager.ins.getData('hc_advert').data;
const { noticeAdvert } = hc_advert;
let { noticeAdvert } = hc_advert;
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
this.visible = noticeAdvert.enable;
// this['adBtn'].mask = this['mask'];
......@@ -26,12 +27,13 @@ export default class ADPanel extends Panel {
this.data.img = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url=='0')return;
snpmAdStatic.snpmAdReport("click","dialog",result);
NetManager.ins.clickLog1(getlogItem(25));
wait(100).then(()=>{
window.location.href = decodeURI(result.url);
});
if(result.url.length>2){
snpmAdStatic.snpmAdReport("click","dialog",result);
NetManager.ins.clickLog1(getlogItem(25));
wait(100).then(()=>{
window.location.href = decodeURI(result.url);
});
}
}, this);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment