From ff28c9a5a214b48b1905079c702a5a84cc2c8384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E8=84=8F=E7=8B=BC?= <786316265@qq.com> Date: Fri, 22 Aug 2025 16:57:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/MyPointsHistory.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/views/MyPointsHistory.vue b/src/views/MyPointsHistory.vue index 6fcd49d..ff3203e 100644 --- a/src/views/MyPointsHistory.vue +++ b/src/views/MyPointsHistory.vue @@ -28,7 +28,7 @@
{{ userPoints }}
-
当前积分
+
我的积分图标 @@ -288,11 +288,18 @@ const viewOrder = (orderId) => { const getUserPoints = async () => { try { const response = await api.get('/user/points') - userPoints.value = response.data.currentPoints - totalEarned.value = response.data.totalEarned - totalSpent.value = response.data.totalSpent + + // 添加更灵活的数据提取方式 + userPoints.value = response.data?.currentPoints ?? response.data?.points ?? 0 + totalEarned.value = response.data?.totalEarned ?? 0 + totalSpent.value = response.data?.totalSpent ?? 0 + } catch (error) { + console.error("获取积分信息失败:", error) ElMessage.error('获取积分信息失败') + userPoints.value = 0 + totalEarned.value = 0 + totalSpent.value = 0 } }