This commit is contained in:
Your Name
2026-04-10 14:43:58 +08:00
parent fdf714f833
commit 4909ec6daa
38 changed files with 6549 additions and 735 deletions
@@ -625,11 +625,47 @@ const getLocalDiagnosisText = () => {
return String(val) + '、';
};
// ---- 音视频权限辅助(仅微信小程序) ----
// #ifdef MP-WEIXIN
const requestAVPermissionsInModal = () => new Promise((resolve) => {
const guide = (deniedScope) => {
uni.showModal({
title: '需要摄像头和麦克风权限',
content: '视频问诊需要摄像头和麦克风权限,请点击「去设置」开启后重试',
confirmText: '去设置',
cancelText: '取消',
success: (res) => {
if (res.confirm) wx.openSetting();
resolve(false);
}
});
};
wx.authorize({
scope: 'scope.camera',
success: () => {
wx.authorize({
scope: 'scope.record',
success: () => resolve(true),
fail: () => guide('record')
});
},
fail: () => guide('camera')
});
});
// #endif
// #ifndef MP-WEIXIN
const requestAVPermissionsInModal = () => Promise.resolve(true);
// #endif
// 关闭就诊人信息弹窗
const closePatientModal = async () => {
if (confirmBtnLoading.value) return;
confirmBtnLoading.value = true;
try {
// 在用户主动点击的时机申请摄像头 + 麦克风权限
// (首次会弹原生授权弹窗;已拒绝则引导去设置页)
const granted = await requestAVPermissionsInModal();
if (!granted) return; // 未授权,停止跳转
const app = getApp();
// const userID = app.globalData.userID;
// const userSig = app.globalData.userSig;