From b69ca83a6f4eacc6afa0ac5b23514e6a520b79ea Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 19 Mar 2021 19:19:23 +0800
Subject: [PATCH] 部分逻辑修改

---
 src/views/realTimePolice/real.vue |  140 +++++++++++++++++-----------------
 vue.config.js                     |    4 
 src/page/index/logo.vue           |   40 ++++++---
 3 files changed, 97 insertions(+), 87 deletions(-)

diff --git a/src/page/index/logo.vue b/src/page/index/logo.vue
index 00b979c..4b421eb 100644
--- a/src/page/index/logo.vue
+++ b/src/page/index/logo.vue
@@ -365,21 +365,31 @@
           url: "/api/blade-jfpts/alarm/alarm/selecttx?id=" + that.deviceId,
           method: "post",
         }).then(function (response) {
-          var userId = JSON.parse(window.localStorage.getItem('物联网安保云服务平台-userInfo')).content.user_id;
-          if (response.data.data.length > 0 && response.data.data[0].waringType == "一键求助" && response.data.data[0].alarmId != userId) {
+          var userId = JSON.parse(
+            window.localStorage.getItem("物联网安保云服务平台-userInfo")
+          ).content.user_id;
+
+          if (response.data.data.length > 0) {
             that.deviceId = response.data.data[0].id;
-            that.form = response.data.data[0];
-            that.peopleList = [
-              { label: that.form.oneContacts, value: that.form.onePhone },
-              { label: that.form.twoContacts, value: that.form.twoPhone },
-              { label: that.form.threeContacts, value: that.form.threePhone },
-            ];
-            that.peopleName = that.form.oneContacts;
-            that.peoplePhone = that.form.onePhone;
-            that.dialogTableVisible = true;
-            that.videoConversationReal = true;
-            that.$refs.realAudio.src = "./realVideo/audio.mp3";
-            that.$refs.realAudio.play();
+            console.log(userId, response.data.data[0].alarmId);
+            if (
+              response.data.data[0].waringType == "紧急求救" &&
+              response.data.data[0].alarmId == userId
+            ) {
+              response.data.data[0].waringType == "一键求助";
+              that.form = response.data.data[0];
+              that.peopleList = [
+                { label: that.form.oneContacts, value: that.form.onePhone },
+                { label: that.form.twoContacts, value: that.form.twoPhone },
+                { label: that.form.threeContacts, value: that.form.threePhone },
+              ];
+              that.peopleName = that.form.oneContacts;
+              that.peoplePhone = that.form.onePhone;
+              that.dialogTableVisible = true;
+              that.videoConversationReal = true;
+              that.$refs.realAudio.src = "./realVideo/audio.mp3";
+              that.$refs.realAudio.play();
+            }
           }
         });
       }, 5000);
@@ -387,6 +397,8 @@
     closeDialog() {
       //关闭窗口回调,关闭警报
       this.$refs.realAudio.pause();
+     this.videoConversationReal = false;
+      this.oldVideoSatart = false;
     },
     updateJtyep(row, jtype, t) {
       var that = this;
diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index 5c65108..29b9620 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -2,7 +2,7 @@
  * @Author: Morpheus
  * @Date: 2021-03-17 15:21:33
  * @Last Modified by: Morpheus
- * @Last Modified time: 2021-03-19 16:56:35
+ * @Last Modified time: 2021-03-19 18:47:03
  */
 <template>
   <basic-container>
@@ -65,11 +65,7 @@
           >{{
             row.jtype == "0"
               ? "未处理"
-              : row.jtype == "1"
-              ? "办结"
-              : row.jtype == "2"
-              ? "推送110"
-              : "派发保安"
+              : "已处理"
           }}
         </el-tag>
       </template>
@@ -97,7 +93,7 @@
           >视频
         </el-button>
         <el-button
-          v-if="row.jtype == 0 || row.jtype == '' "
+          v-if="row.jtype == 0 || row.jtype == ''"
           icon="el-icon-edit"
           :size="size"
           :type="type"
@@ -110,7 +106,7 @@
           :size="size"
           :type="type"
           @click.stop="PoliceTracking(row)"
-        >追踪
+          >追踪
         </el-button>
         <el-button
           icon="el-icon-location-outline"
@@ -367,12 +363,12 @@
                 src="/img/police-num.png"
                 style="margin-top: -20px; height: 80px; vertical-align: middle"
                 alt=""
-                @click.stop="updateJtyep(form, 2, '推送110')"
+                @click.stop="updateJtyep(form, 1, '推送110')"
               />
 
               <el-button
                 type="primary"
-                @click.stop="updateJtyep(form, 3, '派送保安')"
+                @click.stop="updateJtyep(form, 1, '派送保安')"
                 >派送保安
               </el-button>
             </el-form-item>
@@ -444,7 +440,7 @@
           {
             label: "警情类型",
             prop: "waringType",
-            search: true,
+            search: false,
             searchSpan: 3,
             width: 130,
             className: "waringTypeClass",
@@ -527,17 +523,9 @@
                 value: "0",
               },
               {
-                label: "办结",
+                label: "已处理",
                 value: "1",
-              },
-              {
-                label: "推送110",
-                value: "2",
-              },
-              {
-                label: "派发保安",
-                value: "3",
-              },
+              }
             ],
           },
           {
@@ -806,8 +794,6 @@
         ...params,
       };
 
-      console.log(this.$router.query, 111);
-
       if (
         this.$router.query &&
         this.$router.query != null &&
@@ -835,6 +821,10 @@
       this.loading = true;
       getList(page.currentPage, page.pageSize, values).then((res) => {
         const data = res.data.data;
+        console.log(data.records);
+        data.records.forEach(item => {
+          item.waringType == "紧急求救" ? item.waringType = "一键求助" : '';
+        })
         this.page.total = data.total;
 
         data.records.sort((a, b) => {
@@ -842,6 +832,7 @@
         });
 
         this.data = data.records;
+        
         this.loading = false;
         this.selectionClear();
       });
@@ -1128,7 +1119,7 @@
         .then((res) => {
           newAxios
             .get(
-              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=001231663A45&chl=${this.form.channelNumber}`
+              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=001241945990&chl=${this.form.channelNumber}`
             )
             .then((result) => {
               this.videoSource = result.data.data.m3u8;
@@ -1211,54 +1202,61 @@
         },
       });
       var that = this;
+
       Recorder.getPermission().then(() => {
+        // 一键呼叫相关函数
         setInterval(() => {
-          // 一键呼叫相关函数
-          that.recorder.start().then(() => {
-            // 开始录音
-            newCallAxios
-              .post(
-                `/api_control`,
-                {},
-                {
-                  params: {
-                    param: { PktType: "GetAccessToken" },
-                  },
-                }
-              )
-              .then((result) => {
-                setTimeout(() => {
-                  var formData = new FormData();
-                  var blob = that.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);
-
-                  // var dom = document.getElementById("real_audio");
-                  // dom.setAttribute("src", URL.createObjectURL(blob));
-
-                  // this.recorder.play();
-
-                  newCallAxios
-                    .post(`/api_control`, blob, {
+          that.recorder.start().then(
+            () => {
+              // 开始录音
+              setTimeout(() => {
+                newCallAxios
+                  .post(
+                    `/api_control`,
+                    {},
+                    {
                       params: {
-                        param: {
-                          PktType: "Talk",
-                          accessToken: result.data.data.accessToken,
-                          // deviceCode: form.channelNumber,
-                          deviceCode: "001231663A45",
-                        },
+                        param: { PktType: "GetAccessToken" },
                       },
-                    })
-                    .then((result) => {});
-                }, 10000);
-              });
-          });
-        }, 5000);
+                    }
+                  )
+                  .then((result) => {
+                    var formData = new FormData();
+                    var blob = that.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);
+
+                    // var dom = document.getElementById("real_audio");
+                    // dom.setAttribute("src", URL.createObjectURL(blob));
+
+                    // this.recorder.play();
+
+                    newCallAxios
+                      .post(`/api_control`, blob, {
+                        params: {
+                          param: {
+                            PktType: "Talk",
+                            accessToken: result.data.data.accessToken,
+                            // deviceCode: form.channelNumber,
+                            deviceCode: "001241945990",
+                          },
+                        },
+                      })
+                      .then((result) => {});
+                  });
+              }, 5000);
+            },
+            (error) => {
+              // 出错了
+              console.log(`${error.name} : ${error.message}`);
+            }
+          );
+        }, 6000);
       });
     },
 
@@ -1308,7 +1306,7 @@
                         PktType: "Talk",
                         accessToken: result.data.data.accessToken,
                         // deviceCode: form.channelNumber,
-                        deviceCode: "001231663A45",
+                        deviceCode: "001241945990",
                       },
                     },
                   })
@@ -1329,8 +1327,8 @@
     },
     PoliceTracking(row) {
       //警情追踪
-      this.$router.push({path: "/policeTracking/track", query: row});
-    }
+      this.$router.push({ path: "/policeTracking/track", query: row });
+    },
   },
 };
 </script>
diff --git a/vue.config.js b/vue.config.js
index 4cd9174..0aa983d 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -34,8 +34,8 @@
         proxy: {
             '/api': {
                 //本地服务接口地址
-                //target: 'http://192.168.3.39:82/',
-                target: 'https://web.byisf.com:18001/api/',
+                target: 'http://192.168.1.125:82/',
+                // target: 'https://web.byisf.com:18001/api/',
                 //远程演示服务地址,可用于直接启动项目
                 //target: 'https://saber.bladex.vip/api',
                 ws: true,

--
Gitblit v1.9.3