2
0

HomePage.tsx 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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-gray-50 flex flex-col">
  9. {/* 顶部导航 */}
  10. <header className="bg-blue-600 text-white shadow-md fixed w-full z-10">
  11. <div className="container mx-auto px-4 py-3 flex justify-between items-center">
  12. <h1 className="text-xl font-bold">网站首页</h1>
  13. {user ? (
  14. <div className="flex items-center space-x-4">
  15. <div className="flex items-center cursor-pointer" onClick={() => navigate(`/member`)}>
  16. <div className="w-8 h-8 rounded-full bg-white text-blue-600 flex items-center justify-center mr-2">
  17. <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
  18. <path fillRule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clipRule="evenodd" />
  19. </svg>
  20. </div>
  21. <span className="hidden md:inline">{user.username}</span>
  22. </div>
  23. </div>
  24. ) : (
  25. <div className="flex space-x-2">
  26. <button
  27. onClick={() => navigate('/login')}
  28. className="px-4 py-2 rounded text-sm bg-white text-blue-600 hover:bg-blue-50 transition-colors duration-200"
  29. >
  30. 登录
  31. </button>
  32. <button
  33. onClick={() => navigate('/register')}
  34. className="px-4 py-2 rounded text-sm bg-blue-500 text-white hover:bg-blue-600 transition-colors duration-200"
  35. >
  36. 免费试用
  37. </button>
  38. </div>
  39. )}
  40. </div>
  41. </header>
  42. {/* 主内容区 */}
  43. <main className="flex-grow container mx-auto px-4 pt-24 pb-12">
  44. <div className="bg-white rounded-lg shadow-sm p-6 md:p-8">
  45. <h2 className="text-3xl font-bold text-gray-900 mb-4">智能客户关系管理系统</h2>
  46. <p className="text-gray-600 mb-6 text-lg">
  47. 一站式客户管理解决方案,帮助您高效管理客户资源、跟踪销售机会,
  48. 提升转化率和客户满意度。
  49. </p>
  50. <div className="mb-8">
  51. <a
  52. href="/admin"
  53. className="inline-flex items-center px-5 py-2.5 rounded-md text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 transition-colors duration-200 shadow-sm"
  54. >
  55. <svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  56. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 7a4 4 0 11-8 0 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
  57. </svg>
  58. 管理后台入口
  59. </a>
  60. </div>
  61. <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mt-8">
  62. <div className="bg-blue-50 p-6 rounded-lg text-center shadow-sm transition-all duration-300 hover:shadow-md hover:-translate-y-1">
  63. <div className="w-14 h-14 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
  64. <svg xmlns="http://www.w3.org/2000/svg" className="h-7 w-7 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  65. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
  66. </svg>
  67. </div>
  68. <h3 className="font-semibold text-lg mb-2 text-blue-700">客户管理</h3>
  69. <p className="text-gray-600 text-sm">集中管理客户信息,建立完整客户档案,提升客户关系维护效率</p>
  70. </div>
  71. <div className="bg-green-50 p-6 rounded-lg text-center shadow-sm transition-all duration-300 hover:shadow-md hover:-translate-y-1">
  72. <div className="w-14 h-14 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
  73. <svg xmlns="http://www.w3.org/2000/svg" className="h-7 w-7 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  74. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" />
  75. </svg>
  76. </div>
  77. <h3 className="font-semibold text-lg mb-2 text-green-700">销售机会跟踪</h3>
  78. <p className="text-gray-600 text-sm">全流程销售机会管理,从初步接触到成交转化的完整跟踪体系</p>
  79. </div>
  80. <div className="bg-purple-50 p-6 rounded-lg text-center shadow-sm transition-all duration-300 hover:shadow-md hover:-translate-y-1">
  81. <div className="w-14 h-14 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
  82. <svg xmlns="http://www.w3.org/2000/svg" className="h-7 w-7 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  83. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
  84. </svg>
  85. </div>
  86. <h3 className="font-semibold text-lg mb-2 text-purple-700">数据分析报表</h3>
  87. <p className="text-gray-600 text-sm">直观的数据可视化报表,帮助您深入了解业务状况和销售趋势</p>
  88. </div>
  89. </div>
  90. </div>
  91. </main>
  92. {/* 页脚 */}
  93. <footer className="bg-white border-t border-gray-200 py-4">
  94. <div className="container mx-auto px-4 text-center text-gray-500 text-sm">
  95. 网站模板 ©{new Date().getFullYear()} Created with React & Tailwind CSS
  96. <div className="mt-2 space-x-4">
  97. <a href="/ui" className="text-blue-600 hover:underline">Api</a>
  98. </div>
  99. </div>
  100. </footer>
  101. </div>
  102. );
  103. };
  104. export default HomePage;