diff --git a/pages-game/game/minesweeper/play.vue b/pages-game/game/minesweeper/play.vue index 7400a31..d294a78 100644 --- a/pages-game/game/minesweeper/play.vue +++ b/pages-game/game/minesweeper/play.vue @@ -691,6 +691,10 @@ export default { }); } this.gameState = data; + // 收到状态更新时重置计时器(处理重连场景) + if (data.gameStarted) { + this.resetTurnTimer(); + } } else if (opCode === 5) { this.handleEvent(data); } else if (opCode === 6) { @@ -810,42 +814,15 @@ export default { this.addLog('system', '已切断匹配信号'); }, handleCellClick(idx) { - console.log('[handleCellClick] 收到点击事件, 格子:', idx, 'isMyTurn:', this.isMyTurn); - if (this.isSpectator) { - console.warn('[点击拦截] 处于观众模式'); - return; - } - if (!this.gameState) { - console.warn('[点击拦截] 游戏数据未就绪'); - return; - } - if (!this.gameState.gameStarted) { - console.warn('[点击拦截] 游戏尚未开始'); - return; - } - if (this.showResultModal || this.showSettlement) { - console.warn('[点击拦截] 结算界面显示中'); - return; - } - if (!this.isMyTurn) { - const currentPlayerInTurn = this.gameState?.turnOrder?.[this.gameState?.currentTurnIndex]; - console.warn('[点击拦截] 非当前玩家回合', { - myUserId: this.myUserId, - currentTurnIndex: this.gameState?.currentTurnIndex, - turnOrder: this.gameState?.turnOrder, - currentPlayerInTurn, - isMyTurn: this.isMyTurn - }); - return; - } - if (this.gameState.grid[idx].revealed) { - console.warn('[点击拦截] 该格子已揭示', { idx, cell: this.gameState.grid[idx] }); - return; - } + // 前置条件检查 + if (this.isSpectator) return; + if (!this.gameState?.gameStarted) return; + if (this.showResultModal || this.showSettlement) return; + if (!this.isMyTurn) return; + if (this.gameState.grid[idx].revealed) return; - console.log(`[发送指令] 准备发送 - matchId: ${this.matchId}, OpCode: 3, 格子: ${idx}`); + // 发送移动指令 nakamaManager.sendMatchState(this.matchId, 3, JSON.stringify({ index: idx })); - console.log(`[发送指令] 已调用 sendMatchState`); }, refreshAndPlayAgain() { uni.removeStorageSync('minesweeper_last_match_id'); diff --git a/pages-user/tasks/index.vue b/pages-user/tasks/index.vue index 5e75fb3..bc2330c 100644 --- a/pages-user/tasks/index.vue +++ b/pages-user/tasks/index.vue @@ -247,11 +247,26 @@ function getTierRewardText(task, tier) { const texts = rewards.map(r => { const type = r.reward_type || '' + const name = r.reward_name || '' const payload = r.reward_payload || {} const qty = r.quantity || 1 + // 优先使用后端返回的 reward_name + if (name) { + if (type === 'points') { + const points = payload.points || qty + return points > 1 ? `${points}${name}` : name + } + if (type === 'coupon') { + const value = payload.value || payload.amount + return value ? `${name}(¥${value / 100})` : name + } + return qty > 1 ? `${name}×${qty}` : name + } + + // 回退:从 payload 解析 if (type === 'points') { - const value = payload.value || payload.amount || qty + const value = payload.points || payload.value || payload.amount || qty return `${value}积分` } if (type === 'coupon') { @@ -259,12 +274,14 @@ function getTierRewardText(task, tier) { return value ? `¥${value / 100}优惠券` : '优惠券' } if (type === 'item_card') { - const name = payload.name || '道具卡' - return qty > 1 ? `${name}×${qty}` : name + return payload.name || '道具卡' } if (type === 'title') { return payload.name || '专属称号' } + if (type === 'game_ticket') { + return payload.game_code ? `${payload.amount || 1}张抽奖券` : '抽奖券' + } return '奖励' }) diff --git a/utils/request.js b/utils/request.js index d94781c..476da26 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,4 +1,4 @@ -const BASE_URL = 'https://mini-chat.1024tool.vip' +const BASE_URL = 'http://127.0.0.1:9991' let authModalShown = false