From a7a86324ae4e519b8ee0a3fa3038f3afa2e14dec Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 04 Feb 2021 13:49:35 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/jfpt-Vue

---
 src/views/realTimePolice/real.vue |  151 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 97 insertions(+), 54 deletions(-)

diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index 136d15b..186e280 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -89,7 +89,7 @@
           icon="el-icon-location-outline"
           :size="size"
           :type="type"
-          @click.stop="handleAdd11()"
+          @click.stop="handleMap(row)"
           >定位</el-button
         >
       </template>
@@ -99,6 +99,7 @@
       title="警情处置"
       :visible.sync="dialogTableVisible"
       append-to-body="true"
+      @close="innerVisibleVideo = false"
     >
       <el-dialog
         class="old-video-dialog"
@@ -108,7 +109,7 @@
         :visible.sync="innerVisibleVideo"
         :close-on-press-escape="false"
         append-to-body
-        @opened="openOldVideoBox()"
+        @opened="openOldVideoBox"
         @close="closeOldVideoBox"
       >
         <video
@@ -274,16 +275,17 @@
     </el-dialog>
 
     <el-drawer
-      title="我是标题"
+      title="电子地图"
       append-to-body="true"
-      :visible.sync="qwe"
-      :direction="direction"
+      :visible.sync="showMap"
     >
       <iframe
-        src="http://www.baidu.com"
+        id="mapDiv"
+        ref="mapDiv"
+        src="http://s16s652780.51mypc.cn/jfpt/map/index.html"
         frameborder="0"
         width="100%"
-        height="600px"
+        height="100%"
       ></iframe>
     </el-drawer>
   </basic-container>
@@ -302,12 +304,11 @@
 export default {
   data() {
     return {
-      qwe: false,
+      showMap: false,
       hls: "",
       videoSource: "",
       dialogTableVisible: false,
       innerVisibleVideo: false,
-      direction: "rtl",
       form: {},
       query: {},
       dateTime: [],
@@ -323,6 +324,7 @@
         indexLabel: "序号",
         calcHeight: 30,
         labelWidth: "100",
+        size:"mini",
         menuWidth: 240,
         dialogWidth: 950,
         tip: false,
@@ -481,7 +483,8 @@
         ]
       },
       data: [],
-      isActive: false
+      isActive: false,
+      recorder: null
     };
   },
   computed: {
@@ -504,6 +507,13 @@
   },
   created() {
     this.dateTime = this.getDate();
+
+    this.recorder = new Recorder({
+      sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
+      sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
+      numChannels: 1 // 声道,支持 1 或 2, 默认是1
+      // compiling: false,(0.x版本中生效,1.x增加中)  // 是否边录边转换,默认是false
+    });
   },
   methods: {
     rowSave(row, done, loading) {
@@ -613,7 +623,6 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      debugger
       const { releaseTimeRange } = this.query;
       let values = {
         ...params
@@ -636,6 +645,11 @@
       getList(page.currentPage, page.pageSize, values).then(res => {
         const data = res.data.data;
         this.page.total = data.total;
+
+        data.records.sort((a,b)=>{
+          return a.jtype - b.jtype;
+        });
+
         this.data = data.records;
         this.loading = false;
         this.selectionClear();
@@ -749,7 +763,7 @@
         };
       } else {
         return {
-          color: "#ff7627"
+          color: "#ff2727"
         };
       }
     },
@@ -761,8 +775,13 @@
     handleHistory(row) {
       this.$router.push({ path: `/real/history/${row.deviceNumber}` });
     },
-    handleAdd11() {
-      this.qwe = true;
+    handleMap(row) {
+      this.showMap = true;
+      this.$nextTick(() => {
+        this.$refs.mapDiv.onload = () => {
+          window.frames[0].locationObj = {x:row.jd,y:row.wd};
+        };
+      })
     },
     handleManage(row) {
       this.form = row;
@@ -778,7 +797,7 @@
       } else {
         axios({
           url:
-            "http://192.168.0.102:1888/api/blade-jfpts/jingdan/jingdan/submit",
+            "/api/blade-jfpts/jingdan/jingdan/submit",
           method: "post",
           data: {
             rName: row.rname,
@@ -820,7 +839,7 @@
       var that = this;
       axios({
         url:
-          "http://192.168.0.102:1888/api/blade-jfpts/alarm/alarm/deletejj?id=" +
+          "/api/blade-jfpts/alarm/alarm/deletejj?id=" +
           row.id,
         method: "post"
       }).then(function() {
@@ -832,7 +851,7 @@
       var that = this;
       axios({
         url:
-          "http://192.168.0.102:1888/api/blade-jfpts/alarm/alarm/updateJtype?id=" +
+          "/api/blade-jfpts/alarm/alarm/updateJtype?id=" +
           row.id +
           "&czTime=" +
           row.czTime +
@@ -904,9 +923,8 @@
       };
     },
     queryOldVideo(data) {
-      console.log(data);
       var newAxios = axios.create({
-        baseURL: "http://s16s652780.51mypc.cn",
+        baseURL: "https://s16s652780.51mypc.cn",
         withCredentials: false,
         headers: {
           "Content-type": "application/x-www-form-urlencoded"
@@ -926,8 +944,6 @@
           }
         )
         .then(res => {
-          console.log(res.data.data.accessToken);
-
           newAxios
             .get(
               `/GetPlayUrl?deviceCode=${data.channelNumber}&chl=${data.serialNumber}`
@@ -972,11 +988,7 @@
 
         this.hls = new Hls();
 
-        console.log(this.videoSource, "19028321321r073");
-
         var m3u8Url = decodeURIComponent(this.videoSource);
-
-        console.log(m3u8Url);
 
         this.hls.loadSource(m3u8Url);
 
@@ -993,45 +1005,76 @@
       if (dom.getAttribute("src") != "") {
         dom.pause();
 
-        dom.setAttribute("");
+        dom.setAttribute("src", "");
+
+        this.hls.destroy();
       }
     },
     aKeyToCall(e, form) {
+      var newCallAxios = axios.create({
+        baseURL: "https://s16s652780.51mypc.cn",
+        withCredentials: false,
+        headers: {
+          "Content-Type": "application/json;"
+        }
+      });
+
       // 一键呼叫相关函数
       if (this.isActive == true) {
         this.isActive = false;
+
+        newCallAxios
+          .post(
+            `/api_control`,
+            {},
+            {
+              params: {
+                param: { PktType: "GetAccessToken" }
+              }
+            }
+          )
+          .then(result => {
+            var formData = new FormData();
+            var blob = this.recorder.getPCMBlob(); //获取pcm格式音频数据
+            //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData
+            var newbolb = new Blob([blob], { type: "audio/pcm" });
+            var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm");
+            formData.append("file", fileOfBlob);
+
+            document
+              .getElementById("real_audio")
+              .setAttribute("src", URL.createObjectURL(blob));
+
+            console.log(
+              blob,
+              newbolb,
+              fileOfBlob,
+              window.URL.createObjectURL(blob),
+              99999
+            );
+
+            this.recorder.play();
+
+            newCallAxios
+              .post(`/api_control`, blob, {
+                params: {
+                  param: {
+                    PktType: "Talk",
+                    accessToken: result.data.data.accessToken,
+                    deviceCode: form.channelNumber
+                  }
+                }
+              })
+              .then(result => {});
+          });
       } else {
         this.isActive = true;
 
-        let recorder = new Recorder({
-          sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
-          sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
-          numChannels: 1 // 声道,支持 1 或 2, 默认是1
-          // compiling: false,(0.x版本中生效,1.x增加中)  // 是否边录边转换,默认是false
+        Recorder.getPermission().then(() => {
+          this.recorder.start().then(() => {
+            // 开始录音
+          });
         });
-
-        var newAxios = axios.create({
-          baseURL: "http://s16s652780.51mypc.cn",
-          withCredentials: false,
-          headers: {
-            "Content-type": "application/x-www-form-urlencoded"
-          }
-        });
-
-
-        //    newAxios
-        //       .post(
-        //         `/talk?deviceCode=${form.channelNumber}`,
-        //         '12345',
-        //       )
-        //       .then(result => {
-
-        //           console.log(result)
-
-        //       });
-
-
-
       }
     }
   }

--
Gitblit v1.9.3