@bi-nova/ui-weapp 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ad/README.md +7 -7
- package/src/ad/display/index.js +22 -1
package/package.json
CHANGED
package/src/ad/README.md
CHANGED
|
@@ -223,13 +223,13 @@ Page({
|
|
|
223
223
|
|
|
224
224
|
### 通用事件
|
|
225
225
|
|
|
226
|
-
| 事件名 | 说明
|
|
227
|
-
| ---
|
|
228
|
-
| `load` |
|
|
229
|
-
| `error` |
|
|
230
|
-
| `close` |
|
|
231
|
-
| `action` | 自定义广告点击
|
|
232
|
-
| `openWebview` | 自定义广告命中 WebView 跳转
|
|
226
|
+
| 事件名 | 说明 | 事件详情 |
|
|
227
|
+
| --- |---------------------------------| --- |
|
|
228
|
+
| `load` | 广告加载完成;微信系统开屏广告承接时额外返回 `nativeSplash: true` | `{ provider, type, adId?, nativeSplash? }`。仅当 `nativeSplash === true` 时表示微信系统开屏广告已承接;普通微信 `ad-custom` 广告同样返回 `provider: 'wechat'`,但不包含该标识 |
|
|
229
|
+
| `error` | 接口请求失败或返回失败码;SDK 未初始化;广告素材加载失败;广告跳转失败 | `{ provider?, type, adId?, errCode, errMsg }` |
|
|
230
|
+
| `close` | 广告关闭;远程配置成功但无可展示广告时也会触发 | `{ provider, type, adId?, reason? }`,无可展示广告时 `reason` 为 `noAd` |
|
|
231
|
+
| `action` | 自定义广告点击 | `{ provider, type, adId? }` |
|
|
232
|
+
| `openWebview` | 自定义广告命中 WebView 跳转 | `{ provider, type, adId?, url }` |
|
|
233
233
|
|
|
234
234
|
### 统一广告组件扩展事件
|
|
235
235
|
|
package/src/ad/display/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @Author wutao
|
|
4
4
|
* @Date 2026-04-10
|
|
5
5
|
* @LastEditors wutao
|
|
6
|
-
* @LastEditTime 2026-05
|
|
6
|
+
* @LastEditTime 2026-08-05 14:11:33
|
|
7
7
|
*/
|
|
8
8
|
const SUPPORTED_TYPES = ['banner', 'splash']
|
|
9
9
|
/** 微信系统开屏广告承接记录的本地缓存键前缀,用于按 appId 和广告位隔离缓存 */
|
|
@@ -266,6 +266,20 @@ Component({
|
|
|
266
266
|
this.triggerEvent('error', detail)
|
|
267
267
|
},
|
|
268
268
|
|
|
269
|
+
/**
|
|
270
|
+
* 触发无可展示广告的关闭事件,确保依赖广告终态回调的业务流程可以继续执行
|
|
271
|
+
* @param {Record<string, any>} remoteData 远程广告配置
|
|
272
|
+
* @returns {void}
|
|
273
|
+
*/
|
|
274
|
+
triggerNoAdClose(remoteData) {
|
|
275
|
+
this.triggerEvent('close', {
|
|
276
|
+
type: this.data.resolvedType,
|
|
277
|
+
adId: this.properties.adId || remoteData && remoteData.adId || '',
|
|
278
|
+
provider: remoteData && remoteData.provider || 'none',
|
|
279
|
+
reason: 'noAd'
|
|
280
|
+
})
|
|
281
|
+
},
|
|
282
|
+
|
|
269
283
|
/**
|
|
270
284
|
* 拉取远程广告配置
|
|
271
285
|
* @param {string} reason 触发原因
|
|
@@ -354,6 +368,9 @@ Component({
|
|
|
354
368
|
return
|
|
355
369
|
}
|
|
356
370
|
|
|
371
|
+
const remoteResolved = this.resolveRemoteAdData(result.data)
|
|
372
|
+
const shouldTriggerNoAdClose = Boolean(this.properties.show && !remoteResolved.show)
|
|
373
|
+
|
|
357
374
|
this.setData({
|
|
358
375
|
remoteLoading: false,
|
|
359
376
|
remoteLoaded: true,
|
|
@@ -366,6 +383,10 @@ Component({
|
|
|
366
383
|
requestOptions,
|
|
367
384
|
data: result.data
|
|
368
385
|
})
|
|
386
|
+
|
|
387
|
+
if (shouldTriggerNoAdClose) {
|
|
388
|
+
this.triggerNoAdClose(result.data)
|
|
389
|
+
}
|
|
369
390
|
} catch (error) {
|
|
370
391
|
if (requestToken !== this.requestToken) return
|
|
371
392
|
|