diff --git a/src/App.vue b/src/App.vue index af5c1c6..36994d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -35,7 +35,7 @@ onShow(() => { data: JSON.stringify({ event: "ping", data: {} }), fail: () => { // 如果发送失败,说明连接已断开,需要重新连接 - websocket.createWebSocket(token, updateConnect, (content) => { + websocket.createWebSocket(token, (content) => { uni.$emit("socket-inbox", content); }); }, diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue index e3fcc80..89e28b9 100644 --- a/src/pages/battle-room.vue +++ b/src/pages/battle-room.vue @@ -136,12 +136,14 @@ onLoad(async (options) => { tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`; } } - const remain = Date.now() / 1000 - battleInfo.fireTime; - if (remain > 0 && remain < 15) { - // 等渲染好再通知 - setTimeout(() => { - uni.$emit("update-ramain", remain); - }, 300); + if (battleInfo.fireTime > 0) { + const remain = Date.now() / 1000 - battleInfo.fireTime; + if (remain > 0 && remain < 15) { + // 等渲染好再通知 + setTimeout(() => { + uni.$emit("update-ramain", remain); + }, 300); + } } } else if (battleInfo.config.mode === 2) { tips.value = "请连续射出6支箭"; @@ -152,7 +154,7 @@ onLoad(async (options) => { scores.value = p.arrows; } }); - if (battleInfo.startTime) { + if (battleInfo.startTime > 0) { const remain = Date.now() / 1000 - battleInfo.startTime; if (remain <= 90) { setTimeout(() => { diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue index 79dcb6f..02b6d4c 100644 --- a/src/pages/melee-match.vue +++ b/src/pages/melee-match.vue @@ -67,7 +67,7 @@ onLoad(async (options) => { scores.value = p.arrows; } }); - if (battleInfo.startTime) { + if (battleInfo.startTime > 0) { const remain = Date.now() / 1000 - battleInfo.startTime; if (remain <= 90) { setTimeout(() => { diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue index d15cf68..e70d2b7 100644 --- a/src/pages/team-match.vue +++ b/src/pages/team-match.vue @@ -103,12 +103,14 @@ onLoad(async (options) => { tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`; } } - const remain = Date.now() / 1000 - battleInfo.fireTime; - if (remain > 0 && remain <= 15) { - // 等渲染好再通知 - setTimeout(() => { - uni.$emit("update-ramain", remain); - }, 300); + if (battleInfo.fireTime > 0) { + const remain = Date.now() / 1000 - battleInfo.fireTime; + if (remain > 0 && remain <= 15) { + // 等渲染好再通知 + setTimeout(() => { + uni.$emit("update-ramain", remain); + }, 300); + } } } } else {