From 0f7255783acdfac949154a89ceb0f56b1388e76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Sun, 4 Jan 2026 11:01:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20`getUserProfile`=20=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=B9=B6=E4=B8=BA=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/index.vue | 4 ++-- pages/mine/index.vue | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pages/login/index.vue b/pages/login/index.vue index c1de2f9..b776d60 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -441,7 +441,7 @@ async function onGetPhoneNumber(e) { // 更新用户信息 try { - const updatedUserInfo = await authRequest({ url: '/api/app/users/info', method: 'GET' }) + const updatedUserInfo = await getUserProfile() // 使用 api/appUser.js 中的函数 if (updatedUserInfo) { uni.setStorageSync('user_info', updatedUserInfo) } @@ -497,7 +497,7 @@ async function onGetPhoneNumber(e) { // 更新用户信息 try { - const updatedUserInfo = await authRequest({ url: '/api/app/users/info', method: 'GET' }) + const updatedUserInfo = await getUserProfile() if (updatedUserInfo) { Object.assign(data, updatedUserInfo) uni.setStorageSync('user_info', updatedUserInfo) diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 38df546..ce2bba8 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -776,7 +776,12 @@ export default { } try { // 优先使用新的 profile API - const profile = await getUserProfile() + let profile = null + try { + profile = await getUserProfile() + } catch (err) { + console.warn('[Mine] getUserProfile 调用失败,将尝试降级逻辑:', err) + } if (profile) { console.log('[Mine] 从 profile API 获取用户信息:', profile)