他人页

This commit is contained in:
2025-09-15 21:13:13 +08:00
parent 7a0bc71f9f
commit f4c7840130
6 changed files with 95 additions and 49 deletions

View File

@@ -19,7 +19,7 @@ const MyselfPage: React.FC = () => {
// 用户信息状态
const [user_info, set_user_info] = useState<UserInfo>({
id: "1",
id: "",
nickname: "加载中...",
avatar: require("@/static/userInfo/default_avatar.svg"),
join_date: "加载中...",
@@ -54,11 +54,8 @@ const MyselfPage: React.FC = () => {
set_loading(true);
// 获取用户信息(包含统计数据)
const user_data = await UserService.get_user_info(user_id);
const user_data = await UserService.get_user_info();
set_user_info(user_data);
// 获取球局记录
load_game_data();
// let games_data;
// if (active_tab === "hosted") {
// games_data = await UserService.get_hosted_games(user_id);
@@ -78,6 +75,12 @@ const MyselfPage: React.FC = () => {
}
};
useEffect(() => {
if (user_info.id) {
load_game_data(); // 在 user_info 更新后调用
}
}, [user_info]);
// 页面加载时获取数据
// useEffect(() => {
// load_user_data();