浏览代码

fix UPYUN_URL undefined

Michael Wang 6 年之前
父节点
当前提交
a27a69bc24
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      src/components/FaceRecognition/FaceRecognition.vue

+ 9 - 5
src/components/FaceRecognition/FaceRecognition.vue

@@ -76,6 +76,7 @@ export default {
       const [fileName, captureFilePath] = await this.uploadToServer(
       const [fileName, captureFilePath] = await this.uploadToServer(
         captureBlob
         captureBlob
       );
       );
+
       await this.faceCompare(fileName, captureFilePath);
       await this.faceCompare(fileName, captureFilePath);
       const video = this.$refs.video;
       const video = this.$refs.video;
       video && video.play();
       video && video.play();
@@ -86,9 +87,7 @@ export default {
       this.msg = "上传照片中...";
       this.msg = "上传照片中...";
       const [, captureFilePath] = await this.uploadToServer(captureBlob);
       const [, captureFilePath] = await this.uploadToServer(captureBlob);
       this.msg = "人脸比对中...";
       this.msg = "人脸比对中...";
-      const UPYUN_URL = (await this.$http.get("/api/ecs_oe_student_face/upyun"))
-        .data.downloadPrefix;
-      await this.faceCompareSync(UPYUN_URL + captureFilePath);
+      await this.faceCompareSync(captureFilePath);
       const video = this.$refs.video;
       const video = this.$refs.video;
       video && video.play();
       video && video.play();
     },
     },
@@ -122,7 +121,13 @@ export default {
         return;
         return;
       }
       }
 
 
-      return [fileName, "/capture_photo/" + this.user.userId + "/" + fileName];
+      const UPYUN_URL = (await this.$http.get("/api/ecs_oe_student_face/upyun"))
+        .data.downloadPrefix;
+
+      return [
+        fileName,
+        UPYUN_URL + "/capture_photo/" + this.user.userId + "/" + fileName
+      ];
     },
     },
     async faceCompareSync(captureFilePath) {
     async faceCompareSync(captureFilePath) {
       try {
       try {
@@ -147,7 +152,6 @@ export default {
       try {
       try {
         await this.$http.post(
         await this.$http.post(
           "/api/ecs_oe_student_face/examCaptureQueue/uploadExamCapture?fileUrl=" +
           "/api/ecs_oe_student_face/examCaptureQueue/uploadExamCapture?fileUrl=" +
-            UPYUN_URL +
             captureFilePath +
             captureFilePath +
             "&fileName=" +
             "&fileName=" +
             fileName +
             fileName +