@dcloudio/uni-cli-shared 2.0.1-34720220422001 → 2.0.1-34920220607002
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 +30 -0
- package/components/ad-interactive.vue +141 -0
- package/components/ad-interstitial.vue +30 -0
- package/components/ad-rewarded-video.vue +29 -0
- package/components/ad.mixin.js +556 -0
- package/components/ad.mixin.mp.js +104 -0
- package/components/uniad.vue +24 -0
- package/lib/cache.js +9 -2
- package/lib/index.js +4 -2
- package/lib/json.js +3 -8
- package/lib/manifest.js +32 -3
- package/lib/pages.js +15 -2
- package/lib/platform.js +194 -185
- package/package.json +2 -2
- package/template/common/__uniappscan.js +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="_onclick">
|
|
3
|
+
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
// #ifndef MP-WEIXIN
|
|
12
|
+
import adMixin from "./ad.mixin.js"
|
|
13
|
+
// #endif
|
|
14
|
+
// #ifdef MP-WEIXIN
|
|
15
|
+
import adMixin from "./ad.mixin.mp.js"
|
|
16
|
+
// #endif
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'AdFullscreenVideo',
|
|
20
|
+
mixins: [adMixin],
|
|
21
|
+
props: {
|
|
22
|
+
adType: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'FullScreenVideo'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="onclick">
|
|
3
|
+
<slot
|
|
4
|
+
:options="options"
|
|
5
|
+
:data="adData"
|
|
6
|
+
/>
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
const AD_URL = 'https://wxac1.dcloud.net.cn/tuiaApplet/acs'
|
|
12
|
+
const AD_REPORT_URL = 'https://wxac1.dcloud.net.cn/tuiaApplet/acs'
|
|
13
|
+
const WEBVIEW_PATH = '/uni_modules/uni-ad-interactive/pages/uni-ad-interactive/uni-ad-interactive'
|
|
14
|
+
|
|
15
|
+
const events = {
|
|
16
|
+
load: 'load',
|
|
17
|
+
close: 'close',
|
|
18
|
+
error: 'error'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const OpenTypes = {
|
|
22
|
+
Interactive: 'interactive'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: 'AdInteractive',
|
|
27
|
+
props: {
|
|
28
|
+
options: {
|
|
29
|
+
type: [Object, Array],
|
|
30
|
+
default () {
|
|
31
|
+
return {}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
adpid: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
openUrl: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: WEBVIEW_PATH
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
data () {
|
|
44
|
+
return {
|
|
45
|
+
adData: {}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
created () {
|
|
49
|
+
this._uniAdPlugin = null
|
|
50
|
+
this._interactiveUrl = null
|
|
51
|
+
if (this.openType === OpenTypes.Interactive) {
|
|
52
|
+
this.getAdData()
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
show () {
|
|
57
|
+
if (this._uniAdPlugin === null) {
|
|
58
|
+
this._uniAdPlugin = this.selectComponent('.uni-ad-plugin')
|
|
59
|
+
}
|
|
60
|
+
this._uniAdPlugin.show()
|
|
61
|
+
},
|
|
62
|
+
getAdData () {
|
|
63
|
+
if (!this.adpid) {
|
|
64
|
+
this.$emit(events.error, {
|
|
65
|
+
code: -5002,
|
|
66
|
+
message: 'invalid adpid'
|
|
67
|
+
})
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
uni.request({
|
|
72
|
+
url: AD_URL,
|
|
73
|
+
method: 'POST',
|
|
74
|
+
data: {
|
|
75
|
+
adpid: this.adpid
|
|
76
|
+
},
|
|
77
|
+
timeout: 5000,
|
|
78
|
+
dataType: 'json',
|
|
79
|
+
success: (res) => {
|
|
80
|
+
console.log(res.data)
|
|
81
|
+
|
|
82
|
+
if (res.statusCode !== 200) {
|
|
83
|
+
this.$emit(events.error, {
|
|
84
|
+
code: res.statusCode,
|
|
85
|
+
message: res.statusCode
|
|
86
|
+
})
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const responseData = res.data
|
|
91
|
+
if (responseData.ret === 0) {
|
|
92
|
+
this._interactiveUrl = responseData.data.adp_url
|
|
93
|
+
this.adData.imgUrl = responseData.data.icon_url
|
|
94
|
+
this.adData.openUrl = this.openUrl + '?url=' + encodeURIComponent(this._interactiveUrl)
|
|
95
|
+
this.$emit(events.load, {})
|
|
96
|
+
} else {
|
|
97
|
+
this.$emit(events.error, {
|
|
98
|
+
code: responseData.ret,
|
|
99
|
+
message: responseData.msg
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
fail: (err) => {
|
|
104
|
+
this.$emit(events.error, {
|
|
105
|
+
code: '',
|
|
106
|
+
message: err.errMsg
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
onclick () {
|
|
112
|
+
if (this.openType !== OpenTypes.Interactive || !this._interactiveUrl) {
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
uni.navigateTo({
|
|
117
|
+
url: this.adData.openUrl
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
this._report()
|
|
121
|
+
},
|
|
122
|
+
_report () {
|
|
123
|
+
uni.request({
|
|
124
|
+
url: AD_REPORT_URL,
|
|
125
|
+
data: {
|
|
126
|
+
adpid: this.adpid,
|
|
127
|
+
t: '10019'
|
|
128
|
+
},
|
|
129
|
+
timeout: 5000,
|
|
130
|
+
dataType: 'json'
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style>
|
|
138
|
+
view {
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="_onclick">
|
|
3
|
+
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
// #ifndef MP-WEIXIN
|
|
12
|
+
import adMixin from "./ad.mixin.js"
|
|
13
|
+
// #endif
|
|
14
|
+
// #ifdef MP-WEIXIN
|
|
15
|
+
import adMixin from "./ad.mixin.mp.js"
|
|
16
|
+
// #endif
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'AdInterstitial',
|
|
20
|
+
mixins: [adMixin],
|
|
21
|
+
props: {
|
|
22
|
+
adType: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'Interstitial'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="_onclick">
|
|
3
|
+
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
+
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
// #ifndef MP-WEIXIN
|
|
12
|
+
import adMixin from "./ad.mixin.js"
|
|
13
|
+
// #endif
|
|
14
|
+
// #ifdef MP-WEIXIN
|
|
15
|
+
import adMixin from "./ad.mixin.mp.js"
|
|
16
|
+
// #endif
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'AdRewardedVideo',
|
|
20
|
+
mixins: [adMixin],
|
|
21
|
+
props: {
|
|
22
|
+
adType: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'RewardedVideo'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {}
|
|
28
|
+
}
|
|
29
|
+
</script>
|