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 = '') => {