Commit 11f5f3b0 authored by wildfirecode's avatar wildfirecode

1

parent 2861f099
......@@ -2,5 +2,5 @@
<e:Skin class="ADSmallSkin" width="582" height="203" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16db4bf413f"/>
<e:Image source="common_adbg_png"/>
<e:Image y="57" horizontalCenter="0" width="493" height="111" source="{data.img}" anchorOffsetY="0"/>
<e:Image id="img" y="57" horizontalCenter="0" width="493" height="111" source="{data.img}" anchorOffsetY="0"/>
</e:Skin>
\ No newline at end of file
import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class AdSmallComp extends ComponentBase {
start(data?) {
this.touchEnabled=this.touchChildren=false;
let result;
this.touchEnabled = this.touchChildren = false;
super.start(data);
NetManager.ins.hc_advert(()=>{
this.data.img = ''
})
NetManager.ins.hc_advert(() => {
const { data } = DataManager.ins.getData('hc_advert');
const { noticeAdvert } = data;
this.visible = noticeAdvert.enable;
if (noticeAdvert.enable) {
result = noticeAdvert.advertList;
if(Array.isArray(noticeAdvert.advertList)) {
const index = Math.floor(noticeAdvert.advertList.length * Math.random());
result =noticeAdvert.advertList[index];
}
this.data.img = result.img;
}
});
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
window.location.href = result.url;
},this);
}
get skinKey(): string { return 'ADSmall' }
......
......@@ -3,18 +3,45 @@
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":[
{
"levelNum":1,
"rank":[
"data":{
"popupAdvert":{
"enable":true,
"advertList":[
{
"nickName":"昵称",
"avatar":"头像",
"stars":1,
"maxScore":123,
"rank":"排名"
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
},
{
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
}
]
},
"noticeAdvert":{
"enable":true,
"advertList":[
{
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
},
{
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
}
]
},
"mapAdvert":{
"enable":true,
"advertList":[
{
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
},
{
"img":"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg",
"url":"Http://www.baidu.com"
}
]
}
]
}
}
\ No newline at end of file
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