|
|
|
@ -11,7 +11,7 @@
|
|
|
|
@click="full"
|
|
|
|
@click="full"
|
|
|
|
v-if="isFullscreen"
|
|
|
|
v-if="isFullscreen"
|
|
|
|
><a-icon type="left" /> 退出全屏 </a-button>
|
|
|
|
><a-icon type="left" /> 退出全屏 </a-button>
|
|
|
|
|
|
|
|
|
|
|
|
<a-button
|
|
|
|
<a-button
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
@click="countVideo(2)"
|
|
|
|
@click="countVideo(2)"
|
|
|
|
@ -20,10 +20,10 @@
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
@click="countVideo(3)"
|
|
|
|
@click="countVideo(3)"
|
|
|
|
> <a-icon type="number" /></a-button>
|
|
|
|
> <a-icon type="number" /></a-button>
|
|
|
|
|
|
|
|
|
|
|
|
<a-tabs
|
|
|
|
<a-tabs
|
|
|
|
:activeKey="activeKey"
|
|
|
|
:activeKey="activeKey"
|
|
|
|
default-active-key="1"
|
|
|
|
default-active-key="1"
|
|
|
|
@edit="onEdit"
|
|
|
|
@edit="onEdit"
|
|
|
|
@change="onTabClick"
|
|
|
|
@change="onTabClick"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
@ -32,28 +32,29 @@
|
|
|
|
:key="pane.key"
|
|
|
|
:key="pane.key"
|
|
|
|
:tab="pane.title"
|
|
|
|
:tab="pane.title"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a-row
|
|
|
|
|
|
|
|
v-for='rowIndex in row'
|
|
|
|
|
|
|
|
:key='rowIndex'
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-col
|
|
|
|
|
|
|
|
v-for='colIndex in column'
|
|
|
|
|
|
|
|
:key='colIndex'
|
|
|
|
|
|
|
|
:span="24/column"
|
|
|
|
|
|
|
|
:style="{height: videoHeight}"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<video
|
|
|
|
|
|
|
|
class="camera"
|
|
|
|
|
|
|
|
:id="rowIndex+'-'+colIndex"
|
|
|
|
|
|
|
|
autoplay
|
|
|
|
|
|
|
|
muted
|
|
|
|
|
|
|
|
:style="{'height': '100%',width:'100%','object-fit':'fill'}"
|
|
|
|
|
|
|
|
></video>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
</a-row>
|
|
|
|
|
|
|
|
</a-tab-pane>
|
|
|
|
</a-tab-pane>
|
|
|
|
</a-tabs>
|
|
|
|
</a-tabs>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a-row
|
|
|
|
|
|
|
|
v-for='rowIndex in row'
|
|
|
|
|
|
|
|
:key='rowIndex'
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-col
|
|
|
|
|
|
|
|
v-for='colIndex in column'
|
|
|
|
|
|
|
|
:key='colIndex'
|
|
|
|
|
|
|
|
:span="24/column"
|
|
|
|
|
|
|
|
:style="{height: videoHeight}"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<video
|
|
|
|
|
|
|
|
class="camera"
|
|
|
|
|
|
|
|
:id="rowIndex+'-'+colIndex"
|
|
|
|
|
|
|
|
autoplay
|
|
|
|
|
|
|
|
muted
|
|
|
|
|
|
|
|
:style="{'height': '100%',width:'100%','object-fit':'fill'}"
|
|
|
|
|
|
|
|
></video>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
</a-row>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
@ -76,8 +77,8 @@ export default {
|
|
|
|
column: 0,
|
|
|
|
column: 0,
|
|
|
|
a: 0,
|
|
|
|
a: 0,
|
|
|
|
clientHeight: 0,
|
|
|
|
clientHeight: 0,
|
|
|
|
panes: [ ],
|
|
|
|
panes: [],
|
|
|
|
activeKey: 0,//当前页,当前页id,从零开始
|
|
|
|
activeKey: 0, //当前页,当前页id,从零开始
|
|
|
|
videoH: 0,
|
|
|
|
videoH: 0,
|
|
|
|
isFullscreen: false,
|
|
|
|
isFullscreen: false,
|
|
|
|
originHeight: 0,
|
|
|
|
originHeight: 0,
|
|
|
|
@ -88,7 +89,7 @@ export default {
|
|
|
|
//watch: {},
|
|
|
|
//watch: {},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
videoHeight() {
|
|
|
|
videoHeight() {
|
|
|
|
return this.clientHeight / this.row + "px";
|
|
|
|
return (this.clientHeight / this.row )+ "px";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
destroyed() {
|
|
|
|
destroyed() {
|
|
|
|
@ -96,10 +97,12 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
|
this.getWallStyle();
|
|
|
|
this.getWallStyle();
|
|
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
|
|
console.log("DOM已更新完成");
|
|
|
|
|
|
|
|
|
|
|
|
this.playPageCameras();
|
|
|
|
this.playPageCameras();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let isFullscreen =
|
|
|
|
let isFullscreen =
|
|
|
|
document.fullscreenElement ||
|
|
|
|
document.fullscreenElement ||
|
|
|
|
document.mozFullScreenElement ||
|
|
|
|
document.mozFullScreenElement ||
|
|
|
|
@ -123,6 +126,7 @@ export default {
|
|
|
|
that.isFullscreen = !that.isFullscreen;
|
|
|
|
that.isFullscreen = !that.isFullscreen;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
updated() {},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
getWallStyle() {
|
|
|
|
getWallStyle() {
|
|
|
|
this.$api.httpApi
|
|
|
|
this.$api.httpApi
|
|
|
|
@ -150,121 +154,92 @@ export default {
|
|
|
|
console.log("clientHeight:" + this.clientHeight);
|
|
|
|
console.log("clientHeight:" + this.clientHeight);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onEdit(targetKey, action) {
|
|
|
|
onEdit(targetKey, action) {
|
|
|
|
const index = this.panes.findIndex((pane) => pane.key === targetKey);
|
|
|
|
const index = this.panes.findIndex(
|
|
|
|
|
|
|
|
(pane) => pane.key === targetKey
|
|
|
|
|
|
|
|
);
|
|
|
|
if (index !== -1) {
|
|
|
|
if (index !== -1) {
|
|
|
|
this.panes.splice(index, 1);
|
|
|
|
this.panes.splice(index, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getAllCameras() {
|
|
|
|
|
|
|
|
this.$api.httpApi
|
|
|
|
|
|
|
|
.getAllCameras1({
|
|
|
|
|
|
|
|
data: {},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
|
|
let cameras = res.data;
|
|
|
|
|
|
|
|
for (let i = 1; i <= cameras.length; i++) {
|
|
|
|
|
|
|
|
let rowIndex =
|
|
|
|
|
|
|
|
Math.floor((i - 1) / this.column) + 1;
|
|
|
|
|
|
|
|
if (rowIndex > this.row) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let columnIndex = i % this.column;
|
|
|
|
|
|
|
|
if (columnIndex == 0) {
|
|
|
|
|
|
|
|
columnIndex = this.column;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let idName = rowIndex + "-" + columnIndex;
|
|
|
|
|
|
|
|
console.log("idName:" + idName);
|
|
|
|
|
|
|
|
let server =
|
|
|
|
|
|
|
|
cameras[i - 1].rtcServer +
|
|
|
|
|
|
|
|
":" +
|
|
|
|
|
|
|
|
cameras[i - 1].rtcServerPort;
|
|
|
|
|
|
|
|
let video = document.getElementById(idName);
|
|
|
|
|
|
|
|
let player = new WebRtcPlayer(
|
|
|
|
|
|
|
|
server,
|
|
|
|
|
|
|
|
video,
|
|
|
|
|
|
|
|
"camera" + cameras[i - 1].id
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
this.players.push(player);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
console.log(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
//一页个数
|
|
|
|
//一页个数
|
|
|
|
countVideo(i){
|
|
|
|
countVideo(i) {
|
|
|
|
|
|
|
|
this.row = i;
|
|
|
|
|
|
|
|
this.column = i;
|
|
|
|
|
|
|
|
|
|
|
|
this.row= i;
|
|
|
|
this.activeKey = 0;
|
|
|
|
this.column= i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.activeKey=0;
|
|
|
|
|
|
|
|
this.playPageCameras();
|
|
|
|
this.playPageCameras();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//墙信息
|
|
|
|
//墙信息
|
|
|
|
pageInfo(cameras){
|
|
|
|
pageInfo(cameras) {
|
|
|
|
var page = Math.ceil(cameras.length/(this.row*this.column));
|
|
|
|
var page = Math.ceil(cameras.length / (this.row * this.column));
|
|
|
|
this.panes = [];
|
|
|
|
this.panes = [];
|
|
|
|
for(var i=1;i<=page;i++){
|
|
|
|
for (var i = 1; i <= page; i++) {
|
|
|
|
this.panes.push({ title: "视频墙 "+i, content: "Content of Tab "+i, key: i-1 });
|
|
|
|
this.panes.push({
|
|
|
|
|
|
|
|
title: "视频墙 " + i,
|
|
|
|
|
|
|
|
content: "Content of Tab " + i,
|
|
|
|
|
|
|
|
key: i - 1,
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
changeTab(key){
|
|
|
|
changeTab(key) {
|
|
|
|
console.log(key);
|
|
|
|
console.log(key);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onTabClick(key) {
|
|
|
|
onTabClick(key) {
|
|
|
|
this.destory()
|
|
|
|
this.destory();
|
|
|
|
|
|
|
|
|
|
|
|
console.log(key);
|
|
|
|
console.log(key);
|
|
|
|
this.activeKey =key;
|
|
|
|
this.activeKey = key;
|
|
|
|
this.playPageCameras();
|
|
|
|
this.playPageCameras();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
playPageCameras() {
|
|
|
|
playPageCameras() {
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$api.httpApi
|
|
|
|
this.$api.httpApi
|
|
|
|
.getAllCameras({
|
|
|
|
.getAllCameras({
|
|
|
|
data: {},
|
|
|
|
data: {},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
if (res.code == 200) {
|
|
|
|
let cameras = res.data;
|
|
|
|
let cameras = res.data;
|
|
|
|
this.pageInfo(cameras)
|
|
|
|
this.pageInfo(cameras);
|
|
|
|
var pageSize = (this.row*this.column);
|
|
|
|
var pageSize = this.row * this.column;
|
|
|
|
var camerasPage = cameras.slice(this.activeKey*pageSize,(this.activeKey+1)*pageSize);
|
|
|
|
var camerasPage = cameras.slice(
|
|
|
|
console.log(camerasPage);
|
|
|
|
this.activeKey * pageSize,
|
|
|
|
this.players=[];
|
|
|
|
(this.activeKey + 1) * pageSize
|
|
|
|
for (let i = 1; i <= camerasPage.length; i++) {
|
|
|
|
|
|
|
|
let rowIndex =
|
|
|
|
|
|
|
|
Math.floor((i - 1) / this.column) + 1;
|
|
|
|
|
|
|
|
if (rowIndex > this.row) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let columnIndex = i % this.column;
|
|
|
|
|
|
|
|
if (columnIndex == 0) {
|
|
|
|
|
|
|
|
columnIndex = this.column;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let idName = rowIndex + "-" + columnIndex;
|
|
|
|
|
|
|
|
console.log("idName:" + idName);
|
|
|
|
|
|
|
|
let server =
|
|
|
|
|
|
|
|
camerasPage[i - 1].rtcServer +
|
|
|
|
|
|
|
|
":" +
|
|
|
|
|
|
|
|
camerasPage[i - 1].rtcServerPort;
|
|
|
|
|
|
|
|
let video = document.getElementById(idName);
|
|
|
|
|
|
|
|
let player = new WebRtcPlayer(
|
|
|
|
|
|
|
|
server,
|
|
|
|
|
|
|
|
video,
|
|
|
|
|
|
|
|
"camera" + camerasPage[i - 1].id
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
this.players.push(player);
|
|
|
|
console.log(camerasPage);
|
|
|
|
|
|
|
|
this.players = [];
|
|
|
|
|
|
|
|
for (let i = 1; i <= camerasPage.length; i++) {
|
|
|
|
|
|
|
|
let rowIndex =
|
|
|
|
|
|
|
|
Math.floor((i - 1) / this.column) + 1;
|
|
|
|
|
|
|
|
if (rowIndex > this.row) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let columnIndex = i % this.column;
|
|
|
|
|
|
|
|
if (columnIndex == 0) {
|
|
|
|
|
|
|
|
columnIndex = this.column;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let idName = rowIndex + "-" + columnIndex;
|
|
|
|
|
|
|
|
console.log("idName:" + idName);
|
|
|
|
|
|
|
|
let server =
|
|
|
|
|
|
|
|
camerasPage[i - 1].rtcServer +
|
|
|
|
|
|
|
|
":" +
|
|
|
|
|
|
|
|
camerasPage[i - 1].rtcServerPort;
|
|
|
|
|
|
|
|
let video = document.getElementById(idName);
|
|
|
|
|
|
|
|
console.log(video);
|
|
|
|
|
|
|
|
let player = new WebRtcPlayer(
|
|
|
|
|
|
|
|
server,
|
|
|
|
|
|
|
|
video,
|
|
|
|
|
|
|
|
"camera" + camerasPage[i - 1].id
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
this.players.push(player);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
destory() {
|
|
|
|
destory() {
|
|
|
|
for (let player of this.players) {
|
|
|
|
for (let player of this.players) {
|
|
|
|
|