|
|
@@ -335,8 +335,19 @@ export default { |
|
|
|
|
|
|
|
async function uploadMinio(url, e) { |
|
|
|
const res = await axios.put(url, e.target.result); |
|
|
|
delete e.target.result |
|
|
|
delete e.target.result |
|
|
|
etags[currentChunk] = res.headers.etag; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
async function uploadMinioNewMethod(url,e){ |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
xhr.open('PUT', url, false); |
|
|
|
xhr.setRequestHeader('Content-Type', 'text/plain') |
|
|
|
xhr.send(e.target.result); |
|
|
|
var etagValue = xhr.getResponseHeader('etag'); |
|
|
|
//console.log(etagValue); |
|
|
|
etags[currentChunk] = etagValue; |
|
|
|
} |
|
|
|
|
|
|
|
async function updateChunk(currentChunk) { |
|
|
@@ -359,8 +370,10 @@ export default { |
|
|
|
// 获取分片上传url |
|
|
|
await getUploadChunkUrl(currentChunk, partSize); |
|
|
|
if (urls[currentChunk] != '') { |
|
|
|
// 上传到minio |
|
|
|
await uploadMinio(urls[currentChunk], e); |
|
|
|
// 上传到minio |
|
|
|
//await uploadMinio(urls[currentChunk], e); |
|
|
|
await uploadMinioNewMethod(urls[currentChunk], e); |
|
|
|
|
|
|
|
if (etags[currentChunk] != '') { |
|
|
|
// 更新数据库:分片上传结果 |
|
|
|
//await updateChunk(currentChunk); |
|
|
@@ -372,8 +385,9 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.emitDropzoneFailed(file); |
|
|
|
console.log(error); |
|
|
|
//this.emitDropzoneFailed(file); |
|
|
|
//console.log(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|