From ae504cf3ec136ef53b4625d1755ce838b2585a52 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期二, 22 六月 2021 16:04:27 +0800
Subject: [PATCH] 修复朔黄事件关联视频的流程

---
 src/pages/shuohuangMonitorAnalyze/components/eventVideos.vue           |   29 ++++++++++++++++-------------
 src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue |    7 ++++++-
 src/api/shuohuang.ts                                                   |   19 +++++++++++++------
 3 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/src/api/shuohuang.ts b/src/api/shuohuang.ts
index 48ff302..accdfee 100644
--- a/src/api/shuohuang.ts
+++ b/src/api/shuohuang.ts
@@ -156,11 +156,6 @@
   method: 'get',
   params: query
 })
-export const getEventVideo = (query: any) => request({
-  url: '/data/api-c/lkg/getEventClip',
-  method: 'get',
-  params: query
-})
 
 export const uploadLKG = (data: any) =>
   request({
@@ -180,4 +175,16 @@
     url: '/data/api-c/lkg/delLKGData',
     method: 'get',
     params: query
-  })
\ No newline at end of file
+  })
+
+export const getEventVideo = (query: any) => request({
+  url: '/data/api-c/event/getEventClip',
+  method: 'get',
+  params: query
+})
+
+export const getVideoUrl = (query: any) => request({
+  url: '/data/api-c/event/getEventVideo',
+  method: 'get',
+  params: query
+})
\ No newline at end of file
diff --git a/src/pages/shuohuangMonitorAnalyze/components/eventVideos.vue b/src/pages/shuohuangMonitorAnalyze/components/eventVideos.vue
index cd08380..8d87cdb 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/eventVideos.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/eventVideos.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="event-video-content">
     <div class="video-player">
-      <video :src="curVideo.ClipPath" controls></video>
+      <video :src="videoUrl" controls autoplay></video>
     </div>
     <div class="more-videos">
       <div class="top">
@@ -20,7 +20,7 @@
           :key="item.ID"
           @click="checkVideo(item)"
         >
-          <img :src="item.Cover" alt />
+          <img :src="`/httpImage/` + item.Cover" alt />
           <div class="time">{{item.EventTime}}</div>
         </div>
       </div>
@@ -29,6 +29,8 @@
 </template>
 
 <script>
+import { getVideoUrl } from "@/api/shuohuang"
+
 export default {
   props: {
     eventVideoArr: {
@@ -36,19 +38,14 @@
       default: () => { return [] }
     }
   },
-  data () {
+  data() {
     return {
       curVideo: {},
+      videoUrl: ""
     }
   },
-  watch: {
-    eventVideoArr (n, o) {
-      if (n.length) {
-        this.curVideo = n[0]
-      }
-    }
-  },
-  mounted () {
+
+  mounted() {
     //this.eventVideoArr.length && (this.curVideo = this.eventVideoArr[0]);
     //this.curVideo = this.eventVideoArr[0];
     this.$nextTick(() => {
@@ -56,8 +53,13 @@
     })
   },
   methods: {
-    checkVideo (data) {
-      this.curVideo = data;
+    checkVideo(item) {
+      this.curVideo = item;
+      getVideoUrl({ id: item.ID }).then(rsp => {
+        if (rsp && rsp.success) {
+          this.videoUrl = "/httpImage/" + rsp.data.videoUrl;
+        }
+      })
     }
   }
 }
@@ -107,6 +109,7 @@
         padding: 10px;
         border: 1px solid #eee;
         border-radius: 3px;
+        cursor: pointer;
         &.act {
           border-color: #0096fa;
         }
diff --git a/src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue b/src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue
index 360f613..7fbb1ab 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue
@@ -428,10 +428,15 @@
   },
   methods: {
     checkEventVideo(label) {
+      if (label.LKGID != "") {
+        this.$message.warning("璇ヤ簨浠舵病鏈夌浉鍏宠仈鐨勮棰�")
+        return
+      }
+
       this.eventDialogVisible = true;
       this.curEventDetail = label;
       let _this = this;
-      getEventVideo({ Event: label.Event, LkgID: label.ParentID }).then(
+      getEventVideo({ event: label.Event, videoId: label.VideoIds }).then(
         (res) => {
           _this.eventVideoArr = res.data;
           _this.curEvName = label.Event;

--
Gitblit v1.8.0