|
|
@ -155,7 +155,7 @@ Page({ |
|
|
const existingUserId = wx.getStorageSync('userId') |
|
|
const existingUserId = wx.getStorageSync('userId') |
|
|
const existingUserInfo = wx.getStorageSync('userInfo') |
|
|
const existingUserInfo = wx.getStorageSync('userInfo') |
|
|
|
|
|
|
|
|
if (existingOpenid && existingUserId && existingUserInfo && existingUserInfo.phoneNumber !== '13800138000') { |
|
|
if (existingOpenid && existingUserId && existingUserInfo && existingUserInfo.phoneNumber) { |
|
|
console.log('用户已登录且手机号有效,直接完成身份设置') |
|
|
console.log('用户已登录且手机号有效,直接完成身份设置') |
|
|
// 直接完成身份设置,跳过重复授权
|
|
|
// 直接完成身份设置,跳过重复授权
|
|
|
const currentUserType = this.data.pendingUserType || this.data.currentUserType || 'buyer' |
|
|
const currentUserType = this.data.pendingUserType || this.data.currentUserType || 'buyer' |
|
|
@ -268,8 +268,8 @@ Page({ |
|
|
const isNewPhone = phoneRes.isNewPhone || true |
|
|
const isNewPhone = phoneRes.isNewPhone || true |
|
|
const phoneNumber = phoneRes.phoneNumber || null |
|
|
const phoneNumber = phoneRes.phoneNumber || null |
|
|
|
|
|
|
|
|
// 如果有手机号冲突且没有返回手机号,使用临时手机号
|
|
|
// 如果有手机号冲突且没有返回手机号,使用实际返回的手机号
|
|
|
const finalPhoneNumber = hasPhoneConflict && !phoneNumber ? '13800138000' : phoneNumber |
|
|
const finalPhoneNumber = phoneNumber |
|
|
|
|
|
|
|
|
console.log('手机号解密结果:', { |
|
|
console.log('手机号解密结果:', { |
|
|
phoneNumber: finalPhoneNumber, |
|
|
phoneNumber: finalPhoneNumber, |
|
|
@ -419,7 +419,7 @@ Page({ |
|
|
wx.setStorageSync('userId', mockUserId) |
|
|
wx.setStorageSync('userId', mockUserId) |
|
|
|
|
|
|
|
|
// 4. 模拟手机号解密结果
|
|
|
// 4. 模拟手机号解密结果
|
|
|
const mockPhoneNumber = '13800138000' |
|
|
const mockPhoneNumber = null |
|
|
console.log('模拟手机号解密成功:', mockPhoneNumber) |
|
|
console.log('模拟手机号解密成功:', mockPhoneNumber) |
|
|
|
|
|
|
|
|
// 5. 创建模拟用户信息
|
|
|
// 5. 创建模拟用户信息
|
|
|
@ -611,12 +611,8 @@ Page({ |
|
|
wx.setStorageSync('userInfo', userInfo) |
|
|
wx.setStorageSync('userInfo', userInfo) |
|
|
console.log('验证登录状态成功,用户信息已同步:', userInfo) |
|
|
console.log('验证登录状态成功,用户信息已同步:', userInfo) |
|
|
|
|
|
|
|
|
// 检查是否为临时手机号,如果是则提示用户重新授权
|
|
|
// 如果手机号存在则清除重新授权标志
|
|
|
if (userInfo.phoneNumber === '13800138000') { |
|
|
if (userInfo.phoneNumber) { |
|
|
console.warn('检测到临时手机号,建议用户重新授权') |
|
|
|
|
|
// 设置重新授权标志
|
|
|
|
|
|
wx.setStorageSync('needPhoneAuth', true) |
|
|
|
|
|
} else { |
|
|
|
|
|
// 清除可能存在的重新授权标志
|
|
|
// 清除可能存在的重新授权标志
|
|
|
wx.removeStorageSync('needPhoneAuth') |
|
|
wx.removeStorageSync('needPhoneAuth') |
|
|
console.log('手机号验证通过:', userInfo.phoneNumber) |
|
|
console.log('手机号验证通过:', userInfo.phoneNumber) |
|
|
@ -742,8 +738,7 @@ Page({ |
|
|
const completeUserInfo = { |
|
|
const completeUserInfo = { |
|
|
...userInfo, |
|
|
...userInfo, |
|
|
// 确保包含服务器需要的必要字段
|
|
|
// 确保包含服务器需要的必要字段
|
|
|
nickName: userInfo.nickName || '测试用户', |
|
|
nickName: userInfo.nickName || '测试用户' |
|
|
phoneNumber: userInfo.phoneNumber || '13800138000' |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
|