引入 NativeTabs 替代默认 Tabs 以支持原生标签栏样式,并添加 GlassButton 组件实现毛玻璃效果按钮。 移除对 useBottomTabBarHeight 的依赖,统一使用固定底部间距 60。 重构头像上传逻辑,使用新的 uploadImage API 替代 COS 直传方案。 更新 expo-router 至 ~6.0.1 版本以支持不稳定特性。
32 lines
892 B
TypeScript
32 lines
892 B
TypeScript
import { api } from '@/services/api';
|
||
|
||
export type Gender = 'male' | 'female';
|
||
|
||
export type UpdateUserDto = {
|
||
name?: string;
|
||
avatar?: string; // base64 字符串
|
||
gender?: Gender;
|
||
birthDate?: number; // 时间戳(秒)
|
||
dailyStepsGoal?: number;
|
||
dailyCaloriesGoal?: number;
|
||
pilatesPurposes?: string[];
|
||
weight?: number;
|
||
height?: number;
|
||
activityLevel?: number; // 活动水平 1-4
|
||
initialWeight?: number; // 初始体重
|
||
targetWeight?: number; // 目标体重
|
||
};
|
||
|
||
export async function updateUser(dto: UpdateUserDto): Promise<Record<string, any>> {
|
||
// 固定使用后端文档接口:PUT /api/users/update
|
||
return await api.put('/api/users/update', dto);
|
||
}
|
||
|
||
export async function uploadImage(formData: FormData): Promise<{ fileKey: string; fileUrl: string }> {
|
||
return await api.post('/api/users/cos/upload-image', formData, {
|
||
unsetContentType: true
|
||
});
|
||
}
|
||
|
||
|