downloadFile:fail 请求超时,如何处理?
downloadFile:fail 请求超时 [图片]
//下载文件
function downloadSaveFile(type, url, successc, failc) {
wx.downloadFile({
url: url,
success: res => {
if (res.statusCode === 200) {
if (type === 'video') {
//类型为视频
wx.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
success: res => {
successc && successc();
},
fail: res => {
failc && failc('保存失败');
}
})
} else if (type === 'image') {
//类型为图片
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: res => {
successc && successc();
},
fail: res => {
failc && failc('保存失败');
}
})
}
} else {
failc && failc('状态码非200');
}
},
fail: res => {
console.log(res)
failc && failc('下载失败');
}
})
}