This commit is contained in:
2025-12-14 17:38:35 +08:00
parent 8c56251d72
commit b7b8947939
16 changed files with 659 additions and 201 deletions

View File

@@ -121,7 +121,8 @@ export default {
// 保存用户信息到全局数据
getApp().globalData = {
userRole, // 'pub' 或 'admin'
matchCode: this.matchCode,
matchCode: this.matchCode, // 比赛编码
inviteCode: this.inviteCode, // 邀请码重要用于后续API调用
matchId,
matchName,
matchTime,

View File

@@ -216,14 +216,10 @@ export default {
return
}
// 收集选中的扣分项
// 收集选中的扣分项ID
const selectedDeductions = this.deductions
.filter(item => item.checked)
.map(item => ({
deductionId: item.deductionId,
deductionName: item.deductionName,
deductionScore: item.deductionScore
}))
.map(item => item.deductionId)
try {
uni.showLoading({

View File

@@ -22,7 +22,15 @@
</view>
<view class="project-section">
<view class="project-btn active">{{ projectInfo.name }}</view>
<view
class="project-btn"
:class="{ active: index === currentProjectIndex }"
v-for="(project, index) in projects"
:key="project.projectId"
@click="switchProject(index)"
>
{{ project.projectName }}
</view>
</view>
</view>
@@ -89,6 +97,8 @@ export default {
name: ''
},
judgeId: '',
projects: [], // 所有分配的项目列表
currentProjectIndex: 0, // 当前选中的项目索引
players: [],
scoredCount: 0,
totalCount: 0
@@ -112,14 +122,12 @@ export default {
name: globalData.venueName || '场地'
}
// 加载项目信息
const projects = globalData.projects || []
const currentIndex = globalData.currentProjectIndex || 0
const currentProject = projects[currentIndex] || {}
this.projectInfo = {
id: currentProject.projectId,
name: currentProject.projectName || '项目'
}
// 加载项目列表
this.projects = globalData.projects || []
this.currentProjectIndex = globalData.currentProjectIndex || 0
// 设置当前项目信息
this.updateCurrentProject()
this.judgeId = globalData.judgeId
@@ -128,7 +136,8 @@ export default {
console.log('评分列表页加载:', {
judgeId: this.judgeId,
venueId: this.venueInfo.id,
projectId: this.projectInfo.id
projectId: this.projectInfo.id,
projectsCount: this.projects.length
})
}
@@ -147,12 +156,36 @@ export default {
// 🔥 关键改动:使用 dataAdapter 获取选手列表
// Mock模式调用 mock/athlete.js 的 getMyAthletes 函数
// API模式调用 api/athlete.js 的 getMyAthletes 函数GET /api/mini/athletes
const response = await dataAdapter.getData('getMyAthletes', {
// 构建请求参数
// 优先使用 matchCode比赛编码这样后端可以根据邀请码关联查询
const app = getApp()
const globalData = app.globalData || {}
const params = {
// 方案1使用比赛编码推荐后端可以根据邀请码关联
matchCode: globalData.matchCode,
// 方案2使用具体的ID作为备选
judgeId: this.judgeId,
venueId: this.venueInfo.id,
projectId: this.projectInfo.id
}
// 移除无效参数
Object.keys(params).forEach(key => {
if (params[key] === undefined || params[key] === null || params[key] === '') {
delete params[key]
}
})
// 调试信息
if (config.debug) {
console.log('请求运动员列表参数:', params)
}
const response = await dataAdapter.getData('getMyAthletes', params)
uni.hideLoading()
// 保存选手列表
@@ -190,6 +223,50 @@ export default {
uni.navigateTo({
url: '/pages/score-detail/score-detail'
})
},
/**
* 更新当前项目信息
*/
updateCurrentProject() {
const currentProject = this.projects[this.currentProjectIndex] || {}
this.projectInfo = {
id: currentProject.projectId,
name: currentProject.projectName || '项目'
}
},
/**
* 切换项目
* @param {Number} index - 项目索引
*/
async switchProject(index) {
// 如果点击的是当前项目,不做处理
if (index === this.currentProjectIndex) {
return
}
// 更新当前项目索引
this.currentProjectIndex = index
// 更新全局数据中的项目索引
const app = getApp()
app.globalData.currentProjectIndex = index
// 更新当前项目信息
this.updateCurrentProject()
// 调试信息
if (config.debug) {
console.log('切换项目:', {
index: index,
projectId: this.projectInfo.id,
projectName: this.projectInfo.name
})
}
// 重新加载选手列表
await this.loadPlayers()
}
}
}
@@ -310,7 +387,8 @@ export default {
.project-section {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 20rpx;
}
.project-btn {
@@ -321,6 +399,12 @@ export default {
font-size: 28rpx;
color: #1B7C5E;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}
.project-btn:active {
opacity: 0.7;
}
.project-btn.active {