refactor(permission): 移除位置和麦克风权限相关代码

重构权限判断逻辑,移除不再需要的位置和麦克风权限请求代码
更新manifest文件,排除位置权限并调整版本号
This commit is contained in:
2025-12-26 10:41:06 +08:00
parent dee6848bd2
commit 168ab738a3
15 changed files with 8401 additions and 10105 deletions

View File

@@ -5,7 +5,7 @@
"configurations" : [ "configurations" : [
{ {
"app" : { "app" : {
"launchtype" : "local" "launchtype" : "remote"
}, },
"app-plus" : { "app-plus" : {
"launchtype" : "remote" "launchtype" : "remote"

View File

@@ -1,9 +1,9 @@
import $http from '@/config/requestConfig' import $http from '@/config/requestConfig'
import store from '@/store'; import store from '@/store';
import base from '@/config/baseUrl'; import base from '@/config/baseUrl';
import { // import {
getAppWxLatLon // getAppWxLatLon
} from '@/plugins/utils'; // } from '@/plugins/utils';
// #ifdef H5 // #ifdef H5
import { import {
getLatLonH5, getLatLonH5,
@@ -208,32 +208,32 @@ export const setPayAssign = function(orderInfo, callback) {
// #endif // #endif
} }
// 获取地址信息 微信小程序、APP、公众号 // 获取地址信息 微信小程序、APP、公众号
export const getLatLon = function(tip) { // export const getLatLon = function(tip) {
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
const successProcess = function(res) { // const successProcess = function(res) {
store.commit("setCurrentAddress", { // store.commit("setCurrentAddress", {
latitude: res.latitude, // latitude: res.latitude,
longitude: res.longitude // longitude: res.longitude
}); // });
resolve(res); // resolve(res);
}; // };
const errProcess = function(err) { // const errProcess = function(err) {
reject(err); // reject(err);
if (tip) { // if (tip) {
uni.showToast({ // uni.showToast({
title: err, // title: err,
icon: "none" // icon: "none"
}); // });
} // }
}; // };
// #ifdef H5 // // #ifdef H5
getLatLonH5(successProcess, errProcess); // getLatLonH5(successProcess, errProcess);
// #endif // // #endif
// #ifndef H5 // // #ifndef H5
getAppWxLatLon(successProcess, errProcess); // getAppWxLatLon(successProcess, errProcess);
// #endif // // #endif
}); // });
} // }
// 查看是否有某本书的权限 // 查看是否有某本书的权限
export const checkBookRight = function(data,callback) { export const checkBookRight = function(data,callback) {

View File

@@ -59,8 +59,6 @@
"permissions" : [ "permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
@@ -75,7 +73,6 @@
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>", "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>", "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
"<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>", "<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
@@ -86,7 +83,11 @@
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"minSdkVersion" : 21, "minSdkVersion" : 21,
"targetSdkVersion" : 30, "targetSdkVersion" : 30,
"schemes" : "medicine" "schemes" : "medicine",
"excludePermissions" : [
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>"
]
}, },
"sdkConfigs" : { "sdkConfigs" : {
"ad" : {}, "ad" : {},
@@ -440,4 +441,3 @@
} }
} }
// 小程序特有相关 // 小程序特有相关

View File

@@ -239,7 +239,14 @@ function judgePermission(permissionID, callback) {
if (isIos) { if (isIos) {
handle(judgeIosPermissionLocation()); handle(judgeIosPermissionLocation());
} else { } else {
requestAndroidPermission("android.permission.ACCESS_FINE_LOCATION", "位置").then(handle); // requestAndroidPermission("android.permission.ACCESS_FINE_LOCATION", "位置").then(handle);
}
} else
if (permissionID == "record") { // 麦克风
if (isIos) {
handle(judgeIosPermissionRecord());
} else {
// requestAndroidPermission("android.permission.RECORD_AUDIO", "麦克风").then(handle);
} }
} else if (permissionID == "camera") { // 摄像头 } else if (permissionID == "camera") { // 摄像头
if (isIos) { if (isIos) {
@@ -253,12 +260,6 @@ function judgePermission(permissionID, callback) {
} else { } else {
requestAndroidPermission("android.permission.READ_EXTERNAL_STORAGE", "相册读取").then(handle); requestAndroidPermission("android.permission.READ_EXTERNAL_STORAGE", "相册读取").then(handle);
} }
} else if (permissionID == "record") { // 麦克风
if (isIos) {
handle(judgeIosPermissionRecord());
} else {
requestAndroidPermission("android.permission.RECORD_AUDIO", "麦克风").then(handle);
}
} else if (permissionID == "push") { // 推送 } else if (permissionID == "push") { // 推送
if (isIos) { if (isIos) {
handle(judgeIosPermissionPush()); handle(judgeIosPermissionPush());

View File

@@ -503,45 +503,45 @@ function wxAppletsLocation(successCallback, errCallback) {
} }
// 获取地址信息 // 获取地址信息
let locationAuthorize = true; let locationAuthorize = true;
export const getAppWxLatLon = function(successCallback, errCallback) { // export const getAppWxLatLon = function(successCallback, errCallback) {
const _this = this; // const _this = this;
// #ifdef MP // // #ifdef MP
if (locationAuthorize) { // if (locationAuthorize) {
uni.authorize({ // uni.authorize({
scope: 'scope.userLocation', // scope: 'scope.userLocation',
success: () => { // success: () => {
wxAppletsLocation(successCallback, errCallback); // wxAppletsLocation(successCallback, errCallback);
locationAuthorize = false; // locationAuthorize = false;
}, // },
fail: () => { // fail: () => {
locationAuthorize = false; // locationAuthorize = false;
} // }
});
} else {
wxAppletsLocation(successCallback, errCallback);
}
// #endif
// #ifdef APP-PLUS
judgePermission("location", function(result) {
if (result == 1) {
uni.getLocation({
type: 'gcj02',
success: res => {
// store.commit("setCurrentAddress", {
// latitude: res.latitude,
// longitude: res.longitude
// }); // });
successCallback(res); // } else {
}, // wxAppletsLocation(successCallback, errCallback);
fail: (err) => { // }
console.log("位置信息错误", err); // // #endif
errCallback("位置信息获取失败"); // // #ifdef APP-PLUS
} // judgePermission("location", function(result) {
}); // if (result == 1) {
} // uni.getLocation({
}); // type: 'gcj02',
// #endif // success: res => {
} // // store.commit("setCurrentAddress", {
// // latitude: res.latitude,
// // longitude: res.longitude
// // });
// successCallback(res);
// },
// fail: (err) => {
// console.log("位置信息错误", err);
// errCallback("位置信息获取失败");
// }
// });
// }
// });
// // #endif
// }
//金额过滤 //金额过滤
Vue.filter('money', function(val) { Vue.filter('money', function(val) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long