uni.downloadFile({
url: reportObj.value.reportUrl,
success: function (res) {
if (res.statusCode === 200) {
let filePath = res.tempFilePath
console.log('下载成功', filePath, reportObj.value.title)
// #ifdef MP-WEIXIN
// 调用微信收藏文件接口
wx.addFileToFavorites({
filePath: filePath,
fileName: reportObj.value.title + '.pdf',
})
.then(() => {
uni.hideLoading()
setTimeout(() => {
uni.showToast({
title: '已收藏到微信',
})
}, 1000)
})
.catch((err) => {
uni.showToast({
title: '收藏失败',
})
})
// #endif
}
},
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。