|
|
@@ -1,91 +1,187 @@
|
|
|
-import React from 'react';
|
|
|
-import { useAuth } from '@/client/mobile/hooks/AuthProvider';
|
|
|
+import React, { useState } from 'react';
|
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
-import Footer from '@/client/mobile/components/Footer';
|
|
|
+import { useAuth } from '../hooks/AuthProvider';
|
|
|
|
|
|
+// 首页组件 - 银龄智慧平台主入口
|
|
|
const HomePage: React.FC = () => {
|
|
|
- const { user } = useAuth();
|
|
|
const navigate = useNavigate();
|
|
|
+ const { user } = useAuth();
|
|
|
+ const [searchQuery, setSearchQuery] = useState('');
|
|
|
+
|
|
|
+ // 轮播图数据
|
|
|
+ const carouselItems = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ title: '银龄智慧平台上线啦',
|
|
|
+ description: '为银龄群体打造的专业服务平台',
|
|
|
+ image: 'https://picsum.photos/id/1/800/400',
|
|
|
+ link: '/silver-jobs'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ title: '时间银行互助养老',
|
|
|
+ description: '存储时间,收获温暖',
|
|
|
+ image: 'https://picsum.photos/id/2/800/400',
|
|
|
+ link: '/time-bank'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 服务分类数据
|
|
|
+ const serviceCategories = [
|
|
|
+ { name: '银龄岗', icon: '💼', path: '/silver-jobs', color: 'bg-blue-500' },
|
|
|
+ { name: '银龄库', icon: '👥', path: '/silver-talents', color: 'bg-green-500' },
|
|
|
+ { name: '银龄智库', icon: '📚', path: '/silver-wisdom', color: 'bg-purple-500' },
|
|
|
+ { name: '老年大学', icon: '🎓', path: '/elderly-university', color: 'bg-orange-500' },
|
|
|
+ { name: '时间银行', icon: '⏰', path: '/time-bank', color: 'bg-red-500' },
|
|
|
+ { name: '政策资讯', icon: '📰', path: '/policy-news', color: 'bg-indigo-500' }
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 推荐数据
|
|
|
+ const recommendedItems = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ title: '教育培训师',
|
|
|
+ company: '智慧学堂',
|
|
|
+ salary: '面议',
|
|
|
+ image: 'https://picsum.photos/id/20/200/200',
|
|
|
+ tags: ['兼职', '教育']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ title: '健康咨询师',
|
|
|
+ company: '社区服务中心',
|
|
|
+ salary: '3000-5000元/月',
|
|
|
+ image: 'https://picsum.photos/id/21/200/200',
|
|
|
+ tags: ['健康', '咨询']
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ const handleSearch = () => {
|
|
|
+ if (searchQuery.trim()) {
|
|
|
+ // 实现搜索逻辑
|
|
|
+ console.log('搜索:', searchQuery);
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
return (
|
|
|
- <div className="min-h-screen bg-gray-50 flex flex-col">
|
|
|
- {/* 顶部导航 */}
|
|
|
- <header className="bg-blue-600 text-white shadow-md fixed w-full z-10">
|
|
|
- <div className="container mx-auto px-4 py-3 flex justify-between items-center">
|
|
|
- <h1 className="text-xl font-bold">银龄服务</h1>
|
|
|
- {user ? (
|
|
|
- <div className="flex items-center space-x-4">
|
|
|
- <div className="flex items-center cursor-pointer" onClick={() => navigate(`/member`)}>
|
|
|
- <div className="w-8 h-8 rounded-full bg-white text-blue-600 flex items-center justify-center mr-2">
|
|
|
- <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
|
- <path fillRule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clipRule="evenodd" />
|
|
|
- </svg>
|
|
|
- </div>
|
|
|
- <span className="hidden md:inline">{user.username}</span>
|
|
|
+ <div className="min-h-screen bg-gray-50">
|
|
|
+ {/* 顶部导航栏 */}
|
|
|
+ <header className="bg-white shadow-sm sticky top-0 z-10">
|
|
|
+ <div className="px-4 py-3">
|
|
|
+ <div className="flex items-center justify-between mb-3">
|
|
|
+ <h1 className="text-xl font-bold text-blue-600">银龄智慧平台</h1>
|
|
|
+ {user ? (
|
|
|
+ <div className="flex items-center space-x-2">
|
|
|
+ <span className="text-sm text-gray-600">欢迎,{user.username}</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ) : (
|
|
|
- <div className="flex space-x-2">
|
|
|
+ ) : (
|
|
|
<button
|
|
|
onClick={() => navigate('/login')}
|
|
|
- className="px-3 py-1 rounded text-sm bg-white text-blue-600 hover:bg-blue-50"
|
|
|
+ className="text-blue-600 text-sm px-3 py-1 rounded-full border border-blue-600"
|
|
|
>
|
|
|
登录
|
|
|
</button>
|
|
|
- <button
|
|
|
- onClick={() => navigate('/register')}
|
|
|
- className="px-3 py-1 rounded text-sm bg-white text-blue-600 hover:bg-blue-50"
|
|
|
- >
|
|
|
- 注册
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- )}
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 搜索栏 */}
|
|
|
+ <div className="flex items-center bg-gray-100 rounded-full px-4 py-2">
|
|
|
+ <svg className="w-5 h-5 text-gray-400 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
|
+ </svg>
|
|
|
+ <input
|
|
|
+ type="text"
|
|
|
+ placeholder="搜索岗位、人才、知识..."
|
|
|
+ value={searchQuery}
|
|
|
+ onChange={(e) => setSearchQuery(e.target.value)}
|
|
|
+ onKeyPress={(e) => e.key === 'Enter' && handleSearch()}
|
|
|
+ className="flex-1 bg-transparent outline-none text-sm"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</header>
|
|
|
-
|
|
|
- {/* 主内容区 */}
|
|
|
- <main className="flex-grow container mx-auto px-4 pt-24 pb-12">
|
|
|
- <div className="bg-white rounded-lg shadow-sm p-6 md:p-8">
|
|
|
- <h2 className="text-2xl font-bold text-gray-900 mb-4">欢迎使用网站模板</h2>
|
|
|
- <p className="text-gray-600 mb-6">
|
|
|
- 这是一个通用的网站首页模板,您可以根据需要进行自定义。
|
|
|
- 已包含基础的登录、注册和用户中心功能。
|
|
|
- </p>
|
|
|
-
|
|
|
- <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mt-8">
|
|
|
- <div className="bg-blue-50 p-5 rounded-lg text-center">
|
|
|
- <div className="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
|
- <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">
|
|
|
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
|
|
- </svg>
|
|
|
+
|
|
|
+ {/* 滚动轮播图 */}
|
|
|
+ <div className="relative bg-white overflow-hidden">
|
|
|
+ <div className="aspect-w-16 aspect-h-9">
|
|
|
+ <div className="flex overflow-x-auto snap-x">
|
|
|
+ {carouselItems.map((item) => (
|
|
|
+ <div
|
|
|
+ key={item.id}
|
|
|
+ className="snap-center w-full flex-shrink-0 relative cursor-pointer"
|
|
|
+ onClick={() => navigate(item.link)}
|
|
|
+ >
|
|
|
+ <img src={item.image} alt={item.title} className="w-full h-48 object-cover" />
|
|
|
+ <div className="absolute inset-0 bg-gradient-to-t from-black/50 to-transparent">
|
|
|
+ <div className="absolute bottom-4 left-4 text-white">
|
|
|
+ <h3 className="text-lg font-bold">{item.title}</h3>
|
|
|
+ <p className="text-sm">{item.description}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <h3 className="font-semibold text-lg mb-2">用户认证</h3>
|
|
|
- <p className="text-gray-600 text-sm">完整的登录、注册功能,保护您的网站安全</p>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className="bg-green-50 p-5 rounded-lg text-center">
|
|
|
- <div className="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
|
- <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">
|
|
|
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
|
|
|
- </svg>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 服务分类区域 */}
|
|
|
+ <div className="bg-white mt-2 p-4">
|
|
|
+ <div className="grid grid-cols-3 gap-4">
|
|
|
+ {serviceCategories.map((category, index) => (
|
|
|
+ <button
|
|
|
+ key={index}
|
|
|
+ onClick={() => navigate(category.path)}
|
|
|
+ className="flex flex-col items-center p-3 rounded-lg hover:bg-gray-50 transition-colors"
|
|
|
+ >
|
|
|
+ <div className={`${category.color} text-white w-12 h-12 rounded-full flex items-center justify-center text-xl mb-2`}>
|
|
|
+ {category.icon}
|
|
|
</div>
|
|
|
- <h3 className="font-semibold text-lg mb-2">用户中心</h3>
|
|
|
- <p className="text-gray-600 text-sm">用户可以查看和管理个人信息</p>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className="bg-purple-50 p-5 rounded-lg text-center">
|
|
|
- <div className="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
|
- <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">
|
|
|
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4" />
|
|
|
- </svg>
|
|
|
+ <span className="text-sm text-gray-700">{category.name}</span>
|
|
|
+ </button>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 推荐区域 */}
|
|
|
+ <div className="bg-white mt-2 p-4">
|
|
|
+ <div className="flex justify-between items-center mb-4">
|
|
|
+ <h2 className="text-lg font-bold text-gray-900">推荐岗位</h2>
|
|
|
+ <button
|
|
|
+ onClick={() => navigate('/silver-jobs')}
|
|
|
+ className="text-blue-600 text-sm"
|
|
|
+ >
|
|
|
+ 查看更多 →
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="space-y-3">
|
|
|
+ {recommendedItems.map((item) => (
|
|
|
+ <div
|
|
|
+ key={item.id}
|
|
|
+ className="flex items-center p-3 bg-gray-50 rounded-lg cursor-pointer hover:bg-gray-100"
|
|
|
+ onClick={() => navigate(`/silver-jobs/${item.id}`)}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ src={item.image}
|
|
|
+ alt={item.title}
|
|
|
+ className="w-12 h-12 rounded-full object-cover mr-3"
|
|
|
+ />
|
|
|
+ <div className="flex-1">
|
|
|
+ <h4 className="font-medium text-gray-900">{item.title}</h4>
|
|
|
+ <p className="text-sm text-gray-600">{item.company}</p>
|
|
|
+ <div className="flex items-center mt-1">
|
|
|
+ <span className="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">
|
|
|
+ {item.salary}
|
|
|
+ </span>
|
|
|
+ <span className="text-xs bg-green-100 text-green-800 px-2 py-1 rounded ml-2">
|
|
|
+ {item.tags[0]}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <h3 className="font-semibold text-lg mb-2">响应式设计</h3>
|
|
|
- <p className="text-gray-600 text-sm">适配各种设备屏幕,提供良好的用户体验</p>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ ))}
|
|
|
</div>
|
|
|
- </main>
|
|
|
- <Footer />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
};
|