From eb12c4bc2af08b457f4282174626b067ba01f215 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期五, 19 七月 2024 17:02:42 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/WI/Web.V1.0 --- src/components/chat/components/playBar/PlayBar.vue | 44 ++++---------------------------------------- 1 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/components/chat/components/playBar/PlayBar.vue b/src/components/chat/components/playBar/PlayBar.vue index 1175fa8..d410896 100644 --- a/src/components/chat/components/playBar/PlayBar.vue +++ b/src/components/chat/components/playBar/PlayBar.vue @@ -35,22 +35,20 @@ </div> </div> </div> + <VoicePage v-model:isShow="voicePageIsShow" v-show="voicePageIsShow" /> </div> </template> <script setup lang="ts"> -import { ElMessage } from 'element-plus'; import { ref } from 'vue'; - +import VoicePage from './voicePage/VoicePage.vue'; const emits = defineEmits(['sendClick']); const props = defineProps(['isTalking']); - +const voicePageIsShow = ref(false); const inputValue = defineModel({ type: String, }); - -const isListening = ref(false); const enterInput = (e) => { if (props.isTalking) return; @@ -63,41 +61,7 @@ } }; const audioChangeWord = () => { - inputValue.value = ''; - // 鍒涘缓SpeechRecognition瀵硅薄 - // eslint-disable-next-line no-undef - var recognition = new webkitSpeechRecognition(); - if (!recognition) { - // eslint-disable-next-line no-undef - recognition = new SpeechRecognition(); - } - console.log('recognition2', recognition); - console.log(11); - // 璁剧疆璇█ - recognition.lang = 'zh-CN'; - console.log(22); - // 寮�濮嬭闊宠瘑鍒� - recognition.start(); - isListening.value = true; - console.log(33); - // 鐩戝惉璇嗗埆缁撴灉 - recognition.onresult = function (event) { - var result = event.results[0][0].transcript; - console.log('鐩戝惉缁撴灉:', result); - inputValue.value = result; - }; - - // 鐩戝惉閿欒浜嬩欢 - recognition.onerror = function (event) { - isListening.value = false; - ElMessage.error('鐩戝惉璇煶澶辫触'); - console.error(event.error); - }; - // 鐩戝惉缁撴潫浜嬩欢锛堝寘鎷瘑鍒垚鍔熴�佽瘑鍒敊璇拰鐢ㄦ埛鍋滄锛� - recognition.onend = function () { - isListening.value = false; - console.log('璇煶璇嗗埆鍋滄'); - }; + voicePageIsShow.value = true; }; </script> <style scoped lang="scss"> -- Gitblit v1.9.3