提交 f1861737 编写于 作者: d-u-a's avatar d-u-a

fix(h5-ad): 开启摇树后无法找到ad组件导致发行失败的问题

上级 444813b3
...@@ -6,7 +6,7 @@ const { ...@@ -6,7 +6,7 @@ const {
capitalize capitalize
} = require('./util') } = require('./util')
const platformTags = ['map', 'video', 'web-view', 'cover-view', 'cover-image', 'picker'] const platformTags = ['map', 'video', 'web-view', 'cover-view', 'cover-image', 'picker', 'ad']
const autoloadTags = { const autoloadTags = {
// input 在 pageHead 中有使用,resize-sensor 在很多组件中有使用,暂时直接加载 // input 在 pageHead 中有使用,resize-sensor 在很多组件中有使用,暂时直接加载
......
...@@ -441,7 +441,13 @@ export default { ...@@ -441,7 +441,13 @@ export default {
var id = this._randomId() var id = this._randomId()
var view = this._createView(id) var view = this._createView(id)
if (data.a1 === '10011') { if (data.a1 === '10010') {
AdScript.instance.load(data.t, script, () => {
this._renderBaidu(id, data.a2)
}, (err) => {
this.$trigger('error', {}, err)
})
} else if (data.a1 === '10011') {
AdTencent.instance.load(data.a3, data.a2, (res) => { AdTencent.instance.load(data.a3, data.a2, (res) => {
window.TencentGDT.NATIVE.renderAd(res, id) window.TencentGDT.NATIVE.renderAd(res, id)
}) })
...@@ -456,7 +462,7 @@ export default { ...@@ -456,7 +462,7 @@ export default {
}) })
} else { } else {
AdScript.instance.load(data.t, script, () => { AdScript.instance.load(data.t, script, () => {
this._renderAdView(id, view, script, data) this._renderAdView(id, script.s, data)
}, (err) => { }, (err) => {
this.$trigger('error', {}, err) this.$trigger('error', {}, err)
}) })
...@@ -478,9 +484,17 @@ export default { ...@@ -478,9 +484,17 @@ export default {
view.appendChild(adScript) view.appendChild(adScript)
this._startCheckTimer() this._startCheckTimer()
}, },
_renderAdView (id, view, script, data) { _renderBaidu (id, adid) {
(window.slotbydup = window.slotbydup || []).push({
id: adid,
container: id,
async: true
})
this._startCheckTimer()
},
_renderAdView (id, script, data) {
let bindThis = window let bindThis = window
script.s.split('.').reduce((total, currentValue) => { script.split('.').reduce((total, currentValue) => {
bindThis = total bindThis = total
return total[currentValue] return total[currentValue]
}, window).bind(bindThis)(data.a2, id, 2) }, window).bind(bindThis)(data.a2, id, 2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册