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
1aa8ea03
Commit
1aa8ea03
authored
May 11, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snpm上报
parent
93e9c6fb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
AdSmallComp.ts
egret/src/mapScene/AdSmallComp.ts
+5
-0
MapScene.ts
egret/src/mapScene/MapScene.ts
+5
-1
ADPanel.ts
egret/src/panels/ADPanel.ts
+3
-0
snpmAdStatic.ts
egret/src/statics/snpmAdStatic.ts
+64
-0
No files found.
egret/src/mapScene/AdSmallComp.ts
View file @
1aa8ea03
...
...
@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
{
getlogItem
}
from
"../Main"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
{
snpmAdStatic
}
from
"../statics/snpmAdStatic"
;
export
default
class
AdSmallComp
extends
ComponentBase
{
...
...
@@ -21,12 +22,14 @@ export default class AdSmallComp extends ComponentBase {
if
(
popupAdvert
==
null
)
popupAdvert
=
{
enable
:
false
,
advertList
:
[]
}
this
.
visible
=
popupAdvert
.
enable
;
if
(
popupAdvert
.
enable
)
{
result
=
popupAdvert
.
advertList
;
if
(
Array
.
isArray
(
popupAdvert
.
advertList
))
{
const
index
=
Math
.
floor
(
popupAdvert
.
advertList
.
length
*
Math
.
random
());
result
=
popupAdvert
.
advertList
[
index
];
}
snpmAdStatic
.
snpmAdReport
(
"show"
,
"bottom"
,
result
);
this
.
data
.
img
=
result
.
img
;
}
});
...
...
@@ -34,6 +37,8 @@ export default class AdSmallComp extends ComponentBase {
this
[
'img'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
data
.
logid
)
NetManager
.
ins
.
clickLog
(
getlogItem
(
data
.
logid
));
snpmAdStatic
.
snpmAdReport
(
"click"
,
"bottom"
,
result
);
wait
(
50
).
then
(()
=>
{
if
(
result
.
url
!=
0
)
window
.
location
.
href
=
result
.
url
;
});
...
...
egret/src/mapScene/MapScene.ts
View file @
1aa8ea03
...
...
@@ -38,6 +38,7 @@ import getSignBtn from "./getSignBtn";
import
getAdBtn
from
"./getAdBtn"
;
import
getInviteBtn
from
"./getInviteBtn"
;
import
{
play2
,
play1
}
from
"../panels/help/svgaTool"
;
import
{
snpmAdStatic
}
from
"../statics/snpmAdStatic"
;
let
doHelpFlag
=
false
;
// let doScratchHelpFlag = false;
...
...
@@ -732,11 +733,14 @@ export default class MapScene extends Scene {
const
index
=
Math
.
floor
(
mapAdvert
.
advertList
.
length
*
Math
.
random
());
result
=
mapAdvert
.
advertList
[
index
];
}
snpmAdStatic
.
snpmAdReport
(
"show"
,
"icon"
,
result
);
this
[
'adBtn'
].
source
=
result
.
img
;
this
[
'adBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
32
));
if
(
result
.
url
!=
0
)
snpmAdStatic
.
snpmAdReport
(
"click"
,
"icon"
,
result
);
if
(
result
.
url
!=
0
){
window
.
location
.
href
=
result
.
url
;
}
},
this
);
}
}
...
...
egret/src/panels/ADPanel.ts
View file @
1aa8ea03
...
...
@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
{
getlogItem
}
from
"../Main"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
{
snpmAdStatic
}
from
"../statics/snpmAdStatic"
;
export
default
class
ADPanel
extends
Panel
{
start
(
data
)
{
...
...
@@ -21,10 +22,12 @@ export default class ADPanel extends Panel {
const
index
=
Math
.
floor
(
noticeAdvert
.
advertList
.
length
*
Math
.
random
());
result
=
noticeAdvert
.
advertList
[
index
];
}
snpmAdStatic
.
snpmAdReport
(
"show"
,
"dialog"
,
result
);
this
.
data
.
img
=
result
.
img
;
this
[
'adBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
result
.
url
==
'0'
)
return
;
snpmAdStatic
.
snpmAdReport
(
"click"
,
"dialog"
,
result
);
NetManager
.
ins
.
clickLog
(
getlogItem
(
25
));
wait
(
100
).
then
(()
=>
{
window
.
location
.
href
=
result
.
url
;
...
...
egret/src/statics/snpmAdStatic.ts
0 → 100644
View file @
1aa8ea03
export
class
snpmAdStatic
{
/**
* 苏宁广告上报
* @param type show曝光,click点击
* @param from 来源1.icon首页小图标,2.dialog大弹窗广告,3.bottom部分弹窗下挂载的
*/
static
snpmAdReport
(
type
:
string
,
from
:
string
,
adata
:
object
){
}
/**
* 苏宁曝光上报,snpm
* @param params
*/
static
showAdReport
(
params
){
try
{
let
elem
=
document
.
createElement
(
'div'
)
params
.
saData
.
eleid
=
params
.
eleid
;
elem
.
setAttribute
(
'sa-data'
,
JSON
.
stringify
(
params
.
saData
))
// 新增广告埋点
if
(
params
.
targeturl
)
{
elem
.
setAttribute
(
'href'
,
params
.
targeturl
)
}
elem
.
setAttribute
(
"sap-modid"
,
params
.
sapmodid
);
elem
.
setAttribute
(
"eleid"
,
params
.
eleid
);
if
(
window
[
'SAUP'
]
&&
window
[
'SAUP'
].
sendLogData
)
{
//expoManual
//exposure
window
[
'SAUP'
].
sendLogData
(
"exposure"
,
elem
);
}
}
catch
(
e
){
}
}
/**
* 苏宁点击上报,snpm
* @param params
*/
static
clickAdReport
(
params
){
try
{
let
elem
=
document
.
createElement
(
'div'
);
elem
.
setAttribute
(
'sa-data'
,
JSON
.
stringify
(
params
.
saData
));
//广告埋点
if
(
params
.
targeturl
){
elem
.
setAttribute
(
'href'
,
params
.
targeturl
);
//异步发送请求
let
img
=
new
Image
();
img
.
src
=
params
.
targeturl
;
}
if
(
window
[
'SAUP'
]
&&
window
[
'SAUP'
].
sendLogData
)
{
//click
//comclick
window
[
'SAUP'
].
sendLogData
(
'comclick'
,{
tag
:
elem
,
sapmodid
:
params
.
sapmodid
,
eleid
:
params
.
eleid
})
}
elem
.
setAttribute
(
'sa-data'
,
'{}'
);
}
catch
(
e
){
}
}
}
\ 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