|
@@ -50,6 +50,7 @@
|
|
|
import {mapState} from 'vuex'
|
|
|
import draggable from 'vuedraggable'
|
|
|
import VueDragResize from 'vue-drag-resize'
|
|
|
+ import PubSub from 'pubsub-js'
|
|
|
|
|
|
import '../assets/less/splitscreen.less'
|
|
|
import {elePosition, getElementLeft, getElementTop, getStaticFile, guId} from "../../utils/tools"
|
|
@@ -92,53 +93,8 @@
|
|
|
VideoPlayer
|
|
|
},
|
|
|
|
|
|
- async beforeCreate() {
|
|
|
- // 加载大屏json文件
|
|
|
- const bigScreenJson = await getStaticFile('EnityBigScreen.Data')
|
|
|
- // 过滤出显示的大屏
|
|
|
- this.currentBigshow = bigScreenJson.filter(item => item.WindowID === this.window.ID)
|
|
|
- if(this.currentBigshow.length){
|
|
|
- // 给大屏对象进行初始化显示
|
|
|
- const obj = {}
|
|
|
- this.currentBigshow.forEach(item => {
|
|
|
- obj[item.ID] = {
|
|
|
- bindList:[],
|
|
|
- splitStatus:0,
|
|
|
- signalArr:[],
|
|
|
- width:item.Width,
|
|
|
- height:item.Height
|
|
|
- }
|
|
|
- const num = item.BindList.filter(item => item.DeviceID).length
|
|
|
- // 拼接屏数量
|
|
|
- for(let i=0;i<num;i++){
|
|
|
- obj[item.ID].bindList.push(i+1)
|
|
|
- }
|
|
|
- // 根据拼接屏数量得到分屏状态
|
|
|
- obj[item.ID].splitStatus = Math.floor(Math.sqrt(num)-1)
|
|
|
- })
|
|
|
- this.$store.dispatch('updateBigscreenObj',obj)
|
|
|
-
|
|
|
- // 获取视频播放的配置对象
|
|
|
- const preSingleList = await reqPreviewSourceList()
|
|
|
- const videoPlayObj = {}
|
|
|
- for(const item of preSingleList){
|
|
|
- videoPlayObj[item.sourceId] = {
|
|
|
- sources: [
|
|
|
- {
|
|
|
- "src": item.previewUrl,
|
|
|
- "type": "rtmp/flv"
|
|
|
- }
|
|
|
- ],
|
|
|
- techOrder: ['flash'],
|
|
|
- autoplay: true,
|
|
|
- controls: false,
|
|
|
- fluid:true,
|
|
|
- preload: 'auto',
|
|
|
- notSupportedMessage: '此视频暂无法播放,请稍后再试',
|
|
|
- }
|
|
|
- }
|
|
|
- this.videoPlayObj = videoPlayObj
|
|
|
- }
|
|
|
+ created() {
|
|
|
+ this.initBigScreen()
|
|
|
},
|
|
|
|
|
|
updated() {
|
|
@@ -151,6 +107,10 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ beforeDestroy() {
|
|
|
+ PubSub.unsubscribe(this.update_screenobj)
|
|
|
+ },
|
|
|
|
|
|
methods: {
|
|
|
// 大屏开窗接口提交
|
|
@@ -223,6 +183,56 @@
|
|
|
return `transform-origin: 0px 0px;transform:scaleY(${(itemV.height-videoHeight)/videoHeight+1})`
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ // 大屏初始化
|
|
|
+ async initBigScreen() {
|
|
|
+ // 加载大屏json文件
|
|
|
+ const bigScreenJson = await getStaticFile('EnityBigScreen.Data')
|
|
|
+ // 过滤出显示的大屏
|
|
|
+ this.currentBigshow = bigScreenJson.filter(item => item.WindowID === this.window.ID)
|
|
|
+ if(this.currentBigshow.length){
|
|
|
+ // 给大屏对象进行初始化显示
|
|
|
+ const obj = {}
|
|
|
+ bigScreenJson.forEach(item => {
|
|
|
+ obj[item.ID] = {
|
|
|
+ bindList:[],
|
|
|
+ splitStatus:0,
|
|
|
+ signalArr:[],
|
|
|
+ width:item.Width,
|
|
|
+ height:item.Height
|
|
|
+ }
|
|
|
+ const num = item.BindList.filter(item => item.DeviceID).length
|
|
|
+ // 拼接屏数量
|
|
|
+ for(let i=0;i<num;i++){
|
|
|
+ obj[item.ID].bindList.push(i+1)
|
|
|
+ }
|
|
|
+ // 根据拼接屏数量得到分屏状态
|
|
|
+ obj[item.ID].splitStatus = Math.floor(Math.sqrt(num)-1)
|
|
|
+ })
|
|
|
+ this.$store.dispatch('updateBigscreenObj',obj)
|
|
|
+
|
|
|
+ // 获取视频播放的配置对象
|
|
|
+ const preSingleList = await reqPreviewSourceList()
|
|
|
+ const videoPlayObj = {}
|
|
|
+ for(const item of preSingleList){
|
|
|
+ videoPlayObj[item.sourceId] = {
|
|
|
+ sources: [
|
|
|
+ {
|
|
|
+ "src": item.previewUrl,
|
|
|
+ "type": "rtmp/flv"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ techOrder: ['flash'],
|
|
|
+ autoplay: true,
|
|
|
+ controls: false,
|
|
|
+ fluid:true,
|
|
|
+ preload: 'auto',
|
|
|
+ notSupportedMessage: '此视频暂无法播放,请稍后再试',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.videoPlayObj = videoPlayObj
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
@@ -240,6 +250,8 @@
|
|
|
const bigScreenObj = this.$store.state.bigScreenObj
|
|
|
const bigScale = this.$store.state.bigScale
|
|
|
const positionNum = this.$store.state.positionNum
|
|
|
+
|
|
|
+ console.log(bigscreenId,bigScreenObj)
|
|
|
|
|
|
const arr2 = []
|
|
|
arr.forEach(item => {
|
|
@@ -250,16 +262,18 @@
|
|
|
const otherSignals = arr2.filter(item => item.Id)
|
|
|
newObj[0].Id = guId()
|
|
|
newObj[0].bigscreenId = bigscreenId
|
|
|
- newObj[0].splitScreenStatus = bigScreenObj[bigscreenId].splitStatus + 1
|
|
|
- newObj[0].width = bigScreenObj[bigscreenId].width * bigScale / newObj[0].splitScreenStatus
|
|
|
- newObj[0].height = bigScreenObj[bigscreenId].height * bigScale / newObj[0].splitScreenStatus
|
|
|
- newObj[0].widthScale = newObj[0].width / (bigScreenObj[bigscreenId].width * bigScale)
|
|
|
- newObj[0].heightScale = newObj[0].height / (bigScreenObj[bigscreenId].height * bigScale)
|
|
|
- const positionInfo = elePosition(newObj[0].width,newObj[0].height,positionNum,this.screenPosition[bigscreenId].top,this.screenPosition[bigscreenId].left,bigScreenObj[bigscreenId].splitStatus+1)
|
|
|
- newObj[0].top = positionInfo.top - this.screenPosition[bigscreenId].top
|
|
|
- newObj[0].left = positionInfo.left - this.screenPosition[bigscreenId].left
|
|
|
- bigScreenObj[bigscreenId].signalArr = [...otherSignals,...newObj]
|
|
|
- this.refreshBigScreen(bigScreenObj,bigscreenId)
|
|
|
+ if(bigScreenObj[bigscreenId]){
|
|
|
+ newObj[0].splitScreenStatus = bigScreenObj[bigscreenId].splitStatus + 1
|
|
|
+ newObj[0].width = bigScreenObj[bigscreenId].width * bigScale / newObj[0].splitScreenStatus
|
|
|
+ newObj[0].height = bigScreenObj[bigscreenId].height * bigScale / newObj[0].splitScreenStatus
|
|
|
+ newObj[0].widthScale = newObj[0].width / (bigScreenObj[bigscreenId].width * bigScale)
|
|
|
+ newObj[0].heightScale = newObj[0].height / (bigScreenObj[bigscreenId].height * bigScale)
|
|
|
+ const positionInfo = elePosition(newObj[0].width,newObj[0].height,positionNum,this.screenPosition[bigscreenId].top,this.screenPosition[bigscreenId].left,bigScreenObj[bigscreenId].splitStatus+1)
|
|
|
+ newObj[0].top = positionInfo.top - this.screenPosition[bigscreenId].top
|
|
|
+ newObj[0].left = positionInfo.left - this.screenPosition[bigscreenId].left
|
|
|
+ bigScreenObj[bigscreenId].signalArr = [...otherSignals,...newObj]
|
|
|
+ this.refreshBigScreen(bigScreenObj,bigscreenId)
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -289,5 +303,36 @@
|
|
|
return this.$refs.videoPlayer.player
|
|
|
},
|
|
|
},
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ window: {
|
|
|
+ handler (newV, oldV) {
|
|
|
+ if(newV.ID !== oldV){
|
|
|
+ // 更新大屏对象
|
|
|
+ this.initBigScreen()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep:true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|