Browse Source

test

tags/v1.22.4.2^2
lewis 4 years ago
parent
commit
c20142f828
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      web_src/js/components/MinioUploader.vue

+ 9
- 3
web_src/js/components/MinioUploader.vue View File

@@ -27,6 +27,7 @@ import createDropzone from '../features/dropzone.js';


const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
const chunkSize = 1024 * 1024 * 64; const chunkSize = 1024 * 1024 * 64;
const md5ChunkSize = 1024 * 1024 * 1;


export default { export default {
props:{ props:{
@@ -190,7 +191,6 @@ export default {
let currentChunk = 0; let currentChunk = 0;


const time = new Date().getTime(); const time = new Date().getTime();
// console.log('计算MD5...')
this.status = this.dropzoneParams.data('md5-computing'); this.status = this.dropzoneParams.data('md5-computing');
file.totalChunkCounts = chunks; file.totalChunkCounts = chunks;
loadNext(); loadNext();
@@ -207,13 +207,12 @@ export default {
spark.append(e.target.result); // Append array buffer spark.append(e.target.result); // Append array buffer
currentChunk++; currentChunk++;
if (currentChunk < chunks) { if (currentChunk < chunks) {
// console.log(`第${currentChunk}分片解析完成, 开始第${currentChunk +1}/${chunks}分片解析`);
this.status = `${this.dropzoneParams.data('loading-file')} ${( this.status = `${this.dropzoneParams.data('loading-file')} ${(
(currentChunk / chunks) * (currentChunk / chunks) *
100 100
).toFixed(2)}% (${currentChunk}/${chunks})`; ).toFixed(2)}% (${currentChunk}/${chunks})`;
this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2)); this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
loadNext();
loadMd5Next();
return; return;
} }


@@ -235,6 +234,13 @@ export default {
start + chunkSize >= file.size ? file.size : start + chunkSize; start + chunkSize >= file.size ? file.size : start + chunkSize;
fileReader.readAsArrayBuffer(blobSlice.call(file, start, end)); 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) { async computeMD5Success(md5edFile) {


Loading…
Cancel
Save