Commit 9becb750 authored by zjz1994's avatar zjz1994

广告enable和img图片的影响

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