zhaobao hai 1 ano
pai
achega
3c87712876

+ 33 - 0
src/api/hkws.js

@@ -0,0 +1,33 @@
+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(res.data.msg || 'Error')
+      }
+    })
+  })
+}

+ 26 - 1
src/views/bigScreen/home/components/capture.vue

@@ -9,6 +9,7 @@
   </div>
 </template>
 <script>
+import { getVideoUrl, getAppToken } from '@/api/hkws'
 export default {
   name: 'Capture',
   props: {
@@ -16,6 +17,10 @@ export default {
       type: String,
       default: ''
     },
+    type: {
+      type: String,
+      default: ''
+    },
     data: {
       type: Object,
       default: () => {
@@ -24,7 +29,9 @@ export default {
           szIP: '', // protocol ip
           szPort: '', // protocol port
           szUsername: '', // device username
-          szPassword: '' // device password
+          szPassword: '', // device password
+          token: '',
+          transWeightCameraSerialnum: ''
         }
       }
     }
@@ -41,6 +48,10 @@ export default {
   },
   methods: {
     iframeLoaded() {
+      if (this.type === '1') {
+        this.loadWebUrl()
+        return
+      }
       const item = this.data
       if (this.isNull(item.transWeightCameraSocketAddr)) {
         console.error('未配置推流地址')
@@ -80,6 +91,20 @@ export default {
       this.state = true
       this.iframeSrc = `${streamServeUrl}?name=${szUsername}&pwd=${szPassword}&ip=${szIP}&port=${szPort}`
     },
+    // 在线地址获取deviceSerial
+    async loadWebUrl() {
+      const res = await getAppToken({
+        appKey: '054d5877d95646c0a461342d4c379e88',
+        appSecret: 'bd8ef0c40f6536161910c8566e340f0a'
+      })
+      getVideoUrl({
+        accessToken: res.accessToken,
+        deviceSerial: this.data.transWeightCameraSerialnum,
+        quality: 2
+      }).then((resq) => {
+        this.iframeSrc = `https://open.ys7.com/ezopen/h5/iframe?url=${resq.url}&autoplay=1&accessToken=${res.accessToken}`
+      })
+    },
     isNull(val) {
       if (val === undefined || val === 'undefined' && val === null && val === '') {
         return true

+ 1 - 1
src/views/bigScreen/home/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="home-view">
     <div class="side-left">
-      <capture v-for="(capture,index) in captures" :key="index" :title="capture.transCameraLocation" :data="capture" />
+      <capture v-for="(capture,index) in captures" :key="index" :title="capture.transCameraLocation" :data="capture" type="1" />
     </div>
     <div class="side-right">
       <carPlate-info ref="camera-info-statistics" />

+ 7 - 2
src/views/goaf/sensor/CameraModel.vue

@@ -23,6 +23,9 @@
           <el-option :value="1" label="卸货" />
         </el-select>
       </el-form-item>
+      <el-form-item label="相机序列号" required>
+        <el-input v-model="formData.transWeightCameraSerialnum" placeholder="请输入相机序列号" style="width:300px" />
+      </el-form-item>
       <el-form-item label="重量评估摄像头IP" required>
         <el-input v-model="formData.transWeightCameraIp" placeholder="请输入摄像头重量评估摄像头IP" style="width:300px" />
       </el-form-item>
@@ -76,7 +79,8 @@ export default {
         'transWeightCameraAccount': '',
         'transWeightCameraPwd': '',
         'transWeightCameraSocketAddr': '',
-        'transCameraLocation': ''
+        'transCameraLocation': '',
+        'transWeightCameraSerialnum': ''
       },
       rules: {}
     }
@@ -115,7 +119,8 @@ export default {
         'transWeightCameraAccount': '',
         'transWeightCameraPwd': '',
         'transWeightCameraSocketAddr': '',
-        'transCameraLocation': ''
+        'transCameraLocation': '',
+        'transWeightCameraSerialnum': ''
       }
     },
     // 提交