fix: 修改路由筛选
This commit is contained in:
parent
55c472b840
commit
adcad7769e
@ -5,7 +5,7 @@ export default [
|
|||||||
]},
|
]},
|
||||||
{path:"/", redirect: "/home"},
|
{path:"/", redirect: "/home"},
|
||||||
|
|
||||||
{ path: '/home', name :"首页", icon: "PieChartOutlined", component: './HomePage' },
|
{ path: '/home', name :"首页", icon: "PieChartOutlined", component: './HomePage',access: 'canAdmin', },
|
||||||
{ path: '/add_chart', name :"智能分析", icon: "barChart", component: './AddChart' },
|
{ path: '/add_chart', name :"智能分析", icon: "barChart", component: './AddChart' },
|
||||||
{ path: '/add_async', name: "异步分析", icon: "DotChartOutlined", component: './AddChartAsync' },
|
{ path: '/add_async', name: "异步分析", icon: "DotChartOutlined", component: './AddChartAsync' },
|
||||||
{ path: '/my_chart', name: "我的图表", icon: "PictureOutlined", component: './MyChart' },
|
{ path: '/my_chart', name: "我的图表", icon: "PictureOutlined", component: './MyChart' },
|
||||||
@ -29,7 +29,7 @@ export default [
|
|||||||
path: '/admin',
|
path: '/admin',
|
||||||
name: '后台管理',
|
name: '后台管理',
|
||||||
icon: 'crown',
|
icon: 'crown',
|
||||||
// access: 'canAdmin',
|
access: 'canAdmin',
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/admin', redirect: '/admin/sub-page' },
|
{ path: '/admin', redirect: '/admin/sub-page' },
|
||||||
{ path: '/admin/sub-page', name: '论坛管理', component: './Admin' },
|
{ path: '/admin/sub-page', name: '论坛管理', component: './Admin' },
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
* */
|
* */
|
||||||
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
|
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
|
||||||
const { currentUser } = initialState ?? {};
|
const { currentUser } = initialState ?? {};
|
||||||
|
console.log('currentUser',currentUser)
|
||||||
return {
|
return {
|
||||||
canAdmin: currentUser && currentUser.access === 'admin',
|
canAdmin: currentUser && currentUser.userRole === 'admin',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user