|
@@ -79,16 +79,30 @@ Component({
|
|
fileSelected = this.data.fileSelected;
|
|
fileSelected = this.data.fileSelected;
|
|
const downloadTask = wx.downloadFile({
|
|
const downloadTask = wx.downloadFile({
|
|
url: fileSelected.url,
|
|
url: fileSelected.url,
|
|
- filePath: wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '.mp4',
|
|
|
|
- timeout: 600000,
|
|
|
|
|
|
+ // filePath: wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '.mp4',
|
|
|
|
+ timeout: 6000000,
|
|
success(res) {
|
|
success(res) {
|
|
console.log("下载", res)
|
|
console.log("下载", res)
|
|
- that.saveVideo(res.filePath)
|
|
|
|
|
|
+ // that.saveVideo(res.filePath)
|
|
|
|
+ // 下载完成后转发
|
|
|
|
+ wx.shareVideoMessage({
|
|
|
|
+ videoPath: res.tempFilePath,
|
|
|
|
+ fail(err) {
|
|
|
|
+ console.log("转发", err)
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: `转发失败:${err.errMsg}`,
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- fail({
|
|
|
|
- errMsg
|
|
|
|
- }) {
|
|
|
|
- if (errMsg == 'downloadFile:fail exceed max file size') wx.showToast({
|
|
|
|
|
|
+ fail(err) {
|
|
|
|
+ console.log("下载失败", err)
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: `下载失败:${err.errMsg}`,
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ if (err.errMsg == 'downloadFile:fail exceed max file size') wx.showToast({
|
|
title: '视频体积超大,无法保存!请尝试打开视频长按保存下载',
|
|
title: '视频体积超大,无法保存!请尝试打开视频长按保存下载',
|
|
icon: "none"
|
|
icon: "none"
|
|
})
|
|
})
|
|
@@ -96,12 +110,41 @@ Component({
|
|
})
|
|
})
|
|
downloadTask.onProgressUpdate((res) => {
|
|
downloadTask.onProgressUpdate((res) => {
|
|
wx.showLoading({
|
|
wx.showLoading({
|
|
- title: `保存进度` + res.progress + `%`,
|
|
|
|
|
|
+ title: res.progress + `%`,
|
|
mask: true
|
|
mask: true
|
|
})
|
|
})
|
|
if (res.progress == 100) wx.hideLoading()
|
|
if (res.progress == 100) wx.hideLoading()
|
|
})
|
|
})
|
|
that.closeShow();
|
|
that.closeShow();
|
|
|
|
+
|
|
|
|
+ /* const downloadTask = wx.downloadFile({
|
|
|
|
+ url: fileSelected.url,
|
|
|
|
+ filePath: wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '.mp4',
|
|
|
|
+ timeout: 6000000,
|
|
|
|
+ success(res) {
|
|
|
|
+ console.log("下载", res)
|
|
|
|
+ that.saveVideo(res.filePath)
|
|
|
|
+ },
|
|
|
|
+ fail(err) {
|
|
|
|
+ console.log("下载失败", err)
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: `下载失败:${err}`,
|
|
|
|
+ })
|
|
|
|
+ if (err.errMsg == 'downloadFile:fail exceed max file size') wx.showToast({
|
|
|
|
+ title: '视频体积超大,无法保存!请尝试打开视频长按保存下载',
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ downloadTask.onProgressUpdate((res) => {
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: `保存进度` + res.progress + `%`,
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ if (res.progress == 100) wx.hideLoading()
|
|
|
|
+ })
|
|
|
|
+ that.closeShow(); */
|
|
},
|
|
},
|
|
/* 文件下载 */
|
|
/* 文件下载 */
|
|
dowmLoad() {
|
|
dowmLoad() {
|
|
@@ -157,6 +200,11 @@ Component({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: err,
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -176,6 +224,7 @@ Component({
|
|
"method": (this.data.tabActiveTitle == '列表') ? "selectList" : "selectMyList",
|
|
"method": (this.data.tabActiveTitle == '列表') ? "selectList" : "selectMyList",
|
|
content
|
|
content
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
|
+ console.log("文件列表", res)
|
|
this.selectComponent('#ListBox').RefreshToComplete();
|
|
this.selectComponent('#ListBox').RefreshToComplete();
|
|
if (res.msg != '成功') return wx.showToast({
|
|
if (res.msg != '成功') return wx.showToast({
|
|
title: res.msg,
|
|
title: res.msg,
|