//保存文件到本地
saveFileDownloadCs(url) {
url = "http://192.168.252.30:8080/profile/upload/video/2022/06/07/f5c350d1-99e9-4262-a1bc-5c28f55b7732.mp4"
uni.showToast({
title: "进入文件保存",
icon: 'none',
duration: 3000
})
console.log("测试中" + url)
let that = this
uni.downloadFile({
url: url,
success: res => {
if (res.statusCode === 200) { // saveImageToPhotosAlbum saveVideoToPhotosAlbum
uni.saveFile({
tempFilePath: res.tempFilePath, //临时路径
success: function(saveFileRes) {
uni.showToast({
title: "正在保存文件" + saveFileRes.savedFilePath,
icon: 'none',
duration: 2000
})
},
fail(res2) {
uni.showToast({
title: "报错失败" + res2,
icon: 'none',
duration: 2000
})
},
complete(res3) {
uni.showToast({
title: "保存完成" + res3,
icon: 'none',
duration: 2000
})
}
})
}
else {
uni.showToast({
title: "下载失败",
icon: 'none',
duration: 2000
})
}
},
complete: () => {
}
})
},