合并ljc代码
Change-Id: I6cdc5d1e7a0ecfde80ead9660733b12760093be0
diff --git a/LJC/personalpage/src/App.js b/LJC/personalpage/src/App.js
index ed241f4..f11e487 100644
--- a/LJC/personalpage/src/App.js
+++ b/LJC/personalpage/src/App.js
@@ -31,7 +31,7 @@
<main className="py-5">
<div className="max-w-6xl mx-auto">
<Routes>
- <Route path="/" element={<Navigate to="/user/11" replace />} />
+ {/* <Route path="/" element={<Navigate to="/user/11" replace />} /> */}
<Route path="/user/:userId" element={<UserProfileRoute />} />
</Routes>
</div>
diff --git a/LJC/personalpage/src/components/EditProfileForm.jsx b/LJC/personalpage/src/components/EditProfileForm.jsx
deleted file mode 100644
index d33cbcb..0000000
--- a/LJC/personalpage/src/components/EditProfileForm.jsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import React, { useState } from 'react';
-import { FaCamera, FaTimes } from 'react-icons/fa';
-
-const EditProfileForm = ({ user, onSave, onCancel }) => {
- const [avatar, setAvatar] = useState(user.avatar || '');
- const [bio, setBio] = useState(user.bio || '');
- const [gender, setGender] = useState('secret');
- const [birthday, setBirthday] = useState('');
- const [location, setLocation] = useState('');
-
- const handleSubmit = (e) => {
- e.preventDefault();
- onSave({ avatar, bio });
- };
-
- return (
- <form onSubmit={handleSubmit}>
- <div className="mb-6">
- <label className="block text-sm font-medium text-gray-700 mb-2">头像</label>
- <div className="flex items-center">
- <div className="relative">
- <div className="w-20 h-20 rounded-full bg-gradient-to-r from-pink-300 to-orange-300 flex items-center justify-center">
- {avatar ? (
- <img src={avatar} alt="Avatar" className="w-full h-full rounded-full" />
- ) : (
- <div className="text-white text-2xl">{user.username.charAt(0)}</div>
- )}
- </div>
- <button
- type="button"
- className="absolute bottom-0 right-0 bg-white rounded-full p-1 shadow-md"
- >
- <FaCamera className="text-gray-700 text-sm" />
- </button>
- </div>
- <div className="ml-4">
- <input
- type="text"
- value={avatar}
- onChange={(e) => setAvatar(e.target.value)}
- placeholder="输入头像URL"
- className="w-full rounded-md border-gray-300 shadow-sm text-sm"
- />
- </div>
- </div>
- </div>
-
- <div className="mb-4">
- <label className="block text-sm font-medium text-gray-700 mb-2">个人简介</label>
- <textarea
- value={bio}
- onChange={(e) => setBio(e.target.value)}
- rows="3"
- maxLength="100"
- className="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"
- placeholder="介绍一下自己吧~"
- />
- <div className="text-right text-xs text-gray-500 mt-1">{bio.length}/100</div>
- </div>
-
- <div className="grid grid-cols-2 gap-4 mb-4">
- <div>
- <label className="block text-sm font-medium text-gray-700 mb-2">性别</label>
- <select
- value={gender}
- onChange={(e) => setGender(e.target.value)}
- className="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"
- >
- <option value="secret">保密</option>
- <option value="male">男</option>
- <option value="female">女</option>
- </select>
- </div>
-
- <div>
- <label className="block text-sm font-medium text-gray-700 mb-2">生日</label>
- <input
- type="date"
- value={birthday}
- onChange={(e) => setBirthday(e.target.value)}
- className="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"
- />
- </div>
- </div>
-
- <div className="mb-6">
- <label className="block text-sm font-medium text-gray-700 mb-2">地区</label>
- <input
- type="text"
- value={location}
- onChange={(e) => setLocation(e.target.value)}
- placeholder="填写你所在的城市"
- className="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"
- />
- </div>
-
- <div className="flex justify-end space-x-3">
- <button
- type="button"
- onClick={onCancel}
- className="px-5 py-2 bg-gray-100 text-gray-700 rounded-full text-sm hover:bg-gray-200"
- >
- 取消
- </button>
- <button
- type="submit"
- className="px-5 py-2 bg-red-500 text-white rounded-full text-sm hover:bg-red-600"
- >
- 保存
- </button>
- </div>
- </form>
- );
-};
-
-export default EditProfileForm;
\ No newline at end of file
diff --git a/LJC/personalpage/src/components/FavoritePosts.jsx b/LJC/personalpage/src/components/FavoritePosts.jsx
deleted file mode 100644
index 4033d7b..0000000
--- a/LJC/personalpage/src/components/FavoritePosts.jsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import { getFavorites } from '../services/api';
-import { FaHeart } from 'react-icons/fa';
-
-const FavoritePosts = ({ userId }) => {
- const [favorites, setFavorites] = useState([]);
- const [loading, setLoading] = useState(true);
-
- useEffect(() => {
- const fetchFavorites = async () => {
- try {
- setLoading(true);
- const response = await getFavorites(userId);
- setFavorites(response.data);
- } catch (error) {
- console.error('Failed to fetch favorites:', error);
- } finally {
- setLoading(false);
- }
- };
-
- if (userId) {
- fetchFavorites();
- }
- }, [userId]);
-
- if (loading) {
- return (
- <div className="grid grid-cols-2 md:grid-cols-3 gap-4">
- {[1, 2, 3, 4, 5, 6].map(item => (
- <div key={item} className="bg-gray-100 rounded-xl aspect-square animate-pulse"></div>
- ))}
- </div>
- );
- }
-
- if (favorites.length === 0) {
- return (
- <div className="text-center py-16">
- <div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-red-100 text-red-500 mb-4">
- <FaHeart className="text-2xl" />
- </div>
- <h3 className="text-lg font-medium text-gray-900">暂无收藏内容</h3>
- <p className="mt-1 text-gray-500">你还没有收藏任何笔记</p>
- </div>
- );
- }
-
- // 模拟瀑布流布局数据
- const waterfallData = favorites.map(post => ({
- ...post,
- height: Math.floor(Math.random() * 100) + 200 // 随机高度
- }));
-
- return (
- <div className="grid grid-cols-2 md:grid-cols-3 gap-4">
- {waterfallData.map(post => (
- <div
- key={post.id}
- className="bg-white rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow"
- >
- <div
- className="relative bg-gray-200"
- style={{ height: `${post.height}px` }}
- >
- {/* 占位图片 */}
- <div className="absolute inset-0 bg-gradient-to-br from-pink-100 to-orange-100"></div>
-
- {/* 类型标签 */}
- <div className="absolute top-2 right-2 bg-black bg-opacity-50 text-white text-xs px-2 py-1 rounded-full">
- {post.type === 'image' ? '图文' :
- post.type === 'video' ? '视频' : '文档'}
- </div>
-
- {/* 收藏标记 */}
- <div className="absolute bottom-2 right-2 bg-red-500 rounded-full p-1">
- <FaHeart className="text-white text-xs" />
- </div>
- </div>
-
- <div className="p-3">
- <h3 className="font-medium line-clamp-2">{post.title}</h3>
- <div className="flex items-center mt-2 text-xs text-gray-500">
- <span>❤️ 2.5k</span>
- <span className="mx-2">•</span>
- <span>⭐ 156</span>
- </div>
- </div>
- </div>
- ))}
- </div>
- );
-};
-
-export default FavoritePosts;
\ No newline at end of file
diff --git a/LJC/personalpage/src/components/FollowButton.jsx b/LJC/personalpage/src/components/FollowButton.jsx
deleted file mode 100644
index 9e738d4..0000000
--- a/LJC/personalpage/src/components/FollowButton.jsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import React from 'react';
-import { followUser, unfollowUser } from '../services/api';
-
-const FollowButton = ({ userId, isFollowing, onFollowChange }) => {
- const handleFollow = async () => {
- try {
- if (isFollowing) {
- await unfollowUser(userId);
- onFollowChange(false);
- } else {
- await followUser(userId);
- onFollowChange(true);
- }
- } catch (error) {
- console.error('关注操作失败:', error);
- }
- };
-
- return (
- <button
- onClick={handleFollow}
- className={`px-6 py-2 rounded-full text-sm font-medium transition-all ${
- isFollowing
- ? 'bg-gray-100 text-gray-800 hover:bg-gray-200'
- : 'bg-red-500 text-white hover:bg-red-600'
- }`}
- >
- {isFollowing ? '已关注' : '关注'}
- </button>
- );
-};
-
-export default FollowButton;
\ No newline at end of file