Commit 73a109af authored by zhoucong's avatar zhoucong

123

parent 580b16f0
...@@ -91,8 +91,7 @@ ...@@ -91,8 +91,7 @@
let fileName = new Date().valueOf(); //获取时间戳 let fileName = new Date().valueOf(); //获取时间戳
uni.downloadFile({ //下载文件资源到本地 uni.downloadFile({ //下载文件资源到本地
url, url,
filePath: wx.env.USER_DATA_PATH + '/' + fileName + filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
'.mp4', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
success: res => { //下载到本地成功 success: res => { //下载到本地成功
let filePath = res.filePath; let filePath = res.filePath;
uni.saveVideoToPhotosAlbum({ //保存视频到系统相册。 uni.saveVideoToPhotosAlbum({ //保存视频到系统相册。
...@@ -101,8 +100,7 @@ ...@@ -101,8 +100,7 @@
//删除本地缓存 //删除本地缓存
let fileMgr = uni.getFileSystemManager(); let fileMgr = uni.getFileSystemManager();
fileMgr.unlink({ fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + '/' + fileName + filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
'.mp4',
}) })
uni.showToast({ uni.showToast({
title: "下载成功", title: "下载成功",
...@@ -111,6 +109,13 @@ ...@@ -111,6 +109,13 @@
}) })
}, },
fail: err => { fail: err => {
uni.showModal({
title: '提示',
content: err,
showCancel:false,
});
uni.hideLoading(); uni.hideLoading();
//拒绝授权时显示 //拒绝授权时显示
if (err.errMsg === 'saveVideoToPhotosAlbum:fail auth deny') { if (err.errMsg === 'saveVideoToPhotosAlbum:fail auth deny') {
...@@ -147,6 +152,12 @@ ...@@ -147,6 +152,12 @@
}) })
}, },
fail: err => { //下载失败 fail: err => { //下载失败
uni.showModal({
title: '提示',
content: "123"+ err,
showCancel:false,
});
uni.hideLoading(); uni.hideLoading();
if (err.errMsg == 'downloadFile:fail createDownloadTask:fail url not in domain list') { if (err.errMsg == 'downloadFile:fail createDownloadTask:fail url not in domain list') {
uni.showToast({ 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