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
88e0db8e
Commit
88e0db8e
authored
Jun 05, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
0ceb70e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
205 additions
and
155 deletions
+205
-155
ad-popup.vue
vedio/components/ad-popup/ad-popup.vue
+172
-135
ttVideoDetail.vue
vedio/pagesC/ttvideo/ttVideoDetail.vue
+33
-20
No files found.
vedio/components/ad-popup/ad-popup.vue
View file @
88e0db8e
<
template
>
<view>
<uni-popup
type=
"center"
ref=
"adPop"
:maskClick=
"false"
:isMaskClick=
"false"
>
<view
class=
"container"
>
<!--
<view
class=
"ad-view"
>
<ad
:unit-id=
"adUnitId"
@
load=
"onload"
@
close=
"onclose"
@
error=
"onerror"
></ad>
</view>
-->
<view
class=
"content"
>
<text
class=
"title"
>
恭喜你,获得免费看剧名额
</text>
<text
class=
"button"
@
click=
"handleClose"
>
看视频免费解锁1集
</text>
<text
class=
"downtext"
>
{{
countDown
}}
s后自动进入广告,观看完成解锁第
{{
vedioIndex
+
1
}}
集剧情
</text>
</view>
</view>
</uni-popup>
</view>
</
template
>
<
script
>
import
{
EXPRESS_ID
}
from
"@/utils/adConstant.js"
export
default
{
name
:
'adPopup'
,
props
:
{
show
:
{
type
:
Boolean
,
default
:
false
,
},
vedioIndex
:
{
type
:
[
Number
,
String
],
default
:
0
}
},
data
()
{
return
{
adUnitId
:
EXPRESS_ID
,
countDown
:
3
,
};
},
methods
:
{
handleShow
()
{
this
.
$refs
.
adPop
.
open
(
'center'
);
this
.
startCountdown
()
},
startCountdown
()
{
let
that
=
this
;
var
countDownSeconds
=
3
that
.
countDown
=
countDownSeconds
const
timer
=
setInterval
(()
=>
{
if
(
countDownSeconds
>
0
)
{
that
.
countDown
=
countDownSeconds
countDownSeconds
--
}
else
{
clearInterval
(
timer
)
that
.
handleClose
()
}
},
1000
)
},
handleClose
()
{
this
.
$refs
.
adPop
.
close
(
'center'
);
this
.
$emit
(
'close'
);
},
onload
(
e
)
{
console
.
log
(
"onload"
);
},
onclose
(
e
)
{
console
.
log
(
"onclose: "
+
e
.
detail
);
},
onerror
(
e
)
{
console
.
log
(
"onerror: "
+
e
.
detail
.
errCode
+
" message:: "
+
e
.
detail
.
errMsg
);
}
},
watch
:
{
show
:
{
handler
:
function
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
this
.
handleShow
();
}
},
immediate
:
true
}
}
};
</
script
>
<
style
lang=
"scss"
>
.container
{
width
:
600rpx
;
height
:
800rpx
;
position
:
relative
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
}
.ad-view
{
width
:
600rpx
;
border-radius
:
20rpx
;
// background-color: white;
margin-bottom
:
10px
;
}
.content
{
border-radius
:
20rpx
;
background-color
:
white
;
display
:
flex
;
width
:
600rpx
;
padding
:
30rpx
0
;
flex-direction
:
column
;
align-items
:
center
;
.title
{
color
:
black
;
font-size
:
40rpx
;
font-weight
:
bold
;
margin-bottom
:
30rpx
;
}
.button
{
margin
:
20rpx
20rpx
;
border-radius
:
10rpx
;
background-color
:
orange
;
color
:
white
;
<
template
>
<view>
<uni-popup
type=
"center"
ref=
"adPop"
:maskClick=
"false"
:isMaskClick=
"false"
>
<view
class=
"container"
>
<!--
<view
class=
"ad-view"
>
<ad
:unit-id=
"adUnitId"
@
load=
"onload"
@
close=
"onclose"
@
error=
"onerror"
></ad>
</view>
-->
<image
@
click=
"onClose"
style=
"width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx;
margin-bottom: 30rpx;"
src=
"@/static/video/close.png"
></image>
<view
class=
"content"
>
<text
class=
"title"
>
恭喜你,获得免费看剧名额
</text>
<text
class=
"button1"
@
click=
"handleAd"
>
看视频免费解锁1集
</text>
<text
class=
"button2"
@
click=
"handleVip"
>
免广告解锁
</text>
<text
class=
"downtext"
>
{{
countDown
}}
s后自动进入广告,观看完成解锁第
{{
vedioIndex
+
1
}}
集剧情
</text>
</view>
</view>
</uni-popup>
</view>
</
template
>
<
script
>
import
{
EXPRESS_ID
}
from
"@/utils/adConstant.js"
export
default
{
name
:
'adPopup'
,
props
:
{
show
:
{
type
:
Boolean
,
default
:
false
,
},
vedioIndex
:
{
type
:
[
Number
,
String
],
default
:
0
}
},
data
()
{
return
{
adUnitId
:
EXPRESS_ID
,
countDown
:
3
,
timer
:
''
};
},
methods
:
{
handleShow
()
{
this
.
$refs
.
adPop
.
open
(
'center'
);
this
.
startCountdown
()
},
startCountdown
()
{
let
that
=
this
;
var
countDownSeconds
=
3
that
.
countDown
=
countDownSeconds
this
.
timer
=
setInterval
(()
=>
{
if
(
countDownSeconds
>
0
)
{
that
.
countDown
=
countDownSeconds
countDownSeconds
--
}
else
{
clearInterval
(
that
.
timer
)
that
.
handleAd
()
}
},
1000
)
},
handleAd
()
{
clearInterval
(
this
.
timer
)
// this.$refs.adPop.close('center');
this
.
$emit
(
'handleAd'
);
},
handleVip
()
{
clearInterval
(
this
.
timer
)
this
.
$refs
.
adPop
.
close
(
'center'
);
this
.
$emit
(
'handleVip'
);
},
onClose
()
{
clearInterval
(
this
.
timer
)
this
.
$refs
.
adPop
.
close
(
'center'
);
this
.
$emit
(
'handleClose'
);
},
onload
(
e
)
{
console
.
log
(
"onload"
);
},
onclose
(
e
)
{
console
.
log
(
"onclose: "
+
e
.
detail
);
},
onerror
(
e
)
{
console
.
log
(
"onerror: "
+
e
.
detail
.
errCode
+
" message:: "
+
e
.
detail
.
errMsg
);
}
},
watch
:
{
show
:
{
handler
:
function
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
this
.
handleShow
();
}
else
{
clearInterval
(
this
.
timer
)
this
.
$refs
.
adPop
.
close
(
'center'
);
}
},
immediate
:
true
}
}
};
</
script
>
<
style
lang=
"scss"
>
.container
{
width
:
600rpx
;
height
:
800rpx
;
position
:
relative
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
}
.ad-view
{
width
:
600rpx
;
border-radius
:
20rpx
;
// background-color: white;
margin-bottom
:
10px
;
}
.content
{
border-radius
:
20rpx
;
background-color
:
white
;
display
:
flex
;
width
:
600rpx
;
padding
:
30rpx
0
;
flex-direction
:
column
;
align-items
:
center
;
.title
{
color
:
black
;
font-size
:
40rpx
;
font-weight
:
bold
;
margin-bottom
:
30rpx
;
}
.button1
{
width
:
500rpx
;
height
:
66rpx
;
line-height
:
66rpx
;
text-align
:
center
;
margin
:
20rpx
20rpx
;
border-radius
:
10rpx
;
background-color
:
orange
;
color
:
white
;
font-size
:
36rpx
;
}
.downtext
{
color
:
darkgray
;
font-size
:
26rpx
;
}
}
box-shadow
:
0
0
2px
0px
rgba
(
255
,
255
,
255
,
0
.1
);
}
.button2
{
width
:
500rpx
;
height
:
66rpx
;
line-height
:
66rpx
;
text-align
:
center
;
margin
:
20rpx
20rpx
;
border-radius
:
10rpx
;
background-color
:
white
;
border
:
1px
orange
solid
;
color
:
orange
;
font-size
:
36rpx
;
box-shadow
:
0
0
2px
0px
rgba
(
255
,
255
,
255
,
0
.1
);
}
.downtext
{
color
:
darkgray
;
font-size
:
26rpx
;
}
}
</
style
>
\ No newline at end of file
vedio/pagesC/ttvideo/ttVideoDetail.vue
View file @
88e0db8e
...
...
@@ -67,7 +67,10 @@
: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"
:vedioIndex=
"originIndex"
/>
<ad-popup
:show=
"showAdPop"
@
handleAd=
"handleAd"
@
handleVip=
"handleVip"
@
handleClose=
"handleClose"
:vedioIndex=
"originIndex"
/>
<ad-more-popup
:show=
"showAdMorePop"
@
handleAd2=
"handleAd"
@
handleClose=
"handleClose"
/>
<sign-popup
:show=
"showSignPop"
@
close=
"showSignPop = false"
/>
</view>
</
template
>
...
...
@@ -84,6 +87,7 @@
}
from
"@/utils/utils.js"
import
adPopup
from
'@/components/ad-popup/ad-popup.vue'
;
import
adMorePopup
from
'@/components/ad-more-popup/ad-more-popup.vue'
;
import
coinPopup
from
'@/components/coin-popup/coin-popup.vue'
;
import
signPopup
from
'@/components/sign-popup/sign-popup.vue'
;
import
episodePopup
from
'@/components/episode-popup/episode-popup.vue'
;
...
...
@@ -133,8 +137,8 @@
showTap
:
false
,
showCoinPop
:
false
,
showSignPop
:
false
,
showAdPop
:
false
,
showAd
ForServer
:
false
,
showAdPop
:
false
,
showAd
MorePop
:
false
,
vipBackPage
:
''
,
curTimeData
:
''
,
localTimeData
:
''
,
...
...
@@ -178,18 +182,18 @@
});
}
this
.
post
({
url
:
'/vedio/confs'
,
showLoading
:
false
,
success
:
({
data
})
=>
{
// this.showAdForServer = data.douyinAdTipOpen;
this
.
showAdForServer
=
true
;
}
});
//
this.post({
//
url: '/vedio/confs',
//
showLoading: false,
//
success: ({
//
data
//
}) => {
// // this.showAdForServer = data.douyinAdTipOpen;
//
this.showAdForServer = true;
//
}
//
});
},
},
// 分享
// onShareAppMessage() {
// let result = {
...
...
@@ -262,7 +266,8 @@
this
.
$nextTick
(()
=>
{
// 延迟渲染,否则位置错乱
this
.
showCoinPop
=
true
// this.showCoinPop = true
this
.
showAdPop
=
true
})
},
govip
()
{
...
...
@@ -567,6 +572,7 @@
uni
.
showToast
({
title
:
"正在为您解锁剧集"
})
that
.
showAdPop
=
false
that
.
adUnlock
(
that
.
originIndex
,
''
)
}
else
{
uni
.
showToast
({
...
...
@@ -591,16 +597,23 @@
navigateTo
(
`/pagesA/task/task`
)
},
coinPopupClose
()
{
if
(
this
.
showAdForServer
)
{
this
.
showCoinPop
=
false
setTimeout
(()
=>
{
this
.
showAdPop
=
true
}
else
{
this
.
showCoinPop
=
false
}
},
500
)
},
adPopup
Close
()
{
handle
Close
()
{
this
.
showAdPop
=
false
},
handleAd
()
{
// this.showAdPop = false
this
.
playRewardVideo
()
},
handleVip
()
{
this
.
showAdPop
=
false
this
.
showCoinPop
=
true
},
playRewardVideo
()
{
// 播放激励视频
uni
.
showLoading
({
...
...
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