Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
40dc2b64
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
40dc2b64
编写于
4月 27, 2022
作者:
d-u-a
提交者:
qiang
4月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ad: 增加getProvider方法
上级
a1b213c8
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
53 addition
and
25 deletion
+53
-25
packages/uni-cli-shared/components/ad-fullscreen-video.vue
packages/uni-cli-shared/components/ad-fullscreen-video.vue
+1
-1
packages/uni-cli-shared/components/ad-interstitial.vue
packages/uni-cli-shared/components/ad-interstitial.vue
+1
-1
packages/uni-cli-shared/components/ad-rewarded-video.vue
packages/uni-cli-shared/components/ad-rewarded-video.vue
+1
-1
packages/uni-cli-shared/components/ad.mixin.js
packages/uni-cli-shared/components/ad.mixin.js
+32
-17
packages/uni-cli-shared/components/ad.mixin.mp.js
packages/uni-cli-shared/components/ad.mixin.mp.js
+11
-1
packages/uni-cli-shared/components/uniad.vue
packages/uni-cli-shared/components/uniad.vue
+3
-3
packages/uni-template-compiler/lib/index.js
packages/uni-template-compiler/lib/index.js
+4
-1
未找到文件。
packages/uni-cli-shared/components/ad-fullscreen-video.vue
浏览文件 @
40dc2b64
...
...
@@ -2,7 +2,7 @@
<view
@
click=
"_onclick"
>
<slot
:options=
"options"
:loading=
"loading"
:error=
"errorMessage"
/>
<!-- #ifdef MP-WEIXIN -->
<uniad-plugin
class=
"uni
-
ad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<uniad-plugin
class=
"uniad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<!-- #endif -->
</view>
</
template
>
...
...
packages/uni-cli-shared/components/ad-interstitial.vue
浏览文件 @
40dc2b64
...
...
@@ -2,7 +2,7 @@
<view
@
click=
"_onclick"
>
<slot
:options=
"options"
:loading=
"loading"
:error=
"errorMessage"
/>
<!-- #ifdef MP-WEIXIN -->
<uniad-plugin
class=
"uni
-
ad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<uniad-plugin
class=
"uniad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<!-- #endif -->
</view>
</
template
>
...
...
packages/uni-cli-shared/components/ad-rewarded-video.vue
浏览文件 @
40dc2b64
...
...
@@ -2,7 +2,7 @@
<view
@
click=
"_onclick"
>
<slot
:options=
"options"
:loading=
"loading"
:error=
"errorMessage"
/>
<!-- #ifdef MP-WEIXIN -->
<uniad-plugin
class=
"uni
-
ad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<uniad-plugin
class=
"uniad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
@
close=
"_onmpclose"
@
error=
"_onmperror"
></uniad-plugin>
<!-- #endif -->
</view>
</
template
>
...
...
packages/uni-cli-shared/components/ad.mixin.js
浏览文件 @
40dc2b64
...
...
@@ -19,14 +19,13 @@ const ProviderType = {
const
RETRY_COUNT
=
1
class
AdBase
{
constructor
(
adInstance
,
options
=
{}
,
interstitial
)
{
constructor
(
adInstance
,
options
=
{})
{
this
.
_isLoad
=
false
this
.
_isLoading
=
false
this
.
_isPlaying
=
false
this
.
_lastLoadTime
=
0
this
.
_lastError
=
null
this
.
_retryCount
=
0
this
.
_isInterstitial
=
interstitial
||
false
if
(
options
.
retry
!==
undefined
)
{
this
.
_retry
=
options
.
retry
}
else
{
...
...
@@ -140,19 +139,10 @@ class AdBase {
return
}
// TODO
if
(
this
.
_isInterstitial
&&
provider
===
ProviderType
.
GDT
)
{
setTimeout
(()
=>
{
this
.
_isPlaying
=
true
this
.
_ad
.
show
()
onshow
&&
onshow
()
},
1000
)
}
else
{
this
.
_isPlaying
=
true
this
.
_ad
.
show
()
onshow
&&
onshow
()
}
}
onLoad
(
e
)
{
if
(
this
.
_loadCallback
!=
null
)
{
...
...
@@ -199,8 +189,8 @@ class FullScreenVideo extends AdBase {
}
class
Interstitial
extends
AdBase
{
constructor
(
options
=
{}
,
interstitial
)
{
super
(
plus
.
ad
.
createInterstitialAd
(
options
),
options
,
interstitial
)
constructor
(
options
=
{})
{
super
(
plus
.
ad
.
createInterstitialAd
(
options
),
options
)
}
}
...
...
@@ -208,6 +198,7 @@ class AdHelper {
constructor
(
adType
)
{
this
.
_ads
=
{}
this
.
_adType
=
adType
this
.
_lastWaterfallIndex
=
-
1
}
load
(
options
,
onload
,
onerror
)
{
...
...
@@ -251,6 +242,10 @@ class AdHelper {
return
}
if
(
index
===
0
)
{
this
.
_lastWaterfallIndex
=
-
1
}
const
options2
=
{
adpid
:
adpid
[
index
],
urlCallback
,
...
...
@@ -258,6 +253,7 @@ class AdHelper {
}
this
.
load
(
options2
,
(
res
)
=>
{
this
.
_lastWaterfallIndex
=
index
onload
(
options2
)
},
(
err
)
=>
{
index
++
...
...
@@ -280,8 +276,13 @@ class AdHelper {
return
}
let
idx
=
index
if
(
this
.
_lastWaterfallIndex
>
-
1
)
{
idx
=
this
.
_lastWaterfallIndex
}
const
options2
=
{
adpid
:
adpid
[
i
nde
x
],
adpid
:
adpid
[
i
d
x
],
urlCallback
,
retry
:
false
}
...
...
@@ -352,6 +353,13 @@ class AdHelper {
return
this
.
_ads
[
adpid
]
}
getProvider
(
adpid
)
{
if
(
this
.
_ads
[
adpid
])
{
return
this
.
_ads
[
adpid
].
getProvider
()
}
return
null
}
remove
(
adpid
)
{
if
(
this
.
_ads
[
adpid
])
{
this
.
_ads
[
adpid
].
destroy
()
...
...
@@ -464,6 +472,13 @@ export default {
})
},
getProvider
()
{
if
(
Array
.
isArray
(
this
.
adpid
))
{
return
null
}
return
this
.
_adHelper
.
getProvider
(
this
.
adpid
)
},
_loadAd
()
{
if
(
this
.
_canCreateAd
())
{
this
.
load
()
...
...
packages/uni-cli-shared/components/ad.mixin.mp.js
浏览文件 @
40dc2b64
...
...
@@ -57,7 +57,7 @@ export default {
show
()
{
this
.
errorMessage
=
null
this
.
_ad
=
this
.
selectComponent
(
'
.uni
-ad
'
)
this
.
_ad
=
this
.
selectComponent
(
'
.uni
ad-plugin
'
)
this
.
_ad
.
show
()
},
...
...
@@ -70,6 +70,16 @@ export default {
this
.
errorMessage
=
null
},
_canCreateAd
()
{
let
result
=
false
if
(
typeof
this
.
adpid
===
'
string
'
&&
this
.
adpid
.
length
>
0
)
{
result
=
true
}
else
if
(
typeof
this
.
adpid
===
'
number
'
)
{
result
=
true
}
return
result
},
_onmpload
(
e
)
{
this
.
loading
=
false
this
.
_dispatchEvent
(
EventType
.
Load
,
{})
...
...
packages/uni-cli-shared/components/uniad.vue
浏览文件 @
40dc2b64
<
template
>
<view
@
click=
"onclick"
>
<uni
-
ad-plugin
class=
"uni
-
ad-plugin"
<uniad-plugin
class=
"uniad-plugin"
:adpid=
"adpid"
:unit-id=
"unitId"
@
load=
"_onmpload"
...
...
@@ -14,7 +14,7 @@
<
script
>
import
adMixin
from
'
./ad.mixin.mp.js
'
export
default
{
name
:
'
Uni
A
d
'
,
name
:
'
Uni
a
d
'
,
mixins
:
[
adMixin
],
props
:
{
},
...
...
packages/uni-template-compiler/lib/index.js
浏览文件 @
40dc2b64
...
...
@@ -121,6 +121,9 @@ module.exports = {
// (可用的原生微信小程序组件,global+scoped)
options
.
mp
.
wxComponents
=
options
.
wxComponents
||
Object
.
create
(
null
)
Object
.
assign
(
options
.
mp
.
wxComponents
,
{
'
uniad-plugin
'
:
'
plugin://uni-ad/ad
'
})
const
state
=
{
ast
:
{},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录