소스 검색

fix bug 不应该在学生有底照的情况下覆盖

Michael Wang 3 년 전
부모
커밋
401adc4550
1개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 13 13
      src/views/index.vue

+ 13 - 13
src/views/index.vue

@@ -289,25 +289,25 @@ export default {
         // };
         // await this.saveStudentFaceInfoByPut(photoInfo);
 
-        let alreadyHavePhoto = false;
+        let studentInfo = await this.getStudentInfo(rootOrgId, identityNumber);
+        let alreadyHavePhoto = studentInfo.photoPath ? true : false;
+        let shouldUpload = false;
+
+        let resStr = "";
         if (this.overridePhoto) {
-          let studentInfo = await this.getStudentInfo(
-            rootOrgId,
-            identityNumber
-          );
-          alreadyHavePhoto = studentInfo.photoPath ? true : false;
+          resStr = alreadyHavePhoto ? "--覆盖更新" : "--保存";
+          shouldUpload = true;
+        } else {
+          resStr = alreadyHavePhoto ? "--已有底照-跳过" : "--保存";
+          shouldUpload = !alreadyHavePhoto;
         }
 
-        if (this.overridePhoto || (!this.overridePhoto && !alreadyHavePhoto)) {
-          // 如果选择覆盖,或者不覆盖,但是没有底照,就保存底照
+        if (shouldUpload) {
+          // 如果选择覆盖,或者(不覆盖,但是没有底照),就保存底照
           await this.saveStudentBasePhoto(photoFile, photoFileName);
         }
-        const notOverride = this.overridePhoto && alreadyHavePhoto;
 
-        this.finishOnePhotoSuccess(
-          "处理成功" + (this.overridePhoto && notOverride ? "--不覆盖" : ""),
-          studentPhotoPath
-        );
+        this.finishOnePhotoSuccess("处理成功" + resStr, studentPhotoPath);
 
         {
           // 执行过程中的元信息