注释跳转到权限页面2

This commit is contained in:
2025-07-18 14:35:50 +08:00
parent abc83f85e4
commit 266cc7451f
+19 -16
View File
@@ -88,10 +88,15 @@ const initRecord = () => {
unref(recordObjCom)?.onStop((res, duration)=>{ unref(recordObjCom)?.onStop((res, duration)=>{
audioPath.value = res.tempFilePath audioPath.value = res.tempFilePath
}) })
unref(recordObjCom).onStart(() => {
console.log('开始录音了');
showTalkingModel.value = true
})
} }
const startRecord = () => { const startRecord = () => {
unref(recordObjCom).start({format:'mp3'}) unref(recordObjCom).start({format:'mp3'})
} }
const stopRecord = () => { const stopRecord = () => {
if(unref(recordObjCom).stop){ if(unref(recordObjCom).stop){
unref(recordObjCom)?.stop?.() unref(recordObjCom)?.stop?.()
@@ -120,21 +125,18 @@ onMounted(async ()=>{
}) })
} }
}else{ }else{
let _recordPerm = uni.getAppAuthorizeSetting() // let _recordPerm = permission.judgeIosPermission('record')
let _state = _recordPerm.microphoneAuthorized // if(!_recordPerm){
if(_state === 'denied'){ // common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => {
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => { // if(res) {
if(res) { // // 去开启权限
// 去开启权限 // permission.gotoAppPermissionSetting()
permission.gotoAppPermissionSetting() // }else{
}else{ // // 取消
// 取消 // common.navigateBack()
common.navigateBack() // }
} // })
}) // }
}else if(_state === 'not determined'){
startRecord()
}
} }
// #endif // #endif
}) })
@@ -158,6 +160,7 @@ const recNum = ref(1)
const activeNum = ref(1) const activeNum = ref(1)
const getRecordPermission = async (obj) => { const getRecordPermission = async (obj) => {
//#ifdef APP-PLUS //#ifdef APP-PLUS
// 安卓端 // 安卓端
// let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO') // let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO')
@@ -184,7 +187,7 @@ const showOverlayTalking = (obj) => {
emit('startRecord') emit('startRecord')
recNum.value += 1 recNum.value += 1
if(!isDisabled.value){ if(!isDisabled.value){
showTalkingModel.value = true
touchX.value = obj.changedTouches[0].pageX touchX.value = obj.changedTouches[0].pageX
touchY.value = obj.changedTouches[0].pageY touchY.value = obj.changedTouches[0].pageY
baseY.value = obj.currentTarget.offsetTop baseY.value = obj.currentTarget.offsetTop