From d4d298a275d225266252952c224ad42bee4fd1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Thu, 1 Jan 2026 12:07:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E5=86=8D=E6=9D=A5=E4=B8=80=E5=B1=80=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E6=8C=81=E4=BB=BB=E5=8A=A1=E6=8C=89=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=87=91=E9=A2=9D=E7=BB=9F=E8=AE=A1=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-game/game/webview.vue | 10 ++++++++++ pages-user/tasks/index.vue | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/pages-game/game/webview.vue b/pages-game/game/webview.vue index 8d0e6b5..a1e797b 100644 --- a/pages-game/game/webview.vue +++ b/pages-game/game/webview.vue @@ -43,6 +43,16 @@ function onMessage(e) { data.forEach(msg => { if (msg.action === 'close') { uni.navigateBack() + } else if (msg.action === 'playAgain') { + // 再来一局: 返回上一页,上一页会自动刷新重新获取token进入游戏 + console.log('PlayAgain: 返回游戏入口页面') + uni.navigateBack({ + delta: 1, + success: () => { + // 可选: 发送事件通知上一页刷新 + uni.$emit('refreshGame') + } + }) } else if (msg.action === 'game_over') { // Optional: Refresh user balance or state } diff --git a/pages-user/tasks/index.vue b/pages-user/tasks/index.vue index a547ff4..683f984 100644 --- a/pages-user/tasks/index.vue +++ b/pages-user/tasks/index.vue @@ -139,6 +139,7 @@ const claiming = reactive({}) // 用户进度 (汇总) const userProgress = reactive({ orderCount: 0, + orderAmount: 0, inviteCount: 0, firstOrder: false, claimedTiers: {} // { taskId: [tierId1, tierId2] } @@ -224,6 +225,7 @@ function getTierBadge(tier) { const metric = tier.metric || '' if (metric === 'first_order') return '首' if (metric === 'order_count') return `${tier.threshold}单` + if (metric === 'order_amount') return `¥${tier.threshold / 100}` if (metric === 'invite_count') return `${tier.threshold}人` return tier.threshold || '' } @@ -233,6 +235,7 @@ function getTierConditionText(tier) { const metric = tier.metric || '' if (metric === 'first_order') return '完成首笔订单' if (metric === 'order_count') return `累计下单 ${tier.threshold} 笔` + if (metric === 'order_amount') return `累计消费 ¥${tier.threshold / 100}` if (metric === 'invite_count') return `邀请 ${tier.threshold} 位好友` return `达成 ${tier.threshold}` } @@ -285,6 +288,8 @@ function isTierClaimable(task, tier) { return userProgress.firstOrder } else if (metric === 'order_count') { current = userProgress.orderCount || 0 + } else if (metric === 'order_amount') { + current = userProgress.orderAmount || 0 } else if (metric === 'invite_count') { current = userProgress.inviteCount || 0 } @@ -305,6 +310,9 @@ function getTierProgressText(task, tier) { return userProgress.firstOrder ? '已完成' : '未完成' } else if (metric === 'order_count') { current = userProgress.orderCount || 0 + } else if (metric === 'order_amount') { + current = userProgress.orderAmount || 0 + return `¥${current / 100}/¥${threshold / 100}` } else if (metric === 'invite_count') { current = userProgress.inviteCount || 0 } @@ -368,6 +376,7 @@ async function fetchData() { try { const progressRes = await getTaskProgress(list[0].id, userId) userProgress.orderCount = progressRes.order_count || 0 + userProgress.orderAmount = progressRes.order_amount || 0 userProgress.inviteCount = progressRes.invite_count || 0 userProgress.firstOrder = progressRes.first_order || false