From 78bfe58f78d175f6f886b0735b016e0dbbc1ad94 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 22 Apr 2021 16:06:04 +0800
Subject: [PATCH] 录音同步

---
 src/views/realTimePolice/real.vue |    5 -----
 src/page/index/logo.vue           |   26 ++++++++++++++++++++++----
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/page/index/logo.vue b/src/page/index/logo.vue
index 1dc459f..1ad8035 100644
--- a/src/page/index/logo.vue
+++ b/src/page/index/logo.vue
@@ -687,7 +687,6 @@
 
     aKeyToCall() {
       this.isActive = true;
-
       var that = this;
       if (this.recorder == null) {
         this.recorder = new Recorder({
@@ -709,11 +708,10 @@
         }
       );
     },
-
+   
     // 序列号后期待修改
     aKeyStopCall() {
       this.isActive = false;
-
       var newCallAxios = axios.create({
         baseURL: "https://web.byisf.com:18000",
         withCredentials: false,
@@ -721,6 +719,7 @@
           "Content-Type": "application/json;",
         },
       });
+
       var that = this;
 
       newCallAxios
@@ -735,12 +734,31 @@
         )
         .then((result) => {
           var formData = new FormData();
-          var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据
+          // that.recorder.downloadWAV("新文件");
 
+          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 wavBlob = that.recorder.getWAVBlob();
+
+          var wavformData = new FormData();
+          var wavform = new File([wavBlob], new Date().getTime() + ".wav");
+          wavformData.append("file", wavform);
+
+          axios({
+            method: "post",
+            url: "/api/blade-jfpts/xlfeedback/xlfeedback/put-objecty",
+            data: wavformData,
+            params: {
+              jid: that.form.id,
+            },
+          }).then((resdata) => {
+            console.log(resdata);
+          });
+
           newCallAxios
             .post(`/api_control`, blob, {
               params: {
diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index 9a382f6..1c7264d 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -1386,11 +1386,6 @@
         },
       });
 
-      var wavAxios = axios.create({
-        baseURL: "https://web.byisf.com",
-        withCredentials: false,
-      });
-
       var that = this;
 
       newCallAxios

--
Gitblit v1.9.3