[图片]
调用图片downloadFile下载成功但是临时路径为空?在模拟器上是可以实现的。但是在iphoneX上。statusCode:200 .TempFilePath:wxfile:// 就没有然后了。 [图片] [代码]wx.downloadFile({[代码][代码] [代码][代码]url: [代码][代码]'https://www.parrotfamily.cn/static/image/2019/鉴定卡.jpg'[代码][代码],[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]that.showToast(JSON.stringify(res),300000);[代码][代码] [代码][代码]console.log([代码][代码]'res:'[代码] [代码]+ JSON.stringify(res));[代码][代码] [代码][代码]if[代码] [代码](res.statusCode === 200) {[代码][代码] [代码][代码]//缓存图片[代码][代码] [代码][代码]const fs = wx.getFileSystemManager()[代码][代码] [代码][代码]fs.saveFile({[代码][代码] [代码][代码]tempFilePath: res.tempFilePath, [代码][代码]// 传入一个临时文件路径[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]that.showToast([代码][代码]'保存成功'[代码][代码],JSON.stringify(res), 30000);[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]bgImage: res.savedFilePath,[代码][代码] [代码][代码]downImageState:[代码][代码]true[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.setStorageSync([代码][代码]'image_cache'[代码][代码], res.savedFilePath)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(res){[代码][代码] [代码][代码]that.showToast([代码][代码]'保存失败'[代码][代码], JSON.stringify(res), 30000);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(res){[代码][代码] [代码][代码]this[代码][代码].showToast([代码][代码]'下载图片失败'[代码][代码],2000);[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]downImageState: [代码][代码]false[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码]
2019-08-13