|
|
@@ -470,7 +470,7 @@ module.exports = {
|
|
|
//APP获取手机权限鉴权
|
|
|
// APP获取手机权限鉴权(优化版,兼容全权限+多系统)
|
|
|
|
|
|
- async checkPermission(permission, tip, that) {
|
|
|
+ async checkPermission(permission, tip, that,perpop='permission') {
|
|
|
// 权限映射配置
|
|
|
let permisionID = '';
|
|
|
let permisionIosID = '';
|
|
|
@@ -496,7 +496,20 @@ module.exports = {
|
|
|
|
|
|
// 特殊处理:相机权限在非iOS平台显示自定义弹窗
|
|
|
if (uni.getSystemInfoSync().platform != 'ios') {
|
|
|
- that.$refs.permission.open();
|
|
|
+ switch(perpop){
|
|
|
+ case 'permission':
|
|
|
+ that.$refs.permission.open();
|
|
|
+ break
|
|
|
+ case 'microphonePermission':
|
|
|
+ that.$refs.microphonePermission.open();
|
|
|
+ break
|
|
|
+ case 'locationPermission':
|
|
|
+ that.$refs.locationPermission.open();
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ console.warn('未知权限类型:', perpop);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// Android 平台处理
|
|
|
@@ -509,23 +522,29 @@ module.exports = {
|
|
|
try {
|
|
|
const result = await permision.requestAndroidPermission(permisionID);
|
|
|
console.log(result);
|
|
|
-
|
|
|
+ switch(perpop){
|
|
|
+ case 'permission':
|
|
|
+ that.$refs.permission.close();
|
|
|
+ break
|
|
|
+ case 'microphonePermission':
|
|
|
+ that.$refs.microphonePermission.close();
|
|
|
+ break
|
|
|
+ case 'locationPermission':
|
|
|
+ that.$refs.locationPermission.close();
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ console.warn('未知权限类型:', perpop);
|
|
|
+ }
|
|
|
if (result == 1) {
|
|
|
console.log("已获得授权");
|
|
|
- that.$refs.permission?.close();
|
|
|
resolve(true);
|
|
|
} else if (result == 0) {
|
|
|
console.log("未获得授权");
|
|
|
- that.$refs.permission?.close();
|
|
|
resolve(false);
|
|
|
} else {
|
|
|
- console.log("被永久拒绝");
|
|
|
- if (uni.getSystemInfoSync().platform != 'ios') {
|
|
|
- that.$refs.permission?.close();
|
|
|
- }
|
|
|
-
|
|
|
+ console.log("权限被拒绝");
|
|
|
// 显示确认对话框
|
|
|
- this.appConfirm("权限被永久拒绝," + tip, function(res) {
|
|
|
+ this.appConfirm("权限被拒绝," + tip, function(res) {
|
|
|
if (res) {
|
|
|
uni.openAppAuthorizeSetting();
|
|
|
}
|
|
|
@@ -557,9 +576,9 @@ module.exports = {
|
|
|
console.log(`未获得 ${currentPermission} 授权`);
|
|
|
|
|
|
// 特殊处理相机和相册权限
|
|
|
- if (currentPermission == 'camera' || currentPermission == 'photoLibrary') {
|
|
|
+ /* if (currentPermission == 'camera' || currentPermission == 'photoLibrary') {
|
|
|
that.$refs.camera?.open();
|
|
|
- }
|
|
|
+ } */
|
|
|
} else {
|
|
|
console.log(`已获得 ${currentPermission} 授权`);
|
|
|
}
|