浏览代码

百度统计减少统计明细类型

Michael Wang 4 年之前
父节点
当前提交
a1cb549b21

+ 1 - 1
public/index.html

@@ -87,7 +87,7 @@
       var _hmt = _hmt || [];
       (function () {
         var hm = document.createElement("script");
-        hm.src = "https://hm.baidu.com/hm.js?8f776e9b3eb700921c71576bbba0dac8";
+        hm.src = "https://hm.baidu.com/hm.js?d00b10467bcf422aeadda1f7074f32d3";
         var s = document.getElementsByTagName("script")[0];
         s.parentNode.insertBefore(hm, s);
 

+ 3 - 1
src/App.vue

@@ -50,7 +50,9 @@ export default {
           });
           window._hmt.push([
             "_trackEvent",
-            window.location.pathname.replace(/\d+/g, ""),
+            window.location.pathname
+              .replace(/=\w*/g, "=")
+              .replace(/\d+/g, "{id}"),
             "学生端不是置顶状态",
           ]);
           if (this.$route.name === "OnlineExamingHome") {

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

@@ -333,7 +333,7 @@ export default {
             "_trackEvent",
             "摄像头框",
             "定时抓拍照片大小异常" + chromeUA.major,
-            captureBlob.size,
+            captureBlob.size < 48 * 48 ? "小于 48 *48" : "大于 2 * 1024 * 1024",
           ]);
           this.logger({
             action: "摄像头异常",

+ 12 - 13
src/features/Login/Login.vue

@@ -13,14 +13,12 @@
           @load="(e) => (e.target.style = '')"
         />
       </div>
-      <a class="close" @click="closeApp">
-        关闭
-      </a>
+      <a class="close" @click="closeApp"> 关闭 </a>
     </header>
 
     <div class="center">
       <div class="content">
-        <div style="display: flex;">
+        <div style="display: flex">
           <a
             v-if="allowLoginType.includes('STUDENT_CODE')"
             key="STUDENT_CODE"
@@ -30,7 +28,7 @@
               loginType === 'STUDENT_CODE' && 'active-type',
               allowLoginType.length === 1 && 'single-login-type',
             ]"
-            style="border-top-left-radius: 6px;"
+            style="border-top-left-radius: 6px"
             @click="loginType = 'STUDENT_CODE'"
           >
             {{ QECSConfig.STUDENT_CODE_LOGIN_ALIAS }}
@@ -44,7 +42,7 @@
               loginType !== 'STUDENT_CODE' && 'active-type',
               allowLoginType.length === 1 && 'single-login-type',
             ]"
-            style="border-top-right-radius: 6px;"
+            style="border-top-right-radius: 6px"
             @click="loginType = 'STUDENT_IDENTITY_NUMBER'"
           >
             {{ QECSConfig.IDENTITY_NUMBER_LOGIN_ALIAS }}
@@ -58,11 +56,11 @@
           </a>
         </div>
 
-        <div class="qm-title-text" style="margin: 40px 0 20px 0;">
+        <div class="qm-title-text" style="margin: 40px 0 20px 0">
           {{ productName }}
         </div>
 
-        <div style="margin: 0 40px 40px 40px;">
+        <div style="margin: 0 40px 40px 40px">
           <i-form ref="loginForm" :model="loginForm" :rules="loginFormRule">
             <i-form-item prop="accountValue" class="form-item-style">
               <i-input
@@ -87,22 +85,22 @@
             <i-form-item
               v-if="isGeeTestEnabled"
               class="form-item-style"
-              style="height: 40px; margin-top: 0px;"
+              style="height: 40px; margin-top: 0px"
             >
               <GeeTest :reset="resetGeeTime" @on-load="handleGtResult" />
             </i-form-item>
 
-            <i-form-item style="position: relative;">
+            <i-form-item style="position: relative">
               <div
                 v-if="errorInfo !== ''"
-                style="position: absolute; top: -25px; width: 100%;"
+                style="position: absolute; top: -25px; width: 100%"
               >
                 <i-alert type="error" show-icon>{{ errorInfo }}</i-alert>
               </div>
               <i-button
                 size="large"
                 class="qm-primary-button"
-                style="margin-top: 10px;"
+                style="margin-top: 10px"
                 long
                 :disabled="disableLoginBtn"
                 :loading="loginBtnLoading"
@@ -117,7 +115,7 @@
     </div>
 
     <footer class="footer">
-      <div style="position: absolute; right: 20px; bottom: 20px;">
+      <div style="position: absolute; right: 20px; bottom: 20px">
         版本: {{ VUE_APP_GIT_REPO_VERSION }}
       </div>
       <DevTools />
@@ -1057,6 +1055,7 @@ export default {
           shellVersion + "/" + chromeVersion,
         ]);
       } else {
+        window._hmt.push(["_trackEvent", "登录页面", "浏览器登录"]);
         if (chromeVersion) {
           window._hmt.push([
             "_trackEvent",

+ 8 - 12
src/utils/axios.js

@@ -93,8 +93,7 @@ qmInstance.interceptors.response.use(
       try {
         (detailInfo += error.config.url
           .replace(/=\w*/g, "=")
-          .replace(/\/\d+\//g, "/{id}/")
-          .replace(/\/\d+$/g, "/{id}")) +
+          .replace(/\d+/g, "/{id}")) +
           " ||| " +
           error.message;
       } catch (error) {
@@ -103,7 +102,7 @@ qmInstance.interceptors.response.use(
 
       window._hmt.push([
         "_trackEvent",
-        location.pathname.replace(/\d+/g, ""),
+        location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
         "网络连接异常,请检查网络设置。",
         detailInfo,
       ]);
@@ -145,9 +144,9 @@ qmInstance.interceptors.response.use(
     } else if (status == 502) {
       window._hmt.push([
         "_trackEvent",
-        location.pathname,
+        location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
         "服务器异常(502)!",
-        error.config.url,
+        error.config.url.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
       ]);
       Message.error({
         content: "服务器异常(502)!",
@@ -165,9 +164,9 @@ qmInstance.interceptors.response.use(
       }
       window._hmt.push([
         "_trackEvent",
-        location.pathname.replace(/\d+/g, ""),
+        location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
         "服务器繁忙(503)!请稍后重试。",
-        error.config.url.replace(/\d+/g, ""),
+        error.config.url.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
       ]);
       Message.error({
         content: "服务器繁忙(503)!请稍后重试。",
@@ -178,12 +177,9 @@ qmInstance.interceptors.response.use(
     } else if (status != 200) {
       window._hmt.push([
         "_trackEvent",
-        location.pathname.replace(/\d+/g, ""),
+        location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
         "status: " + status,
-        error.config.url
-          .replace(/=\w*/g, "=")
-          .replace(/\/\d+\//g, "/{id}/")
-          .replace(/\/\d+$/g, "/{id}"),
+        error.config.url.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
       ]);
       if (
         wk_token &&

+ 1 - 0
src/utils/logger.js

@@ -47,6 +47,7 @@ export function createUserDetailLog(logs) {
       logger.push(k, v);
     }
     logger.push("clientDate", moment().format("hh:mm:ss.SSS"));
+    logger.push("UA", navigator.userAgent);
     logger.logger();
   } catch (error) {
     console.log(error);

+ 10 - 5
src/utils/monitors.js

@@ -50,9 +50,10 @@ window.addEventListener("error", function (event) {
   // );
   window._hmt.push([
     "_trackEvent",
-    "全局JS错误:" + window.location.pathname.replace(/\d+/g, ""),
+    "全局JS错误:" +
+      window.location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
     event.message,
-    event.error.stack.replace(/\n/g, "||||"),
+    "detail see ali",
   ]);
   createLog({
     action: "全局JS错误",
@@ -111,13 +112,17 @@ window.addEventListener("unhandledrejection", function (event) {
     (event.reason.message.includes("Box.constructor") ||
       event.reason.message.includes("Error: toNetInput"))
   ) {
-    window._hmt.push(["_trackEvent", "全局Promise未处理错误", event.reason]);
+    window._hmt.push([
+      "_trackEvent",
+      "全局Promise未处理错误",
+      event.reason.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
+    ]);
   } else {
     window._hmt.push([
       "_trackEvent",
       "全局Promise未处理错误",
-      window.location.pathname.replace(/\d+/g, ""),
-      event.reason,
+      window.location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
+      event.reason.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
     ]);
   }
 });

+ 2 - 2
src/utils/nativeExe.js

@@ -5,7 +5,7 @@ export default function async(exeName, cb) {
     console.log("nodeRequire failed");
     window._hmt.push([
       "_trackEvent",
-      window.location.pathname.replace(/\d+/g, ""),
+      window.location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
       "不在Electron中,调用 " + exeName + " 失败",
     ]);
     createLog({
@@ -45,7 +45,7 @@ export function fileExists(file) {
     console.log("nodeRequire failed");
     window._hmt.push([
       "_trackEvent",
-      window.location.pathname.replace(/\d+/g, ""),
+      window.location.pathname.replace(/=\w*/g, "=").replace(/\d+/g, "{id}"),
       "不在Electron中,调用 fs 失败",
     ]);
     createLog({