|
|
|
@ -145,12 +145,11 @@ Page({ |
|
|
|
|
|
|
|
// 检查用户登录状态
|
|
|
|
const openid = wx.getStorageSync('openid'); |
|
|
|
const userInfo = wx.getStorageSync('userInfo'); |
|
|
|
const userId = wx.getStorageSync('userId'); |
|
|
|
|
|
|
|
console.log('检查用户授权状态 - openid:', !!openid, 'userInfo:', !!userInfo, 'userId:', !!userId); |
|
|
|
console.log('检查用户授权状态 - openid:', !!openid, 'userId:', !!userId); |
|
|
|
|
|
|
|
if (!openid || !userId || !userInfo) { |
|
|
|
if (!openid || !userId) { |
|
|
|
console.log('用户未登录,显示一键登录弹窗'); |
|
|
|
// 显示一键登录弹窗,让用户确认是否要登录
|
|
|
|
this.showOneKeyLogin(); |
|
|
|
@ -1250,42 +1249,27 @@ Page({ |
|
|
|
// 预览图片
|
|
|
|
previewImage(e) { |
|
|
|
// 登录验证
|
|
|
|
const userInfo = wx.getStorageSync('userInfo') || null |
|
|
|
const userId = wx.getStorageSync('userId') || null |
|
|
|
if (!userInfo || !userId) { |
|
|
|
// 未登录,显示授权登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showAuthModal: true, |
|
|
|
pendingUserType: 'buyer' |
|
|
|
}) |
|
|
|
return |
|
|
|
const openid = wx.getStorageSync('openid'); |
|
|
|
const userId = wx.getStorageSync('userId'); |
|
|
|
|
|
|
|
if (!openid || !userId) { |
|
|
|
console.log('用户未登录,直接显示授权登录弹窗'); |
|
|
|
// 直接显示授权登录弹窗
|
|
|
|
this.showOneKeyLogin(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 已登录,执行图片预览
|
|
|
|
const { urls, index } = e.currentTarget.dataset |
|
|
|
this.setData({ |
|
|
|
showImagePreview: true, |
|
|
|
previewImageUrls: urls, |
|
|
|
previewImageIndex: parseInt(index) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 预览图片
|
|
|
|
previewImage(e) { |
|
|
|
// 登录验证
|
|
|
|
const userInfo = wx.getStorageSync('userInfo') || null |
|
|
|
const userId = wx.getStorageSync('userId') || null |
|
|
|
if (!userInfo || !userId) { |
|
|
|
// 未登录,显示授权登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showAuthModal: true, |
|
|
|
pendingUserType: 'buyer' |
|
|
|
}) |
|
|
|
return |
|
|
|
const { item, index } = e.currentTarget.dataset; |
|
|
|
console.log('预览图片参数:', item, index); |
|
|
|
|
|
|
|
// 从item中获取图片URL列表
|
|
|
|
const urls = item.imageUrls || []; |
|
|
|
if (urls.length === 0) { |
|
|
|
console.error('没有图片可预览'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 已登录,执行图片预览
|
|
|
|
const { urls, index } = e.currentTarget.dataset |
|
|
|
this.setData({ |
|
|
|
showImagePreview: true, |
|
|
|
previewImageUrls: urls, |
|
|
|
@ -1614,6 +1598,9 @@ Page({ |
|
|
|
} |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
|
|
|
|
// 登录成功后,加载用户收藏列表,更新商品收藏状态
|
|
|
|
this.loadUserFavorites(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 记录用户行为
|
|
|
|
@ -1687,17 +1674,9 @@ Page({ |
|
|
|
const userId = wx.getStorageSync('userId'); |
|
|
|
|
|
|
|
if (!openid || !userId) { |
|
|
|
console.log('用户未登录,显示登录提示和弹窗'); |
|
|
|
// 提示登录后才可查看详情
|
|
|
|
wx.showToast({ |
|
|
|
title: '登录后才可查看详情', |
|
|
|
icon: 'none', |
|
|
|
duration: 1500 |
|
|
|
}); |
|
|
|
// 显示登录弹窗
|
|
|
|
setTimeout(() => { |
|
|
|
this.showOneKeyLogin(); |
|
|
|
}); |
|
|
|
console.log('用户未登录,直接显示授权登录弹窗'); |
|
|
|
// 直接显示授权登录弹窗
|
|
|
|
this.showOneKeyLogin(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1728,118 +1707,249 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
// 获取手机号并登录
|
|
|
|
onGetPhoneNumber: function (e) { |
|
|
|
async onGetPhoneNumber(e) { |
|
|
|
console.log('获取手机号:', e); |
|
|
|
|
|
|
|
|
|
|
|
// 首先检查用户是否拒绝授权
|
|
|
|
if (e.detail.errMsg !== 'getPhoneNumber:ok') { |
|
|
|
console.log('用户拒绝授权手机号'); |
|
|
|
wx.showToast({ |
|
|
|
title: '您已拒绝授权,操作已取消', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
// 直接返回,取消所有后续操作
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const encryptedData = e.detail.encryptedData; |
|
|
|
const iv = e.detail.iv; |
|
|
|
|
|
|
|
// 调用API进行登录
|
|
|
|
API.login(encryptedData, iv) |
|
|
|
.then(res => { |
|
|
|
console.log('登录成功:', res); |
|
|
|
|
|
|
|
if (res.success) { |
|
|
|
// 保存登录信息
|
|
|
|
wx.setStorageSync('openid', res.data.openid); |
|
|
|
wx.setStorageSync('userId', res.data.userId); |
|
|
|
wx.setStorageSync('sessionKey', res.data.sessionKey || ''); |
|
|
|
|
|
|
|
// 登录成功后立即获取用户微信名称
|
|
|
|
|
|
|
|
wx.showLoading({ |
|
|
|
title: '登录中...', |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
try { |
|
|
|
// 引入API服务
|
|
|
|
const API = require('../../utils/api.js'); |
|
|
|
|
|
|
|
// 1. 先执行微信登录获取code
|
|
|
|
const loginRes = await new Promise((resolve, reject) => { |
|
|
|
wx.login({ |
|
|
|
success: resolve, |
|
|
|
fail: reject |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
if (!loginRes.code) { |
|
|
|
throw new Error('获取登录code失败'); |
|
|
|
} |
|
|
|
|
|
|
|
console.log('获取登录code成功:', loginRes.code); |
|
|
|
|
|
|
|
// 2. 使用code换取openid
|
|
|
|
const openidRes = await API.getOpenid(loginRes.code); |
|
|
|
|
|
|
|
// 增强版响应处理逻辑,支持多种返回格式
|
|
|
|
let openid = null; |
|
|
|
let userId = null; |
|
|
|
let sessionKey = null; |
|
|
|
|
|
|
|
// 优先从data字段获取数据
|
|
|
|
if (openidRes && openidRes.data && typeof openidRes.data === 'object') { |
|
|
|
openid = openidRes.data.openid || openidRes.data.OpenID || null; |
|
|
|
userId = openidRes.data.userId || openidRes.data.userid || null; |
|
|
|
sessionKey = openidRes.data.session_key || openidRes.data.sessionKey || null; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果data为空或不存在,尝试从响应对象直接获取
|
|
|
|
if (!openid && openidRes && typeof openidRes === 'object') { |
|
|
|
console.warn('服务器返回格式可能不符合预期,data字段为空或不存在,但尝试从根对象提取信息:', openidRes); |
|
|
|
openid = openidRes.openid || openidRes.OpenID || null; |
|
|
|
userId = openidRes.userId || openidRes.userid || null; |
|
|
|
sessionKey = openidRes.session_key || openidRes.sessionKey || null; |
|
|
|
} |
|
|
|
|
|
|
|
// 检查服务器状态信息
|
|
|
|
const isSuccess = openidRes && (openidRes.success === true || openidRes.code === 200); |
|
|
|
|
|
|
|
if (!openid) { |
|
|
|
throw new Error('获取openid失败: ' + (openidRes && openidRes.message ? openidRes.message : '未知错误')); |
|
|
|
} |
|
|
|
|
|
|
|
// 存储openid和session_key
|
|
|
|
wx.setStorageSync('openid', openid); |
|
|
|
if (sessionKey) { |
|
|
|
wx.setStorageSync('sessionKey', sessionKey); |
|
|
|
} |
|
|
|
|
|
|
|
// 确保始终使用从服务器获取的正式用户ID,不再生成临时ID
|
|
|
|
if (userId) { |
|
|
|
wx.setStorageSync('userId', userId); |
|
|
|
} else { |
|
|
|
const app = getApp(); |
|
|
|
if (app.globalData.userInfo && app.globalData.userInfo.userId) { |
|
|
|
const serverUserId = String(app.globalData.userInfo.userId); |
|
|
|
wx.setStorageSync('userId', serverUserId); |
|
|
|
userId = serverUserId; |
|
|
|
console.log('使用从全局获取的正式用户ID:', serverUserId); |
|
|
|
} else { |
|
|
|
console.warn('未找到有效的用户ID,请确保用户已授权登录'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log('获取openid成功并存储:', openid); |
|
|
|
|
|
|
|
// 3. 上传手机号加密数据到服务器解密
|
|
|
|
const phoneData = { |
|
|
|
...e.detail, |
|
|
|
openid: openid, |
|
|
|
sessionKey: sessionKey || '' |
|
|
|
}; |
|
|
|
|
|
|
|
console.log('准备上传手机号加密数据到服务器'); |
|
|
|
const phoneRes = await API.uploadPhoneNumberData(phoneData); |
|
|
|
|
|
|
|
// 改进手机号解密结果的处理逻辑
|
|
|
|
if (!phoneRes || (!phoneRes.success && !phoneRes.phoneNumber)) { |
|
|
|
// 如果服务器返回格式不标准但包含手机号,也接受
|
|
|
|
if (!(phoneRes && phoneRes.phoneNumber)) { |
|
|
|
throw new Error('获取手机号失败: ' + (phoneRes && phoneRes.message ? phoneRes.message : '未知错误')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有手机号冲突
|
|
|
|
const hasPhoneConflict = phoneRes.phoneNumberConflict || false; |
|
|
|
const isNewPhone = phoneRes.isNewPhone || true; |
|
|
|
const phoneNumber = phoneRes.phoneNumber || null; |
|
|
|
|
|
|
|
console.log('手机号解密结果:', { |
|
|
|
phoneNumber: phoneNumber, |
|
|
|
hasPhoneConflict: hasPhoneConflict, |
|
|
|
isNewPhone: isNewPhone |
|
|
|
}); |
|
|
|
|
|
|
|
// 4. 获取用户微信名称和头像
|
|
|
|
let userProfile = null; |
|
|
|
try { |
|
|
|
userProfile = await new Promise((resolve, reject) => { |
|
|
|
wx.getUserProfile({ |
|
|
|
desc: '用于完善会员资料', |
|
|
|
success: (userProfile) => { |
|
|
|
console.log('获取用户信息成功:', userProfile); |
|
|
|
|
|
|
|
// 构建用户信息
|
|
|
|
const userInfo = { |
|
|
|
openid: res.data.openid, |
|
|
|
userId: res.data.userId, |
|
|
|
name: userProfile.userInfo.name || userProfile.userInfo.nickName, |
|
|
|
avatarUrl: userProfile.userInfo.avatarUrl, |
|
|
|
type: this.data.pendingUserType |
|
|
|
}; |
|
|
|
|
|
|
|
// 保存用户信息到本地存储
|
|
|
|
wx.setStorageSync('userInfo', userInfo); |
|
|
|
|
|
|
|
// 上传用户信息到服务器
|
|
|
|
API.uploadUserInfo(userInfo) |
|
|
|
.then(uploadRes => { |
|
|
|
console.log('用户信息上传成功:', uploadRes); |
|
|
|
|
|
|
|
// 关闭登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
|
|
|
|
// 登录成功后,重新执行"我想要"操作
|
|
|
|
this.handleLoginSuccess(); |
|
|
|
}) |
|
|
|
.catch(uploadErr => { |
|
|
|
console.error('用户信息上传失败:', uploadErr); |
|
|
|
|
|
|
|
// 即使上传失败,也关闭登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
|
|
|
|
// 登录成功后,重新执行"我想要"操作
|
|
|
|
this.handleLoginSuccess(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
fail: (profileErr) => { |
|
|
|
console.error('获取用户信息失败:', profileErr); |
|
|
|
|
|
|
|
// 即使获取用户信息失败,也构建基本用户信息对象
|
|
|
|
const userInfo = { |
|
|
|
openid: res.data.openid, |
|
|
|
userId: res.data.userId, |
|
|
|
name: '微信用户', |
|
|
|
avatarUrl: '/images/default-avatar.png', |
|
|
|
type: this.data.pendingUserType |
|
|
|
}; |
|
|
|
|
|
|
|
// 保存用户信息到本地存储
|
|
|
|
wx.setStorageSync('userInfo', userInfo); |
|
|
|
|
|
|
|
// 关闭登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
|
|
|
|
// 登录成功后,重新执行"我想要"操作
|
|
|
|
this.handleLoginSuccess(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: '登录失败,请重试', |
|
|
|
icon: 'none' |
|
|
|
success: resolve, |
|
|
|
fail: reject |
|
|
|
}); |
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.error('登录失败:', err); |
|
|
|
}); |
|
|
|
console.log('获取用户信息成功:', userProfile); |
|
|
|
} catch (err) { |
|
|
|
console.warn('获取用户信息失败:', err); |
|
|
|
// 如果获取失败,使用默认值
|
|
|
|
} |
|
|
|
|
|
|
|
// 5. 创建用户信息
|
|
|
|
const app = getApp(); |
|
|
|
const existingUserInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {}; |
|
|
|
const userInfo = { |
|
|
|
// 优先使用最新获取的微信头像和昵称,如果没有获取到则使用本地存储的
|
|
|
|
name: (userProfile ? (userProfile.userInfo.name || userProfile.userInfo.nickName) : existingUserInfo.name) || '微信用户', |
|
|
|
avatarUrl: (userProfile ? userProfile.userInfo.avatarUrl : existingUserInfo.avatarUrl) || 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', |
|
|
|
gender: (userProfile ? userProfile.userInfo.gender : existingUserInfo.gender) || 0, |
|
|
|
country: (userProfile ? userProfile.userInfo.country : existingUserInfo.country) || '', |
|
|
|
province: (userProfile ? userProfile.userInfo.province : existingUserInfo.province) || '', |
|
|
|
city: (userProfile ? userProfile.userInfo.city : existingUserInfo.city) || '', |
|
|
|
language: (userProfile ? userProfile.userInfo.language : existingUserInfo.language) || 'zh_CN', |
|
|
|
phoneNumber: phoneNumber |
|
|
|
}; |
|
|
|
|
|
|
|
// 6. 获取用户类型
|
|
|
|
const users = wx.getStorageSync('users') || {}; |
|
|
|
let currentUserType = users[userId] && users[userId].type ? users[userId].type : ''; |
|
|
|
|
|
|
|
// 如果没有用户类型,使用pendingUserType或从全局获取
|
|
|
|
if (!currentUserType) { |
|
|
|
currentUserType = this.data.pendingUserType || app.globalData.userType || ''; |
|
|
|
} |
|
|
|
|
|
|
|
// 7. 保存用户信息并等待上传完成
|
|
|
|
console.log('开始保存用户信息并上传到服务器...'); |
|
|
|
await this.uploadUserInfoToServer(userInfo, userId, currentUserType); |
|
|
|
console.log('用户信息保存并上传完成'); |
|
|
|
|
|
|
|
// 更新本地和全局用户信息
|
|
|
|
app.globalData.userInfo = userInfo; |
|
|
|
wx.setStorageSync('userInfo', userInfo); |
|
|
|
|
|
|
|
// 确保users存储结构存在
|
|
|
|
let usersStorage = wx.getStorageSync('users') || {}; |
|
|
|
if (!usersStorage[userId]) { |
|
|
|
usersStorage[userId] = {}; |
|
|
|
} |
|
|
|
|
|
|
|
// 保存手机号到users对象中
|
|
|
|
usersStorage[userId].phoneNumber = phoneNumber; |
|
|
|
usersStorage[userId].type = currentUserType; |
|
|
|
wx.setStorageSync('users', usersStorage); |
|
|
|
|
|
|
|
wx.hideLoading(); |
|
|
|
|
|
|
|
// 关闭登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
|
|
|
|
// 登录成功后,重新执行"我想要"操作
|
|
|
|
this.handleLoginSuccess(); |
|
|
|
|
|
|
|
// 根据服务器返回的结果显示不同的提示
|
|
|
|
if (hasPhoneConflict) { |
|
|
|
wx.showToast({ |
|
|
|
title: '网络错误,请重试', |
|
|
|
icon: 'none' |
|
|
|
title: '登录成功,但手机号已被其他账号绑定', |
|
|
|
icon: 'none', |
|
|
|
duration: 3000 |
|
|
|
}); |
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: '登录成功,手机号已绑定', |
|
|
|
icon: 'success', |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
wx.hideLoading(); |
|
|
|
console.error('登录过程中发生错误:', error); |
|
|
|
|
|
|
|
// 更具体的错误提示
|
|
|
|
let errorMsg = '登录失败,请重试'; |
|
|
|
if (error.message.includes('网络')) { |
|
|
|
errorMsg = '网络连接失败,请检查网络后重试'; |
|
|
|
} else if (error.message.includes('服务器')) { |
|
|
|
errorMsg = '服务器连接失败,请稍后重试'; |
|
|
|
} else if (error.message.includes('openid')) { |
|
|
|
errorMsg = '获取登录信息失败,请重试'; |
|
|
|
} else if (error.message.includes('手机号')) { |
|
|
|
errorMsg = '获取手机号失败,请重试'; |
|
|
|
} |
|
|
|
|
|
|
|
wx.showToast({ |
|
|
|
title: errorMsg, |
|
|
|
icon: 'none', |
|
|
|
duration: 3000 |
|
|
|
}); |
|
|
|
|
|
|
|
// 关闭登录弹窗
|
|
|
|
this.setData({ |
|
|
|
showOneKeyLoginModal: false |
|
|
|
}); |
|
|
|
|
|
|
|
// 清除可能已经保存的不完整信息
|
|
|
|
try { |
|
|
|
wx.removeStorageSync('openid'); |
|
|
|
wx.removeStorageSync('sessionKey'); |
|
|
|
wx.removeStorageSync('userId'); |
|
|
|
} catch (e) { |
|
|
|
console.error('清除临时登录信息失败:', e); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存用户信息
|
|
|
|
@ -1869,44 +1979,48 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 上传用户信息到服务器
|
|
|
|
uploadUserInfoToServer: function (userInfo, userId, type) { |
|
|
|
console.log('上传用户信息到服务器:', userInfo); |
|
|
|
|
|
|
|
API.saveUserInfo(userInfo, type) |
|
|
|
.then(res => { |
|
|
|
console.log('上传用户信息成功:', res); |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
showUserInfoForm: false |
|
|
|
}); |
|
|
|
uploadUserInfoToServer(userInfo, userId, type) { |
|
|
|
// 返回Promise以便调用者可以进行错误处理
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
try { |
|
|
|
// 引入API服务
|
|
|
|
const API = require('../../utils/api.js'); |
|
|
|
|
|
|
|
// 登录成功后,重新执行"我想要"操作
|
|
|
|
if (this.data.currentGoodsId) { |
|
|
|
// 模拟点击"我想要"按钮,使用新的商品ID
|
|
|
|
const goodsItem = this.findGoodsItemById(String(this.data.currentGoodsId)); |
|
|
|
if (goodsItem) { |
|
|
|
// 重新调用onClickWant,但这次用户已登录
|
|
|
|
this.onClickWant({ currentTarget: { dataset: { id: this.data.currentGoodsId } } }); |
|
|
|
} |
|
|
|
// 获取openid
|
|
|
|
const openid = wx.getStorageSync('openid'); |
|
|
|
|
|
|
|
// 验证必要参数
|
|
|
|
if (!userId || !openid) { |
|
|
|
const error = new Error('缺少必要的用户信息'); |
|
|
|
console.error('用户信息上传失败:', error); |
|
|
|
reject(error); |
|
|
|
return; |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.error('上传用户信息失败:', err); |
|
|
|
|
|
|
|
// 即使上传失败,也标记为已登录
|
|
|
|
this.setData({ |
|
|
|
showUserInfoForm: false |
|
|
|
// 构造上传数据(包含所有必要字段,包括phoneNumber和头像URL)
|
|
|
|
const uploadData = { |
|
|
|
userId: userId, |
|
|
|
openid: openid, |
|
|
|
name: userInfo.name, |
|
|
|
avatarUrl: userInfo.avatarUrl, // 添加头像URL字段
|
|
|
|
phoneNumber: userInfo.phoneNumber, // 添加phoneNumber字段,满足服务器要求
|
|
|
|
type: type, |
|
|
|
timestamp: Date.now() |
|
|
|
}; |
|
|
|
|
|
|
|
// 调用API上传用户信息
|
|
|
|
API.uploadUserInfo(uploadData).then(res => { |
|
|
|
console.log('用户信息上传成功:', res); |
|
|
|
resolve(res); |
|
|
|
}).catch(err => { |
|
|
|
console.error('用户信息上传失败:', err); |
|
|
|
reject(err); |
|
|
|
}); |
|
|
|
|
|
|
|
// 尝试执行"我想要"操作
|
|
|
|
if (this.data.currentGoodsId) { |
|
|
|
const goodsItem = this.findGoodsItemById(String(this.data.currentGoodsId)); |
|
|
|
if (goodsItem) { |
|
|
|
// 重新调用onClickWant,但这次用户已登录
|
|
|
|
this.onClickWant({ currentTarget: { dataset: { id: this.data.currentGoodsId } } }); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} catch (error) { |
|
|
|
console.error('上传用户信息时发生异常:', error); |
|
|
|
reject(error); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
recordBehavior(behaviorType, targetType, targetId) { |
|
|
|
|