Browse Source

Merge pull request 'fix-1940 上传数据集后端报错了前端进度条还在涨' (#2579) from fix-1940 into V20220801

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2579
Reviewed-by: zhoupzh <zhoupzh@pcl.ac.cn>
pull/2585/head
zhoupzh 2 years ago
parent
commit
b8dbbe45df
1 changed files with 27 additions and 13 deletions
  1. +27
    -13
      web_src/js/components/MinioUploader.vue

+ 27
- 13
web_src/js/components/MinioUploader.vue View File

@@ -135,10 +135,10 @@ export default {
allUploadLength(len){ allUploadLength(len){
if(len===this.uploadFiles.length){ if(len===this.uploadFiles.length){
setTimeout(() => { setTimeout(() => {
this.dropzoneUploader.removeAllFiles(true)
this.btnFlag = false
this.$emit('setcluster',this.btnFlag)
}, 2000);
this.dropzoneUploader.removeAllFiles(true)
this.btnFlag = false
this.$emit('setcluster',this.btnFlag)
}, 2000);
} }
} }
}, },
@@ -254,7 +254,7 @@ export default {
(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));
loadMd5Next(); loadMd5Next();
return; return;
} }
@@ -265,7 +265,7 @@ export default {
file.size file.size
} 用时:${(new Date().getTime() - time) / 1000} s` } 用时:${(new Date().getTime() - time) / 1000} s`
); );
this.updateProgress(file,100)
// this.updateProgress(file,100)
spark.destroy(); // 释放缓存 spark.destroy(); // 释放缓存
file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识 file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识
file.cmd5 = false; // 取消计算md5状态 file.cmd5 = false; // 取消计算md5状态
@@ -297,11 +297,11 @@ export default {
file.chunks = ''; file.chunks = '';
this.multipartUpload(file); this.multipartUpload(file);
} else { } else {
// 失败如何处理
let info = "上传失败"
this.allUploadLength++
this.uploadError(file,info)
this.allUploadFiles.push({name:file.name,status:2,info:info})
// 失败如何处理
let info = "上传失败"
this.allUploadLength++
this.uploadError(file,info)
this.allUploadFiles.push({name:file.name,status:2,info:info})
return; return;
} }
return; return;
@@ -321,12 +321,16 @@ export default {
this.uploadError(file,info) this.uploadError(file,info)
this.allUploadLength++ this.allUploadLength++
this.allUploadFiles.push({name:file.name,status:1,info:info}) this.allUploadFiles.push({name:file.name,status:1,info:info})
return;
} }
}
}
console.log('文件已上传完成'); console.log('文件已上传完成');
this.allUploadLength++
this.allUploadFiles.push({name:file.name,status:0,info:'上传成功'})
this.updateProgress(file, 100);
this.progress = 100; this.progress = 100;
this.status = this.dropzoneParams.data('upload-complete'); this.status = this.dropzoneParams.data('upload-complete');
// this.finishUpload(file);
this.finishUpload(file);
} else { } else {
// 断点续传 // 断点续传
this.multipartUpload(file); this.multipartUpload(file);
@@ -334,6 +338,10 @@ export default {
} catch (error) { } catch (error) {
this.emitDropzoneFailed(file); this.emitDropzoneFailed(file);
console.log(error); console.log(error);
let info = "上传失败"
this.allUploadLength++
this.uploadError(file,info)
this.allUploadFiles.push({name:file.name,status:2,info:info})
} }


async function addAttachment(file) { async function addAttachment(file) {
@@ -503,6 +511,7 @@ export default {
console.log(error); console.log(error);
//this.emitDropzoneFailed(file); //this.emitDropzoneFailed(file);
//console.log(error); //console.log(error);
throw error;
} }
} }


@@ -538,6 +547,11 @@ export default {
await uploadChunk(e); await uploadChunk(e);
}catch(err){ }catch(err){
console.log(err) console.log(err)
let info = "上传失败"
this.allUploadLength++
this.uploadError(file,info)
this.allUploadFiles.push({name:file.name,status:2,info:info});
return;
} }
fileReader.abort(); fileReader.abort();


Loading…
Cancel
Save