Browse Source

仅显示有权限的应用

庄逸洲 6 years ago
parent
commit
0326f0189d

+ 6 - 0
config/dev.env.js View File

@@ -7,4 +7,10 @@ module.exports = {
7 7
   NODE_ENV: '"development"',
8 8
   ENV_CONFIG: '"dev"',
9 9
   BASE_API: '"http://api.xt.test.sgjyun.com"',//'"http://localhost:9529"', // //http://api.xt.test.sgjyun.com http://112.74.16.180:9527
10
+
11
+  SSO_HOST: '"http://testsso.sgjyun.com"',
12
+  SRCM_HOST: '"http://test1.sgjyun.com"',
13
+  XT_HOST: '"http://xt.test.sgjyun.com"',
14
+  MIRCO_MALL_HOST: '"http://mall.sgjyun.com"',
15
+  CDM_HOST: '"http://cdm.sgjyun.com"',
10 16
 }

+ 7 - 1
config/prod.env.js View File

@@ -1,5 +1,11 @@
1 1
 module.exports = {
2 2
   NODE_ENV: '"production"',
3 3
   ENV_CONFIG: '"prod"',
4
-  BASE_API: '"http://api.xt.kuyicloud.com"'
4
+  BASE_API: '"http://api.xt.kuyicloud.com"',
5
+
6
+  SSO_HOST: '"http://sso.kuyicloud.com"',
7
+  SRCM_HOST: '"http://jk.kuyicloud.com"',
8
+  XT_HOST: '"http://xt.kuyicloud.com"',
9
+  MIRCO_MALL_HOST: '"http://mall.kuyicloud.com"',
10
+  CDM_HOST: '"http://cdm.kuyicloud.com"',
5 11
 }

+ 7 - 1
config/sit.env.js View File

@@ -1,5 +1,11 @@
1 1
 module.exports = {
2 2
   NODE_ENV: '"production"',
3 3
   ENV_CONFIG: '"sit"',
4
-  BASE_API: '"http://api.xt.test.sgjyun.com"'
4
+  BASE_API: '"http://api.xt.test.sgjyun.com"',
5
+
6
+  SSO_HOST: '"http://testsso.sgjyun.com"',
7
+  SRCM_HOST: '"http://test1.sgjyun.com"',
8
+  XT_HOST: '"http://xt.test.sgjyun.com"',
9
+  MIRCO_MALL_HOST: '"http://mall.sgjyun.com"',
10
+  CDM_HOST: '"http://cdm.sgjyun.com"',
5 11
 }

+ 20 - 7
src/store/modules/xt_user.js View File

@@ -43,7 +43,9 @@ const xt_user = {
43 43
       patients: 20 // 患者数
44 44
     },
45 45
 
46
-    org_app_types: [], // 该用户拥有权限的应用的类型集
46
+    scrm_role_exist: false,
47
+    cdm_role_exist: false,
48
+    mall_role_exist: false,
47 49
 
48 50
     // 示例: ['', '',]
49 51
     urlfors: []
@@ -78,7 +80,9 @@ const xt_user = {
78 80
       state.subscibe.period_end = cur_info.subscibe.period_end
79 81
       state.subscibe.state = cur_info.subscibe.state
80 82
 
81
-      state.org_app_types = cur_info.app_types == null || cur_info.app_types == undefined ? [3] : cur_info.app_types
83
+      state.scrm_role_exist = cur_info.scrm_role_exist
84
+      state.cdm_role_exist = cur_info.cdm_role_exist
85
+      state.mall_role_exist = cur_info.mall_role_exist
82 86
     },
83 87
 
84 88
     SET_URLFORS: (state, payload) => {
@@ -121,7 +125,10 @@ const xt_user = {
121 125
       state.subscibe.state = 3
122 126
       state.subscibe.patients = 0
123 127
 
124
-      state.org_app_types = []
128
+      state.scrm_role_exist = false
129
+      state.cdm_role_exist = false
130
+      state.mall_role_exist = false
131
+
125 132
       state.urlfors = []
126 133
     }
127 134
   },
@@ -157,7 +164,9 @@ const xt_user = {
157 164
             cur_app_id: infoJSON.current_app_id,
158 165
             org: infoJSON.org,
159 166
             subscibe: infoJSON.subscibe,
160
-            app_types: infoJSON.app_types
167
+            scrm_role_exist: infoJSON.scrm_role_exist,
168
+            cdm_role_exist: infoJSON.cdm_role_exist,
169
+            mall_role_exist: infoJSON.mall_role_exist
161 170
           })
162 171
 
163 172
           commit('SET_URLFORS', {
@@ -168,7 +177,7 @@ const xt_user = {
168 177
           verifyToken(token).then(response => {
169 178
             if (response.data.state === 1) {
170 179
               // alert('验证通过')
171
-              console.log('验证通过')
180
+              // console.log('验证通过')
172 181
               var data = response.data.data
173 182
               this.commit('SET_CURRENT_INFO', {
174 183
                 user: data.user,
@@ -176,7 +185,9 @@ const xt_user = {
176 185
                 cur_app_id: data.current_app_id,
177 186
                 org: data.org,
178 187
                 subscibe: data.subscibe,
179
-                app_types: data.app_types
188
+                scrm_role_exist: data.scrm_role_exist,
189
+                cdm_role_exist: data.cdm_role_exist,
190
+                mall_role_exist: data.mall_role_exist
180 191
               })
181 192
 
182 193
               this.commit('SET_URLFORS', {
@@ -213,7 +224,9 @@ const xt_user = {
213 224
           current_app_id: state.app_id,
214 225
           urlfors: state.urlfors,
215 226
           subscibe: state.subscibe,
216
-          app_types: state.org_app_types
227
+          scrm_role_exist: state.scrm_role_exist,
228
+          cdm_role_exist: state.cdm_role_exist,
229
+          mall_role_exist: state.mall_role_exist
217 230
         })
218 231
       )
219 232
     },

+ 20 - 16
src/views/layout/components/Navbar.vue View File

@@ -14,28 +14,24 @@
14 14
             <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
15 15
           </a>
16 16
         </div>
17
-        <div class="system-nav-menu">
18
-          <a href="http://cdm.kuyicloud.com/">
19
-          <!-- <a href=" http://cdm.test.sgjyun.com/"> -->
17
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.cdm_role_exist">
18
+          <a :href="CDMWebsit()">
20 19
             <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
21 20
           </a>
22 21
         </div>
23
-        <div class="system-nav-menu">
24
-          <a  href="http://jk.kuyicloud.com/">
25
-          <!-- <a href="http://test1.sgjyun.com/"> -->
22
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.scrm_role_exist">
23
+          <a :href="SCRMWebsit()">
26 24
             <span><i class="iconfont icon-pengyou"></i> SCRM</span>
27 25
           </a>
28 26
         </div>
29
-        <div class="system-nav-menu">
30
-          <a href="http://mall.kuyicloud.com/">
31
-          <!-- <a href="http://mall.test.sgjyun.com/"> -->
27
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.mall_role_exist">
28
+          <a :href="MircoMallWebsit()">
32 29
             <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
33 30
           </a>
34 31
         </div>
35 32
 
36 33
         <div class="system-nav-menu">
37
-          <a href="http://sso.kuyicloud.com/org/app/create">
38
-          <!-- <a href="http://testsso.sgjyun.com/org/app/create"> -->
34
+          <a :href="APPManageWebsit()">
39 35
             <span><i class="icon iconfont icon-suoyou"></i> 应用</span>
40 36
           </a>
41 37
         </div>
@@ -79,7 +75,7 @@
79 75
   export default {
80 76
     data() {
81 77
       return {
82
-        orgname: ''
78
+        // scrm_role_exist: $store.getters.xt_user.scrm_role_exist
83 79
       }
84 80
     },
85 81
     components: {
@@ -111,13 +107,21 @@
111 107
       myServe() {
112 108
         this.$router.push('/service')
113 109
         return false
110
+      },
111
+      SCRMWebsit() {
112
+        return process.env.SCRM_HOST
113
+      },
114
+      MircoMallWebsit() {
115
+        return process.env.MIRCO_MALL_HOST
116
+      },
117
+      CDMWebsit() {
118
+        return process.env.CDM_HOST
119
+      },
120
+      APPManageWebsit() {
121
+        return process.env.SSO_HOST + '/org/admin/apps?org=' + this.$store.getters.xt_user.org_id
114 122
       }
115
-
116 123
     },
117 124
     created() {
118
-      var xtuser = this.$store.getters.xt_user
119
-      this.orgname = xtuser.org.org_name
120
-      console.log(this.orgname)
121 125
     }
122 126
   }
123 127
 </script>

+ 13 - 13
src/xt_permission.js View File

@@ -10,19 +10,19 @@ const permissionWhiteList = loginWhiteList.concat(['/']) // 权限验证白名
10 10
 
11 11
 router.beforeEach((to, from, next) => {
12 12
   // 线上注释
13
-  if (!store.getters.configlist || store.getters.configlist === undefined || store.getters.configlist.length <= 0) {
14
-    store.dispatch('VerifyConfigList', []).then(() => {
15
-      next()
16
-    })
17
-  }
18
-  if (store.getters.permission_routers === undefined) {
19
-    store.dispatch('xt_GenerateRoutes', []).then(() => {
20
-      next()
21
-    })
22
-  } else {
23
-    next()
24
-  }
25
-  return
13
+  // if (!store.getters.configlist || store.getters.configlist === undefined || store.getters.configlist.length <= 0) {
14
+  //   store.dispatch('VerifyConfigList', []).then(() => {
15
+  //     next()
16
+  //   })
17
+  // }
18
+  // if (store.getters.permission_routers === undefined) {
19
+  //   store.dispatch('xt_GenerateRoutes', []).then(() => {
20
+  //     next()
21
+  //   })
22
+  // } else {
23
+  //   next()
24
+  // }
25
+  // return
26 26
   // 线上注释
27 27
 
28 28
   NProgress.start()