添加了相关测试文件,引入Tailwindcss

Change-Id: I12054143571bb688590af0357125a0ed26ff2050
diff --git a/src/contexts/AuthContext.jsx b/src/contexts/AuthContext.jsx
new file mode 100644
index 0000000..9e5bb59
--- /dev/null
+++ b/src/contexts/AuthContext.jsx
@@ -0,0 +1,44 @@
+import React, { createContext, useContext, useState, useEffect } from 'react';
+
+const AuthContext = createContext();
+
+export const AuthProvider = ({ children }) => {
+  const [user, setUser] = useState(null);
+  const [permissions, setPermissions] = useState([]);
+  const [loading, setLoading] = useState(true);
+  
+  useEffect(() => {
+    // 从localStorage加载用户和权限信息
+    const storedUser = localStorage.getItem('user');
+    const storedPermissions = localStorage.getItem('permissions');
+    
+    if (storedUser) {
+      setUser(JSON.parse(storedUser));
+    }
+    
+    if (storedPermissions) {
+      setPermissions(JSON.parse(storedPermissions));
+    }
+    
+    setLoading(false);
+  }, []);
+  
+  // 检查用户是否有特定权限
+  const hasPermission = (permissionName) => {
+    return permissions.includes(permissionName);
+  };
+  
+  // 检查用户是否有特定角色
+  const hasRole = (roleName) => {
+    return user?.role === roleName;
+  };
+  
+  return (
+    <AuthContext.Provider value={{ user, permissions, hasPermission, hasRole, loading }}>
+      {children}
+    </AuthContext.Provider>
+  );
+};
+
+// 自定义hook方便使用
+export const useAuth = () => useContext(AuthContext);
\ No newline at end of file