From 77a2a090ff1b9d1b03795d696954a28ba0e0871f Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Wed, 27 May 2020 14:41:27 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/huge/frontEnd/hugeOA --- src/index.js | 41 +++++++++++++++++++++++------------------ 1 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/index.js b/src/index.js index cb0f05c..642bba7 100644 --- a/src/index.js +++ b/src/index.js @@ -17,6 +17,7 @@ // 公用结构组件 import Menu from './module/menu/menu'; import Header from './components/common/HeadView'; +import Login from './module/login/login'; // oa路由映射 import OaRouteDom from './routeDom/oaRouteDom'; @@ -32,7 +33,7 @@ super(props); this.state = { context: { - role: 'oa', + role: '', roleMenuList: [], setContext: this.setContext, }, @@ -45,23 +46,26 @@ ? JSON.parse(window.localStorage.getItem('menusListByRole')) : []; - let role = Object.keys(menusListByRole).reduce((p, n) => { - if ( - menusListByRole[n].menus - .reduce((p, n) => { - if (n.children) { - return p.concat(n.children); - } else { - return p.concat(n); - } - }, []) - .find(({ path }) => path == pathname) - ) { - return p.concat(n); - } else { - return p; - } - }, []); + let role = Object.keys(menusListByRole) + .reduce((p, n) => { + if ( + menusListByRole[n].menus + .reduce((p, n) => { + if (n.children) { + return p.concat(n.children); + } else { + return p.concat(n); + } + }, []) + .find(({ path }) => path == pathname) + ) { + return p.concat(n); + } else { + return p; + } + }, []) + .join(''); + console.log('role', role); this.setState({ context: { @@ -105,6 +109,7 @@ </Switch> <Layout> <Content> + <Route path="/login" component={()=>( <Login setContext={this.setContext}/>)} /> {context.role == 'oa' && <OaRouteDom />} {context.role == 'user' && <UserRouteDom />} </Content> -- Gitblit v1.8.0