瀏覽代碼

feat: H5异常上报

zhengxy 1 年之前
父節點
當前提交
cc3b3e5499
共有 4 個文件被更改,包括 38 次插入3 次删除
  1. 5 2
      qwh5/public/index.html
  2. 1 0
      qwh5/public/jweixin-1.2.0.js
  3. 1 0
      qwh5/public/jwxwork-1.0.0.js
  4. 31 1
      qwh5/src/App.vue

+ 5 - 2
qwh5/public/index.html

@@ -6,8 +6,11 @@
6 6
       <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
7 7
       <meta http-equiv="pragram" content="no-cache">
8 8
       <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
9
-      <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
10
-      <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
9
+      <!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
10
+      <!-- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> -->
11
+      <script src="./jweixin-1.2.0.js"></script>
12
+      <script src="./jwxwork-1.0.0.js"></script>
13
+
11 14
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
12 15
 <!--    <title><%= htmlWebpackPlugin.options.title %></title>-->
13 16
     <title>猎羽</title>

File diff suppressed because it is too large
+ 1 - 0
qwh5/public/jweixin-1.2.0.js


File diff suppressed because it is too large
+ 1 - 0
qwh5/public/jwxwork-1.0.0.js


+ 31 - 1
qwh5/src/App.vue

@@ -1,7 +1,37 @@
1 1
 <template>
2
-  <router-view/>
2
+  <router-view />
3 3
 </template>
4 4
 
5
+<script lang="ts" setup>
6
+import { onErrorCaptured } from "vue";
7
+import { getQueryString } from '@/utils/common'
8
+import $axios from '@/utils/axios'
9
+
10
+const handleWarnReport = async (step, errMsg?) => {
11
+  try {
12
+    const _originalLink = localStorage.getItem('_originalLink') || ''
13
+    const linkInfo = {
14
+      url: window.location.href,
15
+      originalLink: _originalLink,
16
+      errMsg: errMsg,
17
+    }
18
+    const url = '/api/oauth2/warnReport'
19
+    const params = {
20
+      step,
21
+      corpid: getQueryString('corpid') || '0',
22
+      link: JSON.stringify(linkInfo),
23
+    }
24
+    await $axios.get(url, {...params})
25
+  } catch (error) {
26
+    console.log('error =>', error)
27
+  }
28
+}
29
+
30
+onErrorCaptured((err) => {
31
+  handleWarnReport(8, err.message)
32
+})
33
+</script>
34
+
5 35
 <style>
6 36
 #app {
7 37
   font-family: Avenir, Helvetica, Arial, sans-serif;