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 + })