mali-applet-ui 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -449,6 +449,14 @@ export default {
|
|
|
449
449
|
}
|
|
450
450
|
},
|
|
451
451
|
downloadEvent (item) {
|
|
452
|
+
const downloadFileMethod = this.downloadFile ? this.downloadFile : (globalStore.upload ? globalStore.upload.downloadFile : null)
|
|
453
|
+
if (downloadFileMethod) {
|
|
454
|
+
return downloadFileMethod.call(this.currVM, {
|
|
455
|
+
item,
|
|
456
|
+
params: this.params
|
|
457
|
+
})
|
|
458
|
+
}
|
|
459
|
+
|
|
452
460
|
// #ifdef MP-DINGTALK
|
|
453
461
|
uni.showModal({
|
|
454
462
|
content: '当前环境不支持下载',
|
|
@@ -462,12 +470,12 @@ export default {
|
|
|
462
470
|
success: (downRes) => {
|
|
463
471
|
uni.saveFile({
|
|
464
472
|
tempFilePath: downRes.tempFilePath,
|
|
465
|
-
success
|
|
473
|
+
success (res) {
|
|
466
474
|
uni.showToast({
|
|
467
475
|
icon: 'none',
|
|
468
476
|
mask: true,
|
|
469
477
|
title: '文件已保存:' + res.savedFilePath, // 保存路径
|
|
470
|
-
duration:
|
|
478
|
+
duration: 4000
|
|
471
479
|
})
|
|
472
480
|
},
|
|
473
481
|
fail (e) {
|
package/package.json
CHANGED
package/utils/file.js
CHANGED
|
@@ -20,16 +20,18 @@ export function getFileName (url) {
|
|
|
20
20
|
* @param {*} name
|
|
21
21
|
*/
|
|
22
22
|
export function saveFileByUrl (url, name) {
|
|
23
|
-
return new
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
24
|
uni.downloadFile({
|
|
25
25
|
url,
|
|
26
26
|
success: (downRes) => {
|
|
27
27
|
uni.saveFile({
|
|
28
28
|
tempFilePath: downRes.tempFilePath,
|
|
29
29
|
success (res) {
|
|
30
|
-
uni.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
uni.showToast({
|
|
31
|
+
icon: 'none',
|
|
32
|
+
mask: true,
|
|
33
|
+
title: '文件已保存:' + res.savedFilePath,
|
|
34
|
+
duration: 4000
|
|
33
35
|
})
|
|
34
36
|
resolve()
|
|
35
37
|
}
|