合并解决冲突

This commit is contained in:
2026-05-13 18:32:56 +08:00

View File

@@ -41,6 +41,8 @@ const showRoundTip = ref(false);
const isFinalShoot = ref(false); const isFinalShoot = ref(false);
const matchStatus = ref(undefined); const matchStatus = ref(undefined);
const updateRemainSecond = ref(0); const updateRemainSecond = ref(0);
/** 当前对局每人射击时间(秒),从后端 shootTime 字段动态读取,默认 15 */
const shootTimeTotal = ref(15);
/** 对战来源类型1=好友约战2=匹配对战),用于结算页分流 */ /** 对战来源类型1=好友约战2=匹配对战),用于结算页分流 */
const battleWay = ref(0); const battleWay = ref(0);
/** 上一次处理的 ToSomeoneShoot 关键字段,用于去重过滤重复消息 */ /** 上一次处理的 ToSomeoneShoot 关键字段,用于去重过滤重复消息 */
@@ -123,6 +125,8 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
} }
// redPlayer 已在上方 find() 确认:不为 null 则当前射手在红队 // redPlayer 已在上方 find() 确认:不为 null 则当前射手在红队
const targetTeam = redPlayer ? 'red' : 'blue'; const targetTeam = redPlayer ? 'red' : 'blue';
// 从后端消息读取本局射击时间,动态设置进度条满值与倒计时秒数(降级兜底 15s
shootTimeTotal.value = battleInfo.shootTime ?? 15;
if (force) { if (force) {
// force 模式下 start.value 刚由 null 变 trueVue 异步调度渲染, // force 模式下 start.value 刚由 null 变 trueVue 异步调度渲染,
// ShootProgress2v-if="start"尚未挂载update-remain 事件会被丢弃。 // ShootProgress2v-if="start"尚未挂载update-remain 事件会被丢弃。
@@ -130,14 +134,14 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
// onAudioEnded 驱动,需在 nextTick 后直接启动。 // onAudioEnded 驱动,需在 nextTick 后直接启动。
const elapsed = (Date.now() - battleInfo.current.startTime) / 1000; const elapsed = (Date.now() - battleInfo.current.startTime) / 1000;
console.log(`当前轮已进行${elapsed}`); console.log(`当前轮已进行${elapsed}`);
if (elapsed > 0 && elapsed < 15) { if (elapsed > 0 && elapsed < shootTimeTotal.value) {
updateRemainSecond.value = 15 - elapsed - 0.2; updateRemainSecond.value = shootTimeTotal.value - elapsed - 0.2;
} }
const actualRemain = updateRemainSecond.value; const actualRemain = updateRemainSecond.value;
nextTick(() => { nextTick(() => {
// 在 nextTick 内统一发送,确保 ShootProgress2 和 HeaderProgress 均已挂载 // 在 nextTick 内统一发送,确保 ShootProgress2 和 HeaderProgress 均已挂载
uni.$emit("update-tips", nextTips); uni.$emit("update-tips", nextTips);
uni.$emit("update-remain", {reset: true, value: 15, team: targetTeam}); uni.$emit("update-remain", {reset: true, value: shootTimeTotal.value, team: targetTeam});
// 重置动画完成后,直接启动倒计时(无需依赖音频结束回调) // 重置动画完成后,直接启动倒计时(无需依赖音频结束回调)
setTimeout(() => { setTimeout(() => {
uni.$emit("update-remain", {stop: false, value: actualRemain, team: targetTeam}); uni.$emit("update-remain", {stop: false, value: actualRemain, team: targetTeam});
@@ -145,8 +149,8 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
}); });
} else { } else {
// ToSomeoneShoot 到达时:若进度条仍在倒计时则瞬间清零再切换满值,确保视觉连贯 // ToSomeoneShoot 到达时:若进度条仍在倒计时则瞬间清零再切换满值,确保视觉连贯
uni.$emit("update-remain", {zeroThenReset: true, value: 15, team: targetTeam}); uni.$emit("update-remain", {zeroThenReset: true, value: shootTimeTotal.value, team: targetTeam});
updateRemainSecond.value = battleInfo.readyTime; updateRemainSecond.value = shootTimeTotal.value;
} }
} else { } else {
currentRound.value = battleInfo.current.round || 1; currentRound.value = battleInfo.current.round || 1;
@@ -324,6 +328,7 @@ onShow(async () => {
/> />
<ShootProgress2 <ShootProgress2
:tips="tips" :tips="tips"
:total="shootTimeTotal"
:currentRound=" :currentRound="
goldenRound > 0 ? 'gold' + goldenRound : 'round' + currentRound goldenRound > 0 ? 'gold' + goldenRound : 'round' + currentRound
" "