Browse Source

仅显示有权限的应用

庄逸洲 6 years ago
parent
commit
0326f0189d

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

7
   NODE_ENV: '"development"',
7
   NODE_ENV: '"development"',
8
   ENV_CONFIG: '"dev"',
8
   ENV_CONFIG: '"dev"',
9
   BASE_API: '"http://api.xt.test.sgjyun.com"',//'"http://localhost:9529"', // //http://api.xt.test.sgjyun.com http://112.74.16.180:9527
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
 module.exports = {
1
 module.exports = {
2
   NODE_ENV: '"production"',
2
   NODE_ENV: '"production"',
3
   ENV_CONFIG: '"prod"',
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
 module.exports = {
1
 module.exports = {
2
   NODE_ENV: '"production"',
2
   NODE_ENV: '"production"',
3
   ENV_CONFIG: '"sit"',
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
       patients: 20 // 患者数
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
     urlfors: []
51
     urlfors: []
78
       state.subscibe.period_end = cur_info.subscibe.period_end
80
       state.subscibe.period_end = cur_info.subscibe.period_end
79
       state.subscibe.state = cur_info.subscibe.state
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
     SET_URLFORS: (state, payload) => {
88
     SET_URLFORS: (state, payload) => {
121
       state.subscibe.state = 3
125
       state.subscibe.state = 3
122
       state.subscibe.patients = 0
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
       state.urlfors = []
132
       state.urlfors = []
126
     }
133
     }
127
   },
134
   },
157
             cur_app_id: infoJSON.current_app_id,
164
             cur_app_id: infoJSON.current_app_id,
158
             org: infoJSON.org,
165
             org: infoJSON.org,
159
             subscibe: infoJSON.subscibe,
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
           commit('SET_URLFORS', {
172
           commit('SET_URLFORS', {
168
           verifyToken(token).then(response => {
177
           verifyToken(token).then(response => {
169
             if (response.data.state === 1) {
178
             if (response.data.state === 1) {
170
               // alert('验证通过')
179
               // alert('验证通过')
171
-              console.log('验证通过')
180
+              // console.log('验证通过')
172
               var data = response.data.data
181
               var data = response.data.data
173
               this.commit('SET_CURRENT_INFO', {
182
               this.commit('SET_CURRENT_INFO', {
174
                 user: data.user,
183
                 user: data.user,
176
                 cur_app_id: data.current_app_id,
185
                 cur_app_id: data.current_app_id,
177
                 org: data.org,
186
                 org: data.org,
178
                 subscibe: data.subscibe,
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
               this.commit('SET_URLFORS', {
193
               this.commit('SET_URLFORS', {
213
           current_app_id: state.app_id,
224
           current_app_id: state.app_id,
214
           urlfors: state.urlfors,
225
           urlfors: state.urlfors,
215
           subscibe: state.subscibe,
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
             <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
14
             <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
15
           </a>
15
           </a>
16
         </div>
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
             <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
19
             <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
21
           </a>
20
           </a>
22
         </div>
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
             <span><i class="iconfont icon-pengyou"></i> SCRM</span>
24
             <span><i class="iconfont icon-pengyou"></i> SCRM</span>
27
           </a>
25
           </a>
28
         </div>
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
             <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
29
             <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
33
           </a>
30
           </a>
34
         </div>
31
         </div>
35
 
32
 
36
         <div class="system-nav-menu">
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
             <span><i class="icon iconfont icon-suoyou"></i> 应用</span>
35
             <span><i class="icon iconfont icon-suoyou"></i> 应用</span>
40
           </a>
36
           </a>
41
         </div>
37
         </div>
79
   export default {
75
   export default {
80
     data() {
76
     data() {
81
       return {
77
       return {
82
-        orgname: ''
78
+        // scrm_role_exist: $store.getters.xt_user.scrm_role_exist
83
       }
79
       }
84
     },
80
     },
85
     components: {
81
     components: {
111
       myServe() {
107
       myServe() {
112
         this.$router.push('/service')
108
         this.$router.push('/service')
113
         return false
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
     created() {
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
 </script>
127
 </script>

+ 13 - 13
src/xt_permission.js View File

10
 
10
 
11
 router.beforeEach((to, from, next) => {
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
   NProgress.start()
28
   NProgress.start()