Эх сурвалжийг харах

日志记录500错误的类型

Michael Wang 6 жил өмнө
parent
commit
f0a9815435

+ 1 - 1
src/components/FaceRecognition/FaceRecognition.vue

@@ -228,7 +228,7 @@ export default {
           }
         });
         resultUrl = res.data;
-        this.serverLog("debug/S-005001", "抓拍照片保存成功:" + resultUrl);
+        this.serverLog("debug/S-005001", "抓拍照片保存成功:");
       } catch (e) {
         console.log(e);
         this.serverLog("debug/S-006001", "抓拍照片保存失败");

+ 5 - 0
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -405,6 +405,11 @@ export default {
         } catch (error) {
           console.log(error);
           this.$Message.error("提交答案失败");
+          window._hmt.push(["_trackEvent", "正在考试页面", "提交答案", "失败"]);
+          this.serverLog(
+            "debug/S-008001",
+            `提交答案失败 => 考试剩余时间:${this.remainTime / 1000}`
+          );
         }
       }
     },

+ 5 - 0
src/features/OnlineExam/Examing/RemainTime.vue

@@ -53,6 +53,11 @@ export default {
           this.$Message.error("服务器返回的心跳结果不是数字");
         }
       } catch (error) {
+        window._hmt.push(["_trackEvent", "正在考试页面", "心跳", "失败"]);
+        this.serverLog(
+          "debug/S-008002",
+          `心跳失败 => 考试剩余时间:${this.remainTime / 1000}`
+        );
         this.heartbeatErrorNum++;
         if (this.heartbeatErrorNum >= 10) {
           // 心跳异常10次则退出考试

+ 12 - 8
src/main.js

@@ -87,15 +87,19 @@ Vue.mixin({
   },
   methods: {
     async serverLog(level, logText) {
-      await this.$http.post(
-        "/api/ecs_core/log/studentClient/" + level,
-        logText,
-        {
-          headers: {
-            "Content-Type": "text/plain"
+      try {
+        await this.$http.post(
+          "/api/ecs_core/log/studentClient/" + level,
+          logText,
+          {
+            headers: {
+              "Content-Type": "text/plain"
+            }
           }
-        }
-      );
+        );
+      } catch (error) {
+        console.log(error);
+      }
     },
     logout() {
       localStorage.removeItem("phoneVerified");