import React from 'react'; import RenderAuthorized from '@/components/Authorized'; import Exception from '@/components/Exception'; import { getAuthority } from '@/utils/authority'; import { matchRoutes } from 'react-router-config'; import intersection from 'lodash/intersection'; import { formatMessage } from 'umi/locale'; import Link from 'umi/link'; const Authorized = RenderAuthorized(getAuthority()); export default ({ children, route, location }) => { const routes = matchRoutes(route.routes, location.pathname); let authorities = []; routes.forEach(item => { if (Array.isArray(item.route.authority) && item.route.authority.length) { authorities.push(item.route.authority); } else if (typeof item.route.authority === 'string' && item.route.authority) { authorities.push([item.route.authority]); } }); const noMatch = ( ); return ( {children} ); };