| | |
| | | import { Spin, Layout, Menu, Icon } from 'antd'; |
| | | import MenView from '../../components/common/MenuView'; |
| | | import { menus, getMenuListByPermission } from '../../menu'; |
| | | import fetch from '../../api/request'; |
| | | |
| | | // import Fetch from '../fetch'; |
| | | const { Sider } = Layout; |
| | | |
| | | function find(data, pathname) { |
| | |
| | | }; |
| | | } |
| | | |
| | | componentDidMount() { |
| | | this.setState({ data: menus }); |
| | | componentWillMount() { |
| | | // 获取从登录页面记录在缓存里的菜单数据 |
| | | let menu = window.localStorage.getItem('menu') ? JSON.parse(window.localStorage.getItem('menu')) : []; |
| | | let permList = menu && menu.map(({ symbol }) => (symbol)).concat(menu.map(({ moduleSymbol }) => (moduleSymbol))).reduce((p, n) => { |
| | | if (p.indexOf(n) == -1) { |
| | | return p.concat(n) |
| | | } else { |
| | | return p |
| | | } |
| | | }, []); |
| | | console.log(getMenuListByPermission(menus, permList) ) |
| | | this.setState({ data: getMenuListByPermission(menus, permList) }); |
| | | } |
| | | componentDidMount() { } |
| | | |
| | | onCollapse = collapsed => { |
| | | this.setState({ collapsed }); |