From cf9468626781bbb55ffd355d9c56c9111ae07062 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期二, 13 十二月 2022 17:06:43 +0800
Subject: [PATCH] 优化

---
 src/views/systemSetting/device/point/index.vue |   68 ++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/src/views/systemSetting/device/point/index.vue b/src/views/systemSetting/device/point/index.vue
index 46c436b..d7d4b94 100644
--- a/src/views/systemSetting/device/point/index.vue
+++ b/src/views/systemSetting/device/point/index.vue
@@ -80,7 +80,7 @@
       videoData: [],
       searchData: null,
       hls: null,
-      videoList:[]
+      videoList: [],
     };
   },
   methods: {
@@ -104,29 +104,33 @@
         .catch((err) => this.$message.error(err));
     },
     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);
-            this.videoList.push(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);
+              this.videoList.push(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("鏆傛棤瑙嗛");
       }
     },
     selectedDepartment(data) {
@@ -141,9 +145,9 @@
       this.getVideoPointList(this.searchData);
     },
   },
-  beforeDestroy(){
-    videoList.forEach(element => {
-      element.push()
+  beforeDestroy() {
+    videoList.forEach((element) => {
+      element.push();
     });
   },
 };
@@ -285,22 +289,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