feat: 完成5个页面接入dataAdapter - Mock模式功能完成

改造页面列表:
- login.vue: 登录验证使用dataAdapter
- score-list.vue: 普通评委选手列表加载
- score-detail.vue: 评分提交和扣分项加载
- score-list-multi.vue: 裁判长多场地列表(含场地/项目切换)
- modify-score.vue: 裁判长修改评分

关键特性:
-  所有页面使用dataAdapter统一数据接口
-  UI模板和样式完全保持不变(零UI修改)
-  支持Mock/API模式一键切换
-  完整的错误处理和加载提示
-  调试模式下输出详细日志

Mock模式测试准备完成,可通过修改config/env.config.js中dataMode切换到API模式。

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-11 14:48:51 +08:00
parent a4d457b730
commit dc9743e6db
5 changed files with 791 additions and 198 deletions

View File

@@ -11,71 +11,58 @@
<!-- 比赛信息 -->
<view class="match-info">
<view class="match-title">
2025年全国武术散打锦标赛暨第十七届世界武术锦标赛选拔赛
</view>
<view class="match-time">比赛时间2025年6月25日 9:00</view>
<view class="match-title">{{ matchInfo.name }}</view>
<view class="match-time">比赛时间{{ matchInfo.time }}</view>
</view>
<!-- 场地和项目选择 -->
<view class="venue-section">
<view class="venue-header">
<view class="venue-tab active">第一场地</view>
<view class="venue-tab active">{{ venueInfo.name }}</view>
</view>
<view class="project-section">
<view class="project-btn active">男子组陈氏太极拳</view>
<view class="project-btn active">{{ projectInfo.name }}</view>
</view>
</view>
<!-- 已评分统计 -->
<view class="score-stats">
<text class="stats-text">已评分</text>
<text class="stats-number">2/30</text>
<text class="stats-number">{{ scoredCount }}/{{ totalCount }}</text>
</view>
<!-- 选手列表 -->
<view class="player-list">
<!-- 第一个选手 - 显示我的评分和总分 -->
<view class="player-card">
<!-- 遍历选手列表 -->
<view
class="player-card"
v-for="player in players"
:key="player.athleteId"
>
<view class="player-header">
<view class="player-name">张三</view>
<view class="player-scores">
<text class="my-score">我的评分8.906</text>
<text class="total-score">总分8.907</text>
</view>
</view>
<view class="player-info">
<view class="info-item">身份证123456789000000000</view>
<view class="info-item">队伍少林寺武术大学院</view>
<view class="info-item">编号123-4567898275</view>
</view>
</view>
<view class="player-name">{{ player.name }}</view>
<!-- 第二个选手 - 裁判长功能 -->
<view class="player-card">
<view class="player-header">
<view class="player-name">张三</view>
<view class="action-area">
<button class="score-btn" @click="goToScoreDetail">评分</button>
<!-- 已评分显示我的评分和总分 -->
<view class="player-scores" v-if="player.scored">
<text class="my-score">我的评分{{ player.myScore }}</text>
<text class="total-score">总分{{ player.totalScore }}</text>
</view>
</view>
<view class="player-info">
<view class="info-item">身份证123456789000000000</view>
<view class="info-item">队伍少林寺武术大学院</view>
<view class="info-item">编号123-4567898275</view>
</view>
</view>
<!-- 第三个选手 - 简单样式 -->
<view class="player-card">
<view class="player-header">
<view class="player-name">张三</view>
<button class="score-btn" @click="goToScoreDetail">评分</button>
<!-- 未评分显示评分按钮 -->
<button
class="score-btn"
v-else
@click="goToScoreDetail(player)"
>
评分
</button>
</view>
<view class="player-info">
<view class="info-item">身份证123456789000000000</view>
<view class="info-item">身份证{{ player.idCard }}</view>
<view class="info-item">队伍{{ player.team }}</view>
<view class="info-item">编号{{ player.number }}</view>
</view>
</view>
</view>
@@ -83,14 +70,123 @@
</template>
<script>
import dataAdapter from '@/utils/dataAdapter.js'
import config from '@/config/env.config.js'
export default {
data() {
return {
matchInfo: {
name: '',
time: ''
},
venueInfo: {
id: '',
name: ''
},
projectInfo: {
id: '',
name: ''
},
judgeId: '',
players: [],
scoredCount: 0,
totalCount: 0
}
},
async onLoad() {
// 获取全局数据
const app = getApp()
const globalData = app.globalData || {}
// 加载比赛信息
this.matchInfo = {
name: globalData.matchName || '比赛名称',
time: globalData.matchTime || '比赛时间'
}
// 加载场地信息
this.venueInfo = {
id: globalData.venueId,
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.judgeId = globalData.judgeId
// 调试信息
if (config.debug) {
console.log('评分列表页加载:', {
judgeId: this.judgeId,
venueId: this.venueInfo.id,
projectId: this.projectInfo.id
})
}
// 加载选手列表
await this.loadPlayers()
},
methods: {
goToScoreDetail() {
async loadPlayers() {
try {
uni.showLoading({
title: '加载中...',
mask: true
})
// 🔥 关键改动:使用 dataAdapter 获取选手列表
// Mock模式调用 mock/athlete.js 的 getMyAthletes 函数
// API模式调用 api/athlete.js 的 getMyAthletes 函数GET /api/mini/athletes
const response = await dataAdapter.getData('getMyAthletes', {
judgeId: this.judgeId,
venueId: this.venueInfo.id,
projectId: this.projectInfo.id
})
uni.hideLoading()
// 保存选手列表
this.players = response.data || []
// 计算评分统计
this.totalCount = this.players.length
this.scoredCount = this.players.filter(p => p.scored).length
// 调试信息
if (config.debug) {
console.log('选手列表加载成功:', {
total: this.totalCount,
scored: this.scoredCount,
players: this.players
})
}
} catch (error) {
uni.hideLoading()
console.error('加载选手列表失败:', error)
uni.showToast({
title: error.message || '加载失败',
icon: 'none'
})
}
},
goToScoreDetail(player) {
// 保存当前选手信息到全局数据
const app = getApp()
app.globalData.currentAthlete = player
uni.navigateTo({
url: '/pages/score-detail/score-detail'
})