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
9becb750
Commit
9becb750
authored
May 22, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告enable和img图片的影响
parent
4c72c1fe
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
25 deletions
+43
-25
DataManager.ts
egret/libs/tw/manager/DataManager.ts
+10
-7
AdSmallComp.ts
egret/src/mapScene/AdSmallComp.ts
+12
-7
MapScene.ts
egret/src/mapScene/MapScene.ts
+11
-4
getAdBtn.ts
egret/src/mapScene/getAdBtn.ts
+1
-0
ADPanel.ts
egret/src/panels/ADPanel.ts
+9
-7
No files found.
egret/libs/tw/manager/DataManager.ts
View file @
9becb750
...
@@ -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
){
r
eturn
{
r
data
=
{
enable
:
true
,
enable
:
true
,
advertList
:
newAdlist
advertList
:
newAdlist
}
}
}
else
{
}
else
{
r
eturn
{
r
data
=
{
enable
:
false
enable
:
false
}
}
}
}
}
else
{
}
else
{
data
.
enable
=
false
;
data
.
enable
=
false
;
r
eturn
{
r
data
=
{
enable
:
false
enable
:
false
}
}
}
}
}
else
{
}
else
{
r
eturn
{
r
data
=
{
enable
:
false
enable
:
false
}
}
}
}
// console.log("广告处理",rdata);
return
rdata
;
}
}
}
}
\ No newline at end of file
egret/src/mapScene/AdSmallComp.ts
View file @
9becb750
...
@@ -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
){
if
(
data
.
logid
){
NetManager
.
ins
.
clickLog1
(
getlogItem
(
data
.
logid
));
NetManager
.
ins
.
clickLog1
(
getlogItem
(
data
.
logid
));
}
snpmAdStatic
.
snpmAdReport
(
"click"
,
"bottom"
,
result
);
snpmAdStatic
.
snpmAdReport
(
"click"
,
"bottom"
,
result
);
wait
(
50
).
then
(()
=>
{
wait
(
50
).
then
(()
=>
{
if
(
result
.
url
!=
0
)
window
.
location
.
href
=
decodeURI
(
result
.
url
);
window
.
location
.
href
=
decodeURI
(
result
.
url
);
});
});
}
},
this
);
},
this
);
}
}
...
...
egret/src/mapScene/MapScene.ts
View file @
9becb750
...
@@ -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
,
()
=>
{
if
(
result
.
url
.
length
>
2
){
NetManager
.
ins
.
clickLog1
(
getlogItem
(
32
));
NetManager
.
ins
.
clickLog1
(
getlogItem
(
32
));
snpmAdStatic
.
snpmAdReport
(
"click"
,
"icon"
,
result
);
snpmAdStatic
.
snpmAdReport
(
"click"
,
"icon"
,
result
);
if
(
result
.
url
!=
0
){
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
)
{
...
...
egret/src/mapScene/getAdBtn.ts
View file @
9becb750
...
@@ -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
;
}
}
egret/src/panels/ADPanel.ts
View file @
9becb750
...
@@ -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
);
}
}
...
...
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