南昌市物联网技防平台-前端
shuishen
2021-03-19 b69ca83a6f4eacc6afa0ac5b23514e6a520b79ea
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>