From 31c4e4fafa6c04512b46f534843a2db4e98286f0 Mon Sep 17 00:00:00 2001 From: richarjiang Date: Mon, 29 Sep 2025 10:25:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(challenges):=20=E7=A7=BB=E9=99=A4=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E5=BE=BD=E7=AB=A0=E4=B8=8E=E5=89=AF=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=B9=B6=E5=8A=A8=E6=80=81=E8=AE=A1=E7=AE=97=E5=89=A9=E4=BD=99?= =?UTF-8?q?=E5=A4=A9=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 dayjs 实时计算挑战结束剩余天数,替代接口返回的固定值 - 删除 badge、subtitle 字段及相关渲染逻辑,简化 UI - 注释掉未使用的打卡操作区块,保持界面整洁 --- app/challenges/[id].tsx | 24 +++++++----------------- services/challengesApi.ts | 5 ++--- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/app/challenges/[id].tsx b/app/challenges/[id].tsx index 574d1bd..defe784 100644 --- a/app/challenges/[id].tsx +++ b/app/challenges/[id].tsx @@ -19,6 +19,7 @@ import { } from '@/store/challengesSlice'; import { Toast } from '@/utils/toast.utils'; import { Ionicons } from '@expo/vector-icons'; +import dayjs from 'dayjs'; import { BlurView } from 'expo-blur'; import { LinearGradient } from 'expo-linear-gradient'; import { useLocalSearchParams, useRouter } from 'expo-router'; @@ -321,25 +322,14 @@ export default function ChallengeDetailScreen() { > - {progress.badge ? ( - isHttpUrl(progress.badge) ? ( - - ) : ( - - {progress.badge} - - ) - ) : ( - - 打卡中 - - )} + + 打卡中 + {challenge.title} - {progress.subtitle ? {progress.subtitle} : null} - 剩余 {progress.remaining} 天 + 剩余 {dayjs(challenge.endAt).diff(dayjs(), 'd') || 0} 天 @@ -368,7 +358,7 @@ export default function ChallengeDetailScreen() { })} - {isJoined ? ( + {/* {isJoined ? ( <> {progressActionError} ) : null} - ) : null} + ) : null} */} diff --git a/services/challengesApi.ts b/services/challengesApi.ts index 745f5f2..caf8261 100644 --- a/services/challengesApi.ts +++ b/services/challengesApi.ts @@ -5,9 +5,7 @@ export type ChallengeStatus = 'upcoming' | 'ongoing' | 'expired'; export type ChallengeProgressDto = { completed: number; target: number; - remaining: number; - badge: string; - subtitle?: string; + remaining: number }; export type RankingItemDto = { @@ -35,6 +33,7 @@ export type ChallengeListItemDto = { isJoined: boolean; startAt?: string; endAt?: string; + minimumCheckInDays: number; // 最小打卡天数 }; export type ChallengeDetailDto = ChallengeListItemDto & {