fix(event-players): 修复选手列表API响应处理
This commit is contained in:
@@ -133,23 +133,24 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await athleteAPI.getAthleteList(params)
|
const res = await athleteAPI.getAthleteList(params)
|
||||||
|
|
||||||
|
console.log('=== 选手列表响应 ===', res)
|
||||||
|
|
||||||
if (res.code === 200 && res.data) {
|
// request.js already extracts data.data, so res is the actual data
|
||||||
const records = res.data.records || []
|
const records = res.records || res || []
|
||||||
|
|
||||||
if (isLoadMore) {
|
if (isLoadMore) {
|
||||||
this.playersList = [...this.playersList, ...records]
|
this.playersList = [...this.playersList, ...records]
|
||||||
} else {
|
} else {
|
||||||
this.playersList = records
|
this.playersList = Array.isArray(records) ? records : []
|
||||||
this.page = 1
|
this.page = 1
|
||||||
}
|
|
||||||
|
|
||||||
this.totalCount = res.data.total || 0
|
|
||||||
this.hasMore = this.playersList.length < this.totalCount
|
|
||||||
|
|
||||||
// 统计已确认人数
|
|
||||||
this.confirmedCount = this.playersList.filter(p => p.registrationStatus === 1).length
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.totalCount = res.total || this.playersList.length
|
||||||
|
this.hasMore = this.playersList.length < this.totalCount
|
||||||
|
|
||||||
|
// 统计已确认人数
|
||||||
|
this.confirmedCount = this.playersList.filter(p => p.registrationStatus === 1).length
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载选手列表失败:', error)
|
console.error('加载选手列表失败:', error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
Reference in New Issue
Block a user