diff --git a/src/components/publicSearch.vue b/src/components/publicSearch.vue
deleted file mode 100644
index c1f1647..0000000
--- a/src/components/publicSearch.vue
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/utils/common.js b/src/utils/common.js
index 40849b8..0c0890e 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -42,8 +42,6 @@ export const requestAndroidPermissionAsync = (systemInfo, permissions) => {
}
-
-
// 安卓同步调用
export const requestAndroidPermission = (systemInfo) => {
let granted = false;
@@ -123,18 +121,66 @@ const goPermission = () => {
})
}
-// 跳转授权按钮
+// 跳转授权
const jumpAuthPermission = () => {
+
var main = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass('android.content.Intent');
var Uri = plus.android.importClass('android.net.Uri');
+ var Build = plus.android.importClass('android.os.Build');
+ var Settings = plus.android.importClass('android.provider.Settings');
+ var PackageManager = plus.android.importClass('android.content.pm.PackageManager');
var pkg = main.getPackageName();
- var intent = new Intent('android.settings.APPLICATION_DETAILS_SETTINGS');
- intent.setData(Uri.parse('package:' + pkg));
- main.startActivity(intent);
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/loading/loading',
- });
- }, 1000)
+
+ var intent = new Intent();
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ try {
+ // 尝试直接跳转到存储权限设置(Android 13+ 支持)
+ if (Build.VERSION.SDK_INT >= 33) {
+ // Android 13+ 尝试直接打开存储权限页面
+ intent.setAction(Settings.ACTION_MANAGE_APP_PERMISSIONS);
+ intent.putExtra(Settings.EXTRA_APP_PACKAGE, pkg);
+ // 指定权限类型为存储(需要Android 13+支持)
+ intent.putExtra(Settings.EXTRA_PERMISSION_NAME, "android.permission.READ_EXTERNAL_STORAGE");
+ }
+ // Android 11-12 尝试直接跳转到权限列表
+ else if (Build.VERSION.SDK_INT >= 30) {
+ intent.setAction(Settings.ACTION_MANAGE_APP_PERMISSIONS);
+ intent.putExtra(Settings.EXTRA_APP_PACKAGE, pkg);
+ }
+ // Android 6.0-10 跳转到应用详情页(用户需手动点击权限)
+ else if (Build.VERSION.SDK_INT >= 23) {
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ var uri = Uri.fromParts("package", pkg, null);
+ intent.setData(uri);
+ }
+ // 低版本系统
+ else {
+ intent.setAction(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
+ }
+
+ main.startActivity(intent);
+
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/pages/loading/loading',
+ });
+ }, 1000)
+
+ } catch (e) {
+ // 异常情况下降级处理
+ console.error("跳转存储权限页面失败,使用备用方案", e);
+ var fallbackIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ fallbackIntent.setData(Uri.parse('package:' + pkg));
+ fallbackIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ main.startActivity(fallbackIntent);
+
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/pages/loading/loading',
+ });
+ }, 1000)
+ }
+
}