jufubao-base 1.0.63-beta204 → 1.0.63-beta205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -15,41 +15,14 @@
|
|
|
15
15
|
<!-- #endif -->
|
|
16
16
|
<view class="jfb-base-video__body">
|
|
17
17
|
<view class="float"></view>
|
|
18
|
-
<view
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<view
|
|
27
|
-
class="thumb"
|
|
28
|
-
v-if="!playStatus"
|
|
29
|
-
:style="{borderRadius: radius + 'rpx'}"
|
|
30
|
-
>
|
|
31
|
-
<image :src="imageUrl" />
|
|
32
|
-
<view @click="handlePlay()">
|
|
33
|
-
<xd-font-icon
|
|
34
|
-
:icon="iconFont"
|
|
35
|
-
size="100"
|
|
36
|
-
color="#fff"
|
|
37
|
-
></xd-font-icon>
|
|
38
|
-
|
|
39
|
-
</view>
|
|
40
|
-
</view>
|
|
41
|
-
<view
|
|
42
|
-
class="video"
|
|
43
|
-
:style="{borderRadius: radius + 'rpx'}"
|
|
44
|
-
v-else
|
|
45
|
-
>
|
|
46
|
-
<video
|
|
47
|
-
:src="videoUrl"
|
|
48
|
-
:autoplay="autoplay === 'Y'"
|
|
49
|
-
@ended="handleEnd()"
|
|
50
|
-
@error="handleError"
|
|
51
|
-
></video>
|
|
52
|
-
</view>
|
|
18
|
+
<view class="video" v-if="video !== null">
|
|
19
|
+
<xd-video
|
|
20
|
+
:margin="margin"
|
|
21
|
+
:poster="videoSetting"
|
|
22
|
+
:video="video"
|
|
23
|
+
:radius="radius"
|
|
24
|
+
:pack-this="$vm"
|
|
25
|
+
></xd-video>
|
|
53
26
|
</view>
|
|
54
27
|
</view>
|
|
55
28
|
</view>
|
|
@@ -57,19 +30,18 @@
|
|
|
57
30
|
|
|
58
31
|
<script>
|
|
59
32
|
const color = require('color');
|
|
60
|
-
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
61
33
|
import { jfbRootExec } from "@/utils/xd.event";
|
|
62
34
|
import JfbBaseVideoMixin from "./JfbBaseVideoMixin";
|
|
63
35
|
import componentsMixins from "@/mixins/componentsMixins";
|
|
64
36
|
import extsMixins from "@/mixins/extsMixins"
|
|
65
37
|
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
66
|
-
import
|
|
38
|
+
import XdVideo from "./XdVideo.vue";
|
|
67
39
|
|
|
68
40
|
|
|
69
41
|
export default {
|
|
70
42
|
name: "JfbBaseVideo",
|
|
71
43
|
components: {
|
|
72
|
-
|
|
44
|
+
XdVideo
|
|
73
45
|
},
|
|
74
46
|
mixins: [componentsMixins,extsMixins,JfbBaseVideoMixin],
|
|
75
47
|
data() {
|
|
@@ -78,19 +50,12 @@
|
|
|
78
50
|
page_size: 1,
|
|
79
51
|
options:{},
|
|
80
52
|
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
margin: {},
|
|
53
|
+
//data
|
|
54
|
+
video: null,
|
|
55
|
+
videoSetting: null,
|
|
56
|
+
margin:{},
|
|
86
57
|
radius:0,
|
|
87
|
-
|
|
88
|
-
//play
|
|
89
|
-
imageUrl: '//img.jufubao.cn/vedio/700.gif',
|
|
90
|
-
videoUrl: '//img.jufubao.cn/vedio/bg.mp4',
|
|
91
|
-
playStatus: false,
|
|
92
|
-
autoplay: 'N',
|
|
93
|
-
|
|
58
|
+
$vm: {}
|
|
94
59
|
}
|
|
95
60
|
},
|
|
96
61
|
computed: {
|
|
@@ -129,6 +94,7 @@
|
|
|
129
94
|
}
|
|
130
95
|
},
|
|
131
96
|
created() {
|
|
97
|
+
this.$vm = this;
|
|
132
98
|
this.isPreview = this.$configProject.isPreview;
|
|
133
99
|
this.init(this.container);
|
|
134
100
|
|
|
@@ -140,13 +106,9 @@
|
|
|
140
106
|
* @param container {object} 业务组件对象自己
|
|
141
107
|
*/
|
|
142
108
|
init(container) {
|
|
143
|
-
this.
|
|
109
|
+
this.videoSetting = getContainerPropsValue(container, 'content.video', {size:{width: 400, height: 300}, type: '1'});
|
|
144
110
|
this.margin = getContainerPropsValue(container, 'content.margin', {top:0, bottom:0, right:0, left: 0});
|
|
145
111
|
this.radius = getContainerPropsValue(container, 'content.radius', 0);
|
|
146
|
-
if(this.video.size) {
|
|
147
|
-
this.width = this.video.size.width;
|
|
148
|
-
this.height = this.video.size.height;
|
|
149
|
-
}
|
|
150
112
|
},
|
|
151
113
|
|
|
152
114
|
onJfbLoad(options) {
|
|
@@ -161,13 +123,11 @@
|
|
|
161
123
|
})
|
|
162
124
|
.then(res => {
|
|
163
125
|
if(res && res.list && res.list.length > 0) {
|
|
164
|
-
|
|
165
|
-
if(image_url) this.videoUrl = getServiceUrl(image_url);
|
|
166
|
-
if(thumb) this.imageUrl = getServiceUrl(thumb);
|
|
126
|
+
this.video = res.list[0];
|
|
167
127
|
}
|
|
168
128
|
})
|
|
169
129
|
.catch(error => {
|
|
170
|
-
|
|
130
|
+
this.$xdLog.catch(error)
|
|
171
131
|
})
|
|
172
132
|
},
|
|
173
133
|
|
|
@@ -175,34 +135,6 @@
|
|
|
175
135
|
this.onJfbLoad(this.options);
|
|
176
136
|
},
|
|
177
137
|
|
|
178
|
-
handlePlay(){
|
|
179
|
-
if(this.autoplay === 'E') return;
|
|
180
|
-
this.playStatus = !this.playStatus;
|
|
181
|
-
this.autoplay = "Y";
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
handleEnd(){
|
|
185
|
-
setTimeout(()=>{
|
|
186
|
-
this.playStatus = !this.playStatus;
|
|
187
|
-
this.autoplay = "R";
|
|
188
|
-
}, 1000)
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
handleError(){
|
|
192
|
-
this.$xdConfirm({
|
|
193
|
-
title: '温馨提示',
|
|
194
|
-
content:'当前视频资源无法播放',
|
|
195
|
-
cancel: false,
|
|
196
|
-
confirmText:'我知道了',
|
|
197
|
-
zIndex:10000,
|
|
198
|
-
success:()=>{
|
|
199
|
-
this.playStatus = !this.playStatus;
|
|
200
|
-
this.autoplay = "R";
|
|
201
|
-
}
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
138
|
}
|
|
207
139
|
}
|
|
208
140
|
|
|
@@ -214,7 +146,6 @@
|
|
|
214
146
|
.jfb-base-video {
|
|
215
147
|
&__body{
|
|
216
148
|
|
|
217
|
-
|
|
218
149
|
}
|
|
219
150
|
|
|
220
151
|
}
|
|
@@ -225,38 +156,4 @@
|
|
|
225
156
|
overflow: hidden;
|
|
226
157
|
}
|
|
227
158
|
|
|
228
|
-
.video-box {
|
|
229
|
-
view.thumb {
|
|
230
|
-
height: 100%;
|
|
231
|
-
width: 100%;
|
|
232
|
-
position: relative;
|
|
233
|
-
overflow: hidden;
|
|
234
|
-
|
|
235
|
-
& > view {
|
|
236
|
-
width: 120rpx;
|
|
237
|
-
height: 120rpx;
|
|
238
|
-
position: absolute;
|
|
239
|
-
top: 50%;
|
|
240
|
-
left: 50%;
|
|
241
|
-
margin-top: -60rpx;
|
|
242
|
-
margin-left:-60rpx;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
& > image {
|
|
246
|
-
height: 100%;
|
|
247
|
-
width: 100%;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
view.video {
|
|
252
|
-
overflow: hidden;
|
|
253
|
-
height: 100%;
|
|
254
|
-
width: 100%;
|
|
255
|
-
|
|
256
|
-
& video {
|
|
257
|
-
height: 100%;
|
|
258
|
-
width: 100%;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
159
|
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="video-box"
|
|
4
|
+
:style="{
|
|
5
|
+
width: contentWidth + 'rpx',
|
|
6
|
+
height:contentHeight + 'rpx',
|
|
7
|
+
margin: outMargin
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<view
|
|
11
|
+
class="thumb"
|
|
12
|
+
v-if="!playStatus"
|
|
13
|
+
:style="{borderRadius: radius + 'rpx'}"
|
|
14
|
+
>
|
|
15
|
+
<image :src="imageUrl" v-if="imageUrl" />
|
|
16
|
+
<view @click="handlePlay()">
|
|
17
|
+
<xd-font-icon
|
|
18
|
+
:icon="iconFont"
|
|
19
|
+
size="100"
|
|
20
|
+
color="#fff"
|
|
21
|
+
></xd-font-icon>
|
|
22
|
+
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
<view
|
|
26
|
+
class="video"
|
|
27
|
+
:style="{borderRadius: radius + 'rpx'}"
|
|
28
|
+
v-else
|
|
29
|
+
>
|
|
30
|
+
<video
|
|
31
|
+
v-if="videoUrl"
|
|
32
|
+
:src="videoUrl"
|
|
33
|
+
:autoplay="autoplay === 'Y'"
|
|
34
|
+
@ended="handleEnd()"
|
|
35
|
+
@error="handleError"
|
|
36
|
+
></video>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import getServiceUrl from '@/common/getServiceUrl'
|
|
43
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name:'XdVideo',
|
|
47
|
+
components:{
|
|
48
|
+
XdFontIcon
|
|
49
|
+
},
|
|
50
|
+
props:{
|
|
51
|
+
margin:{
|
|
52
|
+
type: Object,
|
|
53
|
+
default(){
|
|
54
|
+
return {
|
|
55
|
+
top:0,
|
|
56
|
+
left:0,
|
|
57
|
+
right:0,
|
|
58
|
+
bottom:0
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
poster:{
|
|
63
|
+
type:Object,
|
|
64
|
+
required: true
|
|
65
|
+
},
|
|
66
|
+
radius:{
|
|
67
|
+
type: String|Number,
|
|
68
|
+
default: 0
|
|
69
|
+
},
|
|
70
|
+
packThis:{
|
|
71
|
+
type:Object,
|
|
72
|
+
required: true
|
|
73
|
+
},
|
|
74
|
+
video:{
|
|
75
|
+
type:Object,
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
data(){
|
|
80
|
+
return {
|
|
81
|
+
isPreview: false,
|
|
82
|
+
|
|
83
|
+
//css
|
|
84
|
+
width: 0,
|
|
85
|
+
height: 0,
|
|
86
|
+
|
|
87
|
+
//play
|
|
88
|
+
imageUrl: '',
|
|
89
|
+
videoUrl: '',
|
|
90
|
+
playStatus: false,
|
|
91
|
+
autoplay: 'N',
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
computed: {
|
|
95
|
+
iconFont(){
|
|
96
|
+
if(this.autoplay === 'N') return 'iconplayright'
|
|
97
|
+
if(this.autoplay === 'E') return 'iconshibai';
|
|
98
|
+
if(this.autoplay === 'R') return 'iconplayreplay';
|
|
99
|
+
},
|
|
100
|
+
contentWidth(){
|
|
101
|
+
let border = 0;
|
|
102
|
+
if(this.isPreview) border = 2;
|
|
103
|
+
return 750 - (this.margin.left + this.margin.right + border);
|
|
104
|
+
},
|
|
105
|
+
contentHeight(){
|
|
106
|
+
let border = 0;
|
|
107
|
+
if(this.isPreview) border = 2;
|
|
108
|
+
let winWidth = 750 - ((this.margin.left||0) + (this.margin.right||0) + border);
|
|
109
|
+
return winWidth * this.height/this.width;
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
outMargin(){
|
|
113
|
+
let margin = `${this.margin.top !== null ? this.margin.top : 0}rpx`;
|
|
114
|
+
margin = `${margin} ${this.margin.right !== null ? this.margin.right : 0}rpx`;
|
|
115
|
+
margin = `${margin} ${this.margin.bottom !== null ? this.margin.bottom :0}rpx`;
|
|
116
|
+
margin = `${margin} ${this.margin.left !== null ? this.margin.left : 0}rpx`;
|
|
117
|
+
return margin;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
watch:{
|
|
121
|
+
poster(){
|
|
122
|
+
this.init();
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
created() {
|
|
126
|
+
this.isPreview = this.$configProject.isPreview;
|
|
127
|
+
this.init();
|
|
128
|
+
},
|
|
129
|
+
methods:{
|
|
130
|
+
init(){
|
|
131
|
+
if(this.poster.size) {
|
|
132
|
+
this.width = Number(this.poster.size.width);
|
|
133
|
+
this.height = Number(this.poster.size.height);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let {image_url, thumb} = this.video;
|
|
137
|
+
if(image_url) this.videoUrl = getServiceUrl(image_url);
|
|
138
|
+
if(thumb) this.imageUrl = getServiceUrl(thumb);
|
|
139
|
+
},
|
|
140
|
+
handlePlay(){
|
|
141
|
+
if(this.autoplay === 'E') return;
|
|
142
|
+
this.playStatus = !this.playStatus;
|
|
143
|
+
this.autoplay = "Y";
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
handleEnd(){
|
|
147
|
+
setTimeout(()=>{
|
|
148
|
+
this.playStatus = !this.playStatus;
|
|
149
|
+
this.autoplay = "R";
|
|
150
|
+
}, 1000)
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
handleError(){
|
|
154
|
+
this.$xdConfirm({
|
|
155
|
+
title: '温馨提示',
|
|
156
|
+
content:'当前视频资源无法播放',
|
|
157
|
+
cancel: false,
|
|
158
|
+
confirmText:'我知道了',
|
|
159
|
+
zIndex:10000,
|
|
160
|
+
success:()=>{
|
|
161
|
+
this.playStatus = !this.playStatus;
|
|
162
|
+
this.autoplay = "R";
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
</script>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
<style scoped lang="less">
|
|
174
|
+
.video-box {
|
|
175
|
+
view.thumb {
|
|
176
|
+
height: 100%;
|
|
177
|
+
width: 100%;
|
|
178
|
+
position: relative;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
|
|
181
|
+
& > view {
|
|
182
|
+
width: 120rpx;
|
|
183
|
+
height: 120rpx;
|
|
184
|
+
position: absolute;
|
|
185
|
+
top: 50%;
|
|
186
|
+
left: 50%;
|
|
187
|
+
margin-top: -60rpx;
|
|
188
|
+
margin-left:-60rpx;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
& > image {
|
|
192
|
+
height: 100%;
|
|
193
|
+
width: 100%;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
view.video {
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
height: 100%;
|
|
200
|
+
width: 100%;
|
|
201
|
+
|
|
202
|
+
& video {
|
|
203
|
+
height: 100%;
|
|
204
|
+
width: 100%;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</style>
|