diff --git a/root/detail/job.vue b/root/detail/job.vue index e8f04be..6b782ef 100644 --- a/root/detail/job.vue +++ b/root/detail/job.vue @@ -97,9 +97,9 @@ - - - + + + @@ -1334,6 +1334,47 @@ export default { }); } }, + // 长按下载视频 + downloadVideo(e) { + var that = this; + console.log("长按下载视频", e); + uni.showLoading({ + title: "下载中...", + mask: true, + }); + uni.downloadFile({ + url: e.image, // 下载url + success: (downloadRes) => { + uni.saveVideoToPhotosAlbum({ + filePath: downloadRes.tempFilePath, + success: () => { + uni.hideLoading(); + uni.showToast({ + title: "视频已保存到相册", + icon: "success" + }); + console.log("视频已保存到相册"); + }, + fail: () => { + uni.hideLoading(); + uni.showToast({ + title: "保存视频到相册失败", + icon: "none" + }); + console.error("保存视频到相册失败"); + }, + }); + }, + fail: () => { + uni.hideLoading(); + uni.showToast({ + title: "下载失败", + icon: "none" + }); + console.error("下载文件失败"); + }, + }); + }, handleUpdateTab(e) { console.log("e", e); this.G.isLogin();