1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<view class="content">
<view style="padding-top: 30rpx;">
<block>
<view class="item" v-if="merchantName">
<video class="video" id="myVideo" :poster="thumbImageUrl" :src="productUrl" play-btn-position="center"
@error="error" object-fit="fill" @play="playVideo()">
</video>
<view class="title">
<text>[ {{merchantName || ""}} ]</text>
<view>
<u-icon name="eye-fill" class="icon" color="#ffffff" size="40rpx"></u-icon><text style="color: #ffffff;" space>1000+</text>
</view>
</view>
</view>
</block>
</view>
<view class="bottom">
<image src="../../../static/img/vlog/icon/bottom.png"></image>
<navigator url="../vlogface/vlogface">
<view class="paizhao">
<image src="../../../static/img/vlog/icon/icon_scan.png"></image>
<view style="width: 100%;text-align: center;margin-top:10rpx;color: #FFFFFF;">获取Vlog</view>
</view>
</navigator>
</view>
</view>
</template>
<script>
export default {
data() {
return {
productUrl: "", //视频地址
thumbImageUrl: "", //图片地址
merchantName: "", //景区名称
videoContext:""
}
},
onReady() { //代替 vue 里面的 mounted
},
onLoad(option) { //代替 vue 里面的 created
this.productUrl = option.productUrl
this.thumbImageUrl = option.thumbImageUrl
this.merchantName = option.merchantName
},
methods: {
playVideo(){
// 获取 video 上下文 videoContext 对象
this.videoContext = uni.createVideoContext('myVideo',this);
// 进入全屏状态
this.videoContext.requestFullScreen({direction:-90})
},
error(e) { //视频播放出错
uni.showModal({
content: e.target.errMsg,
showCancel: false
})
},
}
}
</script>
<style lang="scss" scoped>
.content {
padding: 0 20rpx;
min-height: 100%;
width: 100%;
background-color: #192033;
.item {
padding: 0 10rpx;
border-radius: 10rpx;
background-color: #192033;
margin-bottom: 30rpx;
text-align: center;
.video {
height: 350rpx;
border-radius: 10rpx;
width: 100%;
}
.title {
height: 60rpx;
margin-top: 20rpx;
text {
float: left;
height: 60rpx;
line-height: 60rpx;
color: #FFE600;
font-weight: bold;
}
view {
float: right;
height: 60rpx;
line-height: 60rpx;
align-items: center;
display: flex;
}
}
}
.bottom {
width: 100%;
position: fixed;
bottom: 0;
right: 0rpx;
image {
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
}
.paizhao {
z-index: 1;
position: absolute;
bottom: 15rpx;
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
image {
height: 160rpx;
width: 160rpx;
position: relative;
top: 20rpx;
}
}
}
}
</style>