Jelajahi Sumber

发正式版前,请先在main.js里移除Sentry监控初始化,测试服的异常查看:http://192.168.0.109:5501/

ZaiZai 2 tahun lalu
induk
melakukan
bc2e424dc6
8 mengubah file dengan 87 tambahan dan 5 penghapusan
  1. 1 1
      index.html
  2. 1 0
      package.json
  3. 1 1
      public/version.json
  4. 1 1
      src/config/index.json
  5. 17 0
      src/main.js
  6. 6 1
      src/store/modules/user.js
  7. 0 1
      src/views/login/index.vue
  8. 60 0
      yarn.lock

+ 1 - 1
index.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="zh">
     <head>
-        <script type="text/javascript" src="/plugins/webfunny.js"></script>
+        <!--script type="text/javascript" src="/plugins/webfunny.js"></script-->
         <meta charset="UTF-8"/>
         <link rel="icon" href="/favicon.ico"/>
         <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

+ 1 - 0
package.json

@@ -13,6 +13,7 @@
         "lint:fix": "eslint . --fix"
     },
     "dependencies": {
+        "@sentry/vue": "^7.77.0",
         "axios": "^1.5.1",
         "crypto-js": "^4.2.0",
         "dayjs": "^1.11.10",

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20231107112126"
+  "value": "20231107153358"
 }

+ 1 - 1
src/config/index.json

@@ -1,6 +1,6 @@
 {
     "version": "20230607160059",
-    "target": "http://127.0.0.1:8090",
+    "target": "http://192.168.0.109:8090",
     "smsPhone": "",
     "vite": {
         "port": 5174,

+ 17 - 0
src/main.js

@@ -3,6 +3,7 @@ import './styles/app/tailwind.scss'
 import { createApp } from 'vue'
 import setupPinia from './store/init'
 import router, { setupRouter } from './router'
+import * as Sentry from '@sentry/vue'
 import App from './App.vue'
 
 //饿了么UI
@@ -27,6 +28,22 @@ import './styles/app/theme.scss'
 async function bootstrap() {
     const app = createApp(App)
 
+    //目前在测试阶段,发正式版前,请注释 Sentry 监控初始化
+    Sentry.init({
+        app,
+        dsn: 'http://054a995ed4461324b75ac84cf37b9fb8@192.168.0.109:5501/2',
+        integrations: [
+            new Sentry.BrowserTracing({
+                //tracePropagationTargets: ['localhost'],
+                routingInstrumentation: Sentry.vueRouterInstrumentation(router),
+            }),
+            new Sentry.Replay(),
+        ],
+        tracesSampleRate: 1.0,
+        replaysSessionSampleRate: 0.1,
+        replaysOnErrorSampleRate: 1.0,
+    })
+
     // 挂载状态管理
     app.use(setupPinia)
 

+ 6 - 1
src/store/modules/user.js

@@ -9,6 +9,7 @@ import { logout, refreshToken, userLogin } from '~api/user'
 import { userConfigInfo, userConfigSave } from '~api/other'
 import { ArrToOneObj, arrIndex, getArrValue, getObjValue } from 'js-fast-way'
 import { useOsTheme } from 'hc-vue3-ui'
+import * as Sentry from '@sentry/vue'
 
 //初始变量
 const store = useAppStore(pinia)
@@ -21,11 +22,15 @@ export const useAppLogin = async (form) => {
         store.setRefreshTokenVal(res['refresh_token'])
         store.setTenantId(res['tenant_id'])
         store.setUserInfo(res)
-        window.localStorage.wmUserInfo = JSON.stringify({
+        /*window.localStorage.wmUserInfo = JSON.stringify({
             userId: res['user_id'],
             userTag: res['real_name'],
             projectVersion: '3.5.0',
             env: 'pro',
+        })*/
+        Sentry.setUser({
+            id: res['user_id'],
+            username: res['real_name'],
         })
         const routerRes = await setRouterData()
         if (!routerRes) {

+ 0 - 1
src/views/login/index.vue

@@ -205,7 +205,6 @@ const formValidateClick = async () => {
             } else {
                 router.push({ path: '/home/index/static' })
             }
-            
         }).catch(() => {
             loading.value = false
         })

+ 60 - 0
yarn.lock

@@ -263,6 +263,66 @@
   resolved "https://registry.npmjs.org/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz"
   integrity sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==
 
+"@sentry-internal/tracing@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry-internal/tracing/-/tracing-7.77.0.tgz#f3d82486f8934a955b3dd2aa54c8d29586e42a37"
+  integrity sha512-8HRF1rdqWwtINqGEdx8Iqs9UOP/n8E0vXUu3Nmbqj4p5sQPA7vvCfq+4Y4rTqZFc7sNdFpDsRION5iQEh8zfZw==
+  dependencies:
+    "@sentry/core" "7.77.0"
+    "@sentry/types" "7.77.0"
+    "@sentry/utils" "7.77.0"
+
+"@sentry/browser@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/browser/-/browser-7.77.0.tgz#155440f1a0d3a1bbd5d564c28d6b0c9853a51d72"
+  integrity sha512-nJ2KDZD90H8jcPx9BysQLiQW+w7k7kISCWeRjrEMJzjtge32dmHA8G4stlUTRIQugy5F+73cOayWShceFP7QJQ==
+  dependencies:
+    "@sentry-internal/tracing" "7.77.0"
+    "@sentry/core" "7.77.0"
+    "@sentry/replay" "7.77.0"
+    "@sentry/types" "7.77.0"
+    "@sentry/utils" "7.77.0"
+
+"@sentry/core@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/core/-/core-7.77.0.tgz#21100843132beeeff42296c8370cdcc7aa1d8510"
+  integrity sha512-Tj8oTYFZ/ZD+xW8IGIsU6gcFXD/gfE+FUxUaeSosd9KHwBQNOLhZSsYo/tTVf/rnQI/dQnsd4onPZLiL+27aTg==
+  dependencies:
+    "@sentry/types" "7.77.0"
+    "@sentry/utils" "7.77.0"
+
+"@sentry/replay@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/replay/-/replay-7.77.0.tgz#21d242c9cd70a7235237216174873fd140b6eb80"
+  integrity sha512-M9Ik2J5ekl+C1Och3wzLRZVaRGK33BlnBwfwf3qKjgLDwfKW+1YkwDfTHbc2b74RowkJbOVNcp4m8ptlehlSaQ==
+  dependencies:
+    "@sentry-internal/tracing" "7.77.0"
+    "@sentry/core" "7.77.0"
+    "@sentry/types" "7.77.0"
+    "@sentry/utils" "7.77.0"
+
+"@sentry/types@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/types/-/types-7.77.0.tgz#c5d00fe547b89ccde59cdea59143bf145cee3144"
+  integrity sha512-nfb00XRJVi0QpDHg+JkqrmEBHsqBnxJu191Ded+Cs1OJ5oPXEW6F59LVcBScGvMqe+WEk1a73eH8XezwfgrTsA==
+
+"@sentry/utils@7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/utils/-/utils-7.77.0.tgz#1f88501f0b8777de31b371cf859d13c82ebe1379"
+  integrity sha512-NmM2kDOqVchrey3N5WSzdQoCsyDkQkiRxExPaNI2oKQ/jMWHs9yt0tSy7otPBcXs0AP59ihl75Bvm1tDRcsp5g==
+  dependencies:
+    "@sentry/types" "7.77.0"
+
+"@sentry/vue@^7.77.0":
+  version "7.77.0"
+  resolved "http://47.110.251.215:9000/@sentry/vue/-/vue-7.77.0.tgz#044c9e0853bbb17c0440d86934da666a1e3acf3e"
+  integrity sha512-mYGkahnLAL9t3XKTTonHC+cv5EN/hjlW4tCRMiOVbR3eN3hXTtFCc4bKC5lHGLTLhx4U7Flc7JXmajw3tJOLBQ==
+  dependencies:
+    "@sentry/browser" "7.77.0"
+    "@sentry/core" "7.77.0"
+    "@sentry/types" "7.77.0"
+    "@sentry/utils" "7.77.0"
+
 "@trysound/sax@0.2.0":
   version "0.2.0"
   resolved "http://47.110.251.215:9000/@trysound/sax/-/sax-0.2.0.tgz"