From a1b26208a4e8b846b53d06e26c6d69997777bf61 Mon Sep 17 00:00:00 2001 From: DevOps Date: Wed, 7 Jan 2026 12:28:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B5=9B=E4=BA=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=8A=B6=E6=80=81=E6=A0=B9=E6=8D=AE=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 calculateStatus 方法根据报名时间和比赛时间计算状态 - 状态显示不再依赖数据库字段,而是实时计算 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- src/views/martial/order/index.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/views/martial/order/index.vue b/src/views/martial/order/index.vue index 55f3704..89e5a62 100644 --- a/src/views/martial/order/index.vue +++ b/src/views/martial/order/index.vue @@ -60,8 +60,8 @@ @@ -252,6 +252,19 @@ export default { return `${start} ~ ${end}` }, + // 根据时间计算赛事状态 + calculateStatus(row) { + const now = new Date() + const regStart = row.registrationStartTime ? new Date(row.registrationStartTime) : null + const regEnd = row.registrationEndTime ? new Date(row.registrationEndTime) : null + const compStart = row.competitionStartTime ? new Date(row.competitionStartTime) : null + const compEnd = row.competitionEndTime ? new Date(row.competitionEndTime) : null + if (compEnd && now > compEnd) return 4 + if (compStart && now >= compStart) return 3 + if (regStart && regEnd && now >= regStart && now <= regEnd) return 2 + return 1 + }, + getStatusType(status) { const statusMap = { 1: 'info', // 未开始