Browse Source

fix: H5链接新增收集原始链接参数

zhengxy 1 year ago
parent
commit
750a895ef8
1 changed files with 17 additions and 1 deletions
  1. 17 1
      qwh5/src/views/extend.vue

+ 17 - 1
qwh5/src/views/extend.vue

@@ -9,6 +9,19 @@ import $axios from '@/utils/axios'
9 9
 
10 10
 const { proxy } = getCurrentInstance();
11 11
 
12
+const setOriginalLink = () => {
13
+  try {
14
+    const currentTime: any = new Date().getTime()
15
+    const pageStartTime: any = localStorage.getItem('pageStartTime') || 0
16
+    if ((currentTime - Number(pageStartTime)) > 5000) {
17
+      localStorage.setItem('pageStartTime', currentTime)
18
+      localStorage.setItem('_originalLink', window.location.href)
19
+    }
20
+  } catch (error) {
21
+    console.log('error => ')
22
+  }
23
+}
24
+
12 25
 // 异常上报 (step 异常步骤)
13 26
 // [ 1, '链接无企微id' ],
14 27
 // [ 2, '链接无code参数' ],
@@ -17,11 +30,12 @@ const { proxy } = getCurrentInstance();
17 30
 // [ 5, '链接无jumpLink参数' ],
18 31
 const handleWarnReport = async step => {
19 32
   try {
33
+    const _originalLink = localStorage.getItem('_originalLink')
20 34
     const url = '/api/oauth2/warnReport'
21 35
     const params = {
22 36
       step,
23 37
       corpid: getQueryString('corpid') || '0',
24
-      link: window.location.href,
38
+      link: window.location.href + '&_originalLink=' + _originalLink,
25 39
     }
26 40
     await $axios.get(url, {...params})
27 41
   } catch (error) {
@@ -30,6 +44,8 @@ const handleWarnReport = async step => {
30 44
 }
31 45
 
32 46
 onBeforeMount(() => {//组件挂载之前
47
+  setOriginalLink()
48
+
33 49
   if (getQueryString('againJump')) {
34 50
     getUserInfo()
35 51
   } else {//获取用户信息