From 0ed00cdecb6d9943e2d9739c720b8a979650ebb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B2=A9?= Date: Sat, 28 Feb 2026 20:01:30 +0800 Subject: [PATCH] =?UTF-8?q?JLBA202505130001=5F=E5=85=B3=E4=BA=8E=E5=90=89?= =?UTF-8?q?=E6=9E=97=E9=93=B6=E8=A1=8C=E6=96=B0=E5=BB=BAAI=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E5=9F=B9=E8=AE=AD=E7=B3=BB=E7=BB=9F=E7=9A=84=E9=9C=80?= =?UTF-8?q?=E6=B1=82=5F2=E6=9C=88=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/touch-btn/touch-btn.vue | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/components/touch-btn/touch-btn.vue b/src/components/touch-btn/touch-btn.vue index 4cc1c125..f082de22 100644 --- a/src/components/touch-btn/touch-btn.vue +++ b/src/components/touch-btn/touch-btn.vue @@ -8,9 +8,12 @@ @touchmove="handleMove" @touchend="loosenButton" v-if="!keyboardIsShow" + :throttleTime="0" + :hoverStartTime="0" + :hoverStayTime="100" :customStyle="{ height: '92rpx' }" > - 按住说话 + {{buttonText}} - + 松开发送 + - + @@ -101,8 +105,8 @@ import { startAudioRecord, stopAudioRecord,preRequestRecordPermission } from '@/uni_modules/ty-recording'; import { ProtocolCodec, MessageType, ControlCommand, ControlCode } from '@/pages/sparring/js/ProtocolCodec'; import permissionApi from '@/common/permission'; - - + const buttonText = computed(() => show.value?'松手发送':'按住说话'); + const show = ref(false) const emit = defineEmits(['submit']); const ws = ref(null); const status = ref('voice'); @@ -166,6 +170,11 @@ let startTime = 0; // 开启语音 const startRecord = async (obj: { touches: any[]; }) => { + + // popupRef.value.open(); + console.log('打开'); + show.value = true + return try { const state = await permissionApi.judgeIosPermission('record'); if(state === 'not determined') { // 苹果专用 @@ -182,7 +191,6 @@ popupRef.value.open(); startAudioRecord({ onFrame: (pcmData: any) => { - console.log('pcmData', pcmData); // console.log('pcmData', pcmData.length); // ws.value.send({ // data: ProtocolCodec.pack(MessageType.AUDIO_DATA, pcmData) @@ -237,12 +245,13 @@ }; // 关掉遮罩层 const closePopup = () => { + show.value = false + return nextTick(() => { allText.value = ''; tempText.value = ''; popupRef.value.close(); }); - ws.value && ws.value.close({ code: 1000, @@ -260,6 +269,9 @@ }; // 松开按钮 const loosenButton = () => { + // popupRef.value.close(); + show.value = false + return // 判断一下位置,03的时候是转文字不能关闭 if (isOutStatus.value === '03') { // 03转文字 @@ -286,13 +298,12 @@ stopAudioRecord(); }; - + onMounted(async () => {}); onHide(() => { // closePopup(); console.log('onHide'); }); - const activeNum = ref(1); const clearinputText = (text = '') => {