feat: 更新个人信息和打卡功能

- 在个人信息页面中修改用户姓名字段为“name”,并添加注销帐号功能,支持用户删除帐号及相关数据
- 在打卡页面中集成从后端获取当天打卡列表的功能,确保用户数据的实时同步
- 更新 Redux 状态管理,支持打卡记录的同步和更新
- 新增打卡服务,提供创建、更新和删除打卡记录的 API 接口
- 优化样式以适应新功能的展示和交互
This commit is contained in:
richarjiang
2025-08-13 19:24:03 +08:00
parent ebc74eb1c8
commit 7ad26590e5
7 changed files with 225 additions and 22 deletions

View File

@@ -2,7 +2,7 @@ import { HeaderBar } from '@/components/ui/HeaderBar';
import { Colors } from '@/constants/Colors';
import { useAppDispatch } from '@/hooks/redux';
import { useColorScheme } from '@/hooks/useColorScheme';
import { addExercise } from '@/store/checkinSlice';
import { addExercise, syncCheckin } from '@/store/checkinSlice';
import { EXERCISE_LIBRARY, getCategories, searchExercises } from '@/utils/exerciseLibrary';
import { Ionicons } from '@expo/vector-icons';
import * as Haptics from 'expo-haptics';
@@ -79,6 +79,21 @@ export default function SelectExerciseScreen() {
reps: reps && reps > 0 ? reps : undefined,
},
}));
console.log('addExercise', today, selected.key, sets, reps);
// 同步到后端(读取最新 store 需要在返回后由首页触发 load或此处直接上报
// 简单做法:直接上报新增项(其余项由后端合并/覆盖)
dispatch(syncCheckin({
date: today,
items: [
{
key: selected.key,
name: selected.name,
category: selected.category,
sets: Math.max(1, sets),
reps: reps && reps > 0 ? reps : undefined,
},
],
}));
router.back();
};