fix(select-event): 根据参赛类型过滤项目列表
- 单人赛只显示type=1的项目 - 集体赛只显示type=2的项目 - 修复Issue #5: 单人/集体比赛区分问题
This commit is contained in:
@@ -39,19 +39,32 @@ export default {
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options.eventId) {
|
if (options.eventId) {
|
||||||
this.eventId = options.eventId;
|
this.eventId = options.eventId;
|
||||||
this.loadProjectList(options.eventId)
|
|
||||||
}
|
}
|
||||||
if (options.type) {
|
if (options.type) {
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
}
|
}
|
||||||
|
// Load project list after type is set
|
||||||
|
if (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 res = await competitionAPI.getProjectList({ competitionId: eventId })
|
const params = { competitionId: eventId }
|
||||||
|
|
||||||
|
// Filter by participation type: single=1, team=2
|
||||||
|
if (this.type === 'single') {
|
||||||
|
params.type = 1
|
||||||
|
} else if (this.type === 'team') {
|
||||||
|
params.type = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await competitionAPI.getProjectList(params)
|
||||||
|
|
||||||
let list = []
|
let list = []
|
||||||
if (res.records) {
|
if (res.records) {
|
||||||
@@ -60,7 +73,6 @@ export default {
|
|||||||
list = res
|
list = res
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据映射
|
|
||||||
this.projectList = list.map(item => ({
|
this.projectList = list.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name || item.projectName,
|
name: item.name || item.projectName,
|
||||||
|
|||||||
Reference in New Issue
Block a user