|
@@ -45,7 +45,12 @@ export async function importPaper({
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-export async function importExamStudent({ examId, fileName, file }) {
|
|
|
+export async function importExamStudent({
|
|
|
+ examId,
|
|
|
+ fileName,
|
|
|
+ file,
|
|
|
+ onUploadProgress,
|
|
|
+}) {
|
|
|
const form = new FormData();
|
|
|
form.append("examId", examId);
|
|
|
form.append("fileName", fileName);
|
|
@@ -55,6 +60,15 @@ export async function importExamStudent({ examId, fileName, file }) {
|
|
|
"Content-Type": "multipart/form-data",
|
|
|
md5: await getMd5FromBlob(file),
|
|
|
},
|
|
|
+ onUploadProgress(progressEvent) {
|
|
|
+ let percent = 0;
|
|
|
+ if (progressEvent.total > 0 && progressEvent.loaded) {
|
|
|
+ percent = ((progressEvent.loaded / progressEvent.total) * 100).toFixed(
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ onUploadProgress && onUploadProgress(percent);
|
|
|
+ },
|
|
|
});
|
|
|
}
|
|
|
|