fix:优化重进比赛tips展示逻辑

This commit is contained in:
2026-05-13 11:17:30 +08:00
parent 6d434e89ab
commit 6cb5288631
3 changed files with 25 additions and 2 deletions

View File

@@ -113,7 +113,14 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
audioManager.play(audioKey, false);
}
tips.value = nextTips;
uni.$emit("update-tips", nextTips);
// 同步写入 Pinia store供 HeaderProgress 通过 immediate watch 在 onMounted 时立即读取
// 规避 WeChat 小程序 onShow 在组件 onMounted 之前触发导致 uni.$emit 事件丢失的时序问题
store.updateTips(nextTips);
// force 模式下改为在 nextTick 内发送 update-tips规避 WeChat 小程序
// onShow 与 onMounted 时序问题导致 HeaderProgress 监听器尚未注册的边界情况
if (!force) {
uni.$emit("update-tips", nextTips);
}
// redPlayer 已在上方 find() 确认:不为 null 则当前射手在红队
const targetTeam = redPlayer ? 'red' : 'blue';
if (force) {
@@ -128,7 +135,8 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
}
const actualRemain = updateRemainSecond.value;
nextTick(() => {
// 等 ShootProgress2 挂载后再发重置事件,确保事件能被接收
// 在 nextTick 内统一发送,确保 ShootProgress2 和 HeaderProgress 均已挂载
uni.$emit("update-tips", nextTips);
uni.$emit("update-remain", {reset: true, value: 15, team: targetTeam});
// 重置动画完成后,直接启动倒计时(无需依赖音频结束回调)
setTimeout(() => {