|
@@ -46,17 +46,17 @@
|
|
|
|
|
|
<div id="two">
|
|
|
<div style="width: 49%;height: 100%;float:left;margin-left: -20px;margin-right: 10px;">
|
|
|
- <video id="twoVideo" class="videoType" :src="'/upVedio/ABB/'+firstFile" controls width="100%" height="100%" > </video>
|
|
|
+ <video autoplay="true" loop="true" id="twoVideo" class="videoType" :src="'/upVedio/ABB/'+firstFile" controls width="100%" height="100%" > </video>
|
|
|
<img id="twoImg" class="imgType" :src="'/upVedio/ABB/'+firstFile" width="100%" />
|
|
|
</div>
|
|
|
<div style="width: 50%;height: 100%;float:left;" v-for="task in taskList">
|
|
|
- <video id="twoVideo2" v-if="!task.isImg" class="videoType" :src="'/upVedio/ABB/'+task.fileName" controls width="100%" height="100%" > </video>
|
|
|
- <img v-if="task.isImg" class="imgType" :src="'/upVedio/ABB/'+task.fileName" width="110%" />
|
|
|
+ <video autoplay="true" loop="true" id="twoVideo2" v-if="!task.isImg" class="videoType" :src="'/upVedio/ABB/'+task.fileName" controls width="100%" height="100%" > </video>
|
|
|
+ <img v-if="task.isImg" class="imgType" :src="'/upVedio/ABB/'+task.fileName" width="106%" />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="row" v-for="task in taskList" id="one">
|
|
|
- <video v-if="!task.isImg" id="oneVideo" class="videoType" :src="'/upVedio/AAA/'+task.fileName" controls width="100%" height="100%" > </video>
|
|
|
- <img v-if="task.isImg" class="imgType" :src="'/upVedio/AAA/'+task.fileName" width="100%" />
|
|
|
+ <div class="row" v-for="task in taskList" id="one" style="margin-left: -25px">
|
|
|
+ <video autoplay="true" loop="true" v-if="!task.isImg" id="oneVideo" class="videoType" :src="'/upVedio/AAA/'+task.fileName" controls width="100%" height="100%" > </video>
|
|
|
+ <img v-if="task.isImg" class="imgType" :src="'/upVedio/AAA/'+task.fileName" width="101%" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -74,125 +74,99 @@
|
|
|
var vm = new Vue({
|
|
|
el: '#div-main',
|
|
|
data: {
|
|
|
+ listInit: ServiceProduceTask.getVedioFileList(),
|
|
|
taskList: [],
|
|
|
- cacheDataObject: {}, // 从服务器加载的全数据,界面只取某几条
|
|
|
- imer_long: '', // 定时取服务器数据
|
|
|
- timer_short: '', // 数据超长定时轮播
|
|
|
+ timer: '',
|
|
|
+ pageSize: 1,
|
|
|
+ pageIndex: 0,
|
|
|
+ timer: '',
|
|
|
upVideo:'',
|
|
|
firstFile:''
|
|
|
},
|
|
|
methods: {
|
|
|
- // 从服务器加载数据并显示
|
|
|
- refreshData: function () {
|
|
|
- // 关闭定时器
|
|
|
- // clearInterval(this.timer_short);
|
|
|
- this.loadData();
|
|
|
- // 开启定时器
|
|
|
- this.timer_short = setTimeout(this.scrollData, 3000);
|
|
|
- }, // 轮播数据
|
|
|
- scrollData: function () {
|
|
|
- for (var key in this.cacheDataObject) {
|
|
|
- const dataList = this.cacheDataObject[key].data;
|
|
|
- const pagesize = this.cacheDataObject[key].pagesize;
|
|
|
- var pageindex = this.cacheDataObject[key].pageindex + 1;
|
|
|
-
|
|
|
- if (dataList.length > pagesize) {
|
|
|
- const pagesum = (dataList.length / pagesize).toFixed(0) * 1 + (dataList.length %
|
|
|
- pagesize > 0 ? 1 : 0);
|
|
|
- if (pageindex >= pagesum)
|
|
|
- pageindex = 0;
|
|
|
- this.cacheDataObject[key].pageindex = pageindex;
|
|
|
- const startIndex = pageindex * pagesize;
|
|
|
- const remainSum = dataList.length - startIndex;
|
|
|
- const recordSum = remainSum >= pagesize ? pagesize : remainSum;
|
|
|
- const keyPar = dataList.slice(startIndex, startIndex + pagesize);
|
|
|
- if(keyPar.length < 1){
|
|
|
- continue;
|
|
|
- }
|
|
|
- this[key] = dataList.slice(startIndex, startIndex + pagesize);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }, // 从服务器加载数据
|
|
|
- loadData: function () {
|
|
|
- this.cacheDataObject = {};
|
|
|
+ get() {
|
|
|
+ this.upVideo = this.listInit[0].upVideo;
|
|
|
|
|
|
- const taskList = ServiceProduceTask.getVedioFileList();
|
|
|
- this.upVideo = taskList[0].upVideo;
|
|
|
+ this.firstFile = this.listInit[0].fileName;
|
|
|
+ if(this.listInit[0].isImg){
|
|
|
+ $("#twoVideo").hide();
|
|
|
+ }else{
|
|
|
+ $("#twoImg").hide();
|
|
|
+ }
|
|
|
if(this.upVideo == 'AAA'){
|
|
|
$("#two").hide();
|
|
|
}else{
|
|
|
- $("#one").hide();
|
|
|
+ $("#one").hide();
|
|
|
+ this.listInit.splice(0, 1);
|
|
|
}
|
|
|
|
|
|
- this.firstFile = taskList[0].fileName;
|
|
|
- if(taskList[0].isImg){
|
|
|
- $("#twoVideo").hide();
|
|
|
+ },
|
|
|
+ get2(){
|
|
|
+ this.taskList = this.listInit.slice(this.pageIndex,this.pageSize);
|
|
|
+ if(this.pageSize >= this.listInit.length){
|
|
|
+ this.pageIndex = 0;
|
|
|
+ this.pageSize = 1;
|
|
|
}else{
|
|
|
- $("#twoImg").hide();
|
|
|
+ this.pageIndex = this.pageIndex + 1;
|
|
|
+ this.pageSize = this.pageSize + 1;
|
|
|
+ }
|
|
|
+ // this.getVideo();
|
|
|
+ },
|
|
|
+ getVideo(){
|
|
|
+ var _video1 = $('#twoVideo')[0];
|
|
|
+ var _video2 = $('#twoVideo2')[0];
|
|
|
+ var _video3 = $('#oneVideo')[0];
|
|
|
+
|
|
|
+ if($('#twoVideo').is(':hidden') && _video1.paused){
|
|
|
+ }else{
|
|
|
+ _video1.play();
|
|
|
+ }
|
|
|
+ if($('#twoVideo2').is(':hidden') && _video2.paused){
|
|
|
+ }else{
|
|
|
+ _video1.play();
|
|
|
}
|
|
|
- taskList.splice(0, 1);
|
|
|
- this.cacheDataObject.taskList = {
|
|
|
- data: taskList,
|
|
|
- pagesize: 1,
|
|
|
- pageindex: 0
|
|
|
+ if($('#oneVideo').is(':hidden') && _video3.paused){
|
|
|
+ }else{
|
|
|
+ _video1.play();
|
|
|
}
|
|
|
- this.taskList = taskList.slice(0, this.cacheDataObject.taskList.pagesize);
|
|
|
- getVideo();
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.timer_long = setInterval(this.refreshData, 10000);
|
|
|
- this.refreshData();
|
|
|
+ this.get();
|
|
|
+ this.get2();
|
|
|
+ this.timer = setInterval(this.get2, 7000);
|
|
|
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- clearInterval(this.timer_long);
|
|
|
- // clearInterval(this.timer_short);
|
|
|
+ clearInterval(this.timer);
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- // $(function () {
|
|
|
-
|
|
|
- // if(taskList != null){
|
|
|
-
|
|
|
- // var file = taskList[0].fileType;
|
|
|
- // if (file=='jpg' || file=='jpeg' || file=='png'){
|
|
|
- // $("#videoType").hide();
|
|
|
- // $("#imgType").attr('src',"/upVedio/"+taskList[0].fileName);
|
|
|
- // }else{
|
|
|
- // $("#imgType").hide();
|
|
|
- // $("#videoType").attr('src',"/upVedio/"+taskList[0].fileName);
|
|
|
- // setInterval(function () { getVideo(); }, 3000);
|
|
|
- // }
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
- // })
|
|
|
-
|
|
|
- function getVideo(){
|
|
|
- var _video1 = $('#twoVideo')[0];
|
|
|
- var _video2 = $('#twoVideo2')[0];
|
|
|
- var _video3 = $('#oneVideo')[0];
|
|
|
+
|
|
|
+ // function getVideo(){
|
|
|
+ // var _video1 = $('#twoVideo')[0];
|
|
|
+ // var _video2 = $('#twoVideo2')[0];
|
|
|
+ // var _video3 = $('#oneVideo')[0];
|
|
|
|
|
|
- if($('#twoVideo').is(':hidden') && _video1.paused){
|
|
|
- }else{
|
|
|
- _video1.play();
|
|
|
- }
|
|
|
- if($('#twoVideo2').is(':hidden') && _video2.paused){
|
|
|
- }else{
|
|
|
- _video1.play();
|
|
|
- }
|
|
|
- if($('#oneVideo').is(':hidden') && _video3.paused){
|
|
|
- }else{
|
|
|
- _video1.play();
|
|
|
- }
|
|
|
+ // if($('#twoVideo').is(':hidden') && _video1.paused){
|
|
|
+ // }else{
|
|
|
+ // _video1.play();
|
|
|
+ // }
|
|
|
+ // if($('#twoVideo2').is(':hidden') && _video2.paused){
|
|
|
+ // }else{
|
|
|
+ // _video1.play();
|
|
|
+ // }
|
|
|
+ // if($('#oneVideo').is(':hidden') && _video3.paused){
|
|
|
+ // }else{
|
|
|
+ // _video1.play();
|
|
|
+ // }
|
|
|
|
|
|
- // if(_video3.paused){
|
|
|
- // _video3.play();
|
|
|
- // //_video.pause();//暂停
|
|
|
- // }
|
|
|
- }
|
|
|
+ // if(_video3.paused){
|
|
|
+ // _video3.play();
|
|
|
+ // //_video.pause();//暂停
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
</script>
|