添加了相关测试文件,引入Tailwindcss
Change-Id: I12054143571bb688590af0357125a0ed26ff2050
diff --git a/src/components/PermissionControl.jsx b/src/components/PermissionControl.jsx
new file mode 100644
index 0000000..9d752ef
--- /dev/null
+++ b/src/components/PermissionControl.jsx
@@ -0,0 +1,15 @@
+import React from 'react';
+
+// 基于角色的UI控制组件
+const RoleBasedControl = ({ allowedRoles, children }) => {
+ const user = JSON.parse(localStorage.getItem('user') || '{}');
+ const userRole = user.role || 'guest';
+
+ if (allowedRoles.includes(userRole)) {
+ return <>{children}</>;
+ }
+
+ return null;
+};
+
+export default RoleBasedControl;
\ No newline at end of file