@bi-nova/ui-weapp 1.1.3 → 1.2.0-beta.202608131817
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 +9 -48
- package/src/ad/banner/index.js +297 -34
- package/src/ad/banner/index.wxml +41 -22
- package/src/ad/banner/index.wxss +55 -91
- package/src/ad/display/index.js +21 -5
- package/src/ad/display/index.wxml +4 -1
- package/src/ad/splash/index.js +181 -101
- package/src/ad/splash/index.wxml +32 -17
- package/src/ad/splash/index.wxss +69 -78
- package/src/ad/utils.js +13 -5
package/src/ad/banner/index.wxss
CHANGED
|
@@ -1,132 +1,96 @@
|
|
|
1
1
|
.bi-banner-ad {
|
|
2
2
|
position: relative;
|
|
3
|
-
overflow:
|
|
3
|
+
overflow: visible;
|
|
4
4
|
border-radius: 16rpx;
|
|
5
5
|
background: #ffffff;
|
|
6
6
|
box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.08);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.bi-banner-ad__surface {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
min-height: 156rpx;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.bi-banner-ad__media {
|
|
16
|
-
position: relative;
|
|
17
|
-
flex: 0 0 132rpx;
|
|
18
|
-
width: 132rpx;
|
|
19
|
-
height: 156rpx;
|
|
10
|
+
width: 100%;
|
|
11
|
+
border-radius: inherit;
|
|
20
12
|
overflow: hidden;
|
|
21
13
|
}
|
|
22
14
|
|
|
23
15
|
.bi-banner-ad__image {
|
|
24
16
|
display: block;
|
|
25
17
|
width: 100%;
|
|
26
|
-
height:
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.bi-banner-ad__content {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex: 1;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
min-width: 0;
|
|
35
|
-
padding: 18rpx 20rpx 18rpx 18rpx;
|
|
18
|
+
height: auto;
|
|
36
19
|
}
|
|
37
20
|
|
|
38
21
|
.bi-banner-ad__badge {
|
|
39
|
-
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 8rpx;
|
|
24
|
+
left: 8rpx;
|
|
25
|
+
z-index: 4;
|
|
26
|
+
display: flex;
|
|
40
27
|
align-items: center;
|
|
41
28
|
justify-content: center;
|
|
42
|
-
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
min-width: 70rpx;
|
|
43
31
|
height: 30rpx;
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
padding: 0 8rpx;
|
|
33
|
+
border-radius: 4rpx;
|
|
34
|
+
background: rgba(0, 0, 0, 0.3);
|
|
46
35
|
color: #ffffff;
|
|
47
36
|
font-size: 18rpx;
|
|
48
37
|
line-height: 30rpx;
|
|
49
38
|
}
|
|
50
39
|
|
|
51
|
-
.bi-banner-ad__badge
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
.bi-banner-ad__badge-arrow {
|
|
41
|
+
width: 8rpx;
|
|
42
|
+
height: 8rpx;
|
|
43
|
+
margin: -4rpx 0 0 8rpx;
|
|
44
|
+
border-right: 2rpx solid rgba(255, 255, 255, 0.9);
|
|
45
|
+
border-bottom: 2rpx solid rgba(255, 255, 255, 0.9);
|
|
46
|
+
transform: rotate(45deg);
|
|
47
|
+
transition: transform 0.2s ease;
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
.bi-banner-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
overflow: hidden;
|
|
50
|
+
.bi-banner-ad__badge-arrow--active {
|
|
51
|
+
margin-top: 4rpx;
|
|
52
|
+
transform: rotate(225deg);
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
.bi-banner-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
.bi-banner-ad__feedback-panel {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 42rpx;
|
|
58
|
+
left: 8rpx;
|
|
59
|
+
z-index: 3;
|
|
60
|
+
width: 220rpx;
|
|
61
|
+
border: 1rpx solid #eeeeee;
|
|
62
|
+
border-radius: 8rpx;
|
|
63
|
+
background: #ffffff;
|
|
64
|
+
box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.16);
|
|
70
65
|
overflow: hidden;
|
|
71
|
-
text-overflow: ellipsis;
|
|
72
|
-
-webkit-box-orient: vertical;
|
|
73
|
-
-webkit-line-clamp: 2;
|
|
74
66
|
}
|
|
75
67
|
|
|
76
|
-
.bi-banner-
|
|
77
|
-
|
|
78
|
-
min-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
.bi-banner-ad__feedback-source {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
min-height: 54rpx;
|
|
71
|
+
padding: 12rpx 16rpx;
|
|
72
|
+
border-bottom: 1rpx solid #eeeeee;
|
|
73
|
+
color: #333333;
|
|
74
|
+
font-size: 18rpx;
|
|
75
|
+
line-height: 30rpx;
|
|
83
76
|
white-space: nowrap;
|
|
84
|
-
|
|
85
|
-
text-overflow: ellipsis;
|
|
77
|
+
text-align: center;
|
|
86
78
|
}
|
|
87
79
|
|
|
88
|
-
.bi-banner-
|
|
80
|
+
.bi-banner-ad__feedback-item {
|
|
89
81
|
display: flex;
|
|
90
82
|
align-items: center;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
border: none;
|
|
100
|
-
border-radius: 12rpx;
|
|
101
|
-
background: #18b566;
|
|
102
|
-
color: #ffffff;
|
|
103
|
-
font-size: 24rpx;
|
|
104
|
-
font-weight: 500;
|
|
105
|
-
line-height: 54rpx;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.bi-banner-ad__button::after {
|
|
109
|
-
display: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.bi-banner-ad__close {
|
|
113
|
-
position: absolute;
|
|
114
|
-
top: 10rpx;
|
|
115
|
-
right: 10rpx;
|
|
116
|
-
width: 36rpx;
|
|
117
|
-
height: 36rpx;
|
|
118
|
-
min-height: 0;
|
|
119
|
-
padding: 0;
|
|
120
|
-
border: none;
|
|
121
|
-
border-radius: 999rpx;
|
|
122
|
-
background: rgba(15, 23, 42, 0.35);
|
|
123
|
-
color: #ffffff;
|
|
124
|
-
font-size: 24rpx;
|
|
125
|
-
line-height: 36rpx;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
min-height: 54rpx;
|
|
86
|
+
padding: 10rpx 16rpx;
|
|
87
|
+
border-bottom: 1rpx solid #eeeeee;
|
|
88
|
+
color: #4d6385;
|
|
89
|
+
font-size: 18rpx;
|
|
90
|
+
line-height: 32rpx;
|
|
126
91
|
text-align: center;
|
|
127
|
-
z-index: 1;
|
|
128
92
|
}
|
|
129
93
|
|
|
130
|
-
.bi-banner-
|
|
131
|
-
|
|
94
|
+
.bi-banner-ad__feedback-item:last-child {
|
|
95
|
+
border-bottom: none;
|
|
132
96
|
}
|
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-08-
|
|
6
|
+
* @LastEditTime 2026-08-13 11:28:34
|
|
7
7
|
*/
|
|
8
8
|
const SUPPORTED_TYPES = ['banner', 'splash']
|
|
9
9
|
/** 微信系统开屏广告承接记录的本地缓存键前缀,用于按 appId 和广告位隔离缓存 */
|
|
@@ -17,6 +17,7 @@ Component({
|
|
|
17
17
|
unitId: { type: String, value: '' },
|
|
18
18
|
type: { type: String, value: 'banner' },
|
|
19
19
|
customAd: { type: Object, value: null },
|
|
20
|
+
priority: { type: String, value: 'wechat-first' },
|
|
20
21
|
adOptions: { type: Object, value: null },
|
|
21
22
|
sdkKey: { type: String, value: 'biNova' },
|
|
22
23
|
autoLoad: { type: Boolean, value: true },
|
|
@@ -32,6 +33,7 @@ Component({
|
|
|
32
33
|
resolvedType: 'banner',
|
|
33
34
|
resolvedUnitId: '',
|
|
34
35
|
resolvedCustomAd: null,
|
|
36
|
+
resolvedPriority: 'wechat-first',
|
|
35
37
|
resolvedShow: true,
|
|
36
38
|
remoteLoading: false,
|
|
37
39
|
remoteLoaded: false,
|
|
@@ -54,10 +56,11 @@ Component({
|
|
|
54
56
|
this.syncType(nextType)
|
|
55
57
|
this.syncResolvedAdData()
|
|
56
58
|
},
|
|
57
|
-
'unitId, customAd, show'(nextUnitId, nextCustomAd, nextShow) {
|
|
59
|
+
'unitId, customAd, priority, show'(nextUnitId, nextCustomAd, nextPriority, nextShow) {
|
|
58
60
|
this.syncResolvedAdData({
|
|
59
61
|
unitId: nextUnitId,
|
|
60
62
|
customAd: nextCustomAd,
|
|
63
|
+
priority: nextPriority,
|
|
61
64
|
show: nextShow
|
|
62
65
|
})
|
|
63
66
|
},
|
|
@@ -218,11 +221,12 @@ Component({
|
|
|
218
221
|
/**
|
|
219
222
|
* 解析远程广告数据
|
|
220
223
|
* @param {Record<string, any>} remoteData 远程广告配置
|
|
221
|
-
* @returns {{unitId: string, customAd: Record<string, any> | null, show: boolean}}
|
|
224
|
+
* @returns {{unitId: string, customAd: Record<string, any> | null, priority: string, show: boolean}}
|
|
222
225
|
*/
|
|
223
226
|
resolveRemoteAdData(remoteData) {
|
|
224
227
|
const unitId = remoteData && remoteData.unitId || ''
|
|
225
228
|
const customAd = remoteData && (remoteData.customAd || remoteData.custom) || null
|
|
229
|
+
const priority = remoteData && remoteData.priority || 'wechat-first'
|
|
226
230
|
const show = remoteData && typeof remoteData.show === 'boolean'
|
|
227
231
|
? remoteData.show
|
|
228
232
|
: Boolean(unitId || customAd)
|
|
@@ -230,13 +234,14 @@ Component({
|
|
|
230
234
|
return {
|
|
231
235
|
unitId,
|
|
232
236
|
customAd,
|
|
237
|
+
priority,
|
|
233
238
|
show
|
|
234
239
|
}
|
|
235
240
|
},
|
|
236
241
|
|
|
237
242
|
/**
|
|
238
243
|
* 同步组件最终消费的广告数据
|
|
239
|
-
* @param {{unitId?: string, customAd?: Record<string, any> | null, show?: boolean}} [options] 可选覆盖参数
|
|
244
|
+
* @param {{unitId?: string, customAd?: Record<string, any> | null, priority?: string, show?: boolean}} [options] 可选覆盖参数
|
|
240
245
|
* @returns {void}
|
|
241
246
|
*/
|
|
242
247
|
syncResolvedAdData(options) {
|
|
@@ -246,12 +251,14 @@ Component({
|
|
|
246
251
|
const remoteResolved = remoteAdData ? this.resolveRemoteAdData(remoteAdData) : null
|
|
247
252
|
const unitId = remoteResolved ? remoteResolved.unitId : (nextOptions.unitId !== undefined ? nextOptions.unitId : this.properties.unitId)
|
|
248
253
|
const customAd = remoteResolved ? remoteResolved.customAd : (nextOptions.customAd !== undefined ? nextOptions.customAd : this.properties.customAd)
|
|
254
|
+
const priority = remoteResolved ? remoteResolved.priority : (nextOptions.priority !== undefined ? nextOptions.priority : this.properties.priority)
|
|
249
255
|
const show = nextOptions.show !== undefined ? nextOptions.show : this.properties.show
|
|
250
256
|
const resolvedShow = Boolean(show && (!remoteEnabled || !this.properties.adId || !this.data.remoteLoaded || remoteResolved && remoteResolved.show))
|
|
251
257
|
|
|
252
258
|
this.setData({
|
|
253
259
|
resolvedUnitId: unitId || '',
|
|
254
260
|
resolvedCustomAd: customAd || null,
|
|
261
|
+
resolvedPriority: priority || 'wechat-first',
|
|
255
262
|
resolvedShow
|
|
256
263
|
})
|
|
257
264
|
},
|
|
@@ -414,7 +421,7 @@ Component({
|
|
|
414
421
|
|
|
415
422
|
/**
|
|
416
423
|
* 统一透传子组件事件
|
|
417
|
-
* @param {'load' | 'error' | 'close' | 'action' | 'hide' | 'openWebview'} eventName 事件名称
|
|
424
|
+
* @param {'load' | 'error' | 'close' | 'action' | 'feedback' | 'hide' | 'openWebview'} eventName 事件名称
|
|
418
425
|
* @param {Record<string, any>} event 原始事件对象
|
|
419
426
|
* @returns {void}
|
|
420
427
|
*/
|
|
@@ -496,6 +503,15 @@ Component({
|
|
|
496
503
|
this.forwardEvent('action', event)
|
|
497
504
|
},
|
|
498
505
|
|
|
506
|
+
/**
|
|
507
|
+
* 处理自研广告反馈事件
|
|
508
|
+
* @param {Record<string, any>} event 反馈事件
|
|
509
|
+
* @returns {void}
|
|
510
|
+
*/
|
|
511
|
+
handleFeedback(event) {
|
|
512
|
+
this.forwardEvent('feedback', event)
|
|
513
|
+
},
|
|
514
|
+
|
|
499
515
|
/**
|
|
500
516
|
* 处理广告隐藏事件
|
|
501
517
|
* @param {Record<string, any>} event 广告隐藏事件
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<!-- Banner 广告组件 -->
|
|
2
2
|
<bi-banner-ad
|
|
3
|
-
wx:if="{{resolvedType === 'banner'}}"
|
|
3
|
+
wx:if="{{resolvedType === 'banner' && resolvedShow}}"
|
|
4
4
|
unit-id="{{resolvedUnitId}}"
|
|
5
5
|
custom-ad="{{resolvedCustomAd}}"
|
|
6
|
+
priority="{{resolvedPriority}}"
|
|
6
7
|
ad-intervals="{{adIntervals}}"
|
|
7
8
|
bind:load="handleLoad"
|
|
8
9
|
bind:error="handleError"
|
|
9
10
|
bind:close="handleClose"
|
|
10
11
|
bind:action="handleAction"
|
|
12
|
+
bind:feedback="handleFeedback"
|
|
11
13
|
bind:openWebview="handleOpenWebview"
|
|
12
14
|
/>
|
|
13
15
|
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
wx:elif="{{resolvedType === 'splash'}}"
|
|
17
19
|
unit-id="{{resolvedUnitId}}"
|
|
18
20
|
custom-ad="{{resolvedCustomAd}}"
|
|
21
|
+
priority="{{resolvedPriority}}"
|
|
19
22
|
show="{{resolvedShow}}"
|
|
20
23
|
z-index="{{zIndex}}"
|
|
21
24
|
picture-in-picture="{{pictureInPicture}}"
|