110 lines
3.3 KiB
Vue
110 lines
3.3 KiB
Vue
<template>
|
|
<view class="videoContainer">
|
|
<view class="currentDownFixed">
|
|
<view class="currentDown">
|
|
<view class="currentDownItem">
|
|
<view>视频</view>
|
|
<view class="line"> </view>
|
|
<view>{{duration>0?duration+'秒后':''}}可获得奖励</view>
|
|
</view>
|
|
<view class="currentDownItem">
|
|
<u-icon :name="muted?'volume-off':'volume'" color='#fff' @click='muted =! muted' />
|
|
<view class="line"> </view>
|
|
<view> 关闭</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<video v-if="src!=''" @timeupdate='timeupdate' class="video" :src="src" :controls='false' autoplay direction='0' :muted='muted' />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getVideoUrl
|
|
} from '@/apis/interfaces/mission.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
// url: this.$route.query.url,
|
|
src: '',
|
|
muted: false, // 静音播放
|
|
duration: 0,
|
|
};
|
|
},
|
|
onLoad(e) {
|
|
getVideoUrl(e.id).then(res => {
|
|
this.src = res
|
|
}).catch(res => {
|
|
uni.showModal({
|
|
title: '视频播放出错',
|
|
confirmText: '立即返回',
|
|
showCancel: false,
|
|
success: (res) => {
|
|
uni.navigateBack()
|
|
}
|
|
})
|
|
})
|
|
},
|
|
methods: {
|
|
timeupdate(e) {
|
|
this.duration = parseInt(e.detail.duration - e.detail.currentTime)
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.videoContainer {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
background-color: #000;
|
|
position: relative;
|
|
|
|
.video {
|
|
width: 100%;
|
|
height: calc(100% - 200rpx);
|
|
}
|
|
|
|
.currentDownFixed {
|
|
width: 100%;
|
|
background-color: #000;
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
height: 160rpx;
|
|
padding: var(--status-bar-height) $padding $padding - 10 $padding;
|
|
box-sizing: border-box;
|
|
|
|
.currentDown {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
box-sizing: border-box;
|
|
padding-top: 20rpx;
|
|
|
|
.currentDownItem {
|
|
position: relative;
|
|
z-index: 3;
|
|
border: solid 1rpx rgba(255, 255, 255, 0.2);
|
|
border-radius: 50rpx;
|
|
padding: 14rpx $padding+4;
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
|
|
.line {
|
|
width: 2rpx;
|
|
height: 30rpx;
|
|
background-color: rgba(255, 255, 255, 0.3);
|
|
margin: 0 20rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
</style>
|