zhaobao 1 년 전
부모
커밋
26884646b1
4개의 변경된 파일65개의 추가작업 그리고 5개의 파일을 삭제
  1. 34 0
      src/api/hkws.js
  2. 1 1
      src/views/goafCameraAlarm/index.vue
  3. 19 1
      src/views/home/components/capture.vue
  4. 11 3
      src/views/home/index.vue

+ 34 - 0
src/api/hkws.js

@@ -0,0 +1,34 @@
+import axios from 'axios'
+// 获取应用token
+export function getAppToken(params) {
+  return new Promise((resolve,reject)=>{
+    axios({
+      url: 'https://open.ys7.com/api/lapp/token/get',
+      method: 'POST',
+      params
+    }).then((res)=>{
+      if(res.data.code==="200"){
+        resolve(res.data.data)
+      }else{
+        reject(new Error(res.msg || 'Error'))
+      }
+    })
+  })
+
+}
+// 获取相机播放地址
+export function getVideoUrl(params) {
+  return new Promise((resolve,reject)=>{
+    axios({
+      url: 'https://open.ys7.com/api/lapp/v2/live/address/get',
+      method:"POST",
+      params
+    }).then((res)=>{
+      if(res.data.code==="200"){
+        resolve(res.data.data)
+      }else{
+        reject(new Error(res.msg || 'Error'))
+      }
+    })
+  })
+}

+ 1 - 1
src/views/goafCameraAlarm/index.vue

@@ -77,7 +77,7 @@
           </template>
         </el-table-column>
         <el-table-column property="transTimeInterval" label="时差(分钟)" />
-        <el-table-column property="transLoadWeight" label="载货重量(分钟)" />
+        <el-table-column property="transLoadWeight" label="卸货重量(吨)" />
         <el-table-column property="transUnloadWeight" label="卸货重量(吨)" />
         <el-table-column property="transWeightDifference" label="载物差(吨)" />
         <el-table-column property="transEvaluate" label="结论" width="100" />

+ 19 - 1
src/views/home/components/capture.vue

@@ -9,16 +9,20 @@
     </div>   
 </template>
 <script>
+import {getVideoUrl} from '@/api/hkws'
 export default {
     name:"capture",
     props:{
         title:"",
+        type:"",
         data:{
             streamServeUrl:"",        // 监控视频地址
             szIP: "",    // protocol ip
             szPort: "",            // protocol port
             szUsername: "",     // device username
-            szPassword: "", // device password          
+            szPassword: "", // device password   
+            token:"",//应用token
+            transWeightCameraSerialnum:""//相机序列号
         }
     },
     data(){
@@ -33,6 +37,11 @@ export default {
     },
     methods:{
         iframeLoaded(){
+            debugger
+            if(type==='1'){
+                this.loadWebUrl()
+                return
+            }
             let item=this.data;
             if(this.isNull(item.transWeightCameraSocketAddr)){
                 console.error('未配置推流地址')
@@ -72,6 +81,15 @@ export default {
             this.state=true
             this.iframeSrc=`${streamServeUrl}?name=${szUsername}&pwd=${szPassword}&ip=${szIP}&port=${szPort}`
         },
+        // 在线地址获取deviceSerial
+        loadWebUrl(){
+            getVideoUrl({
+                accessToken:this.token,
+                deviceSerial:this.transWeightCameraSerialnum
+            }).then((resq)=>{
+                this.iframeSrc=`https://open.ys7.com/ezopen/h5/iframe?url=${resq.data.url}&autoplay=1&accessToken=${this.token}`
+            })
+        },
         isNull(val){
             if(val===undefined||val==="undefined"&&val===null&&val===""){
                 return true

+ 11 - 3
src/views/home/index.vue

@@ -1,7 +1,7 @@
 <template>
 <div class="home-view">
     <div class="side-left">
-        <capture v-for="(capture,index) in captures" :title="capture.transCameraLocation" :data="capture" :key="index" />
+        <capture v-for="(capture,index) in captures" :title="capture.transCameraLocation" :data="capture" :key="index" type="1"  />
     </div>
     <div class="side-right">
         <carPlate-info ref="camera-info-statistics" />         
@@ -12,6 +12,7 @@
 import { useStore } from '@/store/modules/user'
 const store=useStore()
 import { getCameraByPage } from '@/api/camera'
+import { getAppToken } from '@/api/hkws'
 import {   
     capture,
     carPlateInfo,
@@ -38,10 +39,17 @@ import {
         init(){
             this.initCapture() 
         },
-        initCapture(){
+        async initCapture(){
+            let res=await getAppToken({
+                appKey:"054d5877d95646c0a461342d4c379e88",
+                appSecret:"bd8ef0c40f6536161910c8566e340f0a"
+            })
             getCameraByPage(this.conditions).then((resp) => {
                 const { data } = resp
-                this.captures = data
+                data.forEach(item=>{
+                    item.token=res.accessToken
+                })
+                this.captures = data            
             })
         },
         saveUserInfo(){