|
@@ -73,13 +73,19 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import { AddFzxz } from "../../api/ghss/ghxz.js";
|
|
import { AddFzxz } from "../../api/ghss/ghxz.js";
|
|
-
|
|
|
|
|
|
+import record from "./record.js";
|
|
let recognition = null;
|
|
let recognition = null;
|
|
export default {
|
|
export default {
|
|
props: {},
|
|
props: {},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- questionList: [],
|
|
|
|
|
|
+ questionList: [
|
|
|
|
+ {
|
|
|
|
+ type: "selectLand",
|
|
|
|
+ content: "sss",
|
|
|
|
+ data: { rwbsm: "5f3d25e556374e78966feca5a64fa887" },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
defaultMsg:
|
|
defaultMsg:
|
|
"我要在抱坡区进行选址,用地面积30到50亩,选择居住用地,距离幼儿园200米,距离医院300米,距离火葬场大于5000米",
|
|
"我要在抱坡区进行选址,用地面积30到50亩,选择居住用地,距离幼儿园200米,距离医院300米,距离火葬场大于5000米",
|
|
sendContent: "",
|
|
sendContent: "",
|
|
@@ -109,7 +115,7 @@ export default {
|
|
};
|
|
};
|
|
recognition.onresult = (event) => {
|
|
recognition.onresult = (event) => {
|
|
this.sendContent = event.results[0][0].transcript;
|
|
this.sendContent = event.results[0][0].transcript;
|
|
- this.send(); // 将识别结果发送到后台
|
|
|
|
|
|
+ // this.send(); // 将识别结果发送到后台
|
|
};
|
|
};
|
|
recognition.onerror = (event) => {
|
|
recognition.onerror = (event) => {
|
|
this.$message.warning("语音识别出错: " + event.error);
|
|
this.$message.warning("语音识别出错: " + event.error);
|
|
@@ -121,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() {
|
|
sendDefault() {
|
|
this.sendContent = this.defaultMsg;
|
|
this.sendContent = this.defaultMsg;
|
|
// this.send();
|
|
// this.send();
|
|
@@ -140,8 +165,9 @@ export default {
|
|
voice() {
|
|
voice() {
|
|
console.log("---this.spdisabled-", this.spdisabled);
|
|
console.log("---this.spdisabled-", this.spdisabled);
|
|
if (!this.spdisabled) {
|
|
if (!this.spdisabled) {
|
|
- if (!recognition) this.initSpeech();
|
|
|
|
- recognition.start(); // 开始语音识别
|
|
|
|
|
|
+ // if (!recognition) this.initSpeech();
|
|
|
|
+ // recognition.start(); // 开始语音识别
|
|
|
|
+ this.init();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
sendToBackend(msg, mindex) {
|
|
sendToBackend(msg, mindex) {
|