From 7aa9a1ab367c658a9eda683931332b02321c18e1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 22 Apr 2023 22:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=95=8C=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E6=94=AF=E6=8C=81=E7=9A=84=20T=20?= =?UTF-8?q?=E5=92=8C=20G=20=E7=99=BB=E5=BD=95=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 ++ .env.development | 3 +++ .env.front | 3 +++ .env.production | 5 ++++- .env.test | 5 ++++- src/main.ts | 2 ++ src/utils/tongji.ts | 23 +++++++++++++++++++++++ src/views/base/login/LoginForm.vue | 15 ++++++++++++--- 8 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 src/utils/tongji.ts diff --git a/.env b/.env index 57bfc6b7..5f9b194b 100644 --- a/.env +++ b/.env @@ -13,3 +13,5 @@ VITE_GLOB_APP_TENANT_ENABLE = true # 验证码的开关 VITE_GLOB_APP_CAPTCHA_ENABLE = true +# 百度统计 +VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/.env.development b/.env.development index 9c8ba136..1eb7327e 100644 --- a/.env.development +++ b/.env.development @@ -23,3 +23,6 @@ VITE_GLOB_UPLOAD_URL = /upload # 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换 VITE_GLOB_API_URL_PREFIX = + +# 百度统计 +VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/.env.front b/.env.front index 699b32c9..f4506bce 100644 --- a/.env.front +++ b/.env.front @@ -23,3 +23,6 @@ VITE_GLOB_UPLOAD_URL = /upload # 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换 VITE_GLOB_API_URL_PREFIX = + +# 百度统计 +VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/.env.production b/.env.production index 704af928..8dd383c4 100644 --- a/.env.production +++ b/.env.production @@ -20,7 +20,10 @@ VITE_GLOB_API_URL = /admin-api VITE_GLOB_UPLOAD_URL = /upload # 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换 -VITE_GLOB_API_URL_PREFIX = +VITE_GLOB_API_URL_PREFIX = # 打包是否开启pwa功能 VITE_USE_PWA = false + +# 百度统计 +VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/.env.test b/.env.test index d9bc0a9c..f58e65a3 100644 --- a/.env.test +++ b/.env.test @@ -21,7 +21,10 @@ VITE_GLOB_API_URL = /admin-api VITE_GLOB_UPLOAD_URL = /upload # 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换 -VITE_GLOB_API_URL_PREFIX = +VITE_GLOB_API_URL_PREFIX = # 打包是否开启pwa功能 VITE_USE_PWA = false + +# 百度统计 +VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/src/main.ts b/src/main.ts index fea3be6f..159c9ceb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,6 +21,8 @@ if (isDevMode()) { import('ant-design-vue/dist/antd.less') } +import '@/utils/tongji' // 百度统计 + async function bootstrap() { const app = createApp(App) diff --git a/src/utils/tongji.ts b/src/utils/tongji.ts new file mode 100644 index 00000000..c912a850 --- /dev/null +++ b/src/utils/tongji.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/base/login/LoginForm.vue b/src/views/base/login/LoginForm.vue index aff968fa..35f54fd9 100644 --- a/src/views/base/login/LoginForm.vue +++ b/src/views/base/login/LoginForm.vue @@ -68,8 +68,17 @@ - - + + + + + + 萌新必读 +
+ + + +
@@ -78,7 +87,7 @@ import { reactive, ref, unref, computed } from 'vue' import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue' -import { GithubFilled, WechatFilled, AlipayCircleFilled, GoogleCircleFilled, TwitterCircleFilled } from '@ant-design/icons-vue' +import { GithubFilled, WechatFilled, AlipayCircleFilled } from '@ant-design/icons-vue' import LoginFormTitle from './LoginFormTitle.vue' import { useI18n } from '@/hooks/web/useI18n'