index.vue
7.99 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<template>
<div>
<div class="box">
<!--打开app-->
<callAppBox :callApps="$parent.callApps" v-if="!isCNLive.value"></callAppBox>
<div class="first_item"></div>
<!--商品列表-->
<div class="item">
<div @click="link(1)">
</div>
<div @click="link(2)">
</div>
</div>
<!--视频-->
<div class="video1_poster">
<div class="video_box">
<video-player class="video-player vjs-custom-skin" @play="onPlayerPlay(1)"
ref="videoPlayer"
:playsinline="playsinline"
:options="playerOptions"
x5-playsinline
webkit-playsinline>
</video-player>
</div>
</div>
<div class="div4"></div>
<div class="div5"></div>
<div class="div6"></div>
<div class="div7"></div>
<div class="div8"></div>
<div class="div9"></div>
<div class="div10"></div>
<div class="div11"></div>
<!--视频-->
<div class="div12 video2_poster">
<div class="video_box">
<video-player class="video-player vjs-custom-skin" @play="onPlayerPlay(2)"
ref="videoPlayer"
:playsinline="playsinline"
:options="playerOptions2"
x5-playsinline
webkit-playsinline>
</video-player>
</div>
</div>
<div class="div13"></div>
<div class="div14"></div>
<div class="div15"></div>
<div class="div16"></div>
<div class="div17"></div>
<div class="div18"></div>
</div>
</div>
</template>
<script>
import {videoPlayer} from 'vue-video-player';
import 'video.js/dist/video-js.css';
import '../../../static/css/video.css';
import callAppBox from "@/components/callAppBox/callAppBox";
export default {
name: 'index',
data () {
return {
callApps:null, // 打开app参数
playsinline: true,
playerOptions: {
events: [],
playbackRates: [0.5, 1.0, 1.5, 2.0], // 播放速度
autoplay: false, // 如果true,浏览器准备好时开始回放。
controls: true, // 控制条
preload: 'auto', // 视频预加载
muted: false, // 默认情况下将会消除任何音频。
loop: false, // 导致视频一结束就重新开始。
language: 'zh-CN',
controlBar: {
timeDivider: true,
durationDisplay: true
},
aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
sources: [{
type: "video/mp4",
src: "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/12/30/5e09739a07d18.mp4"
}],
hls: true, // 启用hls?
poster: './static/img/index/video1.png', // 你的封面地址
width: document.documentElement.clientWidth || document.body.clientWidth,
notSupportedMessage: '此视频暂无法播放,请稍后再试' // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
},
playerOptions2: {
events: [],
playbackRates: [0.5, 1.0, 1.5, 2.0], // 播放速度
autoplay: false, // 如果true,浏览器准备好时开始回放。
controls: true, // 控制条
preload: 'auto', // 视频预加载
muted: false, // 默认情况下将会消除任何音频。
loop: false, // 导致视频一结束就重新开始。
language: 'zh-CN',
controlBar: {
timeDivider: true,
durationDisplay: true
},
aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
sources: [{
type: "video/mp4",
src: "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/12/30/5e0973f0aa9be.mp4"
}],
hls: true, // 启用hls?
poster: './static/img/index/video1.png', // 你的封面地址
width: document.documentElement.clientWidth || document.body.clientWidth,
notSupportedMessage: '此视频暂无法播放,请稍后再试' // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
}
}
},
components: {
videoPlayer,
callAppBox
},
created(){
document.title = '崇学向善 鼠年有礼';
},
mounted(){
// 获取并设置分享参数
this.$parent.getShareData({
type: 22,
id: this.$route.query.id || 1,
url: ""
});
},
methods: {
link(index){
if(this.isCNLive){
let items;
if(index==1){
items={
"title": "线下赛事",
"type": "2",
"shop_type": "2",
"to":"9621652",
}
}else {
items={
"title": "线下赛事",
"type": "2",
"shop_type":"2",
"to":"9620396",
}
}
this.$parent.gotoDetail(items)
}else {
if (index == 1) {
window.location.href = this.getParams(this.mode).shop.apiAddress + "/html/mall/1/#/pages/main/cultureDetail/cultureDetail?id=9621652"
} else {
window.location.href = this.getParams(this.mode).shop.apiAddress + "/html/mall/1/#/pages/main/cultureDetail/cultureDetail?id=9620396"
}
}
},
/**
* 视频播放
* @param {object} $event [播放器对象]
*/
onPlayerPlay(event) {
// if (event == 1) {
// this.playerOptions.sources[0].src = "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/12/30/5e09739a07d18.mp4"
// } else {
// this.playerOptions.sources[0].src = "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/12/30/5e0973f0aa9be.mp4"
// }
},
/**
* 接口调用
* @param {object} [ 分享参数]
*/
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less">
@import "index";
</style>