fix-4953
into V20231211
5 months ago
@@ -217,13 +217,6 @@ export default { | |||
this.uploadProgressList = []; | |||
}, | |||
updateProgress(file, status, progress, infoCode, failedInfo = "") { | |||
console.log("this.uploadProgressList:", this.uploadProgressList); | |||
// file.previewTemplate.querySelector( | |||
// ".dz-upload" | |||
// ).style.width = `${progress}%`; | |||
// file.previewTemplate.querySelector(".dz-upload").style.background = | |||
// "#409eff"; | |||
// file.previewTemplate.querySelector(".dz-upload").style.opacity = 0; | |||
this.uploadProgressList.forEach((item, index) => { | |||
if (item.name === file.name) { | |||
this.uploadProgressList[index].status = status; | |||
@@ -265,7 +258,6 @@ export default { | |||
// this.dropzoneUploader.emit('complete', file); | |||
}, | |||
finishUpload(file) { | |||
console.log("finish", file); | |||
file.previewTemplate.querySelector(".dz-success-mark").style.opacity = 1; | |||
file.previewTemplate.querySelector(".dz-progress").style.opacity = 0; | |||
if (this.uploadLength === this.uploadFiles.length) { | |||
@@ -314,12 +306,6 @@ export default { | |||
(currentChunk / chunks) * | |||
100 | |||
).toFixed(2)}% (${currentChunk}/${chunks})`; | |||
console.log("-=-=-=-=--=", this.status); | |||
// this.updateProgress( | |||
// file, | |||
// this.dropzoneParams.data("md5-computing"), | |||
// Number(((currentChunk / chunks) * 100).toFixed(1)) | |||
// ); | |||
loadMd5Next(); | |||
return; | |||
} | |||
@@ -330,11 +316,6 @@ export default { | |||
file.size | |||
} 用时:${(new Date().getTime() - time) / 1000} s` | |||
); | |||
// this.updateProgress( | |||
// file, | |||
// this.dropzoneParams.data("md5-computing"), | |||
// 100 | |||
// ); | |||
spark.destroy(); // 释放缓存 | |||
file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识 | |||
file.cmd5 = false; // 取消计算md5状态 | |||
@@ -358,7 +339,6 @@ export default { | |||
async computeMD5Success(md5edFile) { | |||
const file = await this.getSuccessChunks(md5edFile); | |||
console.log(file); | |||
try { | |||
if (file.uploadID == "" || file.uuid == "") { | |||
// 未上传过 | |||
@@ -534,7 +514,6 @@ export default { | |||
xhr.setRequestHeader("Content-Type", ""); | |||
xhr.send(e.target.result); | |||
var etagValue = xhr.getResponseHeader("ETag"); | |||
//console.log(etagValue); | |||
etags[currentChunk] = etagValue; | |||
} | |||
} | |||
@@ -550,7 +529,7 @@ export default { | |||
}) | |||
); | |||
} | |||
async function uploadChunk(e) { | |||
async function uploadChunk(e,_this) { | |||
try { | |||
if (!checkSuccessChunks()) { | |||
const start = currentChunk * chunkSize; | |||
@@ -562,10 +541,16 @@ export default { | |||
// 上传到minio | |||
//await uploadMinio(urls[currentChunk], e); | |||
await uploadMinioNewMethod(urls[currentChunk], e); | |||
if (etags[currentChunk] != "") { | |||
// 更新数据库:分片上传结果 | |||
//await updateChunk(currentChunk); | |||
succesLength++ | |||
_this.updateProgress( | |||
file, | |||
_this.dropzoneParams.data("uploading"), | |||
Number(((succesLength / chunks) * 100).toFixed(2)), | |||
3 | |||
); | |||
} else { | |||
console.log( | |||
"上传到minio uploadChunk etags[currentChunk] == ''" | |||
@@ -577,6 +562,8 @@ export default { | |||
} | |||
} catch (error) { | |||
// this.emitDropzoneFailed(file); | |||
//stopFlag = true | |||
errorChunkLength++ | |||
console.log(error); | |||
} | |||
} | |||
@@ -596,85 +583,122 @@ export default { | |||
}) | |||
); | |||
} | |||
async function checkCompleteUpload() { | |||
if(succesLength===chunks) { | |||
try { | |||
await completeUpload(); | |||
} catch (err) { | |||
let info = "上传失败"; | |||
_this.allUploadLength++; | |||
_this.uploadError(file, info); | |||
let completeProgress=Number(((succesLength / chunks) * 100).toFixed(2)) | |||
if(completeProgress==100){ | |||
completeProgress = completeProgress -1 | |||
} | |||
_this.updateProgress( | |||
file, | |||
info, | |||
completeProgress, | |||
2 | |||
); | |||
// this.allUploadFiles.push({ | |||
// name: file.name, | |||
// status: 2, | |||
// info: info, | |||
// }); | |||
if (err) { | |||
return; | |||
} | |||
} | |||
console.log( | |||
`文件上传完成:${file.name} \n分片:${chunks} 大小:${ | |||
file.size | |||
} 用时:${(new Date().getTime() - time) / 1000} s` | |||
); | |||
_this.uploadLength++; | |||
_this.allUploadLength++; | |||
// this.allUploadFiles.push({ | |||
// name: file.name, | |||
// status: 0, | |||
// info: "上传成功", | |||
// }); | |||
_this.updateProgress(file, "上传成功", 100, 0); | |||
// this.progress = 100; | |||
// this.status = this.dropzoneParams.data("upload-complete"); | |||
_this.finishUpload(file); | |||
} | |||
} | |||
const successChunks = []; | |||
let successParts = []; | |||
successParts = file.chunks.split(","); | |||
for (let i = 0; i < successParts.length; i++) { | |||
successChunks[i] = successParts[i].split("-")[0]; | |||
} | |||
if(successChunks.length>1){ | |||
this.updateProgress( | |||
file, | |||
this.dropzoneParams.data("uploading"), | |||
Number((((successChunks.length-1) / chunks) * 100).toFixed(2)), | |||
3 | |||
); | |||
} | |||
let succesLength = successChunks.length-1 | |||
let errorChunkLength = 0 | |||
const urls = []; // TODO const ? | |||
const etags = []; | |||
console.log("上传分片..."); | |||
this.status = this.dropzoneParams.data("uploading"); | |||
for (currentChunk; currentChunk < chunks; currentChunk++) { | |||
if(!checkSuccessChunks()){ | |||
loadNext(); | |||
break | |||
} | |||
} | |||
checkCompleteUpload() | |||
fileReader.onload = async (e) => { | |||
try { | |||
await uploadChunk(e); | |||
await uploadChunk(e,_this); | |||
} catch (err) { | |||
console.log(err); | |||
} | |||
fileReader.abort(); | |||
currentChunk++; | |||
if(succesLength<chunks && errorChunkLength>20){ | |||
this.updateProgress( | |||
file, | |||
"上传失败", | |||
Number(((succesLength / chunks) * 100).toFixed(2)), | |||
2 | |||
); | |||
return | |||
} | |||
if (currentChunk < chunks) { | |||
console.log( | |||
`第${currentChunk}个分片上传完成, 开始第${ | |||
currentChunk + 1 | |||
}/${chunks}个分片上传` | |||
); | |||
this.progress = Math.ceil((currentChunk / chunks) * 100); | |||
this.updateProgress( | |||
file, | |||
this.dropzoneParams.data("uploading"), | |||
Number(((currentChunk / chunks) * 100).toFixed(2)), | |||
3 | |||
); | |||
this.status = `${this.dropzoneParams.data("uploading")} ${( | |||
(currentChunk / chunks) * | |||
100 | |||
).toFixed(2)}%`; | |||
await loadNext(); | |||
} else { | |||
try { | |||
await completeUpload(); | |||
} catch (err) { | |||
let info = "上传失败"; | |||
this.allUploadLength++; | |||
this.uploadError(file, info); | |||
for (currentChunk; currentChunk < chunks; currentChunk++) { | |||
if(!checkSuccessChunks()){ | |||
loadNext(); | |||
break | |||
} | |||
} | |||
} | |||
if(succesLength<chunks && currentChunk === chunks){ | |||
this.updateProgress( | |||
file, | |||
info, | |||
Number(((currentChunk / chunks) * 100).toFixed(2)) - 1, | |||
"上传失败", | |||
Number(((succesLength / chunks) * 100).toFixed(2)), | |||
2 | |||
); | |||
// this.allUploadFiles.push({ | |||
// name: file.name, | |||
// status: 2, | |||
// info: info, | |||
// }); | |||
if (err) { | |||
return; | |||
} | |||
} | |||
console.log( | |||
`文件上传完成:${file.name} \n分片:${chunks} 大小:${ | |||
file.size | |||
} 用时:${(new Date().getTime() - time) / 1000} s` | |||
); | |||
this.uploadLength++; | |||
this.allUploadLength++; | |||
// this.allUploadFiles.push({ | |||
// name: file.name, | |||
// status: 0, | |||
// info: "上传成功", | |||
// }); | |||
this.updateProgress(file, "上传成功", 100, 0); | |||
this.progress = 100; | |||
this.status = this.dropzoneParams.data("upload-complete"); | |||
this.finishUpload(file); | |||
if(succesLength===chunks){ | |||
checkCompleteUpload() | |||
} | |||
}; | |||
}, | |||
@@ -99,7 +99,7 @@ Dropzone.autoDiscover = false; | |||
const uploadChunkSize = 1024 * 1024 * 64; | |||
const md5ChunkSize = 1024 * 1024 * 64; | |||
const maxFileSize = 10; | |||
const maxModelFilesSize = window.MAX_MODEL_SIZE || 200 * 1024 * 1024 * 1024; // 200 GB | |||
const maxModelFilesSize = window.MAX_MODEL_SIZE || 250 * 1024 * 1024 * 1024; // 200 GB | |||
export default { | |||
data() { | |||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》