From a2d430479667247b782dc2dc47cc3695cf8a7c28 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期二, 13 十二月 2022 16:46:48 +0800
Subject: [PATCH] 视频巡查优化

---
 src/views/video/index.vue |  143 ++++++++++++++++++++++++-----------------------
 1 files changed, 74 insertions(+), 69 deletions(-)

diff --git a/src/views/video/index.vue b/src/views/video/index.vue
index d623c8b..2687a18 100644
--- a/src/views/video/index.vue
+++ b/src/views/video/index.vue
@@ -49,7 +49,7 @@
               left: 50px;
             "
           >
-            {{ item.name }}{{ item.community }}
+            {{ item.community }}-{{ item.name }}
           </div>
           <video
             :id="item.id"
@@ -128,29 +128,32 @@
   mounted() {},
   methods: {
     loadVideo(item) {
-      if (Hls.isSupported()) {
-        var video = document.getElementById(item.id);
-        var hls = new Hls();
-        videoPoint.getVideoPointUrl(item.platResourceId).then((res) => {
-          
-          if (res.code === 0) {
-            hls.loadSource(res.data);
-            hls.attachMedia(video);
-            // hls.on(Hls.Events.MANIFEST_PARSED, function () {
-            //   video.play();
-            //   document.body.addEventListener(
-            //     "click",
-            //     function () {
-            //       video.play();
-            //     },
-            //     false
-            //   );
-            // });
-            setTimeout(() => {
-              video.play();
-            }, 2000);
-          }
-        });
+      if (item.platResourceId) {
+        if (Hls.isSupported()) {
+          var video = document.getElementById(item.id);
+          var hls = new Hls();
+          videoPoint.getVideoPointUrl(item.platResourceId).then((res) => {
+            if (res.code === 0) {
+              hls.loadSource(res.data);
+              hls.attachMedia(video);
+              // hls.on(Hls.Events.MANIFEST_PARSED, function () {
+              //   video.play();
+              //   document.body.addEventListener(
+              //     "click",
+              //     function () {
+              //       video.play();
+              //     },
+              //     false
+              //   );
+              // });
+              setTimeout(() => {
+                video.play();
+              }, 2000);
+            }
+          });
+        }
+      } else {
+        this.$message.error("鏆傛棤瑙嗛");
       }
     },
     getVideoPointList(data) {
@@ -218,46 +221,50 @@
       });
     },
     create(item) {
-      const DHWsInstance = DHWs.getInstance();
-      this.ws = DHWsInstance;
-      console.log(this.ws);
-      this.login();
-      // 璋冪敤鍒涘缓鎺т欢鎺ュ彛
-      // if (!this.isLogin) {
-      //      this.$message.info('姝e湪鐧婚檰瀹㈡埛绔紝璇风◢绛�......');
-      //     return false;
-      // }
-      this.dialogCreate = true;
-      setTimeout(() => {
-        let _this = this;
-        const params = [
-          {
-            // ctrlType: "realMonitorUI",
-            ctrlType: "playerWin",
-            ctrlCode: this.ctrl,
-            ctrlProperty: {
-              displayMode: 1,
-              splitNum: 1,
-              channelList: [{ channelId: item.code }],
+      if (item.code) {
+        const DHWsInstance = DHWs.getInstance();
+        this.ws = DHWsInstance;
+        console.log(this.ws);
+        this.login();
+        // 璋冪敤鍒涘缓鎺т欢鎺ュ彛
+        // if (!this.isLogin) {
+        //      this.$message.info('姝e湪鐧婚檰瀹㈡埛绔紝璇风◢绛�......');
+        //     return false;
+        // }
+        this.dialogCreate = true;
+        setTimeout(() => {
+          let _this = this;
+          const params = [
+            {
+              // ctrlType: "realMonitorUI",
+              ctrlType: "playerWin",
+              ctrlCode: this.ctrl,
+              ctrlProperty: {
+                displayMode: 1,
+                splitNum: 1,
+                channelList: [{ channelId: item.code }],
+              },
+              visible: true,
+              domId: this.domId,
             },
-            visible: true,
-            domId: this.domId,
-          },
-        ];
-        this.setPos();
-        _this.ws
-          .createCtrl(params)
-          .then((res) => {
-            this.$message.success("鍒涘缓鎴愬姛");
-            console.log("res", res);
-          })
-          .catch((e) => {
-            console.log("error;", e);
+          ];
+          this.setPos();
+          _this.ws
+            .createCtrl(params)
+            .then((res) => {
+              this.$message.success("鍒涘缓鎴愬姛");
+              console.log("res", res);
+            })
+            .catch((e) => {
+              console.log("error;", e);
+            });
+          _this.ws.on("createCtrlResult", (res) => {
+            console.warn(res);
           });
-        _this.ws.on("createCtrlResult", (res) => {
-          console.warn(res);
-        });
-      }, 1000);
+        }, 1000);
+      } else {
+        this.$message.error("鏆傛棤瑙嗛");
+      }
     },
 
     destroy() {
@@ -414,24 +421,22 @@
 }
 
 video::-webkit-media-controls-timeline {
-    display: none;
+  display: none;
 }
 
 video::-webkit-media-controls-current-time-display {
-    display: none;
+  display: none;
 }
 
 video::-webkit-media-controls-time-remaining-display {
-    display: none;
+  display: none;
 }
 
 video::-webkit-media-controls-mute-button {
-    display: none;
+  display: none;
 }
 
 video::-webkit-media-controls-toggle-closed-captions-button {
-    display: none;
+  display: none;
 }
-
-
 </style>
\ No newline at end of file

--
Gitblit v1.8.0