+1 两天过去了,还没有解决,业务要瘫痪了。
JSSDK调用uploadimage出现失败的情况?(华为部分机型出现)JSSDK调用uploadimage出现失败的情况,是最近才出现的问题,华为p20,微信版本8.0.3,不知道失败的原因,再其他机子里面测试又没问题。。 希望管理员能给一下出现uploadimage:fail的情况,完全不知道怎么定位问题。
2021-04-28问题+1 手机型号 Redmi k30 5g
调用wx.uploadImage 返回 "errMsg":"uploadImage:fail"chooseImage = () => { this.localIds = []; this.tempVisits = []; this.imageNum = 0; this.serverIds = []; window.wx.chooseImage({ count: this.option.limit, success: (res) => { this.localIds = res.localIds; // ["wxLocalRe*://5645646454"] this.timeoutKey = setTimeout(this.startUpload, 200); }, fail: () => { this.reject('无选择图片权限'); }, }); } startUpload = async () => { this.option.startUpload(); try { await Promise.all(this.localIds.map((localId, index) => this.uploadImg(localId, index))) this.uploadSuccess(); } catch (error) { this.reject(error); } } uploadSuccess = () => { this.resolve && this.resolve({ serverIds: this.serverIds, localIds: this.tempVisits, }); }; uploadImg = (localId, index) => { return new Promise((resolve) => { const _img = document.createElement('img'); const load = (type) => { window.wx.uploadImage({ localId, isShowProgressTips: 0, success: (res) => { const uploadHandel = async () => { try { // 上报第三方下载链接 let uploadResult = await this.reportThirdUploadResult(res.serverId); this.serverIds.push(uploadResult.filename); this.tempVisits.push(uploadResult.tempVisit); } catch (err) { console.log('上报三方下载链接err:::', err); } resolve() }; if (type == 'onerror') { window.wx.getLocalImgData({ localId, // 图片的localID success: (LocalRes) => { this.localIds[index] = LocalRes.localData; _img.src = this.localIds[index]; _img.onerror = uploadHandel; _img.onload = uploadHandel; }, }); } else { uploadHandel(); } }, fail: (err) => { this.reject && this.reject(err); }, }); }; _img.onload = () => load('onload'); _img.onerror = () => load('onerror'); _img.src = localId; }) }
2021-04-27