Files
digital-pilates/services/users.ts
richarjiang 1b76cc305a feat(ui): 实现原生标签页与玻璃效果按钮组件
引入 NativeTabs 替代默认 Tabs 以支持原生标签栏样式,并添加 GlassButton 组件实现毛玻璃效果按钮。
移除对 useBottomTabBarHeight 的依赖,统一使用固定底部间距 60。
重构头像上传逻辑,使用新的 uploadImage API 替代 COS 直传方案。
更新 expo-router 至 ~6.0.1 版本以支持不稳定特性。
2025-09-12 15:48:58 +08:00

32 lines
892 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
});
}