fix(register): 确保集体项目报名时传递type字段
- 在项目列表中保存type字段 - 跳转报名页面时传递完整的项目信息(包含type) - 确保集体项目报名时显示集体选择而非选手选择
This commit is contained in:
@@ -43,16 +43,11 @@ export default {
|
||||
if (options.type) {
|
||||
this.type = options.type;
|
||||
}
|
||||
// Load project list after type is set
|
||||
if (this.eventId) {
|
||||
this.loadProjectList(this.eventId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Load project list filtered by participation type
|
||||
* @param {String} eventId Competition ID
|
||||
*/
|
||||
async loadProjectList(eventId) {
|
||||
try {
|
||||
const params = { competitionId: eventId }
|
||||
@@ -77,6 +72,7 @@ export default {
|
||||
id: item.id,
|
||||
name: item.name || item.projectName,
|
||||
price: item.price || item.registrationFee || 0,
|
||||
type: item.type || (this.type === 'team' ? 2 : 1),
|
||||
selected: false
|
||||
}))
|
||||
} catch (err) {
|
||||
@@ -92,6 +88,7 @@ export default {
|
||||
item.selected = !item.selected;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
handleRegister() {
|
||||
const selectedProjects = this.projectList.filter(item => item.selected);
|
||||
if (selectedProjects.length === 0) {
|
||||
@@ -102,8 +99,16 @@ export default {
|
||||
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({
|
||||
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))}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user