HomePage.tsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. import React from 'react';
  2. import { useAuth } from '@/client/home/hooks/AuthProvider';
  3. import { useNavigate } from 'react-router-dom';
  4. const HomePage: React.FC = () => {
  5. const { user } = useAuth();
  6. const navigate = useNavigate();
  7. return (
  8. <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 flex flex-col">
  9. {/* 顶部导航 */}
  10. <header className="bg-white shadow-sm border-b border-gray-100 fixed w-full z-10">
  11. <div className="container mx-auto px-4 py-4 flex justify-between items-center">
  12. <div className="flex items-center space-x-2">
  13. <div className="w-8 h-8 bg-gradient-to-r from-blue-600 to-purple-600 rounded-lg flex items-center justify-center">
  14. <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  15. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
  16. </svg>
  17. </div>
  18. <h1 className="text-xl font-bold text-gray-900">云存储平台</h1>
  19. </div>
  20. {user ? (
  21. <div className="flex items-center space-x-4">
  22. <a
  23. href="/admin/files"
  24. className="text-sm text-gray-600 hover:text-blue-600 transition-colors"
  25. >
  26. 文件管理
  27. </a>
  28. <div className="flex items-center cursor-pointer hover:bg-gray-50 rounded-lg px-3 py-2 transition-colors" onClick={() => navigate(`/member`)}>
  29. <div className="w-8 h-8 rounded-full bg-gradient-to-r from-blue-500 to-purple-500 flex items-center justify-center mr-2">
  30. <span className="text-white text-sm font-medium">{user.username.charAt(0).toUpperCase()}</span>
  31. </div>
  32. <span className="hidden md:inline text-sm text-gray-700">{user.username}</span>
  33. </div>
  34. </div>
  35. ) : (
  36. <div className="flex space-x-3">
  37. <button
  38. onClick={() => navigate('/login')}
  39. className="px-4 py-2 rounded-lg text-sm text-blue-600 hover:bg-blue-50 transition-colors"
  40. >
  41. 登录
  42. </button>
  43. <button
  44. onClick={() => navigate('/register')}
  45. className="px-4 py-2 rounded-lg text-sm bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-700 hover:to-purple-700 transition-all shadow-sm hover:shadow-md"
  46. >
  47. 免费注册
  48. </button>
  49. </div>
  50. )}
  51. </div>
  52. </header>
  53. {/* 主内容区 */}
  54. <main className="flex-grow container mx-auto px-4 pt-24 pb-12">
  55. {/* 英雄区域 */}
  56. <div className="text-center py-12">
  57. <h2 className="text-4xl md:text-5xl font-bold text-gray-900 mb-6">
  58. 安全、高效的
  59. <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600"> 文件存储平台</span>
  60. </h2>
  61. <p className="text-lg text-gray-600 mb-8 max-w-2xl mx-auto">
  62. 基于 MinIO 构建的企业级云存储解决方案,支持大文件分片上传、断点续传、
  63. 文件预览与分享,为您的数据提供银行级安全保障。
  64. </p>
  65. <div className="flex flex-col sm:flex-row gap-4 justify-center">
  66. <a
  67. href={user ? '/admin/files' : '/register'}
  68. className="px-8 py-3 rounded-lg bg-gradient-to-r from-blue-600 to-purple-600 text-white font-medium hover:from-blue-700 hover:to-purple-700 transition-all shadow-lg hover:shadow-xl"
  69. >
  70. {user ? '进入文件管理' : '立即开始使用'}
  71. </a>
  72. <a
  73. href="/admin"
  74. className="px-8 py-3 rounded-lg border border-gray-300 text-gray-700 font-medium hover:bg-gray-50 transition-colors"
  75. >
  76. 管理后台
  77. </a>
  78. </div>
  79. </div>
  80. {/* 功能特性 */}
  81. <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mt-16">
  82. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100 hover:shadow-md transition-shadow">
  83. <div className="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mb-4">
  84. <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  85. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
  86. </svg>
  87. </div>
  88. <h3 className="font-semibold text-lg mb-2">大文件上传</h3>
  89. <p className="text-gray-600 text-sm">支持分片上传,单个文件最大可达 5TB,断点续传不中断</p>
  90. </div>
  91. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100 hover:shadow-md transition-shadow">
  92. <div className="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mb-4">
  93. <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  94. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
  95. </svg>
  96. </div>
  97. <h3 className="font-semibold text-lg mb-2">文件管理</h3>
  98. <p className="text-gray-600 text-sm">完整的文件生命周期管理,支持文件预览、下载、分享和版本控制</p>
  99. </div>
  100. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100 hover:shadow-md transition-shadow">
  101. <div className="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
  102. <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  103. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
  104. </svg>
  105. </div>
  106. <h3 className="font-semibold text-lg mb-2">安全保障</h3>
  107. <p className="text-gray-600 text-sm">端到端加密存储,多重备份机制,确保数据安全可靠</p>
  108. </div>
  109. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100 hover:shadow-md transition-shadow">
  110. <div className="w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center mb-4">
  111. <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-orange-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  112. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" />
  113. </svg>
  114. </div>
  115. <h3 className="font-semibold text-lg mb-2">多端同步</h3>
  116. <p className="text-gray-600 text-sm">支持Web、移动端等多平台访问,随时随地管理您的文件</p>
  117. </div>
  118. </div>
  119. {/* 技术架构 */}
  120. <div className="mt-16 bg-white rounded-xl p-8 shadow-sm border border-gray-100">
  121. <h3 className="text-2xl font-bold text-center mb-8">技术架构</h3>
  122. <div className="grid grid-cols-1 md:grid-cols-3 gap-8">
  123. <div className="text-center">
  124. <div className="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
  125. <span className="text-2xl font-bold text-blue-600">R</span>
  126. </div>
  127. <h4 className="font-semibold mb-2">React 18</h4>
  128. <p className="text-sm text-gray-600">现代化的前端框架,提供流畅的用户体验</p>
  129. </div>
  130. <div className="text-center">
  131. <div className="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
  132. <span className="text-2xl font-bold text-green-600">M</span>
  133. </div>
  134. <h4 className="font-semibold mb-2">MinIO</h4>
  135. <p className="text-sm text-gray-600">高性能对象存储,支持S3协议的标准云存储</p>
  136. </div>
  137. <div className="text-center">
  138. <div className="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
  139. <span className="text-2xl font-bold text-purple-600">T</span>
  140. </div>
  141. <h4 className="font-semibold mb-2">TypeScript</h4>
  142. <p className="text-sm text-gray-600">类型安全的开发体验,提升代码质量和可维护性</p>
  143. </div>
  144. </div>
  145. </div>
  146. {/* 文件管理功能预览 */}
  147. <div className="mt-16">
  148. <div className="text-center mb-8">
  149. <h3 className="text-2xl font-bold mb-4">文件管理功能一览</h3>
  150. <p className="text-gray-600">完整的文件生命周期管理解决方案</p>
  151. </div>
  152. <div className="grid grid-cols-1 md:grid-cols-2 gap-8">
  153. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100">
  154. <h4 className="font-semibold text-lg mb-4 flex items-center">
  155. <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  156. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
  157. </svg>
  158. 核心功能
  159. </h4>
  160. <ul className="space-y-2 text-sm text-gray-600">
  161. <li>• 支持多种文件格式上传(图片、文档、视频、音频等)</li>
  162. <li>• 大文件分片上传,支持断点续传</li>
  163. <li>• 文件预览功能(图片、PDF、文本等)</li>
  164. <li>• 文件搜索和分类管理</li>
  165. <li>• 文件分享和权限控制</li>
  166. </ul>
  167. </div>
  168. <div className="bg-white rounded-xl p-6 shadow-sm border border-gray-100">
  169. <h4 className="font-semibold text-lg mb-4 flex items-center">
  170. <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  171. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
  172. </svg>
  173. 技术特性
  174. </h4>
  175. <ul className="space-y-2 text-sm text-gray-600">
  176. <li>• RESTful API 设计,支持分页查询</li>
  177. <li>• 文件元数据存储(类型、大小、描述等)</li>
  178. <li>• 用户关联,支持个人文件管理</li>
  179. <li>• 时间戳记录,完整的操作日志</li>
  180. <li>• 响应式设计,适配多端访问</li>
  181. </ul>
  182. </div>
  183. </div>
  184. </div>
  185. </main>
  186. {/* 页脚 */}
  187. <footer className="bg-white border-t border-gray-100 py-8">
  188. <div className="container mx-auto px-4">
  189. <div className="text-center">
  190. <p className="text-gray-600 mb-4">
  191. 基于 MinIO 的企业级云存储解决方案
  192. </p>
  193. <div className="flex justify-center space-x-6 text-sm">
  194. <a href="/admin" className="text-blue-600 hover:text-blue-700 transition-colors">管理后台</a>
  195. <a href="/ui" className="text-blue-600 hover:text-blue-700 transition-colors">API 文档</a>
  196. </div>
  197. <p className="text-gray-400 text-xs mt-4">
  198. © {new Date().getFullYear()} 云存储平台. Built with React, TypeScript & MinIO
  199. </p>
  200. </div>
  201. </div>
  202. </footer>
  203. </div>
  204. );
  205. };
  206. export default HomePage;