瀏覽代碼

优化百度统计 & 服务器日志

Michael Wang 5 年之前
父節點
當前提交
1d8b3f8fc9

+ 23 - 11
src/components/FaceRecognition/FaceRecognition.vue

@@ -49,10 +49,15 @@ export default {
           this.lastSnapTime = Date.now();
           this.snapTimer();
         } else {
-          this.serverLog(
-            "debug/S-002001",
-            "上次的抓拍未超过1分钟,本次抓拍指令取消"
-          );
+          // this.serverLog(
+          //   "debug/S-002001",
+          //   "上次的抓拍未超过1分钟,本次抓拍指令取消"
+          // );
+          window._hmt.push([
+            "_trackEvent",
+            "摄像头框",
+            "上次的抓拍未超过1分钟,本次抓拍指令取消",
+          ]);
           this.decreaseSnapCount();
         }
         this.toggleSnapNow();
@@ -153,8 +158,8 @@ export default {
         const examRecordDataId = this.$route.params.examRecordDataId;
         const captureBlob = await this.getSnapShot();
         this.videoStartPlay();
-        // console.log(captureBlob.size);
-        this.serverLog("debug/S-004001", "抓拍照片的大小:" + captureBlob.size);
+        console.log("抓拍照片的大小:" + captureBlob.size);
+        // this.serverLog("debug/S-004001", "抓拍照片的大小:" + captureBlob.size);
         const [captureFilePath, signIdentifier] = await this.uploadToServer(
           captureBlob
         );
@@ -292,7 +297,7 @@ export default {
           "/api/ecs_oe_student/examControl/getCapturePhotoUpYunSign?" + params
         );
 
-        console.log(res);
+        // console.log(res);
 
         // let myHeaders = new Headers();
         // for (let [k, v] of Object.entries(res.data.headers)) {
@@ -307,18 +312,20 @@ export default {
         }
         myFormData.append("file", captureBlob);
 
-        const response = await fetch(res.data.formUrl, {
+        await fetch(res.data.formUrl, {
           method: "POST",
           body: myFormData,
         });
 
-        console.log(response);
+        // console.log(response);
         resultUrl = res.data.accessUrl;
         signIdentifier = res.data.signIdentifier;
-        this.serverLog("debug/S-005001", "抓拍照片保存成功:");
+        // this.serverLog("debug/S-005001", "抓拍照片保存成功:");
+        window._hmt.push(["_trackEvent", "摄像头框", "抓拍照片保存成功"]);
       } catch (e) {
         console.log(e);
-        this.serverLog("debug/S-006001", "抓拍照片保存失败");
+        // this.serverLog("debug/S-006001", "抓拍照片保存失败");
+        window._hmt.push(["_trackEvent", "摄像头框", "抓拍照片保存失败"]);
         this.$Message.error({
           content: "保存抓拍照片到服务器失败!",
           duration: 15,
@@ -382,6 +389,11 @@ export default {
                     }
                     resolve();
                   } catch (error) {
+                    window._hmt.push([
+                      "_trackEvent",
+                      "摄像头框",
+                      "虚拟摄像头-读取摄像头列表失败",
+                    ]);
                     reject("读取摄像头列表失败");
                   }
                 });

+ 7 - 0
src/features/Login/Login.vue

@@ -220,6 +220,13 @@ export default {
     }
   },
   async created() {
+    window._hmt.push([
+      "_trackEvent",
+      "登录页面",
+      `当前网速: ${Number(navigator.connection.downlink).toPrecision(
+        1
+      )}Mib; 网络延迟: ${Number(navigator.connection.rrt).toPrecision(1)}ms`,
+    ]);
     if (this.isEPCC) {
       this.$Spin.show({
         render: () => {

+ 7 - 0
src/features/OnlineExam/CheckComputer.vue

@@ -636,6 +636,13 @@ export default {
       if (this.current < 5) {
         this.current += 1;
       }
+      if (this.current === 5) {
+        window._hmt.push([
+          "_trackEvent",
+          "环境检测",
+          `网络: ${this.step1Status}; 时间: ${this.step2Status}; 摄像头: ${this.step3Status}; 声音: ${this.step4Status}; 小程序: ${this.step5Status};`,
+        ]);
+      }
     },
     async openCamera() {
       const video = this.$refs.video;

+ 2 - 2
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -95,7 +95,7 @@ export default {
       if (!enoughTimeForFaceId) return;
 
       this.faceIdMsgTimeout = setTimeout(() => {
-        this.serverLog("debug/S-002001", "活体检测前抓拍");
+        // this.serverLog("debug/S-002001", "活体检测前抓拍");
         this.toggleSnapNow();
         this.$Message.info({
           content: "30秒后开始活体检测",
@@ -104,7 +104,7 @@ export default {
         });
       }, this.$route.query.faceVerifyMinute * 60 * 1000 - 30 * 1000); // 活体检测提醒
       this.faceIdDivTimeout = setTimeout(() => {
-        this.serverLog("debug/S-003001", "准备弹出活体检测框");
+        // this.serverLog("debug/S-003001", "准备弹出活体检测框");
         this.showFaceId = true;
       }, this.$route.query.faceVerifyMinute * 60 * 1000); // 定时做活体检测
       // }, 1 * 1000); // 定时做活体检测

+ 5 - 1
src/features/OnlineExam/OnlineExamOverview.vue

@@ -100,7 +100,11 @@ export default {
           .map(q => q.groupScore)
           .reduce((p, c) => p + c * 1000, 0) / 1000;
     } catch (e) {
-      this.serverLog("debug/S-010001", "获取考试概览信息异常");
+      window._hmt.push([
+        "_trackEvent",
+        "在线考试概览页面",
+        "获取考试概览信息异常",
+      ]);
       this.$router.back();
       return;
     }