diff --git a/src/components/UserInfo/index.tsx b/src/components/UserInfo/index.tsx index b1fb3bd..7be961f 100644 --- a/src/components/UserInfo/index.tsx +++ b/src/components/UserInfo/index.tsx @@ -297,6 +297,8 @@ export interface GameRecord { level_range: string; game_type: string; image_list: string[]; + deadline_hours: number; + end_time: string; } // 球局卡片组件属性 diff --git a/src/user_pages/other/index.scss b/src/user_pages/other/index.scss index 8aa4539..1059e52 100644 --- a/src/user_pages/other/index.scss +++ b/src/user_pages/other/index.scss @@ -1,9 +1,11 @@ // 他人用户页面样式 .other_user_page { min-height: 100vh; - background: radial-gradient(circle at 50% 0%, - rgba(238, 255, 220, 1) 0%, - rgba(255, 255, 255, 1) 37%); + background: radial-gradient( + circle at 50% 0%, + rgba(238, 255, 220, 1) 0%, + rgba(255, 255, 255, 1) 37% + ); position: relative; // overflow: hidden; box-sizing: border-box; @@ -42,7 +44,7 @@ display: flex; justify-content: center; - &>.detail-navigator-back-icon { + & > .detail-navigator-back-icon { width: 32px; height: 32px; } @@ -542,4 +544,15 @@ } } } -} \ No newline at end of file +} + +.ended_game_text { + font-family: "PingFang SC"; + font-weight: 600; + font-size: 20px; + line-height: 1.4em; + letter-spacing: 1.9%; + color: rgba(0, 0, 0, 0.85); + transition: color 0.3s ease; + padding: 12px 15px; +} diff --git a/src/user_pages/other/index.tsx b/src/user_pages/other/index.tsx index 87fab8d..dc50e77 100644 --- a/src/user_pages/other/index.tsx +++ b/src/user_pages/other/index.tsx @@ -45,6 +45,8 @@ const OtherUserPage: React.FC = () => { // 模拟球局数据 const [game_records, setGameRecords] = useState([]); + // 往期球局 + const [ended_game_records, setEndedGameRecords] = useState([]); // 关注状态 const [is_following, setIsFollowing] = useState(false); @@ -70,8 +72,9 @@ const OtherUserPage: React.FC = () => { nickname: userData.nickname || "", avatar: userData.avatar_url || "", join_date: userData.subscribe_time - ? `${new Date(userData.subscribe_time).getFullYear()}年${new Date(userData.subscribe_time).getMonth() + 1 - }月加入` + ? `${new Date(userData.subscribe_time).getFullYear()}年${ + new Date(userData.subscribe_time).getMonth() + 1 + }月加入` : "", stats: { following: userData.stats?.following_count || 0, @@ -102,6 +105,25 @@ const OtherUserPage: React.FC = () => { load_user_data(); }, [user_id]); + const classifyGameRecords = ( + game_records: GameRecord[] + ): { notEndGames: GameRecord[]; finishedGames: GameRecord[] } => { + const timestamp = new Date().getTime(); + return game_records.reduce( + (result, cur) => { + const { end_time } = cur; + timestamp > new Date(end_time).getTime() + ? result.notEndGames.push(cur) + : result.finishedGames.push(cur); + return result; + }, + { + notEndGames: [] as GameRecord[], + finishedGames: [] as GameRecord[], + } + ); + }; + const load_game_data = async () => { try { set_loading(true); @@ -109,7 +131,9 @@ const OtherUserPage: React.FC = () => { user_id || "", active_tab ); - setGameRecords(games_data); + const { notEndGames, finishedGames } = classifyGameRecords(games_data); + setGameRecords(notEndGames); + setEndedGameRecords(finishedGames); } catch (error) { console.error("加载球局数据失败:", error); Taro.showToast({ @@ -166,7 +190,12 @@ const OtherUserPage: React.FC = () => { - { Taro.navigateBack() }}> + { + Taro.navigateBack(); + }} + > { loading={loading} error={null} reload={load_game_data} - loadMoreMatches={() => { }} + loadMoreMatches={() => {}} + /> + + + + {/* 球局卡片 */} + {/* + {game_records.map((game) => ( + + ))} + */} + + + {/* 往期球局 */} + 往期球局 + + + 5月29日 + / + 星期六 + + + {/* 球局列表 */} + + + {}} />