From 181bf76862b7d2ccf4382bb782a9dd11cfb10c4e Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 20 三月 2024 18:54:39 +0800
Subject: [PATCH] 优化节点在线状态

---
 web_src/src/components/CloudRecord.vue |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/web_src/src/components/CloudRecord.vue b/web_src/src/components/CloudRecord.vue
index ca963e6..9f8d7a0 100755
--- a/web_src/src/components/CloudRecord.vue
+++ b/web_src/src/components/CloudRecord.vue
@@ -213,10 +213,26 @@
       console.log(row)
       this.chooseRecord = row;
       this.showPlayer = true;
-      let videoPath = row.filePath.substring(row.filePath.length - 25);
-      console.log(videoPath)
-      this.videoUrl = `${this.getFileBasePath(row)}/download/${row.app}/${row.stream}/${videoPath}`
-      console.log(this.videoUrl)
+      this.$axios({
+        method: 'get',
+        url: `/api/cloud/record/play/path`,
+        params: {
+          recordId: row.id,
+        }
+      }).then((res) => {
+        console.log(res)
+        if (res.data.code === 0) {
+          if (location.protocol === "https:") {
+            this.videoUrl = res.data.data.httpsPath;
+          }else {
+            this.videoUrl = res.data.data.httpPath;
+          }
+          console.log(222 )
+          console.log(this.videoUrl )
+        }
+      }).catch((error) => {
+        console.log(error);
+      });
     },
       getFileBasePath(item) {
           let basePath = ""
@@ -248,14 +264,16 @@
       });
     },
     formatTime(time) {
-      const h = parseInt(time / 3600)
-      const minute = parseInt(time / 60 % 60)
-      const second = Math.ceil(time % 60)
-
-      return (h > 0 ? h + `灏忔椂` : '') + (minute > 0 ? minute + '鍒�' : '') + second + '绉�'
+      const h = parseInt(time / 3600 / 1000)
+      const minute = parseInt((time - h * 3600 * 1000) / 60 / 1000)
+      let second = Math.ceil((time - h * 3600 * 1000 - minute * 60 * 1000) / 1000)
+      if (second < 0) {
+        second = 0;
+      }
+      return (h > 0 ? h + `灏忔椂` : '') + (minute > 0 ? minute + '鍒�' : '') + (second > 0 ? second + '绉�' : '')
     },
     formatTimeStamp(time) {
-      return moment.unix(time).format('yyyy-MM-DD HH:mm:ss')
+      return moment.unix(time/1000).format('yyyy-MM-DD HH:mm:ss')
     }
 
   }

--
Gitblit v1.8.0