|
|
@ -449,13 +449,14 @@ Page({ |
|
|
const app = getApp() |
|
|
const app = getApp() |
|
|
const existingUserInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {} |
|
|
const existingUserInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {} |
|
|
const userInfo = { |
|
|
const userInfo = { |
|
|
nickName: existingUserInfo.nickName || (userProfile ? userProfile.userInfo.nickName : '微信用户'), |
|
|
// 优先使用最新获取的微信头像和昵称,如果没有获取到则使用本地存储的
|
|
|
avatarUrl: existingUserInfo.avatarUrl || (userProfile ? userProfile.userInfo.avatarUrl : 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'), |
|
|
nickName: (userProfile ? userProfile.userInfo.nickName : existingUserInfo.nickName) || '微信用户', |
|
|
gender: existingUserInfo.gender || (userProfile ? userProfile.userInfo.gender : 0), |
|
|
avatarUrl: (userProfile ? userProfile.userInfo.avatarUrl : existingUserInfo.avatarUrl) || 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', |
|
|
country: existingUserInfo.country || (userProfile ? userProfile.userInfo.country : ''), |
|
|
gender: (userProfile ? userProfile.userInfo.gender : existingUserInfo.gender) || 0, |
|
|
province: existingUserInfo.province || (userProfile ? userProfile.userInfo.province : ''), |
|
|
country: (userProfile ? userProfile.userInfo.country : existingUserInfo.country) || '', |
|
|
city: existingUserInfo.city || (userProfile ? userProfile.userInfo.city : ''), |
|
|
province: (userProfile ? userProfile.userInfo.province : existingUserInfo.province) || '', |
|
|
language: existingUserInfo.language || (userProfile ? userProfile.userInfo.language : 'zh_CN'), |
|
|
city: (userProfile ? userProfile.userInfo.city : existingUserInfo.city) || '', |
|
|
|
|
|
language: (userProfile ? userProfile.userInfo.language : existingUserInfo.language) || 'zh_CN', |
|
|
phoneNumber: phoneNumber |
|
|
phoneNumber: phoneNumber |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -555,11 +556,12 @@ Page({ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 构造上传数据(包含所有必要字段,包括phoneNumber)
|
|
|
// 构造上传数据(包含所有必要字段,包括phoneNumber和头像URL)
|
|
|
const uploadData = { |
|
|
const uploadData = { |
|
|
userId: userId, |
|
|
userId: userId, |
|
|
openid: openid, |
|
|
openid: openid, |
|
|
nickName: userInfo.nickName, |
|
|
nickName: userInfo.nickName, |
|
|
|
|
|
avatarUrl: userInfo.avatarUrl, // 添加头像URL字段
|
|
|
phoneNumber: userInfo.phoneNumber, // 添加phoneNumber字段,满足服务器要求
|
|
|
phoneNumber: userInfo.phoneNumber, // 添加phoneNumber字段,满足服务器要求
|
|
|
type: type, |
|
|
type: type, |
|
|
timestamp: Date.now() |
|
|
timestamp: Date.now() |
|
|
|