Commit 53335e64 authored by 罗超's avatar 罗超

随机视频

parent 44c8ea1a
Pipeline #3 canceled with stages
......@@ -141,7 +141,6 @@ export default {
let key=day+' '+hours
let count=0
this.realData.forEach(x=>{
console.log(x.time+' '+key)
if(x.time.indexOf(key)!=-1){
count+=parseFloat(x.unitPrice)
}
......
......@@ -144,9 +144,9 @@
</div>
</div>
</div>
<!-- <div class="video_box" :class="movieShow ? 'video_box_show' : ''">
<video v-if="movieShow" @ended="nextVideo" style="width:100%;height:100%;" ref="video" :src="movie[movieNum]" muted autoplay="autoplay" controls="controls">您的浏览器不支持视频播放</video>
</div> -->
<div class="video_box" :class="movieShow ? 'video_box_show' : ''">
<video v-if="movieShow" @ended="nextVideo(true)" style="width:100%;height:100%;" ref="video" :src="movie[movieNum]" autoplay="autoplay" controls="controls">您的浏览器不支持视频播放</video>
</div>
</div>
</template>
<script>
......@@ -198,9 +198,11 @@ export default {
};
},
mounted() {
for (let i = 0; i < 20; i ++){
this.movie.push(`http://img.oytour.com/video/${i+1}.mp4`)
for (let i = 0; i < 26; i ++){ // 生成视频数据
this.movie.push(`http://192.168.1.254/${i+1}.mp4`)
// this.movie.push(`http://img.oytour.com/video/${i+1}.mp4`)
}
this.nextVideo();
this.mq();
this.initVideo();
this.bus.$on("addVideo", txt => {
......@@ -218,9 +220,9 @@ export default {
}
}, false);
this.init()
// this.movieTimmer = setInterval(() => {
// this.getMovieTimmer()
// }, 1000)
this.movieTimmer = setInterval(() => {
this.getMovieTimmer()
}, 1000)
this.getTime()
setInterval(() => {
this.getTime()
......@@ -239,11 +241,21 @@ export default {
return
}
},
nextVideo: function () {
if (this.movieNum >= 19){
this.movieNum = 0
nextVideo: function (f) {
if (f) { // 根据f 删除一播放的数据
this.movie.splice(this.movieNum, 1)
}
let maxNum = this.movie.length // 最大随机数
let mathRound = Math.floor(Math.random()*maxNum) // 生成随机数
if (maxNum === 1){ // 如果随机数为1 说明是最后提条数据 重新生成数据
this.movie = []
for (let i = 0; i < 26; i ++){
this.movie.push(`http://192.168.1.254/${i+1}.mp4`)
// this.movie.push(`http://img.oytour.com/video/${i+1}.mp4`)
}
this.nextVideo()
} else {
this.movieNum = this.movieNum + 1
this.movieNum = mathRound
}
},
connec(){
......
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