|
|
@@ -464,9 +464,9 @@ export default { |
|
|
|
// this.localFileHashMap[fileStoreKey] = ipfsCid; |
|
|
|
this.localFileHashMap = { ...this.localFileHashMap, [fileStoreKey]: ipfsCid }; |
|
|
|
}, |
|
|
|
updateFileLoadState(fileId, type, loadProgress = 0, loadSize, totalSize, unit){ |
|
|
|
updateFileLoadState(fileId, type, loadProgress = 0, loadSize, loadUnit, totalSize, unit){ |
|
|
|
const updateState = { |
|
|
|
type, loadProgress, loadSize, totalSize, unit |
|
|
|
type, loadProgress, loadSize, totalSize, unit, loadUnit |
|
|
|
} |
|
|
|
this.localFileLoadStateMap = { ...this.localFileLoadStateMap, [fileId]: updateState }; |
|
|
|
}, |
|
|
@@ -677,9 +677,12 @@ export default { |
|
|
|
this.fetchFolderFiles(); |
|
|
|
}, |
|
|
|
(progressData, upperUploadFile) => { // onLoading |
|
|
|
const { process, hash, size, currentSize, unit } = progressData; |
|
|
|
const { process, hash, size, currentSize, currentUnit, unit } = progressData; |
|
|
|
const uploadFile = firstCharToLowerCase(upperUploadFile); |
|
|
|
this.updateFileLoadState(uploadFile.id, UPLOADING, process, currentSize, size, unit); |
|
|
|
// 避免使用最后一次progreessData中size被修正为Kb的数据 |
|
|
|
if(!hash) { |
|
|
|
this.updateFileLoadState(uploadFile.id, UPLOADING, process, currentSize, currentUnit, size, unit); |
|
|
|
} |
|
|
|
// 覆盖已有的同名文件 |
|
|
|
if(uploadFile.id.indexOf('upload:') === -1) { |
|
|
|
return; |
|
|
@@ -690,7 +693,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
(e, upperFile) => { |
|
|
|
this.removeFileLoadingState(upperFile.Id); |
|
|
|
this.removeFileLoadingState(upperFile.Id); |
|
|
|
this.uploadFileList = this.uploadFileList.filter(iFile => iFile.id !== upperFile.Id); |
|
|
|
} |
|
|
|
); |
|
|
@@ -766,8 +769,10 @@ export default { |
|
|
|
this.workFileList = this.workFileList.map(iFile => iFile.id === file.id ? { ...iFile, ipfsCid: IpfsCid, workStatus: NOT_WORKING } : iFile); |
|
|
|
}, |
|
|
|
(progressData) => { |
|
|
|
const { process, hash, size, currentSize, unit } = progressData; |
|
|
|
this.updateFileLoadState(fileId, UPLOADING, process, currentSize, size, unit); |
|
|
|
const { process, hash, size, currentSize, currentUnit, unit } = progressData; |
|
|
|
// 避免使用最后一次progreessData中size被修正为Kb的数据 |
|
|
|
if(hash) return; |
|
|
|
this.updateFileLoadState(fileId, UPLOADING, process, currentSize, currentUnit, size, unit); |
|
|
|
}, |
|
|
|
errorHandler, |
|
|
|
); |
|
|
|