相关代码
wx.downloadFile({
url: ‘https://hall.career.com.cn/xbsr/img/picRes.zip’,
success: function (res) {
console.log(“成功-开始保存到本地”, res);
if (res.statusCode == 200) {
FileSystemManager.saveFile({
tempFilePath: res.tempFilePath,
// filePath: url + “/picRes.zip”,
success: function (res) {
var savedFilePath = res.savedFilePath;
console.log(“保存成功开始解压”, res.savedFilePath);
FileSystemManager.unzip({
zipFilePath: savedFilePath,
targetPath: wx.env.USER_DATA_PATH + ‘/praResource/’,
success: function (res) {
var targetPath = wx.env.USER_DATA_PATH + ‘/praResource/’;
console.log(’—unzip-成功—’);
that.setData({
zipPath: targetPath,
hiddenload: true
})
},
fail: function (res) {
console.log(res);
}
})
},
fail: function (res) {
console.log(res);
}
})
} else {
console.log(“失败” + res)
}
},
fail: function (res) {
console.log(res)
}
})