|
|
|
@@ -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) { |
|
|
|
|