Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
uniapp_vedio
Commits
03df497e
Commit
03df497e
authored
Mar 07, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告弹窗添加开关
parent
b86bf4b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
22 deletions
+38
-22
ad-popup.vue
vedio/components/ad-popup/ad-popup.vue
+6
-2
ttVideoDetail.vue
vedio/pagesC/ttvideo/ttVideoDetail.vue
+32
-20
No files found.
vedio/components/ad-popup/ad-popup.vue
View file @
03df497e
...
...
@@ -10,7 +10,7 @@
<view
class=
"content"
>
<text
class=
"title"
>
恭喜你,获得免费看剧名额
</text>
<text
class=
"button"
@
click=
"handleClose"
>
看视频免费解锁1集
</text>
<text
class=
"downtext"
>
{{
countDown
+
's后自动进入广告页面解锁后续'
}}
</text>
<text
class=
"downtext"
>
{{
countDown
}}
s后自动进入广告,观看完成解锁第
{{
vedioIndex
+
1
}}
集剧情
</text>
</view>
</view>
</uni-popup>
...
...
@@ -28,7 +28,11 @@
show
:
{
type
:
Boolean
,
default
:
false
,
},
},
vedioIndex
:
{
type
:
[
Number
,
String
],
default
:
0
}
},
data
()
{
return
{
...
...
vedio/pagesC/ttvideo/ttVideoDetail.vue
View file @
03df497e
...
...
@@ -68,7 +68,7 @@
:originIndex=
"originIndex"
/>
<coin-popup
:show=
"showCoinPop"
:point=
"data.point"
:vedioId=
"data.vedioId"
@
close=
"showCoinPop = false"
@
clickClose=
"coinPopupClose"
@
paySuccess=
"paySuccess"
/>
<ad-popup
:show=
"showAdPop"
@
close=
"adPopupClose"
/>
<ad-popup
:show=
"showAdPop"
@
close=
"adPopupClose"
:vedioIndex=
"originIndex"
/>
</view>
</
template
>
...
...
@@ -129,6 +129,7 @@
showTap
:
false
,
showCoinPop
:
false
,
showAdPop
:
false
,
showAdForServer
:
false
,
vipBackPage
:
''
,
canUseTTPlayer
:
true
,
};
...
...
@@ -168,6 +169,16 @@
});
}
this
.
post
({
url
:
'/vedio/confs'
,
showLoading
:
false
,
success
:
({
data
})
=>
{
this
.
showAdForServer
=
data
.
douyinAdTipOpen
;
}
});
},
// 分享
// onShareAppMessage() {
...
...
@@ -444,9 +455,6 @@
this
.
isqp
=
e
.
detail
.
show
},
collect
(
vedioId
,
index
)
{
this
.
showAdPop
=
true
return
this
.
data
.
collect
=
1
// 收藏
this
.
post
({
...
...
@@ -489,7 +497,7 @@
})
=>
{}
});
},
preloadAd
()
{
preloadAd
()
{
let
that
=
this
// 创建实例
this
.
ad
=
tt
.
createRewardedVideoAd
({
...
...
@@ -509,15 +517,15 @@
break
;
default
:
// 更多请参考错误码文档
}
that
.
$nextTick
(()
=>
{
// 延迟渲染,否则位置错乱
that
.
showCoinPop
=
true
}
that
.
$nextTick
(()
=>
{
// 延迟渲染,否则位置错乱
that
.
showCoinPop
=
true
})
});
// 监听视频播放完成
this
.
ad
.
onClose
((
data
)
=>
{
uni
.
hideLoading
();
...
...
@@ -529,11 +537,11 @@
}
else
{
uni
.
showToast
({
title
:
"未观看完整视频"
})
that
.
$nextTick
(()
=>
{
// 延迟渲染,否则位置错乱
that
.
showCoinPop
=
true
})
that
.
$nextTick
(()
=>
{
// 延迟渲染,否则位置错乱
that
.
showCoinPop
=
true
})
}
});
...
...
@@ -546,16 +554,20 @@
this
.
ad
.
load
();
},
coinPopupClose
()
{
this
.
showAdPop
=
true
if
(
this
.
showAdForServer
)
{
this
.
showAdPop
=
true
}
else
{
this
.
showCoinPop
=
false
}
},
adPopupClose
()
{
this
.
showAdPop
=
false
this
.
playRewardVideo
()
},
playRewardVideo
()
{
// 播放激励视频
uni
.
showLoading
({
title
:
'广告加载中'
// 播放激励视频
uni
.
showLoading
({
title
:
'广告加载中'
});
this
.
ad
.
show
();
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment