Commit 84bac9f7 authored by AU-Pro-mac's avatar AU-Pro-mac

complete video task and video rewards --02

parent 471e4555
......@@ -46,9 +46,10 @@
<view class="video_hide" onTap="videoHideFunc"> 缩小视频 </view>
<!-- 视频部分 -->
<view hidden="{{videoBottom_timeout}}" onTap="videoShowFunc" class="video_block {{ videoBottom ? 'block_opciaty0' : ''}}">
<view class="video_block_wrapper">
<view hidden="{{videoBottom_timeout}}" class="video_block {{ videoBottom ? 'block_opciaty0' : ''}}">
<view class="video_block_wrapper" onTap="videoShowFunc" >
<view class="video_block_text">
<image src="{{videoImgSrcSmall}}" mode="aspectFill" />
<view>观看XXXXX视频</view>
<view>赢惊喜抽奖次数</view>
</view>
......
......@@ -15,9 +15,9 @@ Page({
// 视频地址列表 - 存储播放时常
videoSrcArr: [
// { url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false },
// { url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false },
// { url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false }
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0, completed: false }
],
// 视频记录 flag
timeStampCountFlag: false,
......@@ -27,10 +27,12 @@ Page({
timeStampRecord: 0,
// 视频预览图列表
posterSrcArr: [
// 'https://yun.duiba.com.cn/spark/assets/bg1.d818f787351875b0982937d8bb68b0655febec3c.png',
// 'https://yun.duiba.com.cn/spark/assets/弹窗背景_奖品.dce4e3dd9a3fcae166dfbd934b714ce1bc7fa5c9.png',
// 'https://yun.duiba.com.cn/spark/assets/7191ae57140b4937ae42500e76aa533693326ef9.png',
'https://yun.duiba.com.cn/spark/assets/bg1.d818f787351875b0982937d8bb68b0655febec3c.png',
'https://yun.duiba.com.cn/spark/assets/弹窗背景_奖品.dce4e3dd9a3fcae166dfbd934b714ce1bc7fa5c9.png',
'https://yun.duiba.com.cn/spark/assets/7191ae57140b4937ae42500e76aa533693326ef9.png',
],
// 小封面图
videoImgSrcSmallArr: [],
// 是否是会员
isVip: false,
// 是否关注店铺
......@@ -68,6 +70,7 @@ Page({
initTime: 0,
mobilenetHintType: 1,
videoActiveIndex: 0,
videoImgSrcSmall: '', // 视频小封面图
// ------ 视频 配置 ------ //
// 出现 选择游戏弹窗
......@@ -161,14 +164,16 @@ Page({
else {
console.log('%c-----活动基本信息\n' + '-----yd.getActivityBaseInfoById\n', ConsoleStyle, data)
data.videoUrlArr.forEach((item, index) => {
this.videoSrcArr[index] = {
url: item, timeStamp: 0, totalTime: 0, completed: false
}
// this.videoSrcArr[index] = {
// url: item, timeStamp: 0, totalTime: 0, completed: false
// }
// this.posterSrcArr
// this.videoImgSrcSmallArr = data.videoImgSrcSmallArr
})
this.setData({
rule: data.rule,
videoSrc: this.videoSrcArr[0]
videoSrc: this.videoSrcArr[0].url,
// videoImgSrcSmall: this.videoImgSrcSmallArr[0],
})
}
......@@ -328,12 +333,15 @@ Page({
let i = this.data.videoActiveIndex
if (i > 0) {
this.videoCtx.stop()
this.videoRecord(i)
// 因为 现在只有 视频缩小时 会暂停,所以切换时不需要记录 仅在缩小时记录
// this.videoRecord(i)
setTimeout(() => {
i -= 1
let vsrc = this.videoSrcArr[i].url,
psrc = this.posterSrcArr[i]
psrc = this.posterSrcArr[i],
spsrc = this.videoImgSrcSmallArr[i]
this.setData({
videoImgSrcSmall: spsrc,
videoSrc: vsrc,
posterSrc: psrc,
videoActiveIndex: i
......@@ -348,12 +356,15 @@ Page({
let i = this.data.videoActiveIndex
if (i < this.videoSrcArr.length - 1) {
this.videoCtx.stop()
this.videoRecord(i)
// 因为 现在只有 视频缩小时 会暂停,所以切换时不需要记录 仅在缩小时记录
// this.videoRecord(i)
setTimeout(() => {
i += 1
let vsrc = this.videoSrcArr[i].url,
psrc = this.posterSrcArr[i]
psrc = this.posterSrcArr[i],
spsrc = this.videoImgSrcSmallArr[i]
this.setData({
videoImgSrcSmall: spsrc,
videoSrc: vsrc,
posterSrc: psrc,
videoActiveIndex: i
......@@ -379,7 +390,8 @@ Page({
// video - onPause
onPause() {
console.log('---- 视频播放暂停', this.timeStamp)
this.videoRecord(this.data.videoActiveIndex)
// 因为 现在只有 视频缩小时 会暂停,所以切换时不需要记录 仅在缩小时记录
// this.videoRecord(this.data.videoActiveIndex)
},
// video - onEnded
......@@ -400,9 +412,11 @@ Page({
// video - hide
videoHideFunc() {
console.log('videoHideFunc')
this.videoRecord(this.data.videoActiveIndex)
console.log('videoHideFunc', this.videoSrcArr)
this.setData({ videoShow: false })
if (this.videoSrcArr[this.data.videoActiveIndex].timeStamp >= 15 && !this.videoSrcArr[this.data.videoActiveIndex].completed) {
// 观看超过 15000ms 15s
if (this.videoSrcArr[this.data.videoActiveIndex].timeStamp >= 15000 && !this.videoSrcArr[this.data.videoActiveIndex].completed) {
this.videoSrcArr[this.data.videoActiveIndex].completed = true
this.getWatchRewards()
}
......@@ -410,7 +424,7 @@ Page({
// 观看视频领奖
getWatchRewards() {
API.sendCoinsByWatch({activityId: app.activityId, videoIndex: this.videoActiveIndex})
API.sendCoinsByWatch({activityId: app.activityId, videoIndex: this.data.videoActiveIndex})
.then(res => {
const {success, data} = res
if (success) {
......@@ -474,6 +488,7 @@ Page({
}
})
},
// 显示通用弹层
showCommonMoadalT2 (obj) {
let { title, content, confirmCallback1, confirmCallback2, btnImg1, btnImg2, rewardsImg } = obj
......@@ -485,8 +500,6 @@ Page({
})
},
onModalT2One () { this.data.onModalT2One() },
onModalT2Two () { this.data.onModalT2Two() },
confirmCommonModalT1 () { this.data.confirmCommonModalT1() },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment