const wxChooseImage = function (opt) {
return new Promise((resolve, reject) => {
wx.chooseImage({
count: opt.count || 9,
sizeType: opt.sizeType || ['original', 'compressed'],
sourceType: opt.sourceType || ['album', 'camera'],
success: (res) => {
if (res.errMsg === 'chooseImage:ok') {
const errorStatus = filterError(res.tempFiles);
if (errorStatus){
resolve({ errcode: 'uploadErr', data: '',description:'微信处理图片失败!' });
}else{
resolve({ errcode: '0000', data: res.tempFiles });
}
if (res.tempFiles.length > 0) {
resolve({ errcode: '0000', data: res.tempFiles });
}
} else {
resolve({ errcode: 'err', data: res, description: '选择文件异常,请重试!' });
}
},
fail: (errRes) => {
let errcode = 'err';
let description = '选择文件出错,请重试!';
if (errRes.errMsg.indexOf('cancel') !== -1) {
errcode = 'cancel';
description = '取消选择';
}
resolve({ errcode: errcode, description: description })
}
})
// wx.onMemoryWarning(function () {
// wxShowToast('内存占用过高,及时清理微信缓存');
// })
})
}
//调用
blendHandle: async function (type) {
const res = await wxChooseImage({
sizeType: ['original'],
sourceType: type
});
wxShowLoading('处理中');
if (res.errcode === '0000') { //跳转页面前会出现白屏
if (res.data && res.data.length > 0) {
wx.setStorageSync('selectedImgs', JSON.stringify(res.data));
setTimeout(()=>{
wxHideLoading();
wx.navigateTo({
url: '../recognizeList/recognizeList'
})
},2000)
}
} else {
if (res.errcode == 'uploadErr') {
wx.showModal({
title: '温馨提示',
content: '正在紧急修复,不便之处敬请谅解。',
showCancel: false
})
} else {
wxShowToast(res.description);
}
}
}
你好,麻烦具体描述问题流程,提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html
能看具体效果吗?