我的->个人信息->头像->授权->选照片(iqoo neo7se实测有权限无法调用相册)
![2***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/6b5a4c31077d42199f3e267cdfddc129.png)
- 发布:2023-07-13 14:45
- 更新:2023-07-13 14:45
- 阅读:224
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 22H2
HBuilderX类型: 正式
HBuilderX版本号: 3.8.7
手机系统: Android
手机系统版本号: Android 13
手机厂商: OPPO
手机机型: iqoo neo7se
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
App下载地址或H5⽹址: https://play.google.com/store/apps/details?id=joyhub.net.joyhub&pli=1
操作步骤:
预期结果:
/* 选择图片 */
async chooseImage(e, type) {
if (type) {
this.sourceType = type
}
if (e) {
this.count = e
}
var _this = this;
const systemInfo = uni.getSystemInfoSync()
if (type == 'camera') {
console.log(11111)
if (systemInfo.platform === 'android') {
let androidScanBool = await this.requestAndroidPermission(
'android.permission.CAMERA')
console.log(androidScanBool)
if (androidScanBool == 1) {
console.log(1)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
console.log(0)
this.openPermissonSettingModal()
}
} else if (systemInfo.platform === 'ios') {
let isFirstTime = uni.getStorageSync('isFirstTime')
if (isFirstTime === '' || isFirstTime === undefined || isFirstTime === null) {
uni.setStorageSync('isFirstTime', true)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
}
if (isFirstTime === true) {
let iosScanBool = permision.judgeIosPermission('camera')
if (iosScanBool) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal()
}
}
}
} else {
if (systemInfo.platform === 'android') {
let androidScanBool = await this.requestAndroidPermission(
'android.permission.READ_EXTERNAL_STORAGE')
if (androidScanBool == 1) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal2()
}
} else if (systemInfo.platform === 'ios') {
let isFirstTime = uni.getStorageSync('isSTORAGEFirstTime')
if (!isFirstTime) {
uni.setStorageSync('isFirstTime', true)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
const iosScanBool = permision.judgeIosPermission('photoLibrary')
if (iosScanBool) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal2()
}
}
}
}
},
/* 选择图片 */
async chooseImage(e, type) {
if (type) {
this.sourceType = type
}
if (e) {
this.count = e
}
var _this = this;
const systemInfo = uni.getSystemInfoSync()
if (type == 'camera') {
console.log(11111)
if (systemInfo.platform === 'android') {
let androidScanBool = await this.requestAndroidPermission(
'android.permission.CAMERA')
console.log(androidScanBool)
if (androidScanBool == 1) {
console.log(1)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
console.log(0)
this.openPermissonSettingModal()
}
} else if (systemInfo.platform === 'ios') {
let isFirstTime = uni.getStorageSync('isFirstTime')
if (isFirstTime === '' || isFirstTime === undefined || isFirstTime === null) {
uni.setStorageSync('isFirstTime', true)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
}
if (isFirstTime === true) {
let iosScanBool = permision.judgeIosPermission('camera')
if (iosScanBool) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal()
}
}
}
} else {
if (systemInfo.platform === 'android') {
let androidScanBool = await this.requestAndroidPermission(
'android.permission.READ_EXTERNAL_STORAGE')
if (androidScanBool == 1) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal2()
}
} else if (systemInfo.platform === 'ios') {
let isFirstTime = uni.getStorageSync('isSTORAGEFirstTime')
if (!isFirstTime) {
uni.setStorageSync('isFirstTime', true)
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
const iosScanBool = permision.judgeIosPermission('photoLibrary')
if (iosScanBool) {
uni.chooseImage({
count: _this.count,
sourceType: [_this.sourceType],
success: function(res) {
_this.setData({
imageSrc: res.tempFilePaths[0],
});
_this.loadImage();
_this.isShow = true;
},
});
} else {
this.openPermissonSettingModal2()
}
}
}
}
},
实际结果:
调用相册权限,读取相册里的图片
调用相册权限,读取相册里的图片
bug描述:
iqoo neo7se,安卓13,app的相册权限已经启用,但是无法调动相册,其它手机都没出现这个问题
0 个回复