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

随机视频

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