fix(register): 确保集体项目报名时传递type字段

- 在项目列表中保存type字段
- 跳转报名页面时传递完整的项目信息(包含type)
- 确保集体项目报名时显示集体选择而非选手选择
This commit is contained in:
DevOps
2025-12-31 13:30:39 +08:00
parent a56ca34cc3
commit adbafedb5b

View File

@@ -43,16 +43,11 @@ export default {
if (options.type) { if (options.type) {
this.type = options.type; this.type = options.type;
} }
// Load project list after type is set
if (this.eventId) { if (this.eventId) {
this.loadProjectList(this.eventId) this.loadProjectList(this.eventId)
} }
}, },
methods: { methods: {
/**
* Load project list filtered by participation type
* @param {String} eventId Competition ID
*/
async loadProjectList(eventId) { async loadProjectList(eventId) {
try { try {
const params = { competitionId: eventId } const params = { competitionId: eventId }
@@ -77,6 +72,7 @@ export default {
id: item.id, id: item.id,
name: item.name || item.projectName, name: item.name || item.projectName,
price: item.price || item.registrationFee || 0, price: item.price || item.registrationFee || 0,
type: item.type || (this.type === 'team' ? 2 : 1),
selected: false selected: false
})) }))
} catch (err) { } catch (err) {
@@ -92,6 +88,7 @@ export default {
item.selected = !item.selected; item.selected = !item.selected;
this.$forceUpdate(); this.$forceUpdate();
}, },
handleRegister() { handleRegister() {
const selectedProjects = this.projectList.filter(item => item.selected); const selectedProjects = this.projectList.filter(item => item.selected);
if (selectedProjects.length === 0) { if (selectedProjects.length === 0) {
@@ -102,8 +99,16 @@ export default {
return; return;
} }
// Include type in selected projects data
const projectsData = selectedProjects.map(p => ({
id: p.id,
name: p.name,
price: p.price,
type: p.type
}))
uni.navigateTo({ uni.navigateTo({
url: `/pages/event-register/event-register?eventId=${this.eventId}&projects=${encodeURIComponent(JSON.stringify(selectedProjects))}` url: `/pages/event-register/event-register?eventId=${this.eventId}&projects=${encodeURIComponent(JSON.stringify(projectsData))}`
}); });
} }
} }