Commit 73a109af authored by zhoucong's avatar zhoucong

123

parent 580b16f0
......@@ -91,8 +91,7 @@
let fileName = new Date().valueOf(); //获取时间戳
uni.downloadFile({ //下载文件资源到本地
url,
filePath: wx.env.USER_DATA_PATH + '/' + fileName +
'.mp4', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
success: res => { //下载到本地成功
let filePath = res.filePath;
uni.saveVideoToPhotosAlbum({ //保存视频到系统相册。
......@@ -101,8 +100,7 @@
//删除本地缓存
let fileMgr = uni.getFileSystemManager();
fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + '/' + fileName +
'.mp4',
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
})
uni.showToast({
title: "下载成功",
......@@ -111,6 +109,13 @@
})
},
fail: err => {
uni.showModal({
title: '提示',
content: err,
showCancel:false,
});
uni.hideLoading();
//拒绝授权时显示
if (err.errMsg === 'saveVideoToPhotosAlbum:fail auth deny') {
......@@ -147,6 +152,12 @@
})
},
fail: err => { //下载失败
uni.showModal({
title: '提示',
content: "123"+ err,
showCancel:false,
});
uni.hideLoading();
if (err.errMsg == 'downloadFile:fail createDownloadTask:fail url not in domain list') {
uni.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment