名称:{{ project.name }}
-
类型:{{ project.parentProjectTypeName ?? project.projectTypeName ?? '' }}{{ project.parentProjectTypeName || project.projectTypeName ? '-' + project.name : '' }}
+
类型:{{ project.parentProjectTypeName ?? project.projectTypeName ?? '' }}
完成人数:{{ project.completionCount ?? 0 }}
@@ -261,14 +261,7 @@
style="margin-bottom: 12px;"
/>
-
-
+
下一步
@@ -442,7 +435,6 @@ import {
usereventregistrationMemberValidatePost,
usereventregistrationRegistrationLimitCheckPost,
usereventregistrationGroupTeamLimitGet,
- usereventregistrationProjectCompletionCheckPost,
usereventregistrationOrderStatusGet,
} from '/@/api/match/usereventregistration';
import { teamPageGet, teamDetailGet } from '/@/api/match/unitUser';
@@ -807,8 +799,19 @@ const isFreePreview = computed(() => {
const toggleGroupSelection = (id) => {
const idx = selectedGroupIds.value.indexOf(id);
if (idx >= 0) {
+ // 取消选中
selectedGroupIds.value.splice(idx, 1);
} else {
+ // 选中新组别:先找出这个组别属于哪个项目,然后取消该项目的其他组别
+ const clickedGroup = allGroups.value.find(g => g.id === id);
+ if (clickedGroup && clickedGroup.projectId) {
+ // 移除同一项目下的其他组别
+ selectedGroupIds.value = selectedGroupIds.value.filter(selectedId => {
+ const selectedGroup = allGroups.value.find(g => g.id === selectedId);
+ return selectedGroup?.projectId !== clickedGroup.projectId;
+ });
+ }
+ // 添加新选中的组别
selectedGroupIds.value.push(id);
}
};
@@ -845,7 +848,6 @@ const selectedMemberIds = ref([]);
const memberValidationMap = ref({}); // { groupId_memberId: { isValid: boolean, ageValid: boolean, genderValid: boolean, message: string } }
const groupTeamLimitMap = ref({}); // { groupId: { maxTeams: number, currentTeams: number } }
const memberRegistrationLimitMap = ref({}); // { memberId: { isLimited: boolean, message: string } }
-const projectCompletionCheckResult = ref(null); // 项目完成人数检查结果
const registrationLimitCheckResult = ref(null); // 报名限制检查结果
// Step2: 团队相关
@@ -906,7 +908,6 @@ const clearRegisterState = () => {
memberValidationMap.value = {};
groupTeamLimitMap.value = {};
memberRegistrationLimitMap.value = {};
- projectCompletionCheckResult.value = null;
registrationLimitCheckResult.value = null;
previewLoading.value = false;
previewData.value = null;
@@ -1102,10 +1103,7 @@ const hasAnyRegistrationLimit = () => {
return registrationLimitCheckResult.value?.hasLimit ?? false;
};
-// 检查是否有项目完成人数错误
-const hasProjectCompletionCountError = () => {
- return projectCompletionCheckResult.value?.hasError ?? false;
-};
+
// 判断组别是否已达到队伍数量限制
const isGroupAtTeamLimit = (groupId) => {
@@ -1159,8 +1157,7 @@ const assignMemberToActiveGroup = async (member) => {
}
groupMemberMap.value[gId].push({ ...member, teamId: member.teamId });
- // 实时检查项目完成人数和报名限制
- await checkProjectCompletion();
+ // 实时检查报名限制
await checkRegistrationLimit();
};
@@ -1278,25 +1275,7 @@ const fetchGroupTeamLimit = async () => {
}
};
-// 检查项目完成人数
-const checkProjectCompletion = async () => {
- if (!currentEventId.value) return;
- const groupMembers = selectedGroupIds.value.map((gId) => ({
- groupId: gId,
- memberIds: (groupMemberMap.value[gId] ?? []).map((m) => m.userId ?? m.id),
- }));
- try {
- const { succeeded, data } = await usereventregistrationProjectCompletionCheckPost({
- eventId: currentEventId.value,
- groupMembers
- });
- if (succeeded) {
- projectCompletionCheckResult.value = data;
- }
- } catch {
- console.error('检查项目完成人数失败');
- }
-};
+
// 检查报名限制
const checkRegistrationLimit = async () => {
@@ -1337,17 +1316,9 @@ const handleStep1Next = async () => {
const handleStep2Next = async () => {
if (!currentEventId.value) return;
- // 先检查项目完成人数和报名限制
- await checkProjectCompletion();
+ // 先检查报名限制
await checkRegistrationLimit();
- // 检查是否有项目完成人数错误
- if (hasProjectCompletionCountError()) {
- const errors = projectCompletionCheckResult.value?.errors ?? [];
- ElMessage.error(errors[0]?.errorMessage ?? '项目完成人数有错误,请检查');
- return;
- }
-
// 检查是否有报名限制
if (hasAnyRegistrationLimit()) {
const details = registrationLimitCheckResult.value?.limitDetails ?? [];