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

update: ad组件增加参数channel

上级 f0b67ac7
...@@ -10,8 +10,7 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({ ...@@ -10,8 +10,7 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
callbackId, callbackId,
data data
}, pageId) => { }, pageId) => {
const { adpid, width, count } = data getAdData(data, (res) => {
getAdData(adpid, width, count, (res) => {
operateAdView(pageId, callbackId, 'success', res) operateAdView(pageId, callbackId, 'success', res)
}, (err) => { }, (err) => {
operateAdView(pageId, callbackId, 'fail', err) operateAdView(pageId, callbackId, 'fail', err)
...@@ -20,7 +19,8 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({ ...@@ -20,7 +19,8 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
const _adDataCache = {} const _adDataCache = {}
function getAdData (adpid, width, count, onsuccess, onerror) { function getAdData (data, onsuccess, onerror) {
const { adpid, width } = data
const key = adpid + '-' + width const key = adpid + '-' + width
const adDataList = _adDataCache[key] const adDataList = _adDataCache[key]
if (adDataList && adDataList.length > 0) { if (adDataList && adDataList.length > 0) {
...@@ -29,11 +29,7 @@ function getAdData (adpid, width, count, onsuccess, onerror) { ...@@ -29,11 +29,7 @@ function getAdData (adpid, width, count, onsuccess, onerror) {
} }
plus.ad.getAds( plus.ad.getAds(
{ data,
adpid,
count,
width
},
(res) => { (res) => {
const list = res.ads const list = res.ads
onsuccess(list.splice(0, 1)[0]) onsuccess(list.splice(0, 1)[0])
......
...@@ -35,6 +35,10 @@ export default { ...@@ -35,6 +35,10 @@ export default {
dataCount: { dataCount: {
type: Number, type: Number,
default: 5 default: 5
},
channel: {
type: String,
default: ''
} }
}, },
data () { data () {
...@@ -150,7 +154,10 @@ export default { ...@@ -150,7 +154,10 @@ export default {
const data = { const data = {
adpid: adpid || this.adpid, adpid: adpid || this.adpid,
width: this.position.width, width: this.position.width,
count: this.dataCount count: this.dataCount,
ext: {
channel: this.channel
}
} }
UniViewJSBridge.publishHandler('onAdMethodCallback', { UniViewJSBridge.publishHandler('onAdMethodCallback', {
callbackId: this._callbackId, callbackId: this._callbackId,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册