|
|
@@ -133,7 +133,7 @@ import rename from "../popup/rename";
|
|
|
import vAudio from "@/components/audio";
|
|
|
import Upload from "@/components/shared/uploads/UploadMultiple";
|
|
|
import { changeByteUnit } from "@/utils/file";
|
|
|
-import UploadList from "../components/uploadList";
|
|
|
+import UploadList from "../components/uploadList.vue";
|
|
|
import { debounce } from "@/utils/other.js"
|
|
|
|
|
|
import {
|
|
|
@@ -276,6 +276,7 @@ export default {
|
|
|
onFileChange(file) {
|
|
|
let canUploadList = [];
|
|
|
|
|
|
+ // 对选中的文件按照格式限制和名称长度限制,做过滤,name存到this.uploadList,整个file对象存到canUploadList。
|
|
|
file.files.forEach((item, i) => {
|
|
|
let tmp = {
|
|
|
statusStr: "上传中",
|
|
|
@@ -313,6 +314,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ // Promise对象数组,每个Promise都会马上被canUploadList里的元素resolve。
|
|
|
let p = [];
|
|
|
canUploadList.forEach((i) => {
|
|
|
let promise = new Promise((resolve) => {
|
|
|
@@ -322,6 +324,7 @@ export default {
|
|
|
});
|
|
|
|
|
|
Promise.all(p).then((result) => {
|
|
|
+ // pp保存了每个文件的上传任务的Promise对象。
|
|
|
let pp = [];
|
|
|
p.length > 0 &&
|
|
|
result.forEach((data) => {
|
|
|
@@ -345,6 +348,7 @@ export default {
|
|
|
pp.push(promise);
|
|
|
});
|
|
|
pp.length > 0 &&
|
|
|
+ // 上传任务都结束后,this.uploadList里记录的所有任务状态都更新到5,this.uploadList里删除那些结束了的任务,更新列表数据。
|
|
|
Promise.all(pp).then((response) => {
|
|
|
if (response.length > 0) {
|
|
|
this.uploadList.forEach((item) => {
|
|
|
@@ -361,7 +365,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- this.getMoreMaterialItem();
|
|
|
+ this.refreshListDebounced()
|
|
|
}
|
|
|
});
|
|
|
});
|