mirror of https://github.com/fantasticit/think.git
client: update index
This commit is contained in:
parent
9edf9a71bb
commit
3b2b21e9a5
|
@ -92,7 +92,7 @@ export const uploadFile = async (
|
||||||
md5,
|
md5,
|
||||||
isChunk: true,
|
isChunk: true,
|
||||||
onUploadProgress: (progress) => {
|
onUploadProgress: (progress) => {
|
||||||
progressMap[0] = progress * unitPercent;
|
progressMap[1] = progress * unitPercent;
|
||||||
wraponUploadProgress(
|
wraponUploadProgress(
|
||||||
Object.keys(progressMap).reduce((a, c) => {
|
Object.keys(progressMap).reduce((a, c) => {
|
||||||
return (a += progressMap[c]);
|
return (a += progressMap[c]);
|
||||||
|
@ -103,23 +103,24 @@ export const uploadFile = async (
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
chunks.slice(1).map((chunk, index) =>
|
chunks.slice(1).map((chunk, index) => {
|
||||||
uploadFileToServer({
|
const currentIndex = 1 + index + 1;
|
||||||
|
return uploadFileToServer({
|
||||||
filename,
|
filename,
|
||||||
file: chunk,
|
file: chunk,
|
||||||
chunkIndex: index + 1 + 1,
|
chunkIndex: currentIndex,
|
||||||
md5,
|
md5,
|
||||||
isChunk: true,
|
isChunk: true,
|
||||||
onUploadProgress: (progress) => {
|
onUploadProgress: (progress) => {
|
||||||
progressMap[index + 1] = progress * unitPercent;
|
progressMap[currentIndex] = progress * unitPercent;
|
||||||
wraponUploadProgress(
|
wraponUploadProgress(
|
||||||
Object.keys(progressMap).reduce((a, c) => {
|
Object.keys(progressMap).reduce((a, c) => {
|
||||||
return (a += progressMap[c]);
|
return (a += progressMap[c]);
|
||||||
}, 0)
|
}, 0)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
)
|
})
|
||||||
);
|
);
|
||||||
url = await HttpClient.request({
|
url = await HttpClient.request({
|
||||||
method: FileApiDefinition.mergeChunk.method,
|
method: FileApiDefinition.mergeChunk.method,
|
||||||
|
|
Loading…
Reference in New Issue