This commit is contained in:
张成
2025-09-07 22:52:13 +08:00
parent 446c7564a7
commit 50982b7c02
3 changed files with 25 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ class App extends Component<AppProps> {
// 初始化字典数据 // 初始化字典数据
this.initDictionaryData() this.initDictionaryData()
this.getNavBarHeight() this.getNavBarHeight()
this.getLocation() // this.getLocation()
} }
componentDidShow() { } componentDidShow() { }

View File

@@ -21,8 +21,12 @@ export interface UserInfo {
ntrp_level: string; ntrp_level: string;
phone?: string; phone?: string;
gender?: string; gender?: string;
latitude?: number,
longitude?: number,
} }
// 用户信息卡片组件属性 // 用户信息卡片组件属性
interface UserInfoCardProps { interface UserInfoCardProps {
user_info: UserInfo; user_info: UserInfo;
@@ -34,12 +38,12 @@ interface UserInfoCardProps {
} }
// 处理编辑用户信息 // 处理编辑用户信息
const on_edit = () => { const on_edit = () => {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/userInfo/edit/index' url: '/pages/userInfo/edit/index'
}); });
}; };
// 用户信息卡片组件 // 用户信息卡片组件
export const UserInfoCard: React.FC<UserInfoCardProps> = ({ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
user_info, user_info,

View File

@@ -40,8 +40,8 @@ interface UpdateUserParams {
avatar_url: string; avatar_url: string;
gender: string; gender: string;
phone: string; phone: string;
latitude: number; latitude?: number;
longitude: number; longitude?: number;
city: string; city: string;
province: string; province: string;
country: string; country: string;
@@ -379,17 +379,17 @@ export class UserService {
static async save_user_info(user_info: Partial<UserInfo> & { phone?: string; gender?: string }): Promise<boolean> { static async save_user_info(user_info: Partial<UserInfo> & { phone?: string; gender?: string }): Promise<boolean> {
try { try {
// 获取当前位置信息 // 获取当前位置信息
const location = await Taro.getLocation({ // const location = await Taro.getLocation({
type: 'wgs84' // type: 'wgs84'
}); // });
const updateParams: UpdateUserParams = { const updateParams: UpdateUserParams = {
nickname: user_info.nickname || '', nickname: user_info.nickname || '',
avatar_url: user_info.avatar || '', avatar_url: user_info.avatar || '',
gender: user_info.gender || '', gender: user_info.gender || '',
phone: user_info.phone || '', phone: user_info.phone || '',
latitude: location.latitude, latitude: user_info.latitude||'',
longitude: location.longitude, longitude: user_info.longitude||'',
city: user_info.location || '', city: user_info.location || '',
province: '', // 需要从用户信息中获取 province: '', // 需要从用户信息中获取
country: '' // 需要从用户信息中获取 country: '' // 需要从用户信息中获取