mali-applet-ui 0.2.89 → 0.2.91
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.
- package/components/ml-upload/ml-upload.vue +4 -11
- package/package.json +1 -1
- package/utils/file.js +9 -0
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
<script>
|
|
57
57
|
import XEUtils from 'xe-utils'
|
|
58
58
|
import globalStore from '../../config/store'
|
|
59
|
+
import { getFileSuffix } from '../../utils/file'
|
|
59
60
|
import { uploadAllFiles, uploadImageFiles } from './file-handle'
|
|
60
61
|
|
|
61
62
|
export default {
|
|
@@ -183,13 +184,13 @@ export default {
|
|
|
183
184
|
const obj = {
|
|
184
185
|
id: null,
|
|
185
186
|
[this.nameField]: name,
|
|
186
|
-
[this.typeField]:
|
|
187
|
+
[this.typeField]: getFileSuffix(name),
|
|
187
188
|
[this.urlField]: url
|
|
188
189
|
}
|
|
189
190
|
return {
|
|
190
191
|
id: null,
|
|
191
192
|
[this.nameField]: name,
|
|
192
|
-
[this.typeField]:
|
|
193
|
+
[this.typeField]: getFileSuffix(name),
|
|
193
194
|
[this.urlField]: url,
|
|
194
195
|
tempPath: this.getUrl(obj)
|
|
195
196
|
}
|
|
@@ -246,14 +247,6 @@ export default {
|
|
|
246
247
|
const urlRest = XEUtils.parseUrl(url)
|
|
247
248
|
return urlRest.pathname.split('/').slice(-1)[0] || ''
|
|
248
249
|
},
|
|
249
|
-
getSuffix (filename) {
|
|
250
|
-
const pos = filename.lastIndexOf('.')
|
|
251
|
-
let suffix = ''
|
|
252
|
-
if (pos !== -1) {
|
|
253
|
-
suffix = filename.substring(pos + 1)
|
|
254
|
-
}
|
|
255
|
-
return suffix
|
|
256
|
-
},
|
|
257
250
|
previewImageEvent (item, index) {
|
|
258
251
|
if (this.previewStatus) {
|
|
259
252
|
return
|
|
@@ -377,7 +370,7 @@ export default {
|
|
|
377
370
|
this.loading = true
|
|
378
371
|
Promise.all(
|
|
379
372
|
tempFiles.map(file => {
|
|
380
|
-
const fileSuffix =
|
|
373
|
+
const fileSuffix = getFileSuffix(file.name)
|
|
381
374
|
if (uploadMethod) {
|
|
382
375
|
return Promise.resolve(
|
|
383
376
|
uploadMethod.call(this.currVM, {
|
package/package.json
CHANGED