Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
ce89d637
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce89d637
编写于
12月 27, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
chore: merge
上级
81ee2638
7c101633
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
25 deletion
+56
-25
src/platforms/h5/view/components/ad/index.vue
src/platforms/h5/view/components/ad/index.vue
+56
-25
未找到文件。
src/platforms/h5/view/components/ad/index.vue
浏览文件 @
ce89d637
...
...
@@ -254,7 +254,7 @@ class AdScript {
load
(
provider
,
script
,
success
,
fail
)
{
if
(
this
.
_cache
[
provider
]
===
undefined
)
{
this
.
loadScript
(
script
)
this
.
loadScript
(
provider
,
script
)
}
if
(
this
.
_cache
[
provider
]
===
1
)
{
...
...
@@ -400,6 +400,9 @@ export default {
beforeDestroy
()
{
this
.
_clearCheckTimer
()
this
.
$refs
.
container
.
innerHTML
=
''
if
(
this
.
_shanhuAd
)
{
delete
this
.
_shanhuAd
}
},
methods
:
{
_onhandle
(
e
)
{
...
...
@@ -432,47 +435,75 @@ export default {
const
data
=
this
.
_pl
[
this
.
_pi
]
const
providerConfig
=
this
.
_b
[
data
.
a1
][
data
.
t
]
const
script
=
providerConfig
.
script
var
randomId
=
this
.
_randomId
()
var
id
=
this
.
_randomId
()
var
view
=
this
.
_createView
(
id
)
if
(
data
.
a1
===
'
10011
'
)
{
AdTencent
.
instance
.
load
(
data
.
a3
,
data
.
a2
,
(
res
)
=>
{
window
.
TencentGDT
.
NATIVE
.
renderAd
(
res
,
randomI
d
)
window
.
TencentGDT
.
NATIVE
.
renderAd
(
res
,
i
d
)
})
this
.
_startCheckTimer
()
}
else
if
(
data
.
a1
===
'
10012
'
)
{
this
.
_renderAdView
(
providerConfig
,
data
,
randomId
)
this
.
_renderScript
(
view
,
script
)
}
else
if
(
data
.
a1
===
'
10014
'
)
{
AdScript
.
instance
.
load
(
data
.
t
,
script
,
()
=>
{
this
.
_renderShanhu
(
id
,
data
.
tt
,
data
.
tar
)
},
(
err
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
err
)
})
}
else
{
AdScript
.
instance
.
load
(
data
.
t
,
providerConfig
.
script
,
()
=>
{
this
.
_renderAdView
(
providerConfig
,
data
,
randomId
)
AdScript
.
instance
.
load
(
data
.
t
,
script
,
()
=>
{
this
.
_renderAdView
(
id
,
view
,
script
,
data
)
},
(
err
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
err
)
})
}
},
_
renderAdView
(
providerConfig
,
data
,
randomI
d
)
{
_
createView
(
i
d
)
{
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
class
'
,
randomI
d
)
adView
.
setAttribute
(
'
id
'
,
randomI
d
)
adView
.
setAttribute
(
'
id
'
,
i
d
)
adView
.
setAttribute
(
'
class
'
,
i
d
)
this
.
$refs
.
container
.
innerHTML
=
''
this
.
$refs
.
container
.
append
(
adView
)
if
(
data
.
a1
===
'
10011
'
)
{
}
else
if
(
data
.
a1
===
'
10012
'
)
{
var
adScript
=
document
.
createElement
(
'
script
'
)
const
script
=
providerConfig
.
script
for
(
const
var1
in
script
)
{
adScript
.
setAttribute
(
var1
,
script
[
var1
])
}
adView
.
appendChild
(
adScript
)
}
else
{
let
bindThis
=
window
providerConfig
.
s
.
split
(
'
.
'
).
reduce
((
total
,
currentValue
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
).
bind
(
bindThis
)(
data
.
a2
,
randomId
,
2
)
return
adView
},
_renderScript
(
view
,
script
)
{
var
adScript
=
document
.
createElement
(
'
script
'
)
for
(
const
var1
in
script
)
{
adScript
.
setAttribute
(
var1
,
script
[
var1
])
}
view
.
appendChild
(
adScript
)
this
.
_startCheckTimer
()
},
_renderAdView
(
id
,
view
,
script
,
data
)
{
let
bindThis
=
window
script
.
s
.
split
(
'
.
'
).
reduce
((
total
,
currentValue
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
).
bind
(
bindThis
)(
data
.
a2
,
id
,
2
)
this
.
_startCheckTimer
()
},
_renderShanhu
(
id
,
type
,
target
)
{
this
.
_shanhuAd
=
new
window
.
CoralTBSAdv
(
id
,
{
type
:
type
,
target
:
target
,
advShowCb
:
()
=>
{
this
.
_report
(
42
)
this
.
$trigger
(
'
load
'
,
{},
{})
},
advClickCb
:
()
=>
{
this
.
_report
(
43
)
this
.
$trigger
(
'
adclicked
'
,
{},
{})
},
advCloseCb
:
()
=>
{
this
.
$trigger
(
'
close
'
,
{},
{})
},
advErrorCb
:
(
errorno
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
errorno
)
}
})
this
.
_startCheckTimer
()
},
_renderNext
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录