瀏覽代碼

减少百度统计路径

Michael Wang 5 年之前
父節點
當前提交
51e9ccff62
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/utils/axios.js

+ 8 - 3
src/utils/axios.js

@@ -77,8 +77,10 @@ qmInstance.interceptors.response.use(
 
 
       let detailInfo = "";
       let detailInfo = "";
       try {
       try {
-        detailInfo +=
-          error.config.url.replace(/=\w*/g, "=").replace(/\/\d+\//g, "/{id}/") +
+        (detailInfo += error.config.url
+          .replace(/=\w*/g, "=")
+          .replace(/\/\d+\//g, "/{id}/")
+          .replace(/\/\d+$/g, "/{id}")) +
           " ||| " +
           " ||| " +
           error.message;
           error.message;
       } catch (error) {
       } catch (error) {
@@ -164,7 +166,10 @@ qmInstance.interceptors.response.use(
         "_trackEvent",
         "_trackEvent",
         location.pathname.replace(/\d+/g, ""),
         location.pathname.replace(/\d+/g, ""),
         "status: " + status,
         "status: " + status,
-        error.config.url.replace(/=\w*/g, "=").replace(/\/\d+\//g, "/{id}/"),
+        error.config.url
+          .replace(/=\w*/g, "=")
+          .replace(/\/\d+\//g, "/{id}/")
+          .replace(/\/\d+$/g, "/{id}"),
       ]);
       ]);
       if (
       if (
         wk_token &&
         wk_token &&