Browse Source

修改websocket

zhoupeng 2 years ago
parent
commit
81818be34b
2 changed files with 3 additions and 3 deletions
  1. 1 1
      chuanyi_client2/src/App.vue
  2. 2 2
      chuanyi_client2/src/views/login.vue

+ 1 - 1
chuanyi_client2/src/App.vue

@@ -13,7 +13,7 @@ export default {
   name: 'App',
   provide(){
       return {
-        WebSocket:this
+        getWebSocket:this
       }
   },
   metaInfo() {

+ 2 - 2
chuanyi_client2/src/views/login.vue

@@ -74,7 +74,7 @@ import {showAlertWin, showLoading, testHost} from '@/utils/cqcy'
 
 export default {
   name: "Login",
-  inject:['WebSocket'],
+  inject:['getWebSocket'],
   data() {
     /** 表单验证判断:空格 */
     let testKeyBySpace = (rule, value, callback) => {
@@ -135,7 +135,6 @@ export default {
     }
   },
   created() {
-    this.WebSocket.initWebSocket()
     this.getCode();
     this.getCookie();
     this.applicationName = process.env.VUE_APP_SOFTWARENAME
@@ -185,6 +184,7 @@ export default {
           }
           this.loading = true;
           this.$store.dispatch('user/Login', this.loginForm).then(() => {
+            this.getWebSocket.initWebSocket()
             this.$router.push({path: this.redirect || '/', query: {}})
             this.loading = false
           }).catch((e) => {