feat: 添加总裁(裁判长)确认页面

- 新增general-judge.vue总裁确认页面
- 支持查看待确认成绩列表
- 支持确认/修改最终分数
- 更新pages.json路由配置
- 更新login.vue支持总裁角色跳转

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
DevOps
2025-12-28 15:49:31 +08:00
parent a3680f7d3e
commit 314b507748
3 changed files with 499 additions and 1 deletions

View File

@@ -36,6 +36,13 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "pages/general-judge/general-judge",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -0,0 +1,486 @@
<template>
<view class="container">
<!-- 导航栏 -->
<view class="nav-bar">
<view class="nav-title">总裁评分系统</view>
<view class="nav-right">
<view class="logout-btn" @click="handleLogout">退出</view>
</view>
</view>
<!-- 用户信息 -->
<view class="user-info">
<view class="user-name">{{ judgeName }}</view>
<view class="user-role">总裁裁判长</view>
<view class="match-name">{{ matchName }}</view>
</view>
<!-- 场地选择 -->
<view class="venue-section">
<view class="section-title">选择场地</view>
<view class="venue-list">
<view
class="venue-item"
:class="{ active: selectedVenueId === null }"
@click="selectVenue(null)"
>
<text>全部场地</text>
</view>
<view
v-for="venue in venues"
:key="venue.id"
class="venue-item"
:class="{ active: selectedVenueId === venue.id }"
@click="selectVenue(venue.id)"
>
<text>{{ venue.venueName }}</text>
</view>
</view>
</view>
<!-- 待确认成绩列表 -->
<view class="result-section">
<view class="section-title">
待确认成绩
<text class="count">({{ pendingResults.length }})</text>
</view>
<view v-if="loading" class="loading">
<text>加载中...</text>
</view>
<view v-else-if="pendingResults.length === 0" class="empty">
<text>暂无待确认成绩</text>
</view>
<view v-else class="result-list">
<view
v-for="result in pendingResults"
:key="result.id"
class="result-item"
@click="showConfirmDialog(result)"
>
<view class="result-info">
<view class="player-name">{{ result.playerName }}</view>
<view class="team-name">{{ result.teamName }}</view>
</view>
<view class="score-info">
<view class="chief-score">
<text class="label">主裁判分:</text>
<text class="value">{{ result.chiefJudgeScore || result.totalScore }}</text>
</view>
<view class="status-tag">待确认</view>
</view>
</view>
</view>
</view>
<!-- 确认弹窗 -->
<view v-if="showDialog" class="dialog-mask" @click="closeDialog">
<view class="dialog-content" @click.stop>
<view class="dialog-title">确认/修改分数</view>
<view class="dialog-body">
<view class="info-row">
<text class="label">选手:</text>
<text class="value">{{ currentResult.playerName }}</text>
</view>
<view class="info-row">
<text class="label">主裁判分:</text>
<text class="value">{{ currentResult.chiefJudgeScore || currentResult.totalScore }}</text>
</view>
<view class="input-row">
<text class="label">确认分数:</text>
<input
type="digit"
v-model="confirmScore"
placeholder="留空则确认原分数"
class="score-input"
/>
</view>
<view class="input-row">
<text class="label">备注:</text>
<input
type="text"
v-model="confirmNote"
placeholder="可选"
class="note-input"
/>
</view>
</view>
<view class="dialog-footer">
<button class="btn-cancel" @click="closeDialog">取消</button>
<button class="btn-confirm" @click="confirmResult">确认</button>
</view>
</view>
</view>
</view>
</template>
<script>
import config from "@/config/env.config.js"
export default {
data() {
return {
judgeName: "",
matchName: "",
matchId: null,
venues: [],
selectedVenueId: null,
pendingResults: [],
loading: false,
showDialog: false,
currentResult: {},
confirmScore: "",
confirmNote: ""
}
},
onLoad() {
const app = getApp()
this.judgeName = app.globalData.judgeName || ""
this.matchName = app.globalData.matchName || ""
this.matchId = app.globalData.matchId
this.loadVenues()
this.loadPendingResults()
},
methods: {
async loadVenues() {
try {
const res = await uni.request({
url: config.apiBaseURL + "/mini/general/venues",
method: "GET",
data: { competitionId: this.matchId },
header: {
"Authorization": uni.getStorageSync("token")
}
})
if (res[1].data.success) {
this.venues = res[1].data.data || []
}
} catch (e) {
console.error("加载场地失败:", e)
}
},
async loadPendingResults() {
this.loading = true
try {
const res = await uni.request({
url: config.apiBaseURL + "/mini/general/pending",
method: "GET",
data: { competitionId: this.matchId },
header: {
"Authorization": uni.getStorageSync("token")
}
})
if (res[1].data.success) {
let results = res[1].data.data || []
if (this.selectedVenueId) {
results = results.filter(r => r.venueId === this.selectedVenueId)
}
this.pendingResults = results
}
} catch (e) {
console.error("加载待确认成绩失败:", e)
} finally {
this.loading = false
}
},
selectVenue(venueId) {
this.selectedVenueId = venueId
this.loadPendingResults()
},
showConfirmDialog(result) {
this.currentResult = result
this.confirmScore = ""
this.confirmNote = ""
this.showDialog = true
},
closeDialog() {
this.showDialog = false
this.currentResult = {}
},
async confirmResult() {
const app = getApp()
try {
uni.showLoading({ title: "提交中...", mask: true })
const res = await uni.request({
url: config.apiBaseURL + "/mini/general/confirm",
method: "POST",
data: {
resultId: String(this.currentResult.id),
generalJudgeId: String(app.globalData.judgeId),
score: this.confirmScore ? parseFloat(this.confirmScore) : null,
note: this.confirmNote || null
},
header: {
"Content-Type": "application/json",
"Authorization": uni.getStorageSync("token")
}
})
uni.hideLoading()
if (res[1].data.success) {
uni.showToast({ title: "确认成功", icon: "success" })
this.closeDialog()
this.loadPendingResults()
} else {
uni.showToast({ title: res[1].data.msg || "确认失败", icon: "none" })
}
} catch (e) {
uni.hideLoading()
uni.showToast({ title: "网络错误", icon: "none" })
}
},
handleLogout() {
uni.showModal({
title: "提示",
content: "确定要退出登录吗?",
success: (res) => {
if (res.confirm) {
uni.removeStorageSync("token")
uni.reLaunch({ url: "/pages/login/login" })
}
}
})
}
}
}
</script>
<style scoped>
.container {
min-height: 100vh;
background-color: #F5F5F5;
}
.nav-bar {
height: 90rpx;
background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 0 30rpx;
}
.nav-title {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
}
.nav-right {
position: absolute;
right: 30rpx;
}
.logout-btn {
font-size: 28rpx;
color: #FFFFFF;
padding: 10rpx 20rpx;
background: rgba(255,255,255,0.2);
border-radius: 8rpx;
}
.user-info {
background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
padding: 30rpx;
color: #FFFFFF;
}
.user-name {
font-size: 40rpx;
font-weight: 600;
}
.user-role {
font-size: 28rpx;
opacity: 0.9;
margin-top: 10rpx;
}
.match-name {
font-size: 26rpx;
opacity: 0.8;
margin-top: 10rpx;
}
.venue-section, .result-section {
margin: 20rpx;
background: #FFFFFF;
border-radius: 16rpx;
padding: 30rpx;
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
}
.count {
font-size: 28rpx;
color: #999;
font-weight: normal;
}
.venue-list {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
}
.venue-item {
padding: 16rpx 32rpx;
background: #F5F5F5;
border-radius: 8rpx;
font-size: 28rpx;
color: #666;
}
.venue-item.active {
background: #8B4513;
color: #FFFFFF;
}
.loading, .empty {
text-align: center;
padding: 60rpx;
color: #999;
font-size: 28rpx;
}
.result-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.result-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx;
background: #FAFAFA;
border-radius: 12rpx;
border-left: 6rpx solid #8B4513;
}
.player-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.team-name {
font-size: 26rpx;
color: #666;
margin-top: 8rpx;
}
.score-info {
text-align: right;
}
.chief-score .label {
font-size: 24rpx;
color: #999;
}
.chief-score .value {
font-size: 36rpx;
font-weight: 600;
color: #8B4513;
margin-left: 10rpx;
}
.status-tag {
font-size: 24rpx;
color: #FF9800;
margin-top: 8rpx;
}
.dialog-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
}
.dialog-content {
width: 80%;
background: #FFFFFF;
border-radius: 16rpx;
overflow: hidden;
}
.dialog-title {
font-size: 34rpx;
font-weight: 600;
text-align: center;
padding: 30rpx;
border-bottom: 1rpx solid #EEE;
}
.dialog-body {
padding: 30rpx;
}
.info-row, .input-row {
display: flex;
align-items: center;
margin-bottom: 24rpx;
}
.info-row .label, .input-row .label {
width: 160rpx;
font-size: 28rpx;
color: #666;
}
.info-row .value {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.score-input, .note-input {
flex: 1;
height: 70rpx;
border: 1rpx solid #DDD;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
}
.dialog-footer {
display: flex;
border-top: 1rpx solid #EEE;
}
.btn-cancel, .btn-confirm {
flex: 1;
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-size: 32rpx;
border: none;
border-radius: 0;
}
.btn-cancel {
background: #F5F5F5;
color: #666;
}
.btn-confirm {
background: #8B4513;
color: #FFFFFF;
}
</style>

View File

@@ -154,7 +154,12 @@ export default {
// 根据角色跳转到不同页面 // 根据角色跳转到不同页面
setTimeout(() => { setTimeout(() => {
if (userRole === 'admin') { if (userRole === 'general') {
// 总裁跳转到总裁专用页面
uni.navigateTo({
url: '/pages/general-judge/general-judge'
})
} else if (userRole === 'admin') {
// 主裁判跳转到多场地列表页(可以修改评分) // 主裁判跳转到多场地列表页(可以修改评分)
uni.navigateTo({ uni.navigateTo({
url: '/pages/score-list-multi/score-list-multi' url: '/pages/score-list-multi/score-list-multi'