mali-applet-ui 1.0.21 → 1.0.23
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.
|
@@ -14,9 +14,7 @@ export function uploadImageFiles (opts) {
|
|
|
14
14
|
return new Promise((resolve, reject) => {
|
|
15
15
|
uni.chooseImage({
|
|
16
16
|
count: opts.count || 9,
|
|
17
|
-
sizeType: opts.sizeType || ['original', 'compressed'],
|
|
18
17
|
sourceType: opts.sourceType || ['album', 'camera'],
|
|
19
|
-
extension: opts.extension,
|
|
20
18
|
success (res) {
|
|
21
19
|
resolve(normalizeChooseAndUploadFileRes(res, 'image'))
|
|
22
20
|
},
|
|
@@ -40,7 +38,6 @@ export function uploadAllFiles (opts) {
|
|
|
40
38
|
chooseFile({
|
|
41
39
|
type: 'all',
|
|
42
40
|
count: opts.count || 9,
|
|
43
|
-
extension: opts.extension,
|
|
44
41
|
success (res) {
|
|
45
42
|
resolve(normalizeChooseAndUploadFileRes(res))
|
|
46
43
|
},
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<!-- 上传图片 -->
|
|
4
4
|
<view v-if="mediatype === 'image'" class="ml-upload-image-list">
|
|
5
5
|
<view class="ml-upload-image-item" v-for="(item, index) in fileList" :key="index">
|
|
6
|
-
<image class="ml-upload-image-img" mode="aspectFit" :src="getThumbnailFileUrl(item)" @
|
|
7
|
-
<view v-if="!isFromReadonly" class="ml-upload-image-del-btn" @
|
|
6
|
+
<image class="ml-upload-image-img" mode="aspectFit" :src="getThumbnailFileUrl(item)" @tap="previewImageEvent(item, index)"></image>
|
|
7
|
+
<view v-if="!isFromReadonly" class="ml-upload-image-del-btn" @tap="removeEvent(item)">
|
|
8
8
|
<ml-icon name="close" />
|
|
9
9
|
</view>
|
|
10
10
|
</view>
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
<view class="ml-upload-file-name">{{ item[nameField] }}</view>
|
|
41
41
|
<view class="ml-upload-file-desc">
|
|
42
42
|
<ml-button v-if="preview && previewTypes.includes(item[typeField])" status="primary" type="text" size="small" @click="previewDocs(item)">预览</ml-button>
|
|
43
|
-
<ml-button status="primary" type="text" size="small" @
|
|
43
|
+
<ml-button status="primary" type="text" size="small" @tap="downloadEvent(item)">下载</ml-button>
|
|
44
44
|
</view>
|
|
45
45
|
</view>
|
|
46
46
|
<view v-if="!isFromReadonly" class="ml-upload-file-right">
|
|
47
|
-
<view class="ml-upload-file-del-btn" @
|
|
47
|
+
<view class="ml-upload-file-del-btn" @tap="removeEvent(item)">
|
|
48
48
|
<ml-icon name="close" />
|
|
49
49
|
</view>
|
|
50
50
|
</view>
|
|
@@ -56,7 +56,56 @@
|
|
|
56
56
|
<script>
|
|
57
57
|
import globalStore from '../../../config/store'
|
|
58
58
|
import { getFileSuffix, getFileName } from '../../../utils'
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
function normalizeChooseAndUploadFileRes (res, fileType) {
|
|
61
|
+
res.tempFiles.forEach((item) => {
|
|
62
|
+
if (!item.name) {
|
|
63
|
+
item.name = item.path.substring(item.path.lastIndexOf('/') + 1)
|
|
64
|
+
}
|
|
65
|
+
if (fileType) {
|
|
66
|
+
item.fileType = fileType
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
return res
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function uploadImageFiles (opts) {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
uni.chooseImage({
|
|
75
|
+
count: opts.count || 9,
|
|
76
|
+
sourceType: opts.sourceType || ['album', 'camera'],
|
|
77
|
+
success (res) {
|
|
78
|
+
resolve(normalizeChooseAndUploadFileRes(res, 'image'))
|
|
79
|
+
},
|
|
80
|
+
fail (res) {
|
|
81
|
+
reject(res)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function uploadAllFiles (opts) {
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
let chooseFile = uni.chooseFile
|
|
90
|
+
if (typeof wx !== 'undefined' && typeof wx.chooseMessageFile === 'function') {
|
|
91
|
+
chooseFile = wx.chooseMessageFile
|
|
92
|
+
}
|
|
93
|
+
if (typeof chooseFile !== 'function') {
|
|
94
|
+
const err = {}
|
|
95
|
+
return reject(err)
|
|
96
|
+
}
|
|
97
|
+
chooseFile({
|
|
98
|
+
type: 'all',
|
|
99
|
+
count: opts.count || 9,
|
|
100
|
+
success (res) {
|
|
101
|
+
resolve(normalizeChooseAndUploadFileRes(res))
|
|
102
|
+
},
|
|
103
|
+
fail (res) {
|
|
104
|
+
reject(res)
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
}
|
|
60
109
|
|
|
61
110
|
export default {
|
|
62
111
|
name: 'MlUpload',
|