|
@@ -0,0 +1,221 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="camera-page">
|
|
|
|
+ <el-dialog
|
|
|
|
+ width="650px"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ :visible.sync="cameraVisible"
|
|
|
|
+ :modal="true"
|
|
|
|
+ @close="closeDialog"
|
|
|
|
+ append-to-body
|
|
|
|
+ >
|
|
|
|
+ <div class="dialog-title">
|
|
|
|
+ <p>{{videoDialog.riskPointName}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="width: 610px;height:500px;" id="video-dialog"></div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <div class="camera-container">
|
|
|
|
+ <div class="video-container" v-for="(item,key) in items" :key="key" @click="handle(item)">
|
|
|
|
+ <div class="riskPointName">{{ item.riskPointName }}</div>
|
|
|
|
+ <div :id="`video-`+item.id" style="width:100%;height:100%;"></div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+ import "@/assets/js/ezuikit.js"
|
|
|
|
+ export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ cameraVisible:false,
|
|
|
|
+ videoDialog:{},
|
|
|
|
+ items:[]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.init()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ init(){
|
|
|
|
+ this.getData()
|
|
|
|
+ },
|
|
|
|
+ getData(){
|
|
|
|
+ let cId=this.$port.cId||this.$route.query.cId
|
|
|
|
+ this.$axios.AxiosMethods("get",`/3rd/bigScreenData/getystokenbycid/${cId}`,{},(resq)=> {
|
|
|
|
+ if(!resq.data.accessToken){
|
|
|
|
+ this.$message.error('获取token失败')
|
|
|
|
+ }
|
|
|
|
+ this.$axios.AxiosMethods("get",`/3rd/bigScreenData/getallvideourlbyCid/${cId}`,{},(res)=> {
|
|
|
|
+ let items=[]
|
|
|
|
+ items=res.data.map((item,index)=>{
|
|
|
|
+ return{
|
|
|
|
+ ...item,
|
|
|
|
+ "accessToken":resq.data.accessToken,
|
|
|
|
+ "id":`camera-${index+1}`
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // for(let i=0;i<42;i++){
|
|
|
|
+ // if(i%2===0){
|
|
|
|
+ // items.push({
|
|
|
|
+ // "ipCameraUrl":"ezopen://open.ys7.com/E04848389/1.live",
|
|
|
|
+ // "accessToken":resq.data.accessToken,
|
|
|
|
+ // "id":`camera-${i+1}`,
|
|
|
|
+ // "riskPointName":res.data[0].riskPointName
|
|
|
|
+ // })
|
|
|
|
+ // }else{
|
|
|
|
+ // items.push({
|
|
|
|
+ // "ipCameraUrl":"ezopen://open.ys7.com/BA7718340/1.live",
|
|
|
|
+ // "accessToken":resq.data.accessToken,
|
|
|
|
+ // "id":`camera-${i+1}`,
|
|
|
|
+ // "riskPointName":res.data[1].riskPointName
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ this.items=items
|
|
|
|
+ for(let i=0;i<items.length;i++){
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
+ this.render(items[i])
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ render(item={}){
|
|
|
|
+ item.player = new EZUIKit.EZUIKitPlayer({
|
|
|
|
+ id: `video-${item.id}`,
|
|
|
|
+ autoplay: true,
|
|
|
|
+ url: item.ipCameraUrl,
|
|
|
|
+ accessToken: item.accessToken,
|
|
|
|
+ plugin: ['talk'],
|
|
|
|
+ width: item.width||210,
|
|
|
|
+ height: item.height||140,
|
|
|
|
+ themeData:{
|
|
|
|
+ "autoFocus": 5,
|
|
|
|
+ "poster":"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
|
|
|
|
+ "header": {
|
|
|
|
+ "color": "#1890ff",
|
|
|
|
+ "activeColor": "#FFFFFF",
|
|
|
|
+ "backgroundColor": "#000000",
|
|
|
|
+ "btnList": []
|
|
|
|
+ },
|
|
|
|
+ "footer": {
|
|
|
|
+ "color": "#FFFFFF",
|
|
|
|
+ "activeColor": "#1890FF",
|
|
|
|
+ "backgroundColor": "#00000021",
|
|
|
|
+ "btnList": [
|
|
|
|
+ {
|
|
|
|
+ "iconId": "play",
|
|
|
|
+ "part": "left",
|
|
|
|
+ "defaultActive": 1,
|
|
|
|
+ "memo": "播放",
|
|
|
|
+ "isrender": 0
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "iconId": "sound",
|
|
|
|
+ "part": "left",
|
|
|
|
+ "defaultActive": 1,
|
|
|
|
+ "memo": "声音按钮",
|
|
|
|
+ "isrender": 1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "iconId": "pantile",
|
|
|
|
+ "part": "left",
|
|
|
|
+ "defaultActive": 1,
|
|
|
|
+ "memo": "云台控制按钮",
|
|
|
|
+ "isrender": 1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "iconId": "talk",
|
|
|
|
+ "part": "left",
|
|
|
|
+ "defaultActive": 0,
|
|
|
|
+ "memo": "对讲按钮",
|
|
|
|
+ "isrender": 1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "iconId": "expend",
|
|
|
|
+ "part": "right",
|
|
|
|
+ "defaultActive": 0,
|
|
|
|
+ "memo": "全局全屏按钮",
|
|
|
|
+ "isrender": 1
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleError: function(e) {
|
|
|
|
+ console.log('捕获到错误', e)
|
|
|
|
+ },
|
|
|
|
+ handleSuccess: function() {
|
|
|
|
+ console.log("播放成功回调函数,此处可执行播放成功后续动作");
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handle(item){
|
|
|
|
+ this.cameraVisible=true
|
|
|
|
+ if(item.player&&item.player.destroy){
|
|
|
|
+ var destroyPromise = item.player.destroy();
|
|
|
|
+ destroyPromise.then((data) => {
|
|
|
|
+ console.log("promise 获取 数据", data)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.videoDialog={
|
|
|
|
+ ...item,
|
|
|
|
+ id:'dialog',
|
|
|
|
+ width: 600,
|
|
|
|
+ height: 500,
|
|
|
|
+ }
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
+ this.render(this.videoDialog)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ closeDialog(){
|
|
|
|
+ if(this.videoDialog.player&&this.videoDialog.player.destroy){
|
|
|
|
+ var destroyPromise = item.player.destroy();
|
|
|
|
+ destroyPromise.then((data) => {
|
|
|
|
+ this.videoDialog={}
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ destroyed() {
|
|
|
|
+ this.items.map(item=>{
|
|
|
|
+ if(item.player&&item.player.destroy){
|
|
|
|
+ var destroyPromise = item.player.destroy();
|
|
|
|
+ destroyPromise.then((data) => {
|
|
|
|
+ console.log("promise 获取 数据", data)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+<style>
|
|
|
|
+.camera-container{
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ background:linear-gradient(180deg,rgba(0,29,49,1) 0%,rgba(0,35,78,1) 100%);
|
|
|
|
+}
|
|
|
|
+.video-container{
|
|
|
|
+ width:230px;
|
|
|
|
+ height: 160px;
|
|
|
|
+ padding: 5px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+}
|
|
|
|
+.video-container .riskPointName{
|
|
|
|
+ margin: 0;
|
|
|
|
+ padding: 2px 0;
|
|
|
|
+ color: #fff;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+.footer-controls{
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ font-size: 22px;
|
|
|
|
+}
|
|
|
|
+</style>
|