feat: 更新应用名称和图标,优化用户界面

- 将应用名称修改为“Health Bot”,提升品牌识别度
- 更新应用图标为 logo.png,确保视觉一致性
- 删除不再使用的 ai-coach-chat 页面,简化代码结构
- 更新多个页面的导航和按钮文本,提升用户体验
- 添加体重历史记录功能,支持用户追踪健康数据
- 优化 Redux 状态管理,确保数据处理的准确性和稳定性
This commit is contained in:
2025-08-17 21:34:04 +08:00
parent b2c4f76c39
commit 6a67fb21f7
25 changed files with 1511 additions and 1428 deletions

View File

@@ -23,6 +23,13 @@ export type UserState = {
loading: boolean;
error: string | null;
privacyAgreed: boolean;
weightHistory: WeightHistoryItem[];
};
export type WeightHistoryItem = {
weight: string;
source: string;
createdAt: string;
};
export const DEFAULT_MEMBER_NAME = '普拉提星球学员';
@@ -35,6 +42,7 @@ const initialState: UserState = {
loading: false,
error: null,
privacyAgreed: false,
weightHistory: [],
};
export type LoginPayload = Record<string, any> & {
@@ -151,6 +159,18 @@ export const fetchMyProfile = createAsyncThunk('user/fetchMyProfile', async (_,
}
});
// 获取用户体重历史记录
export const fetchWeightHistory = createAsyncThunk('user/fetchWeightHistory', async (_, { rejectWithValue }) => {
try {
const data: WeightHistoryItem[] = await api.get('/api/users/weight-history');
console.log('fetchWeightHistory', data);
return data;
} catch (err: any) {
return rejectWithValue(err?.message ?? '获取用户体重历史记录失败');
}
});
const userSlice = createSlice({
name: 'user',
initialState,
@@ -208,6 +228,12 @@ const userSlice = createSlice({
})
.addCase(setPrivacyAgreed.fulfilled, (state) => {
state.privacyAgreed = true;
})
.addCase(fetchWeightHistory.fulfilled, (state, action) => {
state.weightHistory = action.payload;
})
.addCase(fetchWeightHistory.rejected, (state, action) => {
state.error = (action.payload as string) ?? '获取用户体重历史记录失败';
});
},
});