提交 9db33249 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 增加角色判断

上级 21db2050
...@@ -8,6 +8,7 @@ Vue.use(Vuex) ...@@ -8,6 +8,7 @@ Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
user: {}, user: {},
role: {},
permissions: [], permissions: [],
appConfig: {}, appConfig: {},
appConfigList appConfigList
...@@ -19,6 +20,9 @@ const store = new Vuex.Store({ ...@@ -19,6 +20,9 @@ const store = new Vuex.Store({
setPermissions(state, permissions) { setPermissions(state, permissions) {
state.permissions = permissions state.permissions = permissions
}, },
setRole(state, role) {
state.role = role
},
setAppConfig(state, appConfig) { setAppConfig(state, appConfig) {
state.appConfig = appConfig state.appConfig = appConfig
localStorage.setItem('app_config', JSON.stringify(appConfig)) localStorage.setItem('app_config', JSON.stringify(appConfig))
...@@ -61,6 +65,7 @@ const store = new Vuex.Store({ ...@@ -61,6 +65,7 @@ const store = new Vuex.Store({
await getPermissions().then(res => { await getPermissions().then(res => {
if (res.data && res.data.items) { if (res.data && res.data.items) {
commit('setPermissions', res.data.items) commit('setPermissions', res.data.items)
commit('setRole', res.data.organization.role)
} }
}) })
}, },
......
...@@ -31,5 +31,12 @@ export default async function (to, from, next) { ...@@ -31,5 +31,12 @@ export default async function (to, from, next) {
return return
} }
// BFI机构管理员
const role = store.state.role
if (role.id === '70033365707403264' && !to.path.includes('bfi')) {
next('/bfi/cert')
return
}
next() next()
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论