diff --git a/src/layouts/MainLayout.jsx b/src/layouts/MainLayout.jsx
index fc9a1d0..d63246f 100644
--- a/src/layouts/MainLayout.jsx
+++ b/src/layouts/MainLayout.jsx
@@ -28,7 +28,7 @@
 };
 
 const MainLayout = ({ children }) => {
-  const { user, logout } = useAuth();
+  const { user, logout, hasRole } = useAuth();
   const location = useLocation();
 
   // 根据当前路径获取对应的菜单key
@@ -89,7 +89,7 @@
   ];
 
   // 如果用户是管理员，添加管理面板菜单项
-  if (user?.role === "admin") {
+  if (hasRole("admin")) {
     menuItems.push({
       key: "7",
       icon: <SettingOutlined />,
