Commit 77aaacb2 authored by 张烨's avatar 张烨

feat: 优化权限提示

parent 7b1ae5fd
import check from '@/components/Authorized/CheckPermissions'; import check from '@/components/Authorized/CheckPermissions';
import React from 'react'; import React from 'react';
import { renderRoutes } from 'react-router-config'; import { renderRoutes } from 'react-router-config';
import page403 from '@/pages/exception/403';
const Layout = ({ children, route }) => ( const Layout = ({ children, route }) => (
<> <>
{children || {children ||
renderRoutes( renderRoutes(
route.routes.filter( route.routes.map(r => {
r => !r.authority || check(r.authority, true, false), if (!r.authority) {
), return r;
}
r.component = check(r.authority, r.component, page403);
return r;
}),
)} )}
</> </>
); );
......
...@@ -62,11 +62,13 @@ export default { ...@@ -62,11 +62,13 @@ export default {
{ {
path: '/dbm/dbInit', path: '/dbm/dbInit',
name: '数据库初始化', name: '数据库初始化',
authority: adminAuthority,
component: InitDataBase, component: InitDataBase,
}, },
{ {
path: '/dbm/dbsm', path: '/dbm/dbsm',
name: '数据库标准化管理', name: '数据库标准化管理',
authority: superAuthority,
component: ManagementDataBase, component: ManagementDataBase,
}, },
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment