mali-applet-ui 1.1.10 → 1.1.12
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.
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<view class="ml-upload-file-name">{{ item[nameField] }}</view>
|
|
53
53
|
<view class="ml-upload-file-desc">
|
|
54
54
|
<ml-button v-if="preview && previewTypes.includes(item[typeField])" status="primary" type="text" size="small" @click="previewDocs(item)">预览</ml-button>
|
|
55
|
-
<ml-button status="primary" type="text" size="small" @
|
|
55
|
+
<ml-button status="primary" type="text" size="small" @click="downloadEvent(item)">下载</ml-button>
|
|
56
56
|
</view>
|
|
57
57
|
</view>
|
|
58
58
|
<view v-if="!isFromReadonly" class="ml-upload-file-right">
|
|
@@ -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: '当前环境不支持下载',
|
|
@@ -457,19 +465,12 @@ export default {
|
|
|
457
465
|
// #endif
|
|
458
466
|
|
|
459
467
|
// #ifndef MP-DINGTALK
|
|
460
|
-
const downloadFileMethod = this.downloadFile ? this.downloadFile : (globalStore.upload ? globalStore.upload.downloadFile : null)
|
|
461
|
-
if (downloadFileMethod) {
|
|
462
|
-
return downloadFileMethod.call(this.currVM, {
|
|
463
|
-
item,
|
|
464
|
-
params: this.params
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
468
|
uni.downloadFile({
|
|
468
469
|
url: this.getUrl(item),
|
|
469
470
|
success: (downRes) => {
|
|
470
471
|
uni.saveFile({
|
|
471
472
|
tempFilePath: downRes.tempFilePath,
|
|
472
|
-
success
|
|
473
|
+
success (res) {
|
|
473
474
|
uni.showToast({
|
|
474
475
|
icon: 'none',
|
|
475
476
|
mask: true,
|
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
|
}
|