From 1e528235249124b69f9a1b46c122d9b5e791db01 Mon Sep 17 00:00:00 2001 From: shizhong <124974919@qq.com> Date: Tue, 13 Jun 2023 15:35:13 +0800 Subject: [PATCH] BUG --- src/plugins/tongji/index.ts | 23 +++++++++++++++++++++++ src/views/infra/redis/index.vue | 10 ++++------ src/views/mp/autoReply/index.vue | 2 -- src/views/mp/draft/index.vue | 2 -- src/views/mp/freePublish/index.vue | 2 -- src/views/mp/menu/index.vue | 1 - src/views/mp/tag/index.vue | 2 -- src/views/mp/user/index.vue | 2 -- src/views/system/area/index.vue | 5 ++--- src/views/system/menu/index.vue | 1 - 10 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 src/plugins/tongji/index.ts diff --git a/src/plugins/tongji/index.ts b/src/plugins/tongji/index.ts new file mode 100644 index 00000000..ec261a16 --- /dev/null +++ b/src/plugins/tongji/index.ts @@ -0,0 +1,23 @@ +import router from '@/router' + +// 用于 router push +window._hmt = window._hmt || [] +// HM_ID +const HM_ID = import.meta.env.VITE_APP_BAIDU_CODE +;(function () { + // 有值的时候,才开启 + if (!HM_ID) { + return + } + const hm = document.createElement('script') + hm.src = 'https://hm.baidu.com/hm.js?' + HM_ID + const s = document.getElementsByTagName('script')[0] + s.parentNode.insertBefore(hm, s) +})() + +router.afterEach(function (to) { + if (!HM_ID) { + return + } + _hmt.push(['_trackPageview', to.fullPath]) +}) diff --git a/src/views/infra/redis/index.vue b/src/views/infra/redis/index.vue index f98f2f30..647f5bb5 100644 --- a/src/views/infra/redis/index.vue +++ b/src/views/infra/redis/index.vue @@ -1,6 +1,4 @@