From c20142f8282924abcfe00804e614da8fa583b693 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Mon, 18 Apr 2022 17:00:09 +0800 Subject: [PATCH] test --- web_src/js/components/MinioUploader.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web_src/js/components/MinioUploader.vue b/web_src/js/components/MinioUploader.vue index 8c33608e7..dd2548f40 100755 --- a/web_src/js/components/MinioUploader.vue +++ b/web_src/js/components/MinioUploader.vue @@ -27,6 +27,7 @@ import createDropzone from '../features/dropzone.js'; const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; const chunkSize = 1024 * 1024 * 64; +const md5ChunkSize = 1024 * 1024 * 1; export default { props:{ @@ -190,7 +191,6 @@ export default { let currentChunk = 0; const time = new Date().getTime(); - // console.log('计算MD5...') this.status = this.dropzoneParams.data('md5-computing'); file.totalChunkCounts = chunks; loadNext(); @@ -207,13 +207,12 @@ export default { spark.append(e.target.result); // Append array buffer currentChunk++; if (currentChunk < chunks) { - // console.log(`第${currentChunk}分片解析完成, 开始第${currentChunk +1}/${chunks}分片解析`); this.status = `${this.dropzoneParams.data('loading-file')} ${( (currentChunk / chunks) * 100 ).toFixed(2)}% (${currentChunk}/${chunks})`; this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2)); - loadNext(); + loadMd5Next(); return; } @@ -235,6 +234,13 @@ export default { start + chunkSize >= file.size ? file.size : start + chunkSize; fileReader.readAsArrayBuffer(blobSlice.call(file, start, end)); } + + function loadMd5Next() { + const start = currentChunk * chunkSize; + const end = + start + md5ChunkSize >= file.size ? file.size : start + md5ChunkSize; + fileReader.readAsArrayBuffer(blobSlice.call(file, start, end)); + } }, async computeMD5Success(md5edFile) {