Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
11f5f3b0
Commit
11f5f3b0
authored
Oct 14, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2861f099
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
16 deletions
+59
-16
ADSmallSkin.exml
egret/resource/skins/ADSmallSkin.exml
+1
-1
AdSmallComp.ts
egret/src/mapScene/AdSmallComp.ts
+21
-5
advert.json
mock/happyclear/advert.json
+37
-10
No files found.
egret/resource/skins/ADSmallSkin.exml
View file @
11f5f3b0
...
@@ -2,5 +2,5 @@
...
@@ -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"
>
<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"
/>
<w:Config
id=
"16db4bf413f"
/>
<e:Image
source=
"common_adbg_png"
/>
<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>
</e:Skin>
\ No newline at end of file
egret/src/mapScene/AdSmallComp.ts
View file @
11f5f3b0
import
ComponentBase
from
"../../libs/new_wx/components/ComponentBase"
;
import
ComponentBase
from
"../../libs/new_wx/components/ComponentBase"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
export
default
class
AdSmallComp
extends
ComponentBase
{
export
default
class
AdSmallComp
extends
ComponentBase
{
start
(
data
?)
{
start
(
data
?)
{
this
.
touchEnabled
=
this
.
touchChildren
=
false
;
let
result
;
this
.
touchEnabled
=
this
.
touchChildren
=
false
;
super
.
start
(
data
);
super
.
start
(
data
);
NetManager
.
ins
.
hc_advert
(()
=>
{
NetManager
.
ins
.
hc_advert
(()
=>
{
this
.
data
.
img
=
''
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'
}
get
skinKey
():
string
{
return
'ADSmall'
}
...
...
mock/happyclear/advert.json
View file @
11f5f3b0
...
@@ -3,18 +3,45 @@
...
@@ -3,18 +3,45 @@
"code"
:
null
,
"code"
:
null
,
"desc"
:
null
,
"desc"
:
null
,
"timestamp"
:
1566199822308
,
"timestamp"
:
1566199822308
,
"data"
:
[
"data"
:
{
{
"popupAdvert"
:
{
"
levelNum"
:
1
,
"
enable"
:
true
,
"
rank
"
:[
"
advertList
"
:[
{
{
"nickName"
:
"昵称"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"avatar"
:
"头像"
,
"url"
:
"Http://www.baidu.com"
"stars"
:
1
,
},
"maxScore"
:
123
,
{
"rank"
:
"排名"
"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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment