Przeglądaj źródła

摄像头配置

liwei19941102 2 lat temu
rodzic
commit
5bcd55905e
1 zmienionych plików z 32 dodań i 9 usunięć
  1. 32 9
      src/components/Map/videoMap.vue

+ 32 - 9
src/components/Map/videoMap.vue

@@ -218,16 +218,39 @@ const addLine = (list) => {
 const emit = defineEmits(['childToParent']);
 
 const clickMarker = (e) => {
-    console.log(e)
-    allInfoWindow.value.open(mapObj.value, e.target.getPosition());
-    getCameraPlayerConfig('FD1958046').then(res => {
-        console.log(res.data);
-        var player = new EZUIKit.EZUIKitPlayer({
-          template: "pcLive",
-          id: 'video-container', // 视频容器ID
-          ...res.data
+    // console.log(e.target.getExtData());
+
+    // var json = JSON.parse(e.target.getExtData().remark)
+    console.log(e.target.getExtData().remark)
+    if (e.target.getExtData().remark != null && e.target.getExtData().remark != '') {
+        var showVideo = false
+        var json = JSON.parse(e.target.getExtData().remark)
+        for (var index in json) {
+            if (json[index].type == "camera") {
+                showVideo = true;
+                allInfoWindow.value.open(mapObj.value, e.target.getPosition());
+                getCameraPlayerConfig(json[index].code).then(res => {
+                    console.log(res.data);
+                    var player = new EZUIKit.EZUIKitPlayer({
+                        template: "pcLive",
+                        id: 'video-container', // 视频容器ID
+                        ...res.data
+                    })
+                })
+            }
+        }
+        if (!showVideo) {
+            ElMessage({
+                message: '该站点未配置摄像头',
+                type: 'warning',
+            })
+        }
+    } else {
+        ElMessage({
+            message: '该站点未配置摄像头',
+            type: 'warning',
         })
-      })
+    }
     // emit('childToParent', e.target.getPosition())
 }