Compare commits

..

1 Commits

Author SHA1 Message Date
kk 533170f0a9 接口返回数据结构问题处理
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 39s
2026-07-11 20:33:58 +08:00
+6 -5
View File
@@ -418,14 +418,15 @@ export default {
const openId = uni.getStorageSync('openid') || ''; const openId = uni.getStorageSync('openid') || '';
const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId }); const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId });
const infoData = (infoRes.data || {}).data || {}; const infoData = (infoRes.data || {}).data || {};
if (infoData.user_id) { const userInfo = infoData.user_info || {};
if (userInfo.user_id) {
const existing = getCachedUserInfo() || {}; const existing = getCachedUserInfo() || {};
uni.setStorageSync('user_info', { uni.setStorageSync('user_info', {
...existing, ...existing,
user_id: infoData.user_id, user_id: userInfo.user_id,
nickname: infoData.nickname || existing.nickname || '', nickname: userInfo.nickname || existing.nickname || '',
avatar: infoData.avatar || existing.avatar || '', avatar: userInfo.avatar || existing.avatar || '',
phone: infoData.phone || existing.phone || '', phone: userInfo.phone || existing.phone || '',
}); });
this.loadUserInfo(); this.loadUserInfo();
} }