From 5cebaec98af8b4d36b5bf7d24e6d8592dd5cf724 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 12 Feb 2026 00:22:41 +0800
Subject: [PATCH] feat: 语音
---
uniapps/work-app/src/subPackages/voiceCallDetail/index.vue | 59 +++++++++++++++++++++++++++++++----------------------------
1 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue b/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
index ffe9134..6798ebd 100644
--- a/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
+++ b/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
@@ -23,38 +23,41 @@
*/
async function requestAndroidMicPermission() {
try {
- // 获取麦克风权限
-// #ifdef APP-PLUS
-plus.android.requestPermissions(
- ['android.permission.RECORD_AUDIO'],
- (result) => {
- if (result.granted.length > 0) {
- console.log('麦克风权限已获取')
- }
- if (result.deniedAlways.length > 0) {
- uni.showModal({
- title: '提示',
- content: '需要麦克风权限才能正常使用语音功能,请前往系统设置开启',
- success(res) {
- if (res.confirm) {
- plus.runtime.openURL('app-settings:')
- }
- },
- })
- }
- },
- (error) => {
- console.error('请求麦克风权限失败:', error)
- }
-)
-// #endif
-
-
+ // 获取麦克风权限
+ return await new Promise((resolve) => {
+ plus.android.requestPermissions(
+ ['android.permission.RECORD_AUDIO'],
+ (result) => {
+ if (result.granted.length > 0) {
+ console.log('麦克风权限已获取')
+ resolve(true)
+ return
+ }
+ if (result.deniedAlways.length > 0) {
+ uni.showModal({
+ title: '提示',
+ content: '需要麦克风权限才能正常使用语音功能,请前往系统设置开启',
+ success(res) {
+ if (res.confirm) {
+ plus.runtime.openURL('app-settings:')
+ }
+ },
+ })
+ }
+ resolve(false)
+ },
+ (error) => {
+ console.error('请求麦克风权限失败', error)
+ resolve(false)
+ }
+ )
+ })
} catch (error) {
- console.error('❌ 请求麦克风权限失败:', error)
+ console.error('❌ 请求麦克风权限失败', error)
return false
}
}
+
// #endif
onLoad(async (options) => {
--
Gitblit v1.9.3