maxiaoxiao 10 ay önce
ebeveyn
işleme
957edcb6d5
1 değiştirilmiş dosya ile 23 ekleme ve 3 silme
  1. 23 3
      src/views/aiModel/index.vue

+ 23 - 3
src/views/aiModel/index.vue

@@ -73,7 +73,7 @@
 </template>
 <script>
 import { AddFzxz } from "../../api/ghss/ghxz.js";
-
+import record from "./record.js";
 let recognition = null;
 export default {
   props: {},
@@ -127,6 +127,25 @@ export default {
         };
       }
     },
+    /**初始化 */
+    init() {
+      record.getPermission(function (permiss) {
+        if (permiss.status == "fail") {
+          createMessage.warning(permiss.data);
+        } else {
+          record.startRecorder();
+          // state.confLoading = true;
+        }
+      });
+    },
+    /**结束录音 */
+    stopRec() {
+      // state.loading = true;
+      // state.confLoading = true;
+      record.stopRecorder(function (res) {
+        /**处理 */
+      });
+    },
     sendDefault() {
       this.sendContent = this.defaultMsg;
       // this.send();
@@ -146,8 +165,9 @@ export default {
     voice() {
       console.log("---this.spdisabled-", this.spdisabled);
       if (!this.spdisabled) {
-        if (!recognition) this.initSpeech();
-        recognition.start(); // 开始语音识别
+        // if (!recognition) this.initSpeech();
+        // recognition.start(); // 开始语音识别
+        this.init();
       }
     },
     sendToBackend(msg, mindex) {