From deead01da6b1a9bf1c588cfb4ce9ae5a4f446585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Mon, 24 Nov 2025 17:31:02 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/components/touchBtn.vue | 21 ++++++++++---- src/pages/sparring/components/touchBtn.vue | 32 +++++++++++++++++----- src/pages/sparring/result.vue | 11 ++++---- src/pages/sparring/tip.vue | 5 ---- 4 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 900d17ee..048e1a84 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -61,6 +61,11 @@ import { useStorageStore } from '@/store/storage.js'; + import { + onHide, + onShow + } from '@dcloudio/uni-app'; + const storageStore = useStorageStore(); const proxy = getCurrentInstance(); @@ -304,15 +309,13 @@ if (IsAndEnv) { let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO'); if (_recordPerm !== 1) { + isGettingPermission.value = true common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?', true, '取消', '确定').then((res) => { if (res) { - isGettingPermission.value = true - hideOverlayTalking() // 去开启权限 permission.gotoAppPermissionSetting(); } else { // 取消 - hideOverlayTalking() common.navigateBack(); } }); @@ -324,15 +327,13 @@ let _recordPerm = uni.getAppAuthorizeSetting(); let _state = _recordPerm.microphoneAuthorized; if (_state === 'denied') { + isGettingPermission.value = true common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?', true, '取消', '确定').then((res) => { if (res) { - isGettingPermission.value = true - hideOverlayTalking() // 去开启权限 uni.openAppAuthorizeSetting(); } else { // 取消 - hideOverlayTalking() common.navigateBack(); } }); @@ -351,6 +352,11 @@ const isTalking = ref(false); const showOverlayTalking = (obj) => { if (showTalkingModel.value) return; + if (isGettingPermission.value) { + stopRecord() + isGettingPermission.value = false + return + } if (isLoadingState.value) { uni.showToast({ title: props.loadingText, @@ -449,6 +455,9 @@ keyboardIsShow.value = !keyboardIsShow.value; answerValue.value = ''; }; + onHide(()=>{ + isGettingPermission.value = true + })