This commit is contained in:
2025-12-12 01:44:41 +08:00
parent 21abcaff53
commit 2f1d732a36
46 changed files with 7756 additions and 484 deletions

View File

@@ -42,19 +42,13 @@
</template>
<script>
import resultAPI from '@/api/result.js'
export default {
data() {
return {
medalsList: [
{ rank: 1, team: '北京队', gold: 8, silver: 5, bronze: 3, total: 16 },
{ rank: 2, team: '上海队', gold: 6, silver: 7, bronze: 5, total: 18 },
{ rank: 3, team: '广东队', gold: 5, silver: 4, bronze: 6, total: 15 },
{ rank: 4, team: '天津队', gold: 4, silver: 5, bronze: 4, total: 13 },
{ rank: 5, team: '江苏队', gold: 3, silver: 3, bronze: 5, total: 11 },
{ rank: 6, team: '浙江队', gold: 2, silver: 4, bronze: 3, total: 9 },
{ rank: 7, team: '湖北队', gold: 2, silver: 2, bronze: 4, total: 8 },
{ rank: 8, team: '河北队', gold: 1, silver: 3, bronze: 2, total: 6 }
]
eventId: '',
medalsList: []
};
},
computed: {
@@ -64,6 +58,41 @@ export default {
totalMedals() {
return this.medalsList.reduce((sum, item) => sum + item.total, 0);
}
},
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId
this.loadMedalsList(options.eventId)
}
},
methods: {
/**
* 加载奖牌榜
*/
async loadMedalsList(eventId) {
try {
const res = await resultAPI.getMedalsList(eventId)
let list = []
if (res.records) {
list = res.records
} else if (Array.isArray(res)) {
list = res
}
// 数据映射
this.medalsList = list.map((item, index) => ({
rank: item.rank || item.ranking || (index + 1),
team: item.teamName || item.team,
gold: item.goldMedals || item.gold || 0,
silver: item.silverMedals || item.silver || 0,
bronze: item.bronzeMedals || item.bronze || 0,
total: item.totalMedals || item.total || 0
}))
} catch (err) {
console.error('加载奖牌榜失败:', err)
}
}
}
};
</script>