Bläddra i källkod

Merge branch 'tmp' into develop

scorpio 2 år sedan
förälder
incheckning
df2f3a411c
3 ändrade filer med 5 tillägg och 8 borttagningar
  1. 1 0
      src/App.vue
  2. 3 0
      src/config/website.js
  3. 1 8
      src/layout/top.vue

+ 1 - 0
src/App.vue

@@ -50,6 +50,7 @@ export default {
   },
   mounted() {
     window.addEventListener('scroll', this.menu)
+    console.log(import.meta.env.DEV)
   },
   methods: {
     router,

+ 3 - 0
src/config/website.js

@@ -7,6 +7,9 @@ export default {
   clientId: 'project_web', // 客户端id
   clientSecret: 'project_web_key', // 客户端密钥
   statusWhiteList: [],
+  wss: import.meta.env.DEV
+    ? 'ws://dev.wutongshucloud.com/ws/websocket/'
+    : 'wss://prod.wutongshucloud.com/ws/websocket/',
   reportTypes: [
     {
       label: '未备案/批复',

+ 1 - 8
src/layout/top.vue

@@ -171,14 +171,7 @@ export default {
   },
   methods: {
     initWebSocket() {
-      console.log(window.location.href)
-
-      const url =
-        window.location.href.indexOf('https') > -1
-          ? window.location.href.replace('https', 'wss')
-          : window.location.href.replace('http', 'ws')
-      const wsuri = url + 'websocket/' + this.user.info.userId
-      console.log(wsuri)
+      const wsuri = config.wss + this.user.info.userId
       this.websock = new WebSocket(wsuri)
       this.websock.onmessage = this.websocketonmessage
       // 连接建立时触发