Browse Source

Merge branch '20200710_pc_vue_new_branch' into 20200916_pc_vue_new_branch

csx 4 years ago
parent
commit
669d9ac1db
3 changed files with 13 additions and 61 deletions
  1. 3 61
      src/App.vue
  2. 9 0
      src/router/modules/dialysis.js
  3. 1 0
      src/xt_pages/index/verify_token.vue

+ 3 - 61
src/App.vue View File

@@ -5,78 +5,20 @@
5 5
 </template>
6 6
 
7 7
 <script>
8
-import axios from 'axios'
9
-import { getOrgs, changeOrg } from "@/api/config";
10 8
 export default {
11 9
   name: "App",
12 10
   data () {
13 11
     return {
14
-      isRouterAlive: true,
15
-
16
-      showErr: false,
17
-      showWsErr: false,
18
-    }
19
-  },
20
-  computed: {
21
-    websocket() {
22
-      return this.$store.state.user.websocket;
12
+      isRouterAlive: true
23 13
     }
24
-  },
25
-  created(){
26
-    getOrgs().then(response => {
27
-      if (response.data.state === 1) {
28
-        var creator = response.data.data.creator;
29
-        console.log("creator", creator);
30
-        sessionStorage.setItem("org_id",creator.org_id);
31
-        sessionStorage.setItem("admin_user_id",creator.admin_user_id);
32
-        this.getToken(creator.org_id,creator.admin_user_id)
33
-      }
34
-    });
35
-    
36
-  },
37
-  methods: {
14
+  }, methods: {
38 15
     reload () {
39 16
       this.isRouterAlive = false
40 17
       this.$nextTick(function () {
41 18
         this.isRouterAlive = true
42 19
       })
43
-    },
44
-    getToken(orgId,adminUserId){
45
-      axios.get('/api/index/gettoken/'+ orgId + '/'+ adminUserId
46
-        ).then((res) => {
47
-        console.log('res',res.data)
48
-        
49
-        if(res.data.code == 0){
50
-          let token = res.data.data.token
51
-          localStorage.setItem("token",token)
52
-          let http = 'ws://socket.sgjyun.com?token='
53
-          console.log(this.$store.state.user.websocket)
54
-          this.$store.state.user.websocket = new ReconnectingWebSocket(
55
-            http + token
56
-          );
57
-          this.$store.state.user.websocket.timeoutInterval = 3000;
58
-          setInterval(() => {
59
-            if (navigator.onLine == false) {
60
-              this.showWsErr = true;
61
-              this.wsErrMsg = "网络已断开,请检查网络后重新打开页面";
62
-              alert(this.wsErrMsg)
63
-              console.log('navigator',navigator)
64
-            } else if (
65
-              navigator.onLine == true &&
66
-              this.websocket.readyState == 1
67
-            ) {
68
-              this.showWsErr = false;
69
-            }
70
-            this.websocket.send("1");
71
-          }, 3000);
72
-        }
73
-        
74
-      }).catch(error => {
75
-          window.location.href = error.response.data.redirect;
76
-        });
77 20
     }
78
-  },
79
-  
21
+  }
80 22
 };
81 23
 </script>
82 24
 

+ 9 - 0
src/router/modules/dialysis.js View File

@@ -11,6 +11,15 @@ export default {
11 11
     icon: 'touxi'
12 12
   },
13 13
   children: [
14
+    {
15
+      path: '/dialysis/home',
16
+      component: () => import('@/xt_pages/home/index'),
17
+      name: 'home',
18
+      meta: {
19
+        title: 'home',
20
+        noCache: true
21
+      }
22
+    },
14 23
     {
15 24
       path: '/dialysis/watch',
16 25
       component: () => import('@/xt_pages/dialysis/bloodPresssWatch'),

+ 1 - 0
src/xt_pages/index/verify_token.vue View File

@@ -16,6 +16,7 @@ export default {
16 16
           this.$router.addRoutes(this.$store.getters.xt_permission.addRouters) // 动态添加可访问路由表
17 17
   //        next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
18 18
           this.$router.replace({ path: '/dialysis/dialysisrecord' })
19
+
19 20
         })
20 21
       })
21 22
     }).catch((error) => {