فهرست منبع

更新 cam 相关页面和路由

reghao 2 سال پیش
والد
کامیت
8e55ea8ad9
3فایلهای تغییر یافته به همراه26 افزوده شده و 4 حذف شده
  1. 1 1
      src/router/index.js
  2. 18 2
      src/views/home/LivePage.vue
  3. 7 1
      src/views/post/CamList.vue

+ 1 - 1
src/router/index.js

@@ -331,7 +331,7 @@ const routes = [
     meta: { needAuth: true }
   },
   {
-    path: '/live',
+    path: '/live/:camId',
     name: 'LivePage',
     component: LivePage,
     meta: { needAuth: true }

+ 18 - 2
src/views/home/LivePage.vue

@@ -7,7 +7,8 @@
             <h3 v-html="video.title" />
           </div>
           <div class="text item">
-            <live-player :video-prop="video" />
+<!--            <live-player :video-prop="video" />-->
+            <div id="dplayer" ref="dplayer" style="height: 480px;" />
           </div>
         </el-card>
       </el-row>
@@ -83,7 +84,7 @@
 import flvjs from 'flv.js'
 import DPlayer from 'dplayer'
 import LivePlayer from 'components/LivePlayer'
-import { getCamList, getCamRecordDay, getCamRecordList } from '@/api/cam'
+import { getCamDetail, getCamList, getCamRecordDay, getCamRecordList } from '@/api/cam'
 
 export default {
   name: 'LivePage',
@@ -130,6 +131,7 @@ export default {
       showRecordList: false,
       camList: [],
       cam: null,
+      camDetail: null,
       form: {},
       recordList: []
     }
@@ -158,6 +160,20 @@ export default {
     }
   },
   created() {
+    const camId = this.$route.params.camId
+    if (camId === undefined || camId === null) {
+      return
+    }
+
+    getCamDetail(camId).then(resp => {
+      if (resp.code === 0) {
+        const camDetail = resp.data
+        console.log(camDetail)
+        const url = camDetail.url
+        this.initFlvPlayer(camId, null, url)
+      }
+    })
+
     getCamList().then(resp => {
       if (resp.code === 0) {
         this.camList = resp.data

+ 7 - 1
src/views/post/CamList.vue

@@ -26,7 +26,13 @@
           prop="camName"
           label="摄像头名字"
           width="150"
-        />
+        >
+          <template slot-scope="scope">
+            <router-link style="text-decoration-line: none" target="_blank" :to="`/live/${scope.row.camId}`">
+              {{ scope.row.camName }}
+            </router-link>
+          </template>
+        </el-table-column>
         <el-table-column
           prop="state"
           label="状态"