From 518e7d33a3fe071acd9e5444639722ae83cc5827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Mon, 27 Apr 2026 08:23:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E6=8A=A5=E5=90=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=96=87=E6=A1=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../match/manage/Steps/Step1BasicInfo.vue | 2 +- src/views/match/manage/index.vue | 6 ++--- src/views/match/manage/work.vue | 22 ++++++++++++++----- src/views/user/registration/index.vue | 8 +++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/views/match/manage/Steps/Step1BasicInfo.vue b/src/views/match/manage/Steps/Step1BasicInfo.vue index 9725b08..7ccbe6f 100644 --- a/src/views/match/manage/Steps/Step1BasicInfo.vue +++ b/src/views/match/manage/Steps/Step1BasicInfo.vue @@ -54,7 +54,7 @@ 个人报名 团队报名 - 个人\团队报名 + 个人/团队报名 diff --git a/src/views/match/manage/index.vue b/src/views/match/manage/index.vue index f3eac90..cdf25c2 100644 --- a/src/views/match/manage/index.vue +++ b/src/views/match/manage/index.vue @@ -118,9 +118,9 @@ const columns = reactive([ prop: 'registrationType', label: '报名方式', enum: [ - { label: '只允许个人报名', value: 0 }, - { label: '只允许团队报名', value: 1 }, - { label: '两者都有', value: 2 }, + { label: '个人报名', value: 0 }, + { label: '团队报名', value: 1 }, + { label: '个人/团队报名', value: 2 }, ], }, { diff --git a/src/views/match/manage/work.vue b/src/views/match/manage/work.vue index ff579a7..4883612 100644 --- a/src/views/match/manage/work.vue +++ b/src/views/match/manage/work.vue @@ -456,7 +456,9 @@ const openDialog = async (id) => { const res2 = await eventarrangementListGet(id); eventlist.value = filterProjectsWithParticipants(res2.data).map((item, idx) => ({ ...item, - _tempId: item.id || `temp-${idx}-${Date.now()}` + _tempId: item.id || `temp-${idx}-${Date.now()}`, + // 确保 durationSeconds 是数字类型 + durationSeconds: typeof item.durationSeconds === 'number' ? item.durationSeconds : 0 })); await nextTick(); @@ -667,7 +669,8 @@ const previewArrangement = async () => { // 为每个项目设置正确的 SortIndex(根据当前在数组中的位置) const settingsWithSortIndex = eventlist.value.map((item, index) => ({ - ...item, + ProjectId: item.projectId || item.id, + VenueCount: item.venueCount, SortIndex: index + 1 // 从 1 开始排序 })); @@ -728,7 +731,8 @@ const getTimeRowspan = (index) => { const onSave = async () => { // 为每个项目设置正确的 SortIndex(根据当前在数组中的位置) const settingsWithSortIndex = eventlist.value.map((item, index) => ({ - ...item, + ProjectId: item.projectId || item.id, + VenueCount: item.venueCount, SortIndex: index + 1 // 从 1 开始排序 })); @@ -765,7 +769,8 @@ const getArr = async () => { // 为每个项目设置正确的 SortIndex(根据当前在数组中的位置) const settingsWithSortIndex = eventlist.value.map((item, index) => ({ - ...item, + ProjectId: item.projectId || item.id, + VenueCount: item.venueCount, SortIndex: index + 1 // 从 1 开始排序 })); @@ -1396,6 +1401,9 @@ const validateVenueCount = () => { return { valid: true }; }; +// 保存原始项目时长,用于计算 +const originalDurations = ref({}); + // 监听 eventlist 变化,实时计算总时长(不显示错误提示) watch( eventlist, @@ -1405,13 +1413,17 @@ watch( if (newList && newList.length > 0) { newList.forEach((item) => { + // 确保 durationSeconds 是数字类型 + if (typeof item.durationSeconds !== 'number' || isNaN(item.durationSeconds)) { + item.durationSeconds = 0; + } const result = calculateProjectDuration(item); item.totalDurationMinutes = result.totalMinutes; item.totalDurationSeconds = result.totalSeconds; }); } }, - { deep: true } + { deep: true, immediate: true } ); // 暴露变量 diff --git a/src/views/user/registration/index.vue b/src/views/user/registration/index.vue index e0c075b..e0830ef 100644 --- a/src/views/user/registration/index.vue +++ b/src/views/user/registration/index.vue @@ -538,13 +538,13 @@ const registrationTypeText = (row) => { switch (v) { case 'OnlyIndividual': case 0: - return '只允许个人报名'; + return '个人报名'; case 'OnlyTeam': case 1: - return '只允许团队报名'; + return '团队报名'; case 'Both': case 2: - return '两者都有'; + return '个人/团队报名'; default: return v ?? '-'; } @@ -1051,7 +1051,7 @@ const openRegistrationDialog = async (row) => { // 检查报名类型,如果是只允许个人报名,则显示提示并阻止继续 const registrationType = data?.registrationType; - if (registrationType === 'OnlyIndividual') { + if (registrationType === 'OnlyIndividual' || registrationType === 0) { ElMessageBox.alert( '当前赛事只允许个人报名,请到移动端进行个人报名', '提示',