@dcloudio/uni-cli-shared 2.0.2-4020420240722004 → 2.0.2-4020920240930001
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/components/ad-fullscreen-video.vue +9 -3
- package/components/ad-interstitial.vue +8 -2
- package/components/ad-rewarded-video.vue +8 -2
- package/components/{ad.mixin.js → ad.mixin.app.js} +7 -4
- package/components/ad.mixin.mp-alipay.js +111 -0
- package/components/{ad.mixin.mp.js → ad.mixin.mp-weixin.js} +3 -5
- package/components/uniad.vue +7 -3
- package/license.md +1 -0
- package/package.json +2 -2
|
@@ -3,16 +3,22 @@
|
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
5
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
8
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
9
|
<!-- #endif -->
|
|
7
10
|
</view>
|
|
8
11
|
</template>
|
|
9
12
|
|
|
10
13
|
<script>
|
|
11
|
-
// #
|
|
12
|
-
import adMixin from "./ad.mixin.js"
|
|
14
|
+
// #ifdef APP
|
|
15
|
+
import adMixin from "./ad.mixin.app.js"
|
|
13
16
|
// #endif
|
|
14
17
|
// #ifdef MP-WEIXIN
|
|
15
|
-
import adMixin from "./ad.mixin.mp.js"
|
|
18
|
+
import adMixin from "./ad.mixin.mp-weixin.js"
|
|
19
|
+
// #endif
|
|
20
|
+
// #ifdef MP-ALIPAY
|
|
21
|
+
import adMixin from "./ad.mixin.mp-alipay.js"
|
|
16
22
|
// #endif
|
|
17
23
|
|
|
18
24
|
export default {
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
5
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
8
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
9
|
<!-- #endif -->
|
|
7
10
|
<!-- #ifdef H5 -->
|
|
8
11
|
<div ref="container" />
|
|
@@ -12,13 +15,16 @@
|
|
|
12
15
|
|
|
13
16
|
<script>
|
|
14
17
|
// #ifdef APP
|
|
15
|
-
import adMixin from "./ad.mixin.js"
|
|
18
|
+
import adMixin from "./ad.mixin.app.js"
|
|
16
19
|
// #endif
|
|
17
20
|
// #ifdef H5
|
|
18
21
|
import adMixin from "./ad-interstitial.web.js"
|
|
19
22
|
// #endif
|
|
20
23
|
// #ifdef MP-WEIXIN
|
|
21
|
-
import adMixin from "./ad.mixin.mp.js"
|
|
24
|
+
import adMixin from "./ad.mixin.mp-weixin.js"
|
|
25
|
+
// #endif
|
|
26
|
+
// #ifdef MP-ALIPAY
|
|
27
|
+
import adMixin from "./ad.mixin.mp-alipay.js"
|
|
22
28
|
// #endif
|
|
23
29
|
|
|
24
30
|
export default {
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
5
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
8
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
9
|
<!-- #endif -->
|
|
7
10
|
</view>
|
|
8
11
|
</template>
|
|
9
12
|
|
|
10
13
|
<script>
|
|
11
14
|
// #ifdef APP
|
|
12
|
-
import adMixin from "./ad.mixin.js"
|
|
15
|
+
import adMixin from "./ad.mixin.app.js"
|
|
13
16
|
// #endif
|
|
14
17
|
// #ifdef H5
|
|
15
18
|
import adMixin from "./ad.mixin.web.js"
|
|
16
19
|
// #endif
|
|
17
20
|
// #ifdef MP-WEIXIN
|
|
18
|
-
import adMixin from "./ad.mixin.mp.js"
|
|
21
|
+
import adMixin from "./ad.mixin.mp-weixin.js"
|
|
22
|
+
// #endif
|
|
23
|
+
// #ifdef MP-ALIPAY
|
|
24
|
+
import adMixin from "./ad.mixin.mp-alipay.js"
|
|
19
25
|
// #endif
|
|
20
26
|
|
|
21
27
|
export default {
|
|
@@ -424,10 +424,13 @@ export default {
|
|
|
424
424
|
if (this.preload) {
|
|
425
425
|
this._loadAd()
|
|
426
426
|
}
|
|
427
|
-
},
|
|
428
|
-
// 服务器回调透传参数,仅在创建广告实例时可传递参数,如果发生变化需要重新创建广告实例
|
|
429
|
-
urlCallback
|
|
430
|
-
|
|
427
|
+
},
|
|
428
|
+
// 服务器回调透传参数,仅在创建广告实例时可传递参数,如果发生变化需要重新创建广告实例
|
|
429
|
+
urlCallback: {
|
|
430
|
+
deep: true,
|
|
431
|
+
handler () {
|
|
432
|
+
this._removeInstance()
|
|
433
|
+
}
|
|
431
434
|
}
|
|
432
435
|
},
|
|
433
436
|
created () {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const EventType = {
|
|
2
|
+
Load: 'load',
|
|
3
|
+
Close: 'close',
|
|
4
|
+
Error: 'error'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
props: {
|
|
9
|
+
options: {
|
|
10
|
+
type: [Object, Array],
|
|
11
|
+
default () {
|
|
12
|
+
return {}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
adpid: {
|
|
16
|
+
type: [Number, String],
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
19
|
+
unitId: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
preload: {
|
|
24
|
+
type: [Boolean, String],
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
loadnext: {
|
|
28
|
+
type: [Boolean, String],
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
urlCallback: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default () {
|
|
34
|
+
return {}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
data () {
|
|
39
|
+
return {
|
|
40
|
+
loading: false,
|
|
41
|
+
errorMessage: null
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
created () {
|
|
45
|
+
this._ad = null
|
|
46
|
+
},
|
|
47
|
+
methods: {
|
|
48
|
+
load () {
|
|
49
|
+
if (this.loading) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
this._startLoading()
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
show () {
|
|
56
|
+
this.errorMessage = null
|
|
57
|
+
this._refAdPlugin.show()
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
_handleAdRef (c) {
|
|
61
|
+
// this._refAdPlugin = c
|
|
62
|
+
this._refAdPlugin = c.detail.__args__[0]
|
|
63
|
+
if (this.preload && this._canCreateAd()) {
|
|
64
|
+
this._startLoading()
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
_onclick () {
|
|
69
|
+
this.show()
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
_startLoading () {
|
|
73
|
+
this.loading = true
|
|
74
|
+
this.errorMessage = null
|
|
75
|
+
this._refAdPlugin.load()
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
_canCreateAd () {
|
|
79
|
+
let result = false
|
|
80
|
+
if (typeof this.adpid === 'string' && this.adpid.length > 0) {
|
|
81
|
+
result = true
|
|
82
|
+
} else if (typeof this.adpid === 'number') {
|
|
83
|
+
result = true
|
|
84
|
+
}
|
|
85
|
+
return result
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
_hasCallback () {
|
|
89
|
+
return (typeof this.urlCallback === 'object' && Object.keys(this.urlCallback).length > 0)
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
_onmpload (e) {
|
|
93
|
+
this.loading = false
|
|
94
|
+
this._dispatchEvent(EventType.Load, {})
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
_onmpclose (e) {
|
|
98
|
+
this._dispatchEvent(EventType.Close, e)
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
_onmperror (e) {
|
|
102
|
+
this.loading = false
|
|
103
|
+
this.errorMessage = JSON.stringify(e)
|
|
104
|
+
this._dispatchEvent(EventType.Error, e)
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
_dispatchEvent (type, data) {
|
|
108
|
+
this.$emit(type, data)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -43,11 +43,9 @@ export default {
|
|
|
43
43
|
},
|
|
44
44
|
created () {
|
|
45
45
|
this._ad = null
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}, 100)
|
|
46
|
+
if (this.preload && this._canCreateAd()) {
|
|
47
|
+
this.load()
|
|
48
|
+
}
|
|
51
49
|
},
|
|
52
50
|
methods: {
|
|
53
51
|
load () {
|
package/components/uniad.vue
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<uniad-plugin
|
|
4
4
|
class="uniad-plugin"
|
|
5
5
|
:adpid="adpid"
|
|
6
|
-
:unit-id="unitId"
|
|
7
6
|
@load="_onmpload"
|
|
8
7
|
@close="_onmpclose"
|
|
9
8
|
@error="_onmperror"
|
|
@@ -11,8 +10,13 @@
|
|
|
11
10
|
</view>
|
|
12
11
|
</template>
|
|
13
12
|
|
|
14
|
-
<script>
|
|
15
|
-
|
|
13
|
+
<script>
|
|
14
|
+
// #ifdef MP-WEIXIN
|
|
15
|
+
import adMixin from "./ad.mixin.mp-weixin.js"
|
|
16
|
+
// #endif
|
|
17
|
+
// #ifdef MP-ALIPAY
|
|
18
|
+
import adMixin from "./ad.mixin.mp-alipay.js"
|
|
19
|
+
// #endif
|
|
16
20
|
export default {
|
|
17
21
|
name: 'Uniad',
|
|
18
22
|
mixins: [adMixin],
|
package/license.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[https://uniapp.dcloud.net.cn/license.html ](https://uniapp.dcloud.net.cn/license.html )
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-4020920240930001",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"postcss-urlrewrite": "^0.2.2",
|
|
27
27
|
"strip-json-comments": "^2.0.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "25e144b4432447224b6a5f294e059882d74f3db7"
|
|
30
30
|
}
|