client: fix upload progress

This commit is contained in:
fantasticit 2022-06-05 01:22:03 +08:00
parent ba60716390
commit 610367b8ae
1 changed files with 9 additions and 5 deletions

View File

@ -115,9 +115,13 @@ export const uploadFile = async (
onUploadProgress: (progress) => { onUploadProgress: (progress) => {
progressMap[currentIndex] = progress * unitPercent; progressMap[currentIndex] = progress * unitPercent;
wraponUploadProgress( wraponUploadProgress(
Math.min(
Object.keys(progressMap).reduce((a, c) => { Object.keys(progressMap).reduce((a, c) => {
return (a += progressMap[c]); return (a += progressMap[c]);
}, 0) }, 0),
// 剩下的 5% 交给 merge
0.95
)
); );
}, },
}); });
@ -131,10 +135,10 @@ export const uploadFile = async (
md5, md5,
}, },
}); });
} else {
wraponUploadProgress(1);
} }
wraponUploadProgress(1);
return url; return url;
} }
}; };