feat: 优化 AI 教练聊天和打卡功能
- 在 AI 教练聊天界面中添加会话缓存功能,支持冷启动时恢复聊天记录 - 实现轻量防抖机制,确保会话变动时及时保存缓存 - 在打卡功能中集成按月加载打卡记录,提升用户体验 - 更新 Redux 状态管理,支持打卡记录的按月加载和缓存 - 新增打卡日历页面,允许用户查看每日打卡记录 - 优化样式以适应新功能的展示和交互
This commit is contained in:
@@ -55,4 +55,19 @@ export async function fetchDailyCheckins(date?: string): Promise<any[]> {
|
||||
return Array.isArray(data) ? data : [];
|
||||
}
|
||||
|
||||
// 优先尝试按区间批量获取(若后端暂未实现将抛错,由调用方回退到逐日请求)
|
||||
export async function fetchCheckinsInRange(startDate: string, endDate: string): Promise<any[]> {
|
||||
const path = `/api/checkins/range?start=${encodeURIComponent(startDate)}&end=${encodeURIComponent(endDate)}`;
|
||||
const data = await api.get<any[]>(path);
|
||||
return Array.isArray(data) ? data : [];
|
||||
}
|
||||
|
||||
// 获取时间范围内每日是否已打卡(仅返回日期+布尔)
|
||||
export type DailyStatusItem = { date: string; checkedIn: boolean };
|
||||
export async function fetchDailyStatusRange(startDate: string, endDate: string): Promise<DailyStatusItem[]> {
|
||||
const path = `/api/checkins/range/daily-status?startDate=${encodeURIComponent(startDate)}&endDate=${encodeURIComponent(endDate)}`;
|
||||
const data = await api.get<DailyStatusItem[]>(path);
|
||||
return Array.isArray(data) ? data : [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user