Compare commits
25 Commits
6f3b8db273
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11eb5f2db8 | ||
|
|
56a33707d5 | ||
|
|
1b305fc2bd | ||
|
|
a780ee6b2c | ||
|
|
90ee38a57b | ||
|
|
84b84dd951 | ||
|
|
941112dd4c | ||
|
|
314b507748 | ||
|
|
a3680f7d3e | ||
|
|
711779dc57 | ||
|
|
edd64cda47 | ||
|
|
88a931976d | ||
|
|
96bc2d92a2 | ||
|
|
a9c5c4a904 | ||
|
|
5349b80cf8 | ||
|
|
56c1320e40 | ||
|
|
c5c31e8088 | ||
|
|
c978a5bf64 | ||
|
|
f9efd8baa8 | ||
|
|
53c865a076 | ||
|
|
569f8a14d1 | ||
|
|
bcf040bb15 | ||
|
|
7620d9bf96 | ||
|
|
736aa08fba | ||
|
|
e8a2a5cef6 |
31
App.vue
31
App.vue
@@ -2,17 +2,44 @@
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch')
|
||||
// 禁用 iOS Safari 双击缩放
|
||||
this.disableDoubleTapZoom()
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
},
|
||||
methods: {
|
||||
disableDoubleTapZoom() {
|
||||
// #ifdef H5
|
||||
let lastTouchEnd = 0
|
||||
document.documentElement.addEventListener('touchstart', function(event) {
|
||||
if (event.touches.length > 1) {
|
||||
event.preventDefault()
|
||||
}
|
||||
}, { passive: false })
|
||||
|
||||
document.documentElement.addEventListener('touchend', function(event) {
|
||||
const now = Date.now()
|
||||
if (now - lastTouchEnd <= 300) {
|
||||
event.preventDefault()
|
||||
}
|
||||
lastTouchEnd = now
|
||||
}, { passive: false })
|
||||
|
||||
// 禁用手势缩放
|
||||
document.documentElement.addEventListener('gesturestart', function(event) {
|
||||
event.preventDefault()
|
||||
}, { passive: false })
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||
@import "common/common.css";
|
||||
/* 注意要写在第一行,同时给style标签加入lang=scss属性 */
|
||||
@import common/common.css;
|
||||
</style>
|
||||
|
||||
311
README.md
311
README.md
@@ -1,296 +1,77 @@
|
||||
# 武术评分系统 - UniApp版本
|
||||
# 武术赛事管理系统 - 裁判端
|
||||
|
||||
这是一个基于UniApp开发的武术比赛评分系统,支持H5和小程序平台。
|
||||
基于 UniApp 开发的武术比赛评分小程序,支持 H5 和微信小程序。
|
||||
|
||||
## 项目简介
|
||||
## 在线访问
|
||||
|
||||
本项目是一个完整的武术比赛评分管理系统,包含评委打分、裁判长修改评分、多场地管理等功能。
|
||||
| 服务 | 地址 |
|
||||
|------|------|
|
||||
| 裁判端 H5 | https://martial-mini.aitisai.com |
|
||||
| 后端 API | https://martial-api.aitisai.com |
|
||||
|
||||
## 功能特点
|
||||
|
||||
- ✅ 支持H5和微信小程序双平台
|
||||
- ✅ 评委登录与评分功能
|
||||
- ✅ 裁判长评分修改功能
|
||||
- ✅ 多场地、多项目切换
|
||||
- ✅ 扣分项多选功能
|
||||
- ✅ 精确到0.001分的评分控制
|
||||
- ✅ 实时评分统计
|
||||
- 裁判员登录与评分
|
||||
- 主裁判评分审核
|
||||
- 总裁最终确认
|
||||
- 多场地切换
|
||||
- 扣分项管理
|
||||
- 精确到 0.001 分的评分控制
|
||||
|
||||
## 页面结构
|
||||
## 三级裁判系统
|
||||
|
||||
### 1. 登录页面 (`pages/login/login.vue`)
|
||||
- 输入比赛编码
|
||||
- 输入评委邀请码
|
||||
- 验证登录
|
||||
|
||||
### 2. 评分列表页 (`pages/score-list/score-list.vue`)
|
||||
- 显示比赛信息
|
||||
- 查看选手列表
|
||||
- 评委评分入口
|
||||
- 显示我的评分和总分
|
||||
|
||||
### 3. 修改评分页 (`pages/modify-score/modify-score.vue`)
|
||||
- 裁判长专用功能
|
||||
- 查看所有评委评分
|
||||
- 修改总分(±0.001分)
|
||||
- 添加修改备注
|
||||
|
||||
### 4. 多场地评分列表页 (`pages/score-list-multi/score-list-multi.vue`)
|
||||
- 场地切换功能
|
||||
- 项目切换功能
|
||||
- 裁判长可查看所有场地
|
||||
- 普通评委仅看自己的场地
|
||||
|
||||
### 5. 评分详情页 (`pages/score-detail/score-detail.vue`)
|
||||
- 评委打分界面
|
||||
- 分数精确调整(±0.001分)
|
||||
- 扣分项多选
|
||||
- 添加评分备注
|
||||
```
|
||||
裁判员 → 主裁判 → 总裁
|
||||
↓ ↓ ↓
|
||||
打分 审核修改 最终确认
|
||||
```
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **框架**: UniApp
|
||||
- **前端**: Vue.js 2.x
|
||||
- **样式**: CSS3 (支持rpx单位)
|
||||
- **平台支持**: H5、微信小程序
|
||||
- **平台**: H5、微信小程序
|
||||
- **样式**: SCSS
|
||||
|
||||
## 目录结构
|
||||
## 快速开始
|
||||
|
||||
```
|
||||
martial-admin-mini/
|
||||
├── common/ # 公共资源
|
||||
│ └── common.css # 全局样式
|
||||
├── pages/ # 页面目录
|
||||
│ ├── login/ # 登录页面
|
||||
│ ├── score-list/ # 评分列表页
|
||||
│ ├── modify-score/ # 修改评分页
|
||||
│ ├── score-list-multi/ # 多场地列表页
|
||||
│ └── score-detail/ # 评分详情页
|
||||
├── image/ # 设计图片
|
||||
├── App.vue # 应用配置
|
||||
├── manifest.json # 应用配置清单
|
||||
├── pages.json # 页面配置
|
||||
└── package.json # 项目依赖
|
||||
```
|
||||
|
||||
## 快速开始(推荐方式)
|
||||
|
||||
### 使用HBuilderX运行(最简单)
|
||||
|
||||
1. **下载并安装HBuilderX**
|
||||
- 官网下载:https://www.dcloud.io/hbuilderx.html
|
||||
- 建议下载标准版或App开发版
|
||||
|
||||
2. **打开项目**
|
||||
- 打开HBuilderX
|
||||
- 点击菜单:文件 -> 打开目录
|
||||
- 选择本项目的根目录:`martial-admin-mini`
|
||||
|
||||
3. **运行到H5**
|
||||
- 在项目管理器中,右键点击项目根目录
|
||||
- 选择:运行 -> 运行到浏览器 -> Chrome(或其他浏览器)
|
||||
- 浏览器会自动打开并显示项目
|
||||
|
||||
4. **运行到微信小程序**
|
||||
- 首先安装并打开微信开发者工具
|
||||
- 在HBuilderX中,右键点击项目根目录
|
||||
- 选择:运行 -> 运行到小程序模拟器 -> 微信开发者工具
|
||||
- 首次运行会提示配置小程序工具路径,按提示配置即可
|
||||
|
||||
### 常见问题解决
|
||||
|
||||
#### 问题1:HBuilderX提示"未安装依赖"或"缺少插件"
|
||||
**解决方案:**
|
||||
- 点击HBuilderX顶部菜单:工具 -> 插件安装
|
||||
- 安装以下插件:
|
||||
- uni-app编译器(必需)
|
||||
- App真机运行(如需真机调试)
|
||||
- 微信小程序支持(如需开发小程序)
|
||||
|
||||
#### 问题2:运行时报错"Cannot find module"
|
||||
**解决方案:**
|
||||
```bash
|
||||
# 在项目根目录执行
|
||||
# 安装依赖
|
||||
npm install
|
||||
```
|
||||
|
||||
#### 问题3:小程序无法运行
|
||||
**解决方案:**
|
||||
1. 确保已安装微信开发者工具
|
||||
2. 在HBuilderX中配置微信开发者工具路径:
|
||||
- 工具 -> 设置 -> 运行配置 -> 小程序运行配置
|
||||
- 配置微信开发者工具的安装路径
|
||||
3. 在manifest.json中配置小程序appid(或使用测试号)
|
||||
|
||||
#### 问题4:H5运行时样式异常
|
||||
**解决方案:**
|
||||
- 清除浏览器缓存后重新运行
|
||||
- 或使用Ctrl+F5强制刷新
|
||||
|
||||
## 开发指南
|
||||
|
||||
### 环境要求
|
||||
|
||||
- HBuilderX 3.0+ (推荐)
|
||||
- 或 Node.js 12+ + Vue CLI
|
||||
- 微信开发者工具 (小程序开发需要)
|
||||
|
||||
### 方式一:使用HBuilderX(推荐)
|
||||
|
||||
1. 使用HBuilderX打开项目根目录
|
||||
2. 点击运行 -> 运行到浏览器 (H5开发)
|
||||
3. 或点击运行 -> 运行到小程序模拟器 -> 微信开发者工具
|
||||
|
||||
### 方式二:使用命令行
|
||||
|
||||
#### 安装依赖
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
#### 运行项目
|
||||
|
||||
**H5开发**
|
||||
```bash
|
||||
# H5 开发
|
||||
npm run dev:h5
|
||||
```
|
||||
|
||||
**微信小程序开发**
|
||||
```bash
|
||||
# 微信小程序开发
|
||||
npm run dev:mp-weixin
|
||||
```
|
||||
|
||||
**构建H5**
|
||||
```bash
|
||||
# 构建 H5
|
||||
npm run build:h5
|
||||
```
|
||||
|
||||
**构建微信小程序**
|
||||
```bash
|
||||
npm run build:mp-weixin
|
||||
```
|
||||
|
||||
## 设计还原说明
|
||||
|
||||
本项目严格按照提供的5张设计图进行一比一还原:
|
||||
|
||||
1. **颜色方案**
|
||||
- 主色调:绿色 (#1B7C5E - #2A9D7E 渐变)
|
||||
- 强调色:红色 (#FF4D6A) - 用于提示信息
|
||||
- 背景色:浅灰 (#F5F5F5)
|
||||
|
||||
2. **字体大小**
|
||||
- 导航标题:36rpx
|
||||
- 页面标题:40rpx
|
||||
- 正文内容:26-32rpx
|
||||
- 提示文字:22-24rpx
|
||||
|
||||
3. **间距与圆角**
|
||||
- 卡片圆角:16rpx
|
||||
- 按钮圆角:8-16rpx
|
||||
- 标准间距:30rpx
|
||||
- 内边距:20-40rpx
|
||||
|
||||
4. **交互效果**
|
||||
- 按钮点击反馈
|
||||
- 分数增减控制
|
||||
- 多选框交互
|
||||
- 页面跳转动画
|
||||
|
||||
## 功能说明
|
||||
|
||||
### 评分规则
|
||||
|
||||
- 分数范围:5.0 - 10.0 分
|
||||
- 精度:0.001 分
|
||||
- 评委评分保留3位小数
|
||||
- 裁判长可修改总分 ±0.005 分
|
||||
|
||||
### 权限区分
|
||||
|
||||
- **普通评委**:仅能查看和评分自己负责的场地和项目
|
||||
- **裁判长**:可查看所有场地和项目,可修改评分
|
||||
|
||||
### 扣分项
|
||||
|
||||
- 支持多选
|
||||
- 每个项目可配置不同的扣分项
|
||||
- 扣分项选择后自动计入总分
|
||||
|
||||
## 🚀 API对接状态
|
||||
|
||||
### ✅ 前端已完全准备就绪(100%)
|
||||
|
||||
本项目已完成API对接准备工作,可以立即开始后端对接:
|
||||
|
||||
- ✅ **dataAdapter架构** - 支持Mock/API双模式无缝切换
|
||||
- ✅ **API接口定义** - 9个接口全部定义完成
|
||||
- ✅ **网络请求封装** - 统一的错误处理和Token管理
|
||||
- ✅ **Mock数据完整** - 可独立演示所有功能
|
||||
- ✅ **文档体系完善** - 21个文档,约25,000+行
|
||||
|
||||
### 📋 快速开始API对接
|
||||
|
||||
#### 1. 配置后端地址(30秒)
|
||||
|
||||
编辑 `config/env.config.js`:
|
||||
```javascript
|
||||
apiBaseURL: 'http://localhost:8080' // 修改为实际后端地址
|
||||
```
|
||||
|
||||
#### 2. 切换数据模式
|
||||
|
||||
```javascript
|
||||
// Mock模式(后端未就绪时)
|
||||
dataMode: 'mock'
|
||||
|
||||
// API模式(后端就绪后)
|
||||
dataMode: 'api'
|
||||
```
|
||||
|
||||
#### 3. 查看文档
|
||||
|
||||
- **快速上手**: [API对接快速启动指南.md](doc/API对接快速启动指南.md) - 5分钟快速上手
|
||||
- **后端开发**: [后端接口开发清单.md](doc/后端接口开发清单.md) - 详细的开发规范
|
||||
- **前端联调**: [前端API对接指南.md](doc/前端API对接指南.md) - 前端联调指南
|
||||
- **快速参考**: [快速参考.md](快速参考.md) - 一页纸快速参考
|
||||
|
||||
### ⚠️ 后端待开发接口(5个)
|
||||
|
||||
| 接口 | 路径 | 优先级 | 工作量 |
|
||||
|------|------|--------|--------|
|
||||
| 登录验证 | `POST /api/mini/login` | 🔴 高 | 2天 |
|
||||
| 普通评委选手列表 | `GET /api/mini/athletes` | 🔴 高 | 1天 |
|
||||
| 裁判长选手列表 | `GET /api/mini/athletes/admin` | 🟡 中 | 1天 |
|
||||
| 评分详情 | `GET /api/mini/score/detail/{id}` | 🟡 中 | 1天 |
|
||||
| 修改评分 | `PUT /api/mini/score/modify` | 🟡 中 | 1天 |
|
||||
|
||||
**预计总工作量**: 6人天(约1周)
|
||||
|
||||
详细规范请查看:[后端接口开发清单.md](doc/后端接口开发清单.md)
|
||||
|
||||
### 📊 项目状态
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
前端开发: ████████████████████ 100% ✅
|
||||
后端开发: ████████░░░░░░░░░░░░ 44% ⚠️
|
||||
文档完成: ████████████████████ 100% ✅
|
||||
martial-admin-mini/
|
||||
├── pages/
|
||||
│ ├── login/ # 登录页
|
||||
│ ├── score-list/ # 评分列表
|
||||
│ ├── score-list-multi/ # 多场地评分
|
||||
│ ├── score-detail/ # 评分详情
|
||||
│ └── modify-score/ # 修改评分(裁判长)
|
||||
├── components/ # 公共组件
|
||||
├── static/ # 静态资源
|
||||
├── pages.json # 页面配置
|
||||
└── manifest.json # 应用配置
|
||||
```
|
||||
|
||||
查看实时状态:[项目状态看板.md](项目状态看板.md)
|
||||
## 相关仓库
|
||||
|
||||
## 注意事项
|
||||
| 仓库 | 说明 |
|
||||
|------|------|
|
||||
| [martial-master](https://git.waypeak.work/martial/martial-master) | 后端 API |
|
||||
| [martial-web](https://git.waypeak.work/martial/martial-web) | 管理后台 |
|
||||
| [martial-mini](https://git.waypeak.work/martial/martial-mini) | 用户端小程序 |
|
||||
|
||||
1. ✅ 本项目已完成API对接准备,支持Mock/API双模式
|
||||
2. ✅ Mock模式下所有功能可独立演示
|
||||
3. ✅ API模式下需要后端实现5个专用接口
|
||||
4. ✅ 页面跳转已配置,可直接运行演示
|
||||
5. ✅ 适配了主流手机屏幕尺寸
|
||||
---
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License
|
||||
|
||||
## 联系方式
|
||||
|
||||
如有问题或建议,请联系项目负责人。
|
||||
**最后更新**: 2024-12-29
|
||||
|
||||
@@ -9,13 +9,13 @@ import request from '@/utils/request.js'
|
||||
* 获取选手列表(根据裁判类型返回不同数据)
|
||||
* @param {Object} params
|
||||
* @param {String} params.judgeId - 评委ID
|
||||
* @param {Number} params.refereeType - 裁判类型(1-裁判长, 2-普通裁判)
|
||||
* @param {Number} params.refereeType - 裁判类型(1-主裁判, 2-裁判员)
|
||||
* @param {String} params.venueId - 场地ID(可选)
|
||||
* @param {String} params.projectId - 项目ID(可选)
|
||||
* @returns {Promise}
|
||||
*
|
||||
* 普通裁判:返回待评分的选手列表
|
||||
* 裁判长:返回已有评分的选手列表
|
||||
* 裁判员:返回待评分的选手列表
|
||||
* 主裁判:返回已有评分的选手列表
|
||||
*
|
||||
* 后端路径: GET /api/mini/score/athletes
|
||||
*/
|
||||
@@ -23,27 +23,40 @@ export function getMyAthletes(params) {
|
||||
return request({
|
||||
url: '/mini/score/athletes',
|
||||
method: 'GET',
|
||||
params: params, // GET 请求使用 params
|
||||
params: {
|
||||
...params,
|
||||
size: 200 // 确保获取所有选手
|
||||
},
|
||||
showLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.competitionId - 比赛ID
|
||||
* @param {String} params.venueId - 场地ID
|
||||
* @param {String} params.projectId - 项目ID
|
||||
* @returns {Promise}
|
||||
*
|
||||
* 注意:此接口需要后端实现
|
||||
* 建议路径: GET /api/mini/athletes/admin
|
||||
* 实际调用 /mini/score/athletes 接口,传递 refereeType=1
|
||||
*/
|
||||
export function getAthletesForAdmin(params) {
|
||||
// 从 globalData 获取 judgeId
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
const judgeId = globalData.judgeId
|
||||
|
||||
return request({
|
||||
url: '/mini/athletes/admin',
|
||||
url: '/mini/score/athletes',
|
||||
method: 'GET',
|
||||
params: params, // GET 请求使用 params
|
||||
params: {
|
||||
judgeId: judgeId,
|
||||
refereeType: 1, // 主裁判
|
||||
venueId: params.venueId,
|
||||
projectId: params.projectId,
|
||||
size: 200 // 确保获取所有选手
|
||||
},
|
||||
showLoading: true
|
||||
})
|
||||
}
|
||||
@@ -90,55 +103,3 @@ export default {
|
||||
getVenues,
|
||||
getProjects
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端接口规范:
|
||||
*
|
||||
* GET /api/mini/score/athletes
|
||||
*
|
||||
* 请求参数:
|
||||
* {
|
||||
* "judgeId": "456",
|
||||
* "refereeType": 2, // 1-裁判长, 2-普通裁判
|
||||
* "venueId": "1", // 可选
|
||||
* "projectId": "5" // 可选
|
||||
* }
|
||||
*
|
||||
* 响应(普通裁判 - 待评分选手):
|
||||
* {
|
||||
* "code": 200,
|
||||
* "success": true,
|
||||
* "msg": "操作成功",
|
||||
* "data": [
|
||||
* {
|
||||
* "athleteId": 1,
|
||||
* "name": "张三",
|
||||
* "number": "123-4567898275",
|
||||
* "team": "少林寺武术大学院",
|
||||
* "projectName": "女子组长拳",
|
||||
* "orderNum": 1,
|
||||
* "competitionStatus": 0
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* 响应(裁判长 - 已有评分选手):
|
||||
* {
|
||||
* "code": 200,
|
||||
* "success": true,
|
||||
* "msg": "操作成功",
|
||||
* "data": [
|
||||
* {
|
||||
* "athleteId": 1,
|
||||
* "name": "张三",
|
||||
* "number": "123-4567898275",
|
||||
* "team": "少林寺武术大学院",
|
||||
* "projectName": "女子组长拳",
|
||||
* "orderNum": 1,
|
||||
* "totalScore": 8.907,
|
||||
* "scoredJudgeCount": 3,
|
||||
* "competitionStatus": 2
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
* "msg": "登录成功",
|
||||
* "data": {
|
||||
* "token": "xxx",
|
||||
* "refereeType": 2, // 1-裁判长, 2-普通裁判
|
||||
* "refereeType": 2, // 1-主裁判, 2-裁判员
|
||||
* "matchId": "123",
|
||||
* "matchName": "2025年全国武术散打锦标赛...",
|
||||
* "matchTime": "2025年6月25日 9:00",
|
||||
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
getMyAthletes: athleteApi.getMyAthletes,
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params - { competitionId, venueId, projectId }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -82,14 +82,14 @@ export default {
|
||||
submitScore: scoreApi.submitScore,
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params - { athleteId }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getScoreDetail: scoreApi.getScoreDetail,
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} data - { athleteId, modifierId, modifiedScore, note }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ export default {
|
||||
* 1. 需要实现的新接口(小程序专用):
|
||||
* - POST /api/mini/login # 登录验证
|
||||
* - GET /api/mini/athletes # 普通评委选手列表
|
||||
* - GET /api/mini/athletes/admin # 裁判长选手列表
|
||||
* - GET /api/mini/athletes/admin # 主裁判选手列表
|
||||
* - GET /api/mini/score/detail/{athleteId} # 评分详情
|
||||
* - PUT /api/mini/score/modify # 修改评分
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@ export function submitScore(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @returns {Promise}
|
||||
@@ -61,7 +61,7 @@ export function getScoreDetail(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} data
|
||||
* @param {String} data.athleteId - 选手ID
|
||||
* @param {String} data.modifierId - 修改人ID
|
||||
@@ -86,7 +86,7 @@ export function modifyScore(data) {
|
||||
* 获取选手列表
|
||||
* @param {Object} params
|
||||
* @param {String} params.judgeId - 裁判ID
|
||||
* @param {Number} params.refereeType - 裁判类型(1-裁判长, 2-普通裁判)
|
||||
* @param {Number} params.refereeType - 裁判类型(1-主裁判, 2-裁判员)
|
||||
* @param {String} params.projectId - 项目ID(可选)
|
||||
* @param {String} params.venueId - 场地ID(可选)
|
||||
* @returns {Promise}
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
* }
|
||||
*
|
||||
* 实现逻辑:
|
||||
* 1. 验证权限(只有裁判长可以修改)
|
||||
* 1. 验证权限(只有主裁判可以修改)
|
||||
* 2. 保存 originalScore(如果是第一次修改)
|
||||
* 3. 更新 totalScore
|
||||
* 4. 记录 modifyReason 和 modifyTime
|
||||
|
||||
@@ -28,3 +28,14 @@ button::after {
|
||||
input {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* 防止 iOS Safari 双击缩放 */
|
||||
button, .control-btn, [class*="btn"] {
|
||||
touch-action: manipulation;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
/* 全局禁用双击缩放 */
|
||||
html {
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ const ENV_CONFIG = {
|
||||
dataMode: 'api',
|
||||
|
||||
// API基础路径(dataMode为'api'时使用)
|
||||
apiBaseURL: 'http://localhost:8123',
|
||||
// uni.request 不支持 devServer proxy,必须用完整地址
|
||||
apiBaseURL: 'http://142.91.105.230:8123',
|
||||
|
||||
// 调试模式
|
||||
debug: true,
|
||||
|
||||
// 请求超时时间(毫秒)
|
||||
timeout: 30000,
|
||||
|
||||
166
doc/Linux命令行编译样式问题修复记录.md
Normal file
166
doc/Linux命令行编译样式问题修复记录.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# Linux/Mac 命令行编译样式异常问题修复记录
|
||||
|
||||
## 问题描述
|
||||
|
||||
在 Windows 上使用 HBuilderX 运行项目时样式正常,但在 Linux/Mac 上使用 `npm run dev:h5` 命令行编译时,页面样式完全异常,组件的 scoped 样式没有生效。
|
||||
|
||||
## 问题现象
|
||||
|
||||
- 页面布局错乱
|
||||
- rpx 单位没有被转换为 px
|
||||
- 组件的 scoped 样式没有被正确打包
|
||||
|
||||
## 根本原因
|
||||
|
||||
### 1. postcss.config.js 配置覆盖问题
|
||||
|
||||
项目中自定义的 `postcss.config.js` 文件覆盖了 uni-app 的默认 postcss 配置:
|
||||
|
||||
```javascript
|
||||
// 原配置 - 问题配置
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
autoprefixer()
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
这个配置**没有包含 uni-app 的 postcss 插件**,导致:
|
||||
- rpx 单位没有被转换为 `%?数值?%` 占位符格式
|
||||
- uni-app 运行时无法在浏览器中将占位符转换为实际的 px 值
|
||||
|
||||
### 2. HBuilderX vs 命令行编译的区别
|
||||
|
||||
| 特性 | HBuilderX | 命令行 (npm run dev:h5) |
|
||||
|------|-----------|------------------------|
|
||||
| 编译器 | 内置优化版编译器 | 依赖 node_modules |
|
||||
| rpx 处理 | 自动转换 | 需要 postcss 插件 |
|
||||
| 样式处理 | 完善的内置处理 | 依赖配置文件 |
|
||||
| 版本兼容 | 内部统一管理 | 可能存在版本冲突 |
|
||||
|
||||
### 3. PostCSS 版本兼容问题
|
||||
|
||||
- 项目使用 `postcss-loader@3.0.0`(旧版)
|
||||
- 但 `postcss` 被升级到了 8.x 版本
|
||||
- postcss-loader 3.x 与 postcss 8 不兼容
|
||||
|
||||
## 解决方案
|
||||
|
||||
### 1. 修改 postcss.config.js
|
||||
|
||||
添加 uni-app 的 postcss 插件:
|
||||
|
||||
```javascript
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
// 引入 uni-app 的 postcss 插件来处理 rpx 转换
|
||||
const uniappPlugin = require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
uniappPlugin,
|
||||
autoprefixer
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 降级 postcss 版本
|
||||
|
||||
```bash
|
||||
npm install postcss@7 --save --legacy-peer-deps
|
||||
```
|
||||
|
||||
### 3. 降级 sass 版本(可选,提高兼容性)
|
||||
|
||||
```bash
|
||||
npm install sass@1.32.13 --save
|
||||
```
|
||||
|
||||
## 修复后的依赖版本
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"postcss": "^7.0.39",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"sass": "^1.32.13"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 验证方法
|
||||
|
||||
1. 构建项目:
|
||||
```bash
|
||||
npm run build:h5
|
||||
```
|
||||
|
||||
2. 检查构建后的 JS 文件中 rpx 是否被转换:
|
||||
```bash
|
||||
# 应该看到 %?90?% 这样的占位符,而不是 90rpx
|
||||
grep -oE "height:%\?[0-9]+\?%" dist/build/h5/static/js/pages-login-login.*.js
|
||||
```
|
||||
|
||||
3. 启动开发服务器验证样式:
|
||||
```bash
|
||||
npm run dev:h5
|
||||
# 访问 http://localhost:8080 查看样式
|
||||
```
|
||||
|
||||
## 技术细节
|
||||
|
||||
### uni-app 的 rpx 转换流程
|
||||
|
||||
1. **编译时**:postcss 插件将 `90rpx` 转换为 `%?90?%` 占位符
|
||||
2. **运行时**:uni-app 的 Vue 运行时根据屏幕宽度将占位符转换为实际 px 值
|
||||
3. **计算公式**:`px = rpx * (屏幕宽度 / 750)`
|
||||
|
||||
### 相关文件
|
||||
|
||||
- `/postcss.config.js` - PostCSS 配置
|
||||
- `/node_modules/@dcloudio/vue-cli-plugin-uni/packages/postcss/index.js` - uni-app postcss 插件
|
||||
- `/node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js` - 运行时 rpx 转换
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **不要随意升级 postcss 版本**:postcss-loader 3.x 只兼容 postcss 7.x
|
||||
2. **保留 uni-app postcss 插件**:这是 rpx 转换的关键
|
||||
3. **Node.js 版本建议**:使用 Node 16.x 以获得最佳兼容性
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Node.js: 16.x (推荐 16.20.2)
|
||||
- npm: 8.x
|
||||
- postcss: 7.x
|
||||
- postcss-loader: 3.x
|
||||
|
||||
## 相关命令
|
||||
|
||||
```bash
|
||||
# 安装 nvm(如果没有)
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
|
||||
# 切换到 Node 16
|
||||
nvm install 16
|
||||
nvm use 16
|
||||
|
||||
# 重新安装依赖
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
|
||||
# 开发模式
|
||||
npm run dev:h5
|
||||
|
||||
# 生产构建
|
||||
npm run build:h5
|
||||
```
|
||||
|
||||
## 修复日期
|
||||
|
||||
2024-12-17
|
||||
|
||||
## 修复分支
|
||||
|
||||
`devops`
|
||||
225
index.html
225
index.html
@@ -3,15 +3,236 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<!-- 关键:使用最严格的 viewport 设置 -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>武术评分系统</title>
|
||||
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
|
||||
<style>
|
||||
* {
|
||||
/* 允许垂直滚动,但禁用其他触摸动作 */
|
||||
touch-action: pan-y !important;
|
||||
-webkit-touch-callout: none !important;
|
||||
-webkit-tap-highlight-color: transparent !important;
|
||||
-webkit-user-select: none !important;
|
||||
user-select: none !important;
|
||||
}
|
||||
|
||||
/* 针对按钮元素完全禁用所有触摸动作 */
|
||||
button,
|
||||
.control-btn,
|
||||
[class*="btn"],
|
||||
[class*="control"],
|
||||
.decrease,
|
||||
.increase {
|
||||
touch-action: none !important;
|
||||
-webkit-user-select: none !important;
|
||||
user-select: none !important;
|
||||
-webkit-touch-callout: none !important;
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
/* 允许输入框正常交互 */
|
||||
input, textarea {
|
||||
touch-action: manipulation !important;
|
||||
-webkit-user-select: text !important;
|
||||
user-select: text !important;
|
||||
}
|
||||
|
||||
/* 防止页面整体缩放 */
|
||||
html, body {
|
||||
touch-action: pan-y !important;
|
||||
-ms-touch-action: pan-y !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// UniApp H5 专用:iOS Safari 双击缩放终极解决方案
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var lastTouchEnd = 0;
|
||||
var touchStartTime = 0;
|
||||
var touchCount = 0;
|
||||
var resetTimer = null;
|
||||
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||
|
||||
console.log('iOS 检测:', isIOS);
|
||||
console.log('User Agent:', navigator.userAgent);
|
||||
|
||||
// 方案1: 全局拦截 touchstart - 最高优先级
|
||||
document.addEventListener('touchstart', function(event) {
|
||||
var now = Date.now();
|
||||
touchStartTime = now;
|
||||
|
||||
// 清除重置计时器
|
||||
if (resetTimer) {
|
||||
clearTimeout(resetTimer);
|
||||
}
|
||||
|
||||
// 检查是否是快速连续触摸
|
||||
var timeSinceLastTouch = now - lastTouchEnd;
|
||||
|
||||
if (timeSinceLastTouch < 350) {
|
||||
touchCount++;
|
||||
|
||||
// 如果是第二次或更多次快速触摸,立即阻止
|
||||
if (touchCount >= 1) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
console.log('阻止快速连续触摸', touchCount, timeSinceLastTouch);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
touchCount = 0;
|
||||
}
|
||||
|
||||
// 600ms 后重置计数器
|
||||
resetTimer = setTimeout(function() {
|
||||
touchCount = 0;
|
||||
}, 600);
|
||||
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
// 方案2: 全局拦截 touchend
|
||||
document.addEventListener('touchend', function(event) {
|
||||
var now = Date.now();
|
||||
var touchDuration = now - touchStartTime;
|
||||
var timeSinceLastTouch = now - lastTouchEnd;
|
||||
|
||||
// 如果触摸时间很短(<150ms)且距离上次触摸很近(<350ms),很可能是双击
|
||||
if (touchDuration < 150 && timeSinceLastTouch < 350 && timeSinceLastTouch > 0) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
console.log('阻止疑似双击', touchDuration, timeSinceLastTouch);
|
||||
return false;
|
||||
}
|
||||
|
||||
lastTouchEnd = now;
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
// 方案3: 完全禁用 dblclick 事件
|
||||
document.addEventListener('dblclick', function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
console.log('阻止 dblclick 事件');
|
||||
return false;
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
// 方案4: 禁用手势缩放
|
||||
document.addEventListener('gesturestart', function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
console.log('阻止 gesturestart');
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
document.addEventListener('gesturechange', function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
document.addEventListener('gestureend', function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
// 方案5: 监听 click 事件,过滤快速连续点击
|
||||
var lastClickTime = 0;
|
||||
document.addEventListener('click', function(event) {
|
||||
var now = Date.now();
|
||||
var timeSinceLastClick = now - lastClickTime;
|
||||
|
||||
// 如果距离上次点击小于350ms,阻止
|
||||
if (timeSinceLastClick < 350 && timeSinceLastClick > 0) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
console.log('阻止快速连续点击', timeSinceLastClick);
|
||||
return false;
|
||||
}
|
||||
|
||||
lastClickTime = now;
|
||||
}, { passive: false, capture: true });
|
||||
|
||||
// 方案6: 针对按钮元素的特殊处理
|
||||
function addButtonProtection() {
|
||||
var selectors = [
|
||||
'.control-btn',
|
||||
'.control-btn.decrease',
|
||||
'.control-btn.increase',
|
||||
'button',
|
||||
'[class*="btn"]'
|
||||
];
|
||||
|
||||
selectors.forEach(function(selector) {
|
||||
var elements = document.querySelectorAll(selector);
|
||||
elements.forEach(function(element) {
|
||||
// 移除所有现有的事件监听器(通过克隆节点)
|
||||
var newElement = element.cloneNode(true);
|
||||
element.parentNode.replaceChild(newElement, element);
|
||||
|
||||
// 添加新的保护性事件监听器
|
||||
['touchstart', 'touchend', 'touchmove', 'click', 'dblclick'].forEach(function(eventType) {
|
||||
newElement.addEventListener(eventType, function(e) {
|
||||
if (eventType === 'dblclick') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
}, { passive: false, capture: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// DOM 加载完成后添加按钮保护
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
setTimeout(addButtonProtection, 100);
|
||||
// 使用 MutationObserver 监听 DOM 变化
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
addButtonProtection();
|
||||
});
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
} else {
|
||||
setTimeout(addButtonProtection, 100);
|
||||
}
|
||||
|
||||
// 方案7: 使用 CSS 强制禁用缩放
|
||||
var style = document.createElement('style');
|
||||
style.innerHTML = `
|
||||
* {
|
||||
touch-action: pan-y !important;
|
||||
}
|
||||
.control-btn,
|
||||
.control-btn *,
|
||||
button,
|
||||
button * {
|
||||
touch-action: none !important;
|
||||
-webkit-user-select: none !important;
|
||||
user-select: none !important;
|
||||
-webkit-touch-callout: none !important;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
console.log('iOS Safari 双击缩放防护已启用 - UniApp H5 专用版本');
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>请开启JavaScript运行本应用</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* 获取选手列表(根据裁判类型返回不同数据)
|
||||
* @param {Object} params
|
||||
* @param {String} params.judgeId - 评委ID
|
||||
* @param {Number} params.refereeType - 裁判类型(1-裁判长, 2-普通裁判)
|
||||
* @param {Number} params.refereeType - 裁判类型(1-主裁判, 2-裁判员)
|
||||
* @param {String} params.venueId - 场地ID(可选)
|
||||
* @param {String} params.projectId - 项目ID(可选)
|
||||
* @returns {Array} 选手列表
|
||||
@@ -15,7 +15,7 @@
|
||||
export function getMyAthletes(params) {
|
||||
const { refereeType } = params
|
||||
|
||||
// 裁判长:返回已有评分的选手
|
||||
// 主裁判:返回已有评分的选手
|
||||
if (refereeType === 1) {
|
||||
return [
|
||||
{
|
||||
@@ -54,7 +54,7 @@ export function getMyAthletes(params) {
|
||||
]
|
||||
}
|
||||
|
||||
// 普通裁判:返回待评分的选手
|
||||
// 裁判员:返回待评分的选手
|
||||
return [
|
||||
{
|
||||
athleteId: 3,
|
||||
@@ -80,7 +80,7 @@ export function getMyAthletes(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.competitionId - 比赛ID
|
||||
* @param {String} params.venueId - 场地ID
|
||||
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
getMyAthletes: athleteMock.getMyAthletes,
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params - { competitionId, venueId, projectId }
|
||||
* @returns {Array} 选手列表(带评分统计)
|
||||
*/
|
||||
@@ -70,14 +70,14 @@ export default {
|
||||
submitScore: scoreMock.submitScore,
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params - { athleteId }
|
||||
* @returns {Object} 评分详情(选手信息+评委评分)
|
||||
*/
|
||||
getScoreDetail: scoreMock.getScoreDetail,
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} params - { athleteId, modifierId, modifiedScore, note }
|
||||
* @returns {Object} 修改结果
|
||||
*/
|
||||
|
||||
@@ -23,13 +23,13 @@ export function login(params) {
|
||||
// 返回Mock登录数据
|
||||
return {
|
||||
token: 'mock_token_' + Date.now(),
|
||||
refereeType: role === 'pub' ? 2 : 1, // 1-裁判长, 2-普通裁判
|
||||
refereeType: role === 'pub' ? 2 : 1, // 1-主裁判, 2-裁判员
|
||||
matchId: matchCode || '200', // 使用传入的比赛编码,默认200
|
||||
matchName: '2025年全国武术散打锦标赛暨第十七届世界武术锦标赛选拔赛',
|
||||
matchTime: '2025年6月25日 9:00',
|
||||
judgeId: '456',
|
||||
judgeName: '欧阳丽娜',
|
||||
// 普通评委有固定场地,裁判长可以查看所有场地
|
||||
// 普通评委有固定场地,主裁判可以查看所有场地
|
||||
venueId: role === 'pub' ? '1' : null,
|
||||
venueName: role === 'pub' ? '第一场地' : null,
|
||||
// 分配的项目列表
|
||||
|
||||
@@ -62,7 +62,7 @@ export function submitScore(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @returns {Object} 评分详情
|
||||
@@ -131,10 +131,10 @@ export function getScoreDetail(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @param {String} params.modifierId - 修改人ID(裁判长)
|
||||
* @param {String} params.modifierId - 修改人ID(主裁判)
|
||||
* @param {Number} params.modifiedScore - 修改后的分数
|
||||
* @param {String} params.note - 修改原因
|
||||
* @returns {Object} 修改结果
|
||||
|
||||
1565
package-lock.json
generated
1565
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -20,8 +20,9 @@
|
||||
"css-loader": "^3.6.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-plugin": "^4.5.2",
|
||||
"postcss": "^7.0.39",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"sass": "^1.96.0",
|
||||
"sass": "^1.32.13",
|
||||
"sass-loader": "^10.5.2",
|
||||
"thread-loader": "^2.1.3",
|
||||
"url-loader": "^4.1.1",
|
||||
@@ -43,6 +44,7 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"mini-types": "*",
|
||||
"postcss-comment": "^2.0.0",
|
||||
"postcss-import": "^12.0.1",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
@@ -122,14 +122,14 @@ export default {
|
||||
// 保存用户信息到全局数据
|
||||
getApp().globalData = {
|
||||
userRole, // 'pub' 或 'admin'
|
||||
refereeType, // 1-裁判长, 2-普通裁判
|
||||
refereeType, // 1-主裁判, 2-裁判员
|
||||
matchCode: this.matchCode,
|
||||
matchId,
|
||||
matchName,
|
||||
matchTime,
|
||||
judgeId,
|
||||
judgeName,
|
||||
venueId, // 普通评委有场地,裁判长为null
|
||||
venueId, // 普通评委有场地,主裁判为null
|
||||
venueName,
|
||||
projects, // 分配的项目列表(从登录接口返回)
|
||||
currentProjectIndex: 0 // 当前选中的项目索引
|
||||
@@ -155,12 +155,12 @@ export default {
|
||||
// 根据角色跳转到不同页面
|
||||
setTimeout(() => {
|
||||
if (userRole === 'admin') {
|
||||
// 裁判长跳转到多场地列表页(可以修改评分)
|
||||
// 主裁判跳转到多场地列表页(可以修改评分)
|
||||
uni.navigateTo({
|
||||
url: '/pages/score-list-multi/score-list-multi'
|
||||
})
|
||||
} else {
|
||||
// 普通裁判跳转到评分列表页(可以评分)
|
||||
// 裁判员跳转到评分列表页(可以评分)
|
||||
uni.navigateTo({
|
||||
url: '/pages/score-list/score-list'
|
||||
})
|
||||
|
||||
@@ -50,7 +50,13 @@
|
||||
</view>
|
||||
|
||||
<view class="score-control">
|
||||
<view class="control-btn decrease" @click="decreaseScore">
|
||||
<!-- 减分按钮 - 使用 catchtouchstart 阻止事件冒泡 -->
|
||||
<view
|
||||
class="control-btn decrease"
|
||||
@touchstart="onDecreaseStart"
|
||||
@touchend="onDecreaseEnd"
|
||||
@touchcancel="onTouchCancel"
|
||||
>
|
||||
<text class="btn-symbol">-</text>
|
||||
<text class="btn-value">-0.001</text>
|
||||
</view>
|
||||
@@ -60,15 +66,17 @@
|
||||
<text class="no-modify-text">可不改</text>
|
||||
</view>
|
||||
|
||||
<view class="control-btn increase" @click="increaseScore">
|
||||
<!-- 加分按钮 - 使用 catchtouchstart 阻止事件冒泡 -->
|
||||
<view
|
||||
class="control-btn increase"
|
||||
@touchstart="onIncreaseStart"
|
||||
@touchend="onIncreaseEnd"
|
||||
@touchcancel="onTouchCancel"
|
||||
>
|
||||
<text class="btn-symbol">+</text>
|
||||
<text class="btn-value">+0.001</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="modify-tip">
|
||||
裁判长修改:保留3位小数点,超过上限或下限时,按钮置灰
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
@@ -114,7 +122,15 @@ export default {
|
||||
originalScore: 8.000,
|
||||
note: '',
|
||||
minScore: 5.0,
|
||||
maxScore: 10.0
|
||||
maxScore: 10.0,
|
||||
// 防止双击的状态管理
|
||||
isTouching: false,
|
||||
touchTimer: null,
|
||||
lastTouchTime: 0,
|
||||
// 长按相关
|
||||
longPressTimer: null,
|
||||
longPressInterval: null,
|
||||
isLongPressing: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -124,9 +140,9 @@ export default {
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 获取当前选手信息(从 score-list-multi 页面传递)
|
||||
const currentAthlete = globalData.currentAthlete || {}
|
||||
const currentAthlete = globalData.currentAthlete ||
|
||||
|
||||
// 获取裁判长ID
|
||||
// 获取主裁判ID
|
||||
this.modifierId = globalData.judgeId
|
||||
|
||||
// 调试信息
|
||||
@@ -141,9 +157,151 @@ export default {
|
||||
if (currentAthlete.athleteId) {
|
||||
await this.loadScoreDetail(currentAthlete.athleteId)
|
||||
}
|
||||
|
||||
// H5 平台特殊处理:禁用双击缩放
|
||||
// #ifdef H5
|
||||
this.disableDoubleTapZoom()
|
||||
// #endif
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// 清理定时器
|
||||
this.clearAllTimers()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// #ifdef H5
|
||||
disableDoubleTapZoom() {
|
||||
// 在 H5 环境下,添加额外的事件监听来防止双击缩放
|
||||
this.$nextTick(() => {
|
||||
const decreaseBtn = document.querySelector('.control-btn.decrease')
|
||||
const increaseBtn = document.querySelector('.control-btn.increase')
|
||||
|
||||
const preventZoom = (e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
e.stopImmediatePropagation()
|
||||
return false
|
||||
}
|
||||
|
||||
if (decreaseBtn) {
|
||||
decreaseBtn.addEventListener('touchstart', preventZoom, { passive: false, capture: true })
|
||||
decreaseBtn.addEventListener('touchend', preventZoom, { passive: false, capture: true })
|
||||
decreaseBtn.addEventListener('touchmove', preventZoom, { passive: false, capture: true })
|
||||
decreaseBtn.addEventListener('click', preventZoom, { passive: false, capture: true })
|
||||
}
|
||||
|
||||
if (increaseBtn) {
|
||||
increaseBtn.addEventListener('touchstart', preventZoom, { passive: false, capture: true })
|
||||
increaseBtn.addEventListener('touchend', preventZoom, { passive: false, capture: true })
|
||||
increaseBtn.addEventListener('touchmove', preventZoom, { passive: false, capture: true })
|
||||
increaseBtn.addEventListener('click', preventZoom, { passive: false, capture: true })
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
clearAllTimers() {
|
||||
if (this.touchTimer) {
|
||||
clearTimeout(this.touchTimer)
|
||||
this.touchTimer = null
|
||||
}
|
||||
if (this.longPressTimer) {
|
||||
clearTimeout(this.longPressTimer)
|
||||
this.longPressTimer = null
|
||||
}
|
||||
if (this.longPressInterval) {
|
||||
clearInterval(this.longPressInterval)
|
||||
this.longPressInterval = null
|
||||
}
|
||||
},
|
||||
|
||||
// 减分按钮 - touchstart
|
||||
onDecreaseStart(e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
const now = Date.now()
|
||||
|
||||
// 防止快速连续触摸(300ms内的触摸被忽略)
|
||||
if (now - this.lastTouchTime < 300) {
|
||||
return
|
||||
}
|
||||
|
||||
this.lastTouchTime = now
|
||||
this.isTouching = true
|
||||
|
||||
// 立即执行一次减分
|
||||
this.decreaseScore()
|
||||
|
||||
// 设置长按定时器(500ms后开始连续减分)
|
||||
this.longPressTimer = setTimeout(() => {
|
||||
this.isLongPressing = true
|
||||
// 每100ms执行一次减分
|
||||
this.longPressInterval = setInterval(() => {
|
||||
this.decreaseScore()
|
||||
}, 100)
|
||||
}, 500)
|
||||
},
|
||||
|
||||
// 减分按钮 - touchend
|
||||
onDecreaseEnd(e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
this.isTouching = false
|
||||
this.isLongPressing = false
|
||||
this.clearAllTimers()
|
||||
},
|
||||
|
||||
// 加分按钮 - touchstart
|
||||
onIncreaseStart(e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
const now = Date.now()
|
||||
|
||||
// 防止快速连续触摸(300ms内的触摸被忽略)
|
||||
if (now - this.lastTouchTime < 300) {
|
||||
return
|
||||
}
|
||||
|
||||
this.lastTouchTime = now
|
||||
this.isTouching = true
|
||||
|
||||
// 立即执行一次加分
|
||||
this.increaseScore()
|
||||
|
||||
// 设置长按定时器(500ms后开始连续加分)
|
||||
this.longPressTimer = setTimeout(() => {
|
||||
this.isLongPressing = true
|
||||
// 每100ms执行一次加分
|
||||
this.longPressInterval = setInterval(() => {
|
||||
this.increaseScore()
|
||||
}, 100)
|
||||
}, 500)
|
||||
},
|
||||
|
||||
// 加分按钮 - touchend
|
||||
onIncreaseEnd(e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
this.isTouching = false
|
||||
this.isLongPressing = false
|
||||
this.clearAllTimers()
|
||||
},
|
||||
|
||||
// 触摸取消
|
||||
onTouchCancel(e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
this.isTouching = false
|
||||
this.isLongPressing = false
|
||||
this.clearAllTimers()
|
||||
},
|
||||
|
||||
async loadScoreDetail(athleteId) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
@@ -151,9 +309,6 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取评分详情
|
||||
// Mock模式:调用 mock/score.js 的 getScoreDetail 函数
|
||||
// API模式:调用 api/score.js 的 getScoreDetail 函数(GET /api/mini/score/detail/{athleteId})
|
||||
const response = await dataAdapter.getData('getScoreDetail', {
|
||||
athleteId: athleteId
|
||||
})
|
||||
@@ -202,12 +357,26 @@ export default {
|
||||
decreaseScore() {
|
||||
if (this.currentScore > this.minScore) {
|
||||
this.currentScore = parseFloat((this.currentScore - 0.001).toFixed(3))
|
||||
|
||||
// 添加触觉反馈(仅在支持的平台)
|
||||
// #ifndef H5
|
||||
uni.vibrateShort({
|
||||
type: 'light'
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
increaseScore() {
|
||||
if (this.currentScore < this.maxScore) {
|
||||
this.currentScore = parseFloat((this.currentScore + 0.001).toFixed(3))
|
||||
|
||||
// 添加触觉反馈(仅在支持的平台)
|
||||
// #ifndef H5
|
||||
uni.vibrateShort({
|
||||
type: 'light'
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
@@ -236,14 +405,16 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 修改评分
|
||||
// Mock模式:调用 mock/score.js 的 modifyScore 函数
|
||||
// API模式:调用 api/score.js 的 modifyScore 函数(PUT /api/mini/score/modify)
|
||||
// 获取场地ID
|
||||
const app = getApp()
|
||||
const venueId = app.globalData?.currentVenueId
|
||||
|
||||
const response = await dataAdapter.getData('modifyScore', {
|
||||
athleteId: this.athleteInfo.athleteId,
|
||||
modifierId: this.modifierId,
|
||||
modifiedScore: this.currentScore,
|
||||
note: this.note
|
||||
note: this.note,
|
||||
venueId: venueId // 添加场地ID
|
||||
})
|
||||
|
||||
uni.hideLoading()
|
||||
@@ -465,8 +636,16 @@ export default {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #F5F5F5;
|
||||
border-radius: 12rpx;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
/* 关键:禁用所有可能导致缩放的触摸行为 */
|
||||
touch-action: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.control-btn.decrease {
|
||||
@@ -480,6 +659,7 @@ export default {
|
||||
.btn-symbol {
|
||||
font-size: 48rpx;
|
||||
font-weight: 300;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.control-btn.decrease .btn-symbol {
|
||||
@@ -493,6 +673,7 @@ export default {
|
||||
.btn-value {
|
||||
font-size: 24rpx;
|
||||
margin-top: 8rpx;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.control-btn.decrease .btn-value {
|
||||
@@ -521,13 +702,6 @@ export default {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.modify-tip {
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
line-height: 1.6;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 备注 */
|
||||
.note-section {
|
||||
margin: 30rpx;
|
||||
|
||||
@@ -31,28 +31,22 @@
|
||||
<view class="score-control">
|
||||
<view class="control-btn decrease" @click="decreaseScore">
|
||||
<text class="btn-symbol">-</text>
|
||||
<!-- <text class="btn-value">-0.001</text> -->
|
||||
</view>
|
||||
|
||||
<view class="score-display">
|
||||
<view class="score-display" @click="showScoreInput">
|
||||
<text class="current-score">{{ currentScore.toFixed(3) }}</text>
|
||||
<text class="edit-hint">点击编辑</text>
|
||||
</view>
|
||||
|
||||
<view class="control-btn increase" @click="increaseScore">
|
||||
<text class="btn-symbol">+</text>
|
||||
<!-- <text class="btn-value">+0.001</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="judge-tip">
|
||||
裁判评分:保留3位小数点,超过上限或下限时,按钮置灰
|
||||
</view> -->
|
||||
|
||||
<!-- 扣分项 -->
|
||||
<view class="deduction-section">
|
||||
<view class="deduction-header">
|
||||
<text class="deduction-label">扣分项:</text>
|
||||
<!-- <text class="deduction-hint">扣分项多选</text> -->
|
||||
</view>
|
||||
|
||||
<view class="deduction-list">
|
||||
@@ -82,12 +76,35 @@
|
||||
v-model="note"
|
||||
maxlength="200"
|
||||
/>
|
||||
<!-- <text class="optional-text">可不填</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="handleSubmit">提交</button>
|
||||
|
||||
<!-- 分数输入弹窗 -->
|
||||
<view v-if="showInputModal" class="modal-overlay" @click="hideScoreInput">
|
||||
<view class="modal-content" @click.stop>
|
||||
<view class="modal-header">
|
||||
<text class="modal-title">输入分数</text>
|
||||
</view>
|
||||
<view class="modal-body">
|
||||
<input
|
||||
type="digit"
|
||||
class="score-input"
|
||||
v-model="inputScore"
|
||||
placeholder="请输入5-10之间的分数"
|
||||
:focus="showInputModal"
|
||||
@confirm="confirmScoreInput"
|
||||
/>
|
||||
<text class="input-hint">分数范围:{{ minScore }} - {{ maxScore }},保留3位小数</text>
|
||||
</view>
|
||||
<view class="modal-footer">
|
||||
<button class="modal-btn cancel" @click="hideScoreInput">取消</button>
|
||||
<button class="modal-btn confirm" @click="confirmScoreInput">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -113,16 +130,16 @@ export default {
|
||||
note: '',
|
||||
minScore: 5.0,
|
||||
maxScore: 10.0,
|
||||
deductions: []
|
||||
deductions: [],
|
||||
showInputModal: false,
|
||||
inputScore: ''
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
// 获取全局数据
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 加载当前选手信息(从 score-list 页面传递)
|
||||
const currentAthlete = globalData.currentAthlete || {}
|
||||
this.player = {
|
||||
athleteId: currentAthlete.athleteId || '',
|
||||
@@ -132,18 +149,15 @@ export default {
|
||||
number: currentAthlete.number || ''
|
||||
}
|
||||
|
||||
// 如果选手已评分,加载其原有评分
|
||||
if (currentAthlete.scored && currentAthlete.myScore) {
|
||||
this.currentScore = currentAthlete.myScore
|
||||
}
|
||||
|
||||
// 加载评委ID和项目ID
|
||||
this.judgeId = globalData.judgeId
|
||||
this.projectId = globalData.currentProjectId || ''
|
||||
this.competitionId = globalData.matchId || globalData.matchCode || ''
|
||||
this.venueId = globalData.currentVenueId || globalData.venueId || ''
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('评分详情页加载:', {
|
||||
athlete: this.player,
|
||||
@@ -155,22 +169,17 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
// 加载扣分项列表
|
||||
await this.loadDeductions()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async loadDeductions() {
|
||||
try {
|
||||
// 🔥 关键改动:使用 dataAdapter 获取扣分项列表
|
||||
// Mock模式:调用 mock/score.js 的 getDeductions 函数
|
||||
// API模式:调用 api/score.js 的 getDeductions 函数(GET /martial/deductionItem/list)
|
||||
const response = await dataAdapter.getData('getDeductions', {
|
||||
projectId: this.projectId
|
||||
})
|
||||
|
||||
// 为每个扣分项添加 checked 状态,并映射字段名
|
||||
const records = response.data?.records || []
|
||||
const records = response.data && response.data.records ? response.data.records : []
|
||||
this.deductions = records.map(item => ({
|
||||
deductionId: item.id,
|
||||
deductionName: item.itemName,
|
||||
@@ -178,7 +187,6 @@ export default {
|
||||
checked: false
|
||||
}))
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('扣分项加载成功:', this.deductions)
|
||||
}
|
||||
@@ -201,7 +209,6 @@ export default {
|
||||
delta: 1,
|
||||
fail: (err) => {
|
||||
console.error('返回失败:', err)
|
||||
// 如果返回失败,尝试跳转到评分列表页
|
||||
uni.redirectTo({
|
||||
url: '/pages/score-list/score-list'
|
||||
})
|
||||
@@ -221,12 +228,44 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
showScoreInput() {
|
||||
this.inputScore = this.currentScore.toFixed(3)
|
||||
this.showInputModal = true
|
||||
},
|
||||
|
||||
hideScoreInput() {
|
||||
this.showInputModal = false
|
||||
this.inputScore = ''
|
||||
},
|
||||
|
||||
confirmScoreInput() {
|
||||
const score = parseFloat(this.inputScore)
|
||||
|
||||
if (isNaN(score)) {
|
||||
uni.showToast({
|
||||
title: '请输入有效的数字',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (score < this.minScore || score > this.maxScore) {
|
||||
uni.showToast({
|
||||
title: `分数必须在${this.minScore}-${this.maxScore}之间`,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.currentScore = parseFloat(score.toFixed(3))
|
||||
this.hideScoreInput()
|
||||
},
|
||||
|
||||
toggleDeduction(index) {
|
||||
this.deductions[index].checked = !this.deductions[index].checked
|
||||
},
|
||||
|
||||
async handleSubmit() {
|
||||
// 验证评分范围
|
||||
if (this.currentScore < this.minScore || this.currentScore > this.maxScore) {
|
||||
uni.showToast({
|
||||
title: `评分必须在${this.minScore}-${this.maxScore}分之间`,
|
||||
@@ -235,7 +274,6 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 验证必需字段
|
||||
if (!this.competitionId) {
|
||||
uni.showToast({
|
||||
title: '缺少比赛ID,请重新登录',
|
||||
@@ -252,7 +290,6 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 收集选中的扣分项ID
|
||||
const selectedDeductions = this.deductions
|
||||
.filter(item => item.checked)
|
||||
.map(item => item.deductionId)
|
||||
@@ -263,7 +300,6 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 准备提交数据
|
||||
const submitData = {
|
||||
athleteId: this.player.athleteId,
|
||||
judgeId: this.judgeId,
|
||||
@@ -275,19 +311,14 @@ export default {
|
||||
note: this.note
|
||||
}
|
||||
|
||||
// 调试日志:打印提交数据
|
||||
if (config.debug) {
|
||||
console.log('准备提交评分数据:', submitData)
|
||||
}
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 提交评分
|
||||
// Mock模式:调用 mock/score.js 的 submitScore 函数
|
||||
// API模式:调用 api/score.js 的 submitScore 函数(POST /martial/score/submit)
|
||||
const response = await dataAdapter.getData('submitScore', submitData)
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('评分提交成功:', {
|
||||
athleteId: this.player.athleteId,
|
||||
@@ -297,14 +328,12 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
// 显示成功提示
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
// 返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
@@ -485,6 +514,14 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.score-display:active {
|
||||
background-color: rgba(27, 124, 94, 0.1);
|
||||
}
|
||||
|
||||
.current-score {
|
||||
@@ -493,6 +530,12 @@ export default {
|
||||
color: #1B7C5E;
|
||||
}
|
||||
|
||||
.edit-hint {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.judge-tip {
|
||||
padding: 0 30rpx;
|
||||
font-size: 24rpx;
|
||||
@@ -628,4 +671,95 @@ export default {
|
||||
.submit-btn:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* 分数输入弹窗 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
width: 600rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 20rpx 30rpx 30rpx;
|
||||
}
|
||||
|
||||
.score-input {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
border: 2rpx solid #E0E0E0;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.score-input:focus {
|
||||
border-color: #1B7C5E;
|
||||
}
|
||||
|
||||
.input-hint {
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #E0E0E0;
|
||||
}
|
||||
|
||||
.modal-btn {
|
||||
flex: 1;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.modal-btn.cancel {
|
||||
color: #666666;
|
||||
border-right: 1rpx solid #E0E0E0;
|
||||
}
|
||||
|
||||
.modal-btn.confirm {
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.modal-btn:active {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</scroll-view>
|
||||
|
||||
<view class="venue-tip">
|
||||
<!-- <text class="tip-bold">裁判长可看见所有场地和项目</text> -->
|
||||
<!-- <text class="tip-bold">主裁判可看见所有场地和项目</text> -->
|
||||
<!-- <text class="tip-normal">(场地和项目可动态全部),可以点击切换</text> -->
|
||||
</view>
|
||||
|
||||
@@ -68,13 +68,20 @@
|
||||
<view class="player-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
|
||||
<!-- 已评分:显示总分和修改按钮 -->
|
||||
<view class="action-area" v-if="player.totalScore">
|
||||
<text class="total-score">总分:{{ player.totalScore }}</text>
|
||||
<view class="chief-actions">
|
||||
<!-- <text class="chief-hint">裁判长功能:修改评分、修改按钮需等总分出来才出现</text> -->
|
||||
<button class="modify-btn" @click="goToModify(player)">修改</button>
|
||||
</view>
|
||||
<!-- 动作区域:始终显示 -->
|
||||
<view class="action-area">
|
||||
<!-- 已评分:显示总分和修改按钮 -->
|
||||
<template v-if="player.scoringComplete && player.totalScore > 0">
|
||||
<text class="total-score">总分:{{ player.totalScore }}</text>
|
||||
<view class="chief-actions">
|
||||
<button class="modify-btn" @click="goToModify(player)">修改</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 未评分:显示评分中提示 -->
|
||||
<template v-else>
|
||||
<text class="scoring-status">评分中...</text>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -123,12 +130,12 @@ export default {
|
||||
time: globalData.matchTime || '比赛时间'
|
||||
}
|
||||
|
||||
// 注意:裁判长没有固定场地和项目,需要查看所有
|
||||
// 注意:主裁判没有固定场地和项目,需要查看所有
|
||||
this.competitionId = globalData.matchId
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('裁判长列表页加载:', {
|
||||
console.log('主裁判列表页加载:', {
|
||||
userRole: globalData.userRole,
|
||||
competitionId: this.competitionId
|
||||
})
|
||||
@@ -205,7 +212,7 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取选手列表(裁判长视图)
|
||||
// 🔥 关键改动:使用 dataAdapter 获取选手列表(主裁判视图)
|
||||
// Mock模式:调用 mock/athlete.js 的 getAthletesForAdmin 函数
|
||||
// API模式:调用 api/athlete.js 的 getAthletesForAdmin 函数(GET /api/mini/athletes/admin)
|
||||
const response = await dataAdapter.getData('getAthletesForAdmin', {
|
||||
@@ -217,11 +224,11 @@ export default {
|
||||
uni.hideLoading()
|
||||
|
||||
// 保存选手列表
|
||||
this.players = response.data || []
|
||||
this.players = (response.data.records || response.data) || []
|
||||
|
||||
// 计算评分统计(裁判长视图:统计有总分的选手)
|
||||
// 计算评分统计(主裁判视图:统计有总分的选手)
|
||||
this.totalCount = this.players.length
|
||||
this.scoredCount = this.players.filter(p => p.totalScore).length
|
||||
this.scoredCount = this.players.filter(p => p.scoringComplete).length
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
@@ -389,6 +396,8 @@ export default {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
touch-action: manipulation;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.venue-tab.active {
|
||||
@@ -441,6 +450,8 @@ export default {
|
||||
color: #666666;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
touch-action: manipulation;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.project-btn.active {
|
||||
@@ -505,6 +516,15 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.scoring-status {
|
||||
font-size: 26rpx;
|
||||
color: #FF9800;
|
||||
font-weight: 500;
|
||||
padding: 8rpx 20rpx;
|
||||
background-color: #FFF3E0;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.chief-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -527,6 +547,8 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
touch-action: manipulation;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.modify-btn:active {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
>
|
||||
{{ project.projectName }}
|
||||
</view>
|
||||
<view class="no-project-tip" v-if="projects.length === 0">当前场地暂无比赛项目</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -49,7 +50,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 选手列表 -->
|
||||
<view class="player-list">
|
||||
<view class="player-list" v-if="projects.length > 0">
|
||||
<!-- 遍历选手列表 -->
|
||||
<view
|
||||
class="player-card"
|
||||
@@ -60,20 +61,37 @@
|
||||
<view class="player-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
|
||||
<!-- 裁判长:显示总分和已评分裁判数 -->
|
||||
<!-- 主裁判:显示总分和已评分裁判数 -->
|
||||
<view class="player-scores" v-if="refereeType === 1">
|
||||
<text class="total-score">总分:{{ player.totalScore || '未评分' }}</text>
|
||||
<text class="judge-count">已评分:{{ player.scoredJudgeCount || 0 }}人</text>
|
||||
<text class="total-score">
|
||||
总分:{{ player.scoringComplete ? player.totalScore : '评分中' }}
|
||||
</text>
|
||||
<text class="judge-count">
|
||||
已评分:{{ player.scoredJudgeCount || 0 }}/{{ player.requiredJudgeCount || 0 }}人
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 普通裁判:显示评分按钮 -->
|
||||
<button
|
||||
class="score-btn"
|
||||
v-else
|
||||
@click.stop="goToScoreDetail(player)"
|
||||
>
|
||||
评分
|
||||
</button>
|
||||
<!-- 裁判员:根据评分状态显示不同内容 -->
|
||||
<view class="judge-action" v-else>
|
||||
<!-- 已评分:显示分数和修改按钮 -->
|
||||
<view class="scored-info" v-if="player.scored">
|
||||
<text class="my-score-text">我的评分:{{ player.myScore }}</text>
|
||||
<button
|
||||
class="score-btn modify-btn"
|
||||
@click.stop="goToScoreDetail(player)"
|
||||
>
|
||||
修改
|
||||
</button>
|
||||
</view>
|
||||
<!-- 未评分:显示评分按钮 -->
|
||||
<button
|
||||
class="score-btn"
|
||||
v-else
|
||||
@click.stop="goToScoreDetail(player)"
|
||||
>
|
||||
评分
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="player-info">
|
||||
@@ -107,7 +125,7 @@ export default {
|
||||
},
|
||||
judgeId: '',
|
||||
matchId: '',
|
||||
refereeType: 2, // 裁判类型(1-裁判长, 2-普通裁判)
|
||||
refereeType: 2, // 裁判类型(1-主裁判, 2-裁判员)
|
||||
venues: [], // 所有场地列表
|
||||
currentVenueIndex: 0, // 当前选中的场地索引
|
||||
projects: [], // 所有项目列表
|
||||
@@ -132,7 +150,7 @@ export default {
|
||||
|
||||
this.judgeId = globalData.judgeId
|
||||
this.matchId = globalData.matchId || globalData.matchCode
|
||||
this.refereeType = globalData.refereeType || 2 // 默认为普通裁判
|
||||
this.refereeType = globalData.refereeType || 2 // 默认为裁判员
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
@@ -260,15 +278,15 @@ export default {
|
||||
|
||||
/**
|
||||
* 处理选手卡片点击
|
||||
* - 裁判长:跳转到查看详情页面
|
||||
* - 普通裁判:不处理(通过评分按钮跳转)
|
||||
* - 主裁判:跳转到查看详情页面
|
||||
* - 裁判员:不处理(通过评分按钮跳转)
|
||||
*/
|
||||
handlePlayerClick(player) {
|
||||
if (this.refereeType === 1) {
|
||||
// 裁判长:查看评分详情
|
||||
// 主裁判:查看评分详情
|
||||
this.goToScoreDetail(player)
|
||||
}
|
||||
// 普通裁判不处理卡片点击,只能通过评分按钮跳转
|
||||
// 裁判员不处理卡片点击,只能通过评分按钮跳转
|
||||
},
|
||||
|
||||
goToScoreDetail(player) {
|
||||
@@ -634,6 +652,29 @@ export default {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.judge-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.scored-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.my-score-text {
|
||||
font-size: 28rpx;
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.modify-btn {
|
||||
background: linear-gradient(135deg, #FF9500 0%, #FFB340 100%);
|
||||
padding: 10rpx 30rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.player-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -645,4 +686,12 @@ export default {
|
||||
color: #666666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.no-project-tip {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
// 引入 uni-app 的 postcss 插件来处理 rpx 转换
|
||||
// 使用 postcss.plugin 旧版 API (postcss-loader 3.x 兼容)
|
||||
const postcss = require('postcss')
|
||||
const uniappPlugin = require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
autoprefixer()
|
||||
uniappPlugin,
|
||||
autoprefixer
|
||||
]
|
||||
}
|
||||
|
||||
7
postcss.config.js.bak
Normal file
7
postcss.config.js.bak
Normal file
@@ -0,0 +1,7 @@
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
autoprefixer()
|
||||
]
|
||||
}
|
||||
@@ -24,15 +24,18 @@ import request from '@/utils/request.js'
|
||||
*/
|
||||
export function getMyAthletes(params) {
|
||||
return request({
|
||||
url: '/api/mini/athletes',
|
||||
url: '/mini/score/athletes',
|
||||
method: 'GET',
|
||||
params: params, // GET 请求使用 params
|
||||
params: {
|
||||
...params,
|
||||
refereeType: 2 // 裁判员
|
||||
},
|
||||
showLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.competitionId - 比赛ID
|
||||
* @param {String} params.venueId - 场地ID
|
||||
@@ -44,9 +47,12 @@ export function getMyAthletes(params) {
|
||||
*/
|
||||
export function getAthletesForAdmin(params) {
|
||||
return request({
|
||||
url: '/api/mini/athletes/admin',
|
||||
url: '/mini/score/athletes',
|
||||
method: 'GET',
|
||||
params: params, // GET 请求使用 params
|
||||
params: {
|
||||
...params,
|
||||
refereeType: 1 // 主裁判
|
||||
},
|
||||
showLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
getMyAthletes: athleteApi.getMyAthletes,
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params - { competitionId, venueId, projectId }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -82,14 +82,14 @@ export default {
|
||||
submitScore: scoreApi.submitScore,
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params - { athleteId }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getScoreDetail: scoreApi.getScoreDetail,
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} data - { athleteId, modifierId, modifiedScore, note }
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ export default {
|
||||
* 1. 需要实现的新接口(小程序专用):
|
||||
* - POST /api/mini/login # 登录验证
|
||||
* - GET /api/mini/athletes # 普通评委选手列表
|
||||
* - GET /api/mini/athletes/admin # 裁判长选手列表
|
||||
* - GET /api/mini/athletes/admin # 主裁判选手列表
|
||||
* - GET /api/mini/score/detail/{athleteId} # 评分详情
|
||||
* - PUT /api/mini/score/modify # 修改评分
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ import request from '@/utils/request.js'
|
||||
*/
|
||||
export function getDeductions(params) {
|
||||
return request({
|
||||
url: '/martial/deductionItem/list',
|
||||
url: '/blade-martial/deductionItem/list',
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
@@ -35,7 +35,7 @@ export function getDeductions(params) {
|
||||
*/
|
||||
export function submitScore(data) {
|
||||
return request({
|
||||
url: '/martial/score/submit',
|
||||
url: '/mini/score/submit',
|
||||
method: 'POST',
|
||||
data,
|
||||
showLoading: true,
|
||||
@@ -44,7 +44,7 @@ export function submitScore(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @returns {Promise}
|
||||
@@ -54,14 +54,14 @@ export function submitScore(data) {
|
||||
*/
|
||||
export function getScoreDetail(params) {
|
||||
return request({
|
||||
url: `/api/mini/score/detail/${params.athleteId}`,
|
||||
url: `/mini/score/detail/${params.athleteId}`,
|
||||
method: 'GET',
|
||||
showLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} data
|
||||
* @param {String} data.athleteId - 选手ID
|
||||
* @param {String} data.modifierId - 修改人ID
|
||||
@@ -74,7 +74,7 @@ export function getScoreDetail(params) {
|
||||
*/
|
||||
export function modifyScore(data) {
|
||||
return request({
|
||||
url: '/api/mini/score/modify',
|
||||
url: '/mini/score/modify',
|
||||
method: 'PUT',
|
||||
data,
|
||||
showLoading: true,
|
||||
@@ -158,7 +158,7 @@ export default {
|
||||
* }
|
||||
*
|
||||
* 实现逻辑:
|
||||
* 1. 验证权限(只有裁判长可以修改)
|
||||
* 1. 验证权限(只有主裁判可以修改)
|
||||
* 2. 保存 originalScore(如果是第一次修改)
|
||||
* 3. 更新 totalScore
|
||||
* 4. 记录 modifyReason 和 modifyTime
|
||||
|
||||
@@ -17,11 +17,14 @@ const ENV_CONFIG = {
|
||||
dataMode: 'api',
|
||||
|
||||
// API基础路径(dataMode为'api'时使用)
|
||||
apiBaseURL: 'http://localhost:8123',
|
||||
// uni.request 不支持 devServer proxy,必须用完整地址
|
||||
apiBaseURL: 'https://martial-api.aitisai.com',
|
||||
|
||||
// 请求超时时间(毫秒)
|
||||
timeout: 30000,
|
||||
|
||||
// 调试模式
|
||||
debug: true
|
||||
},
|
||||
|
||||
// 测试环境配置
|
||||
@@ -36,7 +39,7 @@ const ENV_CONFIG = {
|
||||
// 生产环境配置
|
||||
production: {
|
||||
dataMode: 'api',
|
||||
apiBaseURL: 'https://api.yourdomain.com',
|
||||
apiBaseURL: 'https://martial-api.aitisai.com',
|
||||
debug: false,
|
||||
timeout: 30000,
|
||||
mockDelay: 0
|
||||
|
||||
@@ -51,7 +51,7 @@ export function getMyAthletes(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.competitionId - 比赛ID
|
||||
* @param {String} params.venueId - 场地ID
|
||||
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
getMyAthletes: athleteMock.getMyAthletes,
|
||||
|
||||
/**
|
||||
* 获取选手列表(裁判长)
|
||||
* 获取选手列表(主裁判)
|
||||
* @param {Object} params - { competitionId, venueId, projectId }
|
||||
* @returns {Array} 选手列表(带评分统计)
|
||||
*/
|
||||
@@ -70,14 +70,14 @@ export default {
|
||||
submitScore: scoreMock.submitScore,
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params - { athleteId }
|
||||
* @returns {Object} 评分详情(选手信息+评委评分)
|
||||
*/
|
||||
getScoreDetail: scoreMock.getScoreDetail,
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} params - { athleteId, modifierId, modifiedScore, note }
|
||||
* @returns {Object} 修改结果
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ export function login(params) {
|
||||
matchTime: '2025年6月25日 9:00',
|
||||
judgeId: '456',
|
||||
judgeName: '欧阳丽娜',
|
||||
// 普通评委有固定场地,裁判长可以查看所有场地
|
||||
// 普通评委有固定场地,主裁判可以查看所有场地
|
||||
venueId: role === 'pub' ? '1' : null,
|
||||
venueName: role === 'pub' ? '第一场地' : null,
|
||||
// 分配的项目列表(对象数组格式)
|
||||
|
||||
@@ -56,7 +56,7 @@ export function submitScore(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分详情(裁判长查看)
|
||||
* 获取评分详情(主裁判查看)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @returns {Object} 评分详情
|
||||
@@ -125,10 +125,10 @@ export function getScoreDetail(params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
* @param {Object} params
|
||||
* @param {String} params.athleteId - 选手ID
|
||||
* @param {String} params.modifierId - 修改人ID(裁判长)
|
||||
* @param {String} params.modifierId - 修改人ID(主裁判)
|
||||
* @param {Number} params.modifiedScore - 修改后的分数
|
||||
* @param {String} params.note - 修改原因
|
||||
* @returns {Object} 修改结果
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
"path": "pages/score-list/score-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -34,6 +36,13 @@
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/general-judge/general-judge",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
556
src/pages/general-judge/general-judge.vue
Normal file
556
src/pages/general-judge/general-judge.vue
Normal file
@@ -0,0 +1,556 @@
|
||||
<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 pending"
|
||||
@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.finalScore }}</text>
|
||||
</view>
|
||||
<view class="status-tag pending">待确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 已确认成绩列表 -->
|
||||
<view class="result-section">
|
||||
<view class="section-title">
|
||||
已确认成绩
|
||||
<text class="count">({{ confirmedResults.length }})</text>
|
||||
</view>
|
||||
|
||||
<view v-if="confirmedResults.length === 0" class="empty">
|
||||
<text>暂无已确认成绩</text>
|
||||
</view>
|
||||
|
||||
<view v-else class="result-list">
|
||||
<view
|
||||
v-for="result in confirmedResults"
|
||||
:key="result.id"
|
||||
class="result-item confirmed"
|
||||
>
|
||||
<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 confirmed">{{ result.finalScore }}</text>
|
||||
</view>
|
||||
<view class="status-tag confirmed">已确认</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.finalScore }}</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: [],
|
||||
confirmedResults: [],
|
||||
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.loadAllResults()
|
||||
},
|
||||
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 loadAllResults() {
|
||||
this.loading = true
|
||||
try {
|
||||
// 加载待确认成绩
|
||||
const pendingRes = await uni.request({
|
||||
url: config.apiBaseURL + "/mini/general/pending",
|
||||
method: "GET",
|
||||
data: { competitionId: this.matchId },
|
||||
header: {
|
||||
"Authorization": uni.getStorageSync("token")
|
||||
}
|
||||
})
|
||||
if (pendingRes[1].data.success) {
|
||||
let results = pendingRes[1].data.data || []
|
||||
if (this.selectedVenueId) {
|
||||
results = results.filter(r => r.venueId === this.selectedVenueId)
|
||||
}
|
||||
this.pendingResults = results
|
||||
}
|
||||
|
||||
// 加载已确认成绩
|
||||
const confirmedRes = await uni.request({
|
||||
url: config.apiBaseURL + "/mini/general/confirmed",
|
||||
method: "GET",
|
||||
data: { competitionId: this.matchId },
|
||||
header: {
|
||||
"Authorization": uni.getStorageSync("token")
|
||||
}
|
||||
})
|
||||
if (confirmedRes[1].data.success) {
|
||||
let results = confirmedRes[1].data.data || []
|
||||
if (this.selectedVenueId) {
|
||||
results = results.filter(r => r.venueId === this.selectedVenueId)
|
||||
}
|
||||
this.confirmedResults = results
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("加载成绩失败:", e)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
selectVenue(venueId) {
|
||||
this.selectedVenueId = venueId
|
||||
this.loadAllResults()
|
||||
},
|
||||
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.loadAllResults()
|
||||
} 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;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.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: 40rpx;
|
||||
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;
|
||||
}
|
||||
|
||||
.result-item.pending {
|
||||
border-left: 6rpx solid #FF9800;
|
||||
}
|
||||
|
||||
.result-item.confirmed {
|
||||
border-left: 6rpx solid #4CAF50;
|
||||
}
|
||||
|
||||
.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: #FF9800;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.chief-score .value.confirmed {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
font-size: 24rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.status-tag.pending {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.status-tag.confirmed {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.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>
|
||||
@@ -120,6 +120,7 @@ export default {
|
||||
|
||||
// 保存用户信息到全局数据
|
||||
getApp().globalData = {
|
||||
token, // Token(用于登录状态检查)
|
||||
userRole, // 'pub' 或 'admin'
|
||||
matchCode: this.matchCode, // 比赛编码
|
||||
inviteCode: this.inviteCode, // 邀请码(重要:用于后续API调用)
|
||||
@@ -128,7 +129,7 @@ export default {
|
||||
matchTime,
|
||||
judgeId,
|
||||
judgeName,
|
||||
venueId, // 普通评委有场地,裁判长为null
|
||||
venueId, // 普通评委有场地,主裁判为null
|
||||
venueName,
|
||||
projects, // 分配的项目列表
|
||||
currentProjectIndex: 0 // 当前选中的项目索引
|
||||
@@ -153,13 +154,18 @@ export default {
|
||||
|
||||
// 根据角色跳转到不同页面
|
||||
setTimeout(() => {
|
||||
if (userRole === 'admin') {
|
||||
// 裁判长跳转到多场地列表页(可以修改评分)
|
||||
if (userRole === 'general') {
|
||||
// 总裁跳转到总裁专用页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/general-judge/general-judge'
|
||||
})
|
||||
} else if (userRole === 'admin') {
|
||||
// 主裁判跳转到多场地列表页(可以修改评分)
|
||||
uni.navigateTo({
|
||||
url: '/pages/score-list-multi/score-list-multi'
|
||||
})
|
||||
} else {
|
||||
// 普通裁判跳转到评分列表页(可以评分)
|
||||
// 裁判员跳转到评分列表页(可以评分)
|
||||
uni.navigateTo({
|
||||
url: '/pages/score-list/score-list'
|
||||
})
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<view class="player-name">{{ athleteInfo.name }}</view>
|
||||
<view class="total-score-label">
|
||||
<text class="label-text">总分:</text>
|
||||
<text class="score-value">{{ athleteInfo.totalScore }}</text>
|
||||
<text class="score-value">{{ formatScore(athleteInfo.totalScore) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="player-details">
|
||||
@@ -46,7 +46,7 @@
|
||||
<!-- 修改总分区域 -->
|
||||
<view class="modify-section">
|
||||
<view class="modify-header">
|
||||
<text class="modify-label">修改总分(+-0.005分)</text>
|
||||
<text class="modify-label">修改总分(±0.050分)</text>
|
||||
</view>
|
||||
|
||||
<view class="score-control">
|
||||
@@ -65,10 +65,6 @@
|
||||
<text class="btn-value">+0.001</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="modify-tip">
|
||||
裁判长修改:保留3位小数点,超过上限或下限时,按钮置灰
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
@@ -110,10 +106,10 @@ export default {
|
||||
judgeScores: [],
|
||||
modification: null,
|
||||
modifierId: '',
|
||||
currentScore: 8.000,
|
||||
originalScore: 8.000,
|
||||
currentScore: 0,
|
||||
originalScore: 0,
|
||||
note: '',
|
||||
minScore: 5.0,
|
||||
minScore: 0,
|
||||
maxScore: 10.0
|
||||
}
|
||||
},
|
||||
@@ -123,27 +119,101 @@ export default {
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 检查登录状态
|
||||
if (!globalData.judgeId || !globalData.token) {
|
||||
console.warn('用户未登录,跳转到登录页')
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否是主裁判
|
||||
if (globalData.userRole !== 'admin') {
|
||||
console.warn('非主裁判用户,无权修改评分')
|
||||
uni.showToast({
|
||||
title: '无权限',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否有选手信息
|
||||
if (!globalData.currentAthlete || !globalData.currentAthlete.athleteId) {
|
||||
console.warn('没有选手信息,返回列表页')
|
||||
uni.showToast({
|
||||
title: '请选择选手',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取当前选手信息(从 score-list-multi 页面传递)
|
||||
const currentAthlete = globalData.currentAthlete || {}
|
||||
|
||||
// 获取裁判长ID
|
||||
// 获取主裁判ID
|
||||
this.modifierId = globalData.judgeId
|
||||
|
||||
// 🔥 关键修复:先用传递过来的选手数据初始化页面
|
||||
this.athleteInfo = {
|
||||
athleteId: currentAthlete.athleteId,
|
||||
name: currentAthlete.name || '',
|
||||
idCard: currentAthlete.idCard || '',
|
||||
team: currentAthlete.team || '',
|
||||
number: currentAthlete.number || '',
|
||||
totalScore: currentAthlete.totalScore || 0
|
||||
}
|
||||
|
||||
// 设置初始分数(使用传递过来的总分)
|
||||
const totalScore = parseFloat(currentAthlete.totalScore) || 0
|
||||
this.originalScore = totalScore
|
||||
this.currentScore = totalScore
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('修改评分页加载:', {
|
||||
currentAthlete: currentAthlete,
|
||||
athleteId: currentAthlete.athleteId,
|
||||
totalScore: totalScore,
|
||||
modifierId: this.modifierId
|
||||
})
|
||||
}
|
||||
|
||||
// 加载选手评分详情
|
||||
// 尝试加载选手评分详情(获取各评委的评分)
|
||||
if (currentAthlete.athleteId) {
|
||||
await this.loadScoreDetail(currentAthlete.athleteId)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
formatScore(score) {
|
||||
if (score === null || score === undefined || score === -1 || score === '-1') {
|
||||
return '--'
|
||||
}
|
||||
if (typeof score === 'string' && !isNaN(parseFloat(score))) {
|
||||
return parseFloat(score).toFixed(3)
|
||||
}
|
||||
if (typeof score === 'number') {
|
||||
return score.toFixed(3)
|
||||
}
|
||||
return score
|
||||
},
|
||||
|
||||
async loadScoreDetail(athleteId) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
@@ -151,27 +221,35 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取评分详情
|
||||
// Mock模式:调用 mock/score.js 的 getScoreDetail 函数
|
||||
// API模式:调用 api/score.js 的 getScoreDetail 函数(GET /api/mini/score/detail/{athleteId})
|
||||
const response = await dataAdapter.getData('getScoreDetail', {
|
||||
athleteId: athleteId
|
||||
})
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 保存选手信息和评分详情
|
||||
this.athleteInfo = response.data.athleteInfo || {}
|
||||
this.judgeScores = response.data.judgeScores || []
|
||||
this.modification = response.data.modification || null
|
||||
// 如果接口返回了数据,更新页面
|
||||
if (response && response.data) {
|
||||
// 更新评委评分列表
|
||||
this.judgeScores = response.data.judgeScores || []
|
||||
this.modification = response.data.modification || null
|
||||
|
||||
// 设置初始分数
|
||||
this.originalScore = this.athleteInfo.totalScore || 8.000
|
||||
this.currentScore = this.originalScore
|
||||
// 如果接口返回了选手信息,更新(但保留传递过来的数据作为备用)
|
||||
if (response.data.athleteInfo) {
|
||||
const apiAthleteInfo = response.data.athleteInfo
|
||||
this.athleteInfo = {
|
||||
athleteId: apiAthleteInfo.athleteId || this.athleteInfo.athleteId,
|
||||
name: apiAthleteInfo.name || this.athleteInfo.name,
|
||||
idCard: apiAthleteInfo.idCard || this.athleteInfo.idCard,
|
||||
team: apiAthleteInfo.team || this.athleteInfo.team,
|
||||
number: apiAthleteInfo.number || this.athleteInfo.number,
|
||||
totalScore: apiAthleteInfo.totalScore || this.athleteInfo.totalScore
|
||||
}
|
||||
|
||||
// 如果之前已修改过,加载修改后的分数
|
||||
if (this.modification && this.modification.modifiedScore) {
|
||||
this.currentScore = this.modification.modifiedScore
|
||||
// 更新分数
|
||||
const totalScore = parseFloat(apiAthleteInfo.totalScore) || this.originalScore
|
||||
this.originalScore = totalScore
|
||||
this.currentScore = totalScore
|
||||
}
|
||||
}
|
||||
|
||||
// 调试信息
|
||||
@@ -188,10 +266,10 @@ export default {
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
console.error('加载评分详情失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
// 不显示错误提示,因为已经有传递过来的数据可以使用
|
||||
if (config.debug) {
|
||||
console.log('使用传递过来的选手数据')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -200,22 +278,28 @@ export default {
|
||||
},
|
||||
|
||||
decreaseScore() {
|
||||
if (this.currentScore > this.minScore) {
|
||||
// 限制最小值为原始分数-0.050
|
||||
const minAllowed = parseFloat((this.originalScore - 0.050).toFixed(3))
|
||||
if (this.currentScore > minAllowed) {
|
||||
this.currentScore = parseFloat((this.currentScore - 0.001).toFixed(3))
|
||||
}
|
||||
},
|
||||
|
||||
increaseScore() {
|
||||
if (this.currentScore < this.maxScore) {
|
||||
// 限制最大值为原始分数+0.050
|
||||
const maxAllowed = parseFloat((this.originalScore + 0.050).toFixed(3))
|
||||
if (this.currentScore < maxAllowed) {
|
||||
this.currentScore = parseFloat((this.currentScore + 0.001).toFixed(3))
|
||||
}
|
||||
},
|
||||
|
||||
async handleModify() {
|
||||
// 验证评分范围
|
||||
if (this.currentScore < this.minScore || this.currentScore > this.maxScore) {
|
||||
// 验证评分范围(±0.050)
|
||||
const minAllowed = parseFloat((this.originalScore - 0.050).toFixed(3))
|
||||
const maxAllowed = parseFloat((this.originalScore + 0.050).toFixed(3))
|
||||
if (this.currentScore < minAllowed || this.currentScore > maxAllowed) {
|
||||
uni.showToast({
|
||||
title: `评分必须在${this.minScore}-${this.maxScore}分之间`,
|
||||
title: '评分只能在原始分数±0.050范围内',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
@@ -236,12 +320,9 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 修改评分
|
||||
// Mock模式:调用 mock/score.js 的 modifyScore 函数
|
||||
// API模式:调用 api/score.js 的 modifyScore 函数(PUT /api/mini/score/modify)
|
||||
const response = await dataAdapter.getData('modifyScore', {
|
||||
athleteId: this.athleteInfo.athleteId,
|
||||
modifierId: this.modifierId,
|
||||
athleteId: this.athleteInfo.athleteId,
|
||||
modifiedScore: this.currentScore,
|
||||
note: this.note
|
||||
})
|
||||
@@ -420,15 +501,21 @@ export default {
|
||||
}
|
||||
|
||||
.judge-score-item {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 20rpx;
|
||||
background-color: #F5F5F5;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
}
|
||||
|
||||
.judge-name {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.judge-score {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -24,35 +24,36 @@
|
||||
|
||||
<!-- 评分提示 -->
|
||||
<view class="score-tip">
|
||||
点击分数填写或拖动滑块打分(5-10分)
|
||||
直接输入分数或使用加减按钮调整(5-10分)
|
||||
</view>
|
||||
|
||||
<!-- 分数调整 -->
|
||||
<view class="score-control">
|
||||
<view class="control-btn decrease" @click="decreaseScore">
|
||||
<text class="btn-symbol">-</text>
|
||||
<!-- <text class="btn-value">-0.001</text> -->
|
||||
</view>
|
||||
|
||||
<view class="score-display">
|
||||
<text class="current-score">{{ currentScore.toFixed(3) }}</text>
|
||||
<input
|
||||
type="digit"
|
||||
class="score-input-inline"
|
||||
:value="scoreInputValue"
|
||||
@input="onScoreInput"
|
||||
@blur="onScoreBlur"
|
||||
@confirm="onScoreConfirm"
|
||||
placeholder="8.000"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="control-btn increase" @click="increaseScore">
|
||||
<text class="btn-symbol">+</text>
|
||||
<!-- <text class="btn-value">+0.001</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="judge-tip">
|
||||
裁判评分:保留3位小数点,超过上限或下限时,按钮置灰
|
||||
</view> -->
|
||||
|
||||
<!-- 扣分项 -->
|
||||
<view class="deduction-section">
|
||||
<view class="deduction-header">
|
||||
<text class="deduction-label">扣分项:</text>
|
||||
<!-- <text class="deduction-hint">扣分项多选</text> -->
|
||||
</view>
|
||||
|
||||
<view class="deduction-list">
|
||||
@@ -82,12 +83,35 @@
|
||||
v-model="note"
|
||||
maxlength="200"
|
||||
/>
|
||||
<!-- <text class="optional-text">可不填</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="handleSubmit">提交</button>
|
||||
|
||||
<!-- 分数输入弹窗 -->
|
||||
<view v-if="showInputModal" class="modal-overlay" @click="hideScoreInput">
|
||||
<view class="modal-content" @click.stop>
|
||||
<view class="modal-header">
|
||||
<text class="modal-title">输入分数</text>
|
||||
</view>
|
||||
<view class="modal-body">
|
||||
<input
|
||||
type="digit"
|
||||
class="score-input"
|
||||
v-model="inputScore"
|
||||
placeholder="请输入5-10之间的分数"
|
||||
:focus="showInputModal"
|
||||
@confirm="confirmScoreInput"
|
||||
/>
|
||||
<text class="input-hint">分数范围:{{ minScore }} - {{ maxScore }},保留3位小数</text>
|
||||
</view>
|
||||
<view class="modal-footer">
|
||||
<button class="modal-btn cancel" @click="hideScoreInput">取消</button>
|
||||
<button class="modal-btn confirm" @click="confirmScoreInput">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -107,20 +131,28 @@ export default {
|
||||
},
|
||||
judgeId: '',
|
||||
projectId: '',
|
||||
competitionId: '',
|
||||
venueId: '',
|
||||
currentScore: 8.000,
|
||||
note: '',
|
||||
minScore: 5.0,
|
||||
maxScore: 10.0,
|
||||
deductions: []
|
||||
deductions: [],
|
||||
showInputModal: false,
|
||||
inputScore: ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
scoreInputValue() {
|
||||
return this.currentScore.toFixed(3)
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
// 获取全局数据
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 加载当前选手信息(从 score-list 页面传递)
|
||||
const currentAthlete = globalData.currentAthlete || {}
|
||||
this.player = {
|
||||
athleteId: currentAthlete.athleteId || '',
|
||||
@@ -130,49 +162,80 @@ export default {
|
||||
number: currentAthlete.number || ''
|
||||
}
|
||||
|
||||
// 如果选手已评分,加载其原有评分
|
||||
if (currentAthlete.scored && currentAthlete.myScore) {
|
||||
this.currentScore = currentAthlete.myScore
|
||||
}
|
||||
|
||||
// 加载评委ID和项目ID
|
||||
this.judgeId = globalData.judgeId
|
||||
const projects = globalData.projects || []
|
||||
const currentIndex = globalData.currentProjectIndex || 0
|
||||
const currentProject = projects[currentIndex] || {}
|
||||
this.projectId = currentProject.projectId
|
||||
this.projectId = globalData.currentProjectId || ''
|
||||
this.competitionId = globalData.matchId || globalData.matchCode || ''
|
||||
this.venueId = globalData.currentVenueId || globalData.venueId || ''
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('评分详情页加载:', {
|
||||
athlete: this.player,
|
||||
judgeId: this.judgeId,
|
||||
projectId: this.projectId,
|
||||
competitionId: this.competitionId,
|
||||
venueId: this.venueId,
|
||||
initialScore: this.currentScore
|
||||
})
|
||||
}
|
||||
|
||||
// 加载扣分项列表
|
||||
await this.loadDeductions()
|
||||
},
|
||||
|
||||
methods: {
|
||||
onScoreInput(e) {
|
||||
// Allow typing, validation happens on blur
|
||||
},
|
||||
|
||||
onScoreBlur(e) {
|
||||
this.validateAndSetScore(e.detail.value)
|
||||
},
|
||||
|
||||
onScoreConfirm(e) {
|
||||
this.validateAndSetScore(e.detail.value)
|
||||
},
|
||||
|
||||
validateAndSetScore(value) {
|
||||
const score = parseFloat(value)
|
||||
|
||||
if (isNaN(score)) {
|
||||
uni.showToast({
|
||||
title: '请输入有效的数字',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (score < this.minScore || score > this.maxScore) {
|
||||
uni.showToast({
|
||||
title: '分数必须在' + this.minScore + '-' + this.maxScore + '之间',
|
||||
icon: 'none'
|
||||
})
|
||||
// Reset to valid range
|
||||
this.currentScore = Math.max(this.minScore, Math.min(this.maxScore, score))
|
||||
return
|
||||
}
|
||||
|
||||
this.currentScore = parseFloat(score.toFixed(3))
|
||||
},
|
||||
|
||||
async loadDeductions() {
|
||||
try {
|
||||
// 🔥 关键改动:使用 dataAdapter 获取扣分项列表
|
||||
// Mock模式:调用 mock/score.js 的 getDeductions 函数
|
||||
// API模式:调用 api/score.js 的 getDeductions 函数(GET /martial/deductionItem/list)
|
||||
const response = await dataAdapter.getData('getDeductions', {
|
||||
projectId: this.projectId
|
||||
})
|
||||
|
||||
// 为每个扣分项添加 checked 状态
|
||||
this.deductions = (response.data || []).map(item => ({
|
||||
...item,
|
||||
const records = response.data && response.data.records ? response.data.records : []
|
||||
this.deductions = records.map(item => ({
|
||||
deductionId: item.id,
|
||||
deductionName: item.itemName,
|
||||
deductionScore: parseFloat(item.deductionPoint || 0),
|
||||
checked: false
|
||||
}))
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('扣分项加载成功:', this.deductions)
|
||||
}
|
||||
@@ -187,7 +250,19 @@ export default {
|
||||
},
|
||||
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
if (config.debug) {
|
||||
console.log('返回上一页')
|
||||
}
|
||||
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail: (err) => {
|
||||
console.error('返回失败:', err)
|
||||
uni.redirectTo({
|
||||
url: '/pages/score-list/score-list'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
decreaseScore() {
|
||||
@@ -202,12 +277,44 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
showScoreInput() {
|
||||
this.inputScore = this.currentScore.toFixed(3)
|
||||
this.showInputModal = true
|
||||
},
|
||||
|
||||
hideScoreInput() {
|
||||
this.showInputModal = false
|
||||
this.inputScore = ''
|
||||
},
|
||||
|
||||
confirmScoreInput() {
|
||||
const score = parseFloat(this.inputScore)
|
||||
|
||||
if (isNaN(score)) {
|
||||
uni.showToast({
|
||||
title: '请输入有效的数字',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (score < this.minScore || score > this.maxScore) {
|
||||
uni.showToast({
|
||||
title: `分数必须在${this.minScore}-${this.maxScore}之间`,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.currentScore = parseFloat(score.toFixed(3))
|
||||
this.hideScoreInput()
|
||||
},
|
||||
|
||||
toggleDeduction(index) {
|
||||
this.deductions[index].checked = !this.deductions[index].checked
|
||||
},
|
||||
|
||||
async handleSubmit() {
|
||||
// 验证评分范围
|
||||
if (this.currentScore < this.minScore || this.currentScore > this.maxScore) {
|
||||
uni.showToast({
|
||||
title: `评分必须在${this.minScore}-${this.maxScore}分之间`,
|
||||
@@ -216,7 +323,22 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 收集选中的扣分项ID
|
||||
if (!this.competitionId) {
|
||||
uni.showToast({
|
||||
title: '缺少比赛ID,请重新登录',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.projectId) {
|
||||
uni.showToast({
|
||||
title: '缺少项目ID,请返回重新选择',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const selectedDeductions = this.deductions
|
||||
.filter(item => item.checked)
|
||||
.map(item => item.deductionId)
|
||||
@@ -227,20 +349,25 @@ export default {
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 提交评分
|
||||
// Mock模式:调用 mock/score.js 的 submitScore 函数
|
||||
// API模式:调用 api/score.js 的 submitScore 函数(POST /martial/score/submit)
|
||||
const response = await dataAdapter.getData('submitScore', {
|
||||
const submitData = {
|
||||
athleteId: this.player.athleteId,
|
||||
judgeId: this.judgeId,
|
||||
projectId: this.projectId,
|
||||
competitionId: this.competitionId,
|
||||
venueId: this.venueId,
|
||||
score: this.currentScore,
|
||||
deductions: selectedDeductions,
|
||||
note: this.note
|
||||
})
|
||||
}
|
||||
|
||||
if (config.debug) {
|
||||
console.log('准备提交评分数据:', submitData)
|
||||
}
|
||||
|
||||
const response = await dataAdapter.getData('submitScore', submitData)
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('评分提交成功:', {
|
||||
athleteId: this.player.athleteId,
|
||||
@@ -250,14 +377,12 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
// 显示成功提示
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
// 返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
@@ -297,12 +422,19 @@ export default {
|
||||
|
||||
.nav-left {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 120rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nav-left:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
@@ -431,12 +563,26 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10rpx;
|
||||
border-radius: 16rpx;
|
||||
min-width: 240rpx;
|
||||
}
|
||||
|
||||
.current-score {
|
||||
font-size: 80rpx;
|
||||
.score-input-inline {
|
||||
width: 200rpx;
|
||||
height: 100rpx;
|
||||
font-size: 64rpx;
|
||||
font-weight: 600;
|
||||
color: #1B7C5E;
|
||||
text-align: center;
|
||||
border: 2rpx solid #E0E0E0;
|
||||
border-radius: 12rpx;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.score-input-inline:focus {
|
||||
border-color: #1B7C5E;
|
||||
}
|
||||
|
||||
.judge-tip {
|
||||
@@ -574,4 +720,95 @@ export default {
|
||||
.submit-btn:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* 分数输入弹窗 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
width: 600rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 20rpx 30rpx 30rpx;
|
||||
}
|
||||
|
||||
.score-input {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
border: 2rpx solid #E0E0E0;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.score-input:focus {
|
||||
border-color: #1B7C5E;
|
||||
}
|
||||
|
||||
.input-hint {
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #E0E0E0;
|
||||
}
|
||||
|
||||
.modal-btn {
|
||||
flex: 1;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.modal-btn.cancel {
|
||||
color: #666666;
|
||||
border-right: 1rpx solid #E0E0E0;
|
||||
}
|
||||
|
||||
.modal-btn.confirm {
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.modal-btn:active {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,57 +4,45 @@
|
||||
<view class="nav-bar">
|
||||
<view class="nav-title">评分系统</view>
|
||||
<view class="nav-right">
|
||||
<view class="icon-menu">···</view>
|
||||
<view class="icon-close">⊗</view>
|
||||
<view class="nav-dots">···</view>
|
||||
<view class="nav-circle">◎</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 比赛信息 -->
|
||||
<view class="match-info">
|
||||
<view class="match-title">{{ matchInfo.name }}</view>
|
||||
<view class="match-time">比赛时间:{{ matchInfo.time }}</view>
|
||||
<view class="match-time">比赛时间:{{ formatDateTime(matchInfo.time) }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 场地和项目选择 -->
|
||||
<view class="venue-section">
|
||||
<!-- 场地切换 - 横向滚动 -->
|
||||
<scroll-view class="venue-scroll" scroll-x="true" show-scrollbar="false">
|
||||
<view class="venue-tabs">
|
||||
<view
|
||||
v-for="venue in venues"
|
||||
:key="venue.venueId"
|
||||
:class="['venue-tab', currentVenue === venue.venueId ? 'active' : '']"
|
||||
@click="switchVenue(venue.venueId)"
|
||||
>
|
||||
{{ venue.venueName }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="venue-tip">
|
||||
<!-- <text class="tip-bold">裁判长可看见所有场地和项目</text> -->
|
||||
<!-- <text class="tip-normal">(场地和项目可动态全部),可以点击切换</text> -->
|
||||
<!-- 场地和项目卡片 -->
|
||||
<view class="venue-card">
|
||||
<!-- 场地标题行 -->
|
||||
<view class="venue-header">
|
||||
<view class="venue-name">{{ venueInfo.name }}</view>
|
||||
<view class="refresh-link" @click="handleRefresh">刷新</view>
|
||||
</view>
|
||||
|
||||
<!-- 项目选择 - 横向滚动 -->
|
||||
<scroll-view class="project-scroll" scroll-x="true" show-scrollbar="false">
|
||||
<view class="project-list">
|
||||
<!-- 项目筛选 -->
|
||||
<view class="project-row">
|
||||
<view class="project-grid">
|
||||
<view
|
||||
class="project-chip"
|
||||
:class="{ active: index === currentProjectIndex }"
|
||||
v-for="(project, index) in projects"
|
||||
:key="project.projectId"
|
||||
:class="['project-btn', currentProject === project.projectId ? 'active' : '']"
|
||||
@click="switchProject(project.projectId)"
|
||||
@click="switchProject(index)"
|
||||
>
|
||||
{{ project.projectName }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 已评分统计 -->
|
||||
<view class="score-stats">
|
||||
<text class="stats-text">已评分:</text>
|
||||
<text class="stats-number">{{ scoredCount }}/{{ totalCount }}</text>
|
||||
<text class="stats-label">已评分:</text>
|
||||
<text class="stats-value">{{ scoredCount }}/{{ totalCount }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 选手列表 -->
|
||||
@@ -65,25 +53,42 @@
|
||||
v-for="player in players"
|
||||
:key="player.athleteId"
|
||||
>
|
||||
<view class="player-header">
|
||||
<view class="card-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
|
||||
<!-- 已评分:显示总分和修改按钮 -->
|
||||
<view class="action-area" v-if="player.totalScore">
|
||||
<text class="total-score">总分:{{ player.totalScore }}</text>
|
||||
<view class="chief-actions">
|
||||
<!-- <text class="chief-hint">裁判长功能:修改评分、修改按钮需等总分出来才出现</text> -->
|
||||
<button class="modify-btn" @click="goToModify(player)">修改</button>
|
||||
<view class="score-tag">
|
||||
<text class="tag-label">总分:</text>
|
||||
<text class="tag-value">{{ formatScore(player.totalScore) }}</text>
|
||||
</view>
|
||||
<button class="modify-btn" @click="goToModify(player)">修改</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="player-info">
|
||||
<view class="info-item">身份证:{{ player.idCard }}</view>
|
||||
<view class="info-item">队伍:{{ player.team }}</view>
|
||||
<view class="info-item">编号:{{ player.number }}</view>
|
||||
<view class="player-details">
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">身份证:{{ player.idCard }}</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">队伍:{{ player.team }}</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">编号:{{ player.number }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view class="loading-status" v-if="players.length > 0">
|
||||
<view v-if="isLoading" class="loading-text">加载中...</view>
|
||||
<view v-else-if="!hasMore" class="no-more-text">— 没有更多了 —</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="!isLoading && players.length === 0">
|
||||
<text class="empty-text">暂无选手数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -96,190 +101,254 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
matchInfo: {
|
||||
id: '',
|
||||
name: '',
|
||||
time: ''
|
||||
},
|
||||
competitionId: '',
|
||||
currentVenue: '',
|
||||
currentProject: '',
|
||||
venues: [],
|
||||
venueInfo: {
|
||||
id: '',
|
||||
name: ''
|
||||
},
|
||||
projectInfo: {
|
||||
id: '',
|
||||
name: ''
|
||||
},
|
||||
judgeId: '',
|
||||
projects: [],
|
||||
currentProjectIndex: 0,
|
||||
players: [],
|
||||
scoredCount: 0,
|
||||
totalCount: 0
|
||||
totalCount: 0,
|
||||
pagination: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
total: 0
|
||||
},
|
||||
isLoading: false,
|
||||
hasMore: true,
|
||||
isFirstLoad: true
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
// 获取全局数据
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 加载比赛信息
|
||||
this.matchInfo = {
|
||||
id: globalData.matchId,
|
||||
name: globalData.matchName || '比赛名称',
|
||||
time: globalData.matchTime || '比赛时间'
|
||||
// 检查登录状态
|
||||
if (!globalData.judgeId || !globalData.token) {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
// 注意:裁判长没有固定场地和项目,需要查看所有
|
||||
this.competitionId = globalData.matchId
|
||||
// 检查是否是主裁判
|
||||
if (globalData.userRole !== 'admin') {
|
||||
console.warn('非主裁判用户,跳转到普通评分页')
|
||||
uni.reLaunch({
|
||||
url: '/pages/score-list/score-list'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 加载比赛信息
|
||||
this.matchInfo = {
|
||||
name: globalData.matchName || '比赛名称',
|
||||
time: globalData.matchTime || ''
|
||||
}
|
||||
|
||||
// 从 globalData 获取场地信息(与裁判员相同)
|
||||
this.venueInfo = {
|
||||
id: globalData.venueId,
|
||||
name: globalData.venueName || '场地'
|
||||
}
|
||||
|
||||
// 从 globalData 获取项目列表
|
||||
this.projects = globalData.projects || []
|
||||
this.currentProjectIndex = globalData.currentProjectIndex || 0
|
||||
this.updateCurrentProject()
|
||||
this.judgeId = globalData.judgeId
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('裁判长列表页加载:', {
|
||||
console.log('主裁判列表页加载:', {
|
||||
userRole: globalData.userRole,
|
||||
competitionId: this.competitionId
|
||||
judgeId: this.judgeId,
|
||||
venueId: this.venueInfo.id,
|
||||
projectId: this.projectInfo.id
|
||||
})
|
||||
}
|
||||
|
||||
// 加载场地和项目列表
|
||||
await this.loadVenuesAndProjects()
|
||||
await this.loadPlayers(true)
|
||||
this.isFirstLoad = false
|
||||
},
|
||||
|
||||
async onShow() {
|
||||
// 从修改评分页返回时刷新数据
|
||||
if (!this.isFirstLoad) {
|
||||
if (config.debug) {
|
||||
console.log('页面显示,刷新数据')
|
||||
}
|
||||
await this.loadPlayers(true)
|
||||
}
|
||||
},
|
||||
|
||||
async onPullDownRefresh() {
|
||||
await this.loadPlayers(true)
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
|
||||
async onReachBottom() {
|
||||
if (this.hasMore && !this.isLoading) {
|
||||
await this.loadMore()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async loadVenuesAndProjects() {
|
||||
formatDateTime(dateTimeStr) {
|
||||
if (!dateTimeStr) return ''
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取场地列表
|
||||
// Mock模式:调用 mock/athlete.js 的 getVenues 函数
|
||||
// API模式:调用 api/athlete.js 的 getVenues 函数(GET /martial/venue/list)
|
||||
const venuesRes = await dataAdapter.getData('getVenues', {
|
||||
competitionId: this.competitionId
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取项目列表
|
||||
// Mock模式:调用 mock/athlete.js 的 getProjects 函数
|
||||
// API模式:调用 api/athlete.js 的 getProjects 函数(GET /martial/project/list)
|
||||
const projectsRes = await dataAdapter.getData('getProjects', {
|
||||
competitionId: this.competitionId
|
||||
})
|
||||
|
||||
this.venues = venuesRes.data || []
|
||||
this.projects = projectsRes.data || []
|
||||
|
||||
// 默认选中第一个场地和项目
|
||||
if (this.venues.length > 0) {
|
||||
this.currentVenue = this.venues[0].venueId
|
||||
}
|
||||
if (this.projects.length > 0) {
|
||||
this.currentProject = this.projects[0].projectId
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('场地和项目加载成功:', {
|
||||
venues: this.venues.length,
|
||||
projects: this.projects.length,
|
||||
currentVenue: this.currentVenue,
|
||||
currentProject: this.currentProject
|
||||
})
|
||||
}
|
||||
|
||||
// 加载选手列表
|
||||
if (this.currentVenue && this.currentProject) {
|
||||
await this.loadPlayers()
|
||||
}
|
||||
|
||||
const date = new Date(dateTimeStr)
|
||||
if (isNaN(date.getTime())) return dateTimeStr
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hours = date.getHours()
|
||||
const minutes = date.getMinutes()
|
||||
const paddedMinutes = minutes < 10 ? '0' + minutes : minutes
|
||||
return year + '年' + month + '月' + day + '日 ' + hours + ':' + paddedMinutes
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
console.error('加载场地和项目失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
return dateTimeStr
|
||||
}
|
||||
},
|
||||
|
||||
async loadPlayers() {
|
||||
formatScore(score) {
|
||||
// 处理 null、undefined、-1 等无效值
|
||||
if (score === null || score === undefined || score === -1 || score === '-1') {
|
||||
return '--'
|
||||
}
|
||||
// 如果是字符串类型的数字,直接返回
|
||||
if (typeof score === 'string' && !isNaN(parseFloat(score))) {
|
||||
return score
|
||||
}
|
||||
// 如果是数字类型,保留3位小数
|
||||
if (typeof score === 'number') {
|
||||
return score.toFixed(3)
|
||||
}
|
||||
return score
|
||||
},
|
||||
|
||||
async handleRefresh() {
|
||||
if (this.isLoading) return
|
||||
uni.showToast({ title: '刷新中...', icon: 'loading', duration: 1000 })
|
||||
await this.loadPlayers(true)
|
||||
uni.showToast({ title: '刷新成功', icon: 'success', duration: 1000 })
|
||||
},
|
||||
|
||||
async loadPlayers(refresh = false) {
|
||||
if (this.isLoading) return
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
this.isLoading = true
|
||||
if (refresh) {
|
||||
this.pagination.current = 1
|
||||
this.hasMore = true
|
||||
}
|
||||
if (refresh && this.isFirstLoad) {
|
||||
uni.showLoading({ title: '加载中...', mask: true })
|
||||
}
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
const params = {
|
||||
matchCode: globalData.matchCode,
|
||||
judgeId: this.judgeId,
|
||||
venueId: this.venueInfo.id,
|
||||
projectId: this.projectInfo.id,
|
||||
current: this.pagination.current,
|
||||
size: this.pagination.size
|
||||
}
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === undefined || params[key] === null || params[key] === '') {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取选手列表(裁判长视图)
|
||||
// Mock模式:调用 mock/athlete.js 的 getAthletesForAdmin 函数
|
||||
// API模式:调用 api/athlete.js 的 getAthletesForAdmin 函数(GET /api/mini/athletes/admin)
|
||||
const response = await dataAdapter.getData('getAthletesForAdmin', {
|
||||
competitionId: this.competitionId,
|
||||
venueId: this.currentVenue,
|
||||
projectId: this.currentProject
|
||||
})
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 保存选手列表
|
||||
this.players = response.data || []
|
||||
|
||||
// 计算评分统计(裁判长视图:统计有总分的选手)
|
||||
this.totalCount = this.players.length
|
||||
this.scoredCount = this.players.filter(p => p.totalScore).length
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('选手列表加载成功:', {
|
||||
venueId: this.currentVenue,
|
||||
projectId: this.currentProject,
|
||||
total: this.totalCount,
|
||||
console.log('请求选手列表参数:', params)
|
||||
}
|
||||
|
||||
// 主裁判使用 getAthletesForAdmin 接口
|
||||
const response = await dataAdapter.getData('getAthletesForAdmin', params)
|
||||
|
||||
if (config.debug) {
|
||||
console.log('选手列表响应:', response)
|
||||
}
|
||||
|
||||
if (refresh && this.isFirstLoad) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
const responseData = response.data || {}
|
||||
const records = responseData.records || response.data || []
|
||||
const total = responseData.total || records.length
|
||||
this.pagination.total = total
|
||||
this.totalCount = total
|
||||
if (refresh) {
|
||||
this.players = records
|
||||
} else {
|
||||
this.players = [...this.players, ...records]
|
||||
}
|
||||
// 主裁判视图:统计有总分的选手
|
||||
this.scoredCount = this.players.filter(p => p.totalScore).length
|
||||
this.hasMore = this.players.length < total
|
||||
|
||||
if (config.debug) {
|
||||
console.log('选手列表处理结果:', {
|
||||
total: total,
|
||||
loaded: this.players.length,
|
||||
scored: this.scoredCount,
|
||||
players: this.players
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
console.error('加载选手列表失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.showToast({ title: error.message || '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
async switchVenue(venueId) {
|
||||
if (this.currentVenue === venueId) return
|
||||
|
||||
this.currentVenue = venueId
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('切换场地:', venueId)
|
||||
}
|
||||
|
||||
// 重新加载选手列表
|
||||
await this.loadPlayers()
|
||||
},
|
||||
|
||||
async switchProject(projectId) {
|
||||
if (this.currentProject === projectId) return
|
||||
|
||||
this.currentProject = projectId
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('切换项目:', projectId)
|
||||
}
|
||||
|
||||
// 重新加载选手列表
|
||||
await this.loadPlayers()
|
||||
async loadMore() {
|
||||
if (!this.hasMore || this.isLoading) return
|
||||
this.pagination.current++
|
||||
await this.loadPlayers(false)
|
||||
},
|
||||
|
||||
goToModify(player) {
|
||||
// 保存当前选手信息到全局数据
|
||||
const app = getApp()
|
||||
app.globalData.currentAthlete = player
|
||||
app.globalData.currentProjectId = this.projectInfo.id
|
||||
uni.navigateTo({ url: '/pages/modify-score/modify-score' })
|
||||
},
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/modify-score/modify-score'
|
||||
})
|
||||
updateCurrentProject() {
|
||||
const currentProject = this.projects[this.currentProjectIndex] || {}
|
||||
this.projectInfo = {
|
||||
id: currentProject.projectId,
|
||||
name: currentProject.projectName || '项目'
|
||||
}
|
||||
},
|
||||
|
||||
async switchProject(index) {
|
||||
if (index === this.currentProjectIndex) return
|
||||
this.currentProjectIndex = index
|
||||
const app = getApp()
|
||||
app.globalData.currentProjectIndex = index
|
||||
this.updateCurrentProject()
|
||||
await this.loadPlayers(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +361,7 @@ export default {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
/* ==================== 导航栏 ==================== */
|
||||
.nav-bar {
|
||||
height: 90rpx;
|
||||
background: linear-gradient(135deg, #1B7C5E 0%, #2A9D7E 100%);
|
||||
@@ -307,7 +376,6 @@ export default {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
|
||||
.nav-right {
|
||||
@@ -315,24 +383,15 @@ export default {
|
||||
right: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 30rpx;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.icon-menu,
|
||||
.icon-close {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.nav-dots, .nav-circle {
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 比赛信息 */
|
||||
/* ==================== 比赛信息 ==================== */
|
||||
.match-info {
|
||||
padding: 30rpx;
|
||||
background-color: #F5F5F5;
|
||||
@@ -341,132 +400,94 @@ export default {
|
||||
.match-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
margin-bottom: 10rpx;
|
||||
color: #1B7C5E;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.match-time {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/* 场地和项目区域 */
|
||||
.venue-section {
|
||||
/* ==================== 场地卡片 ==================== */
|
||||
.venue-card {
|
||||
margin: 0 30rpx 20rpx;
|
||||
background-color: #FFFFFF;
|
||||
margin: 20rpx 30rpx;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
/* 场地滚动容器 */
|
||||
.venue-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 20rpx;
|
||||
.venue-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 24rpx;
|
||||
border-bottom: 4rpx solid #1B7C5E;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.venue-tabs {
|
||||
display: inline-flex;
|
||||
gap: 30rpx;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 4rpx solid #E0E0E0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.venue-tab {
|
||||
.venue-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
padding: 0 20rpx;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.venue-tab.active {
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.venue-tab.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -24rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 4rpx;
|
||||
background-color: #1B7C5E;
|
||||
.refresh-link {
|
||||
font-size: 26rpx;
|
||||
color: #4A90D9;
|
||||
}
|
||||
|
||||
.venue-tip {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 20rpx;
|
||||
.project-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tip-bold {
|
||||
color: #FF4D6A;
|
||||
font-weight: 500;
|
||||
.project-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.tip-normal {
|
||||
color: #FF4D6A;
|
||||
}
|
||||
|
||||
/* 项目滚动容器 */
|
||||
.project-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-list {
|
||||
display: inline-flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.project-btn {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
border: 2rpx solid #CCCCCC;
|
||||
.project-chip {
|
||||
padding: 20rpx 12rpx;
|
||||
border: 2rpx solid #1B7C5E;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
color: #1B7C5E;
|
||||
background-color: #FFFFFF;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.project-btn.active {
|
||||
.project-chip.active {
|
||||
background-color: #1B7C5E;
|
||||
color: #FFFFFF;
|
||||
border-color: #1B7C5E;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 评分统计 */
|
||||
/* ==================== 评分统计 ==================== */
|
||||
.score-stats {
|
||||
padding: 20rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.stats-label {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.stats-text {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.stats-number {
|
||||
.stats-value {
|
||||
font-size: 32rpx;
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
/* 选手列表 */
|
||||
/* ==================== 选手卡片 ==================== */
|
||||
.player-list {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
@@ -474,12 +495,12 @@ export default {
|
||||
.player-card {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.player-header {
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
@@ -492,32 +513,31 @@ export default {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/* ==================== 操作区域 ==================== */
|
||||
.action-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 10rpx;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.total-score {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.chief-actions {
|
||||
.score-tag {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 10rpx;
|
||||
align-items: center;
|
||||
padding: 12rpx 20rpx;
|
||||
background-color: #F5F5F5;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
}
|
||||
|
||||
.chief-hint {
|
||||
font-size: 22rpx;
|
||||
color: #FF4D6A;
|
||||
text-align: right;
|
||||
line-height: 1.5;
|
||||
max-width: 400rpx;
|
||||
.tag-label {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.tag-value {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.modify-btn {
|
||||
@@ -527,21 +547,50 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.modify-btn:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.player-info {
|
||||
/* ==================== 选手详情 ==================== */
|
||||
.player-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
.detail-row {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.detail-text {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* ==================== 加载状态 ==================== */
|
||||
.loading-status {
|
||||
padding: 30rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 26rpx;
|
||||
color: #1B7C5E;
|
||||
}
|
||||
|
||||
.no-more-text {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
/* ==================== 空状态 ==================== */
|
||||
.empty-state {
|
||||
padding: 100rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,75 +4,113 @@
|
||||
<view class="nav-bar">
|
||||
<view class="nav-title">评分系统</view>
|
||||
<view class="nav-right">
|
||||
<view class="icon-menu">···</view>
|
||||
<view class="icon-close">⊗</view>
|
||||
<view class="logout-btn" @click="handleLogout">退出</view>
|
||||
<view class="nav-dots">···</view>
|
||||
<view class="nav-circle">◎</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 比赛信息 -->
|
||||
<view class="match-info">
|
||||
<view class="match-title">{{ matchInfo.name }}</view>
|
||||
<view class="match-time">比赛时间:{{ matchInfo.time }}</view>
|
||||
<view class="match-time">比赛时间:{{ formatDateTime(matchInfo.time) }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 场地和项目选择 -->
|
||||
<view class="venue-section">
|
||||
<!-- 场地和项目卡片 -->
|
||||
<view class="venue-card">
|
||||
<!-- 场地标题行 -->
|
||||
<view class="venue-header">
|
||||
<view class="venue-tab active">{{ venueInfo.name }}</view>
|
||||
<view class="venue-name">{{ venueInfo.name }}</view>
|
||||
<view class="refresh-link" @click="handleRefresh">刷新</view>
|
||||
</view>
|
||||
|
||||
<view class="project-section">
|
||||
<view
|
||||
class="project-btn"
|
||||
:class="{ active: index === currentProjectIndex }"
|
||||
v-for="(project, index) in projects"
|
||||
:key="project.projectId"
|
||||
@click="switchProject(index)"
|
||||
>
|
||||
{{ project.projectName }}
|
||||
<!-- 项目筛选 - 横向滑动 -->
|
||||
<scroll-view class="project-scroll" scroll-x="true" :show-scrollbar="false">
|
||||
<view class="project-row">
|
||||
<view
|
||||
class="project-chip"
|
||||
:class="{ active: index === currentProjectIndex }"
|
||||
v-for="(project, index) in projects"
|
||||
:key="project.projectId"
|
||||
@click="switchProject(index)"
|
||||
>
|
||||
{{ project.projectName }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="no-project-tip" v-if="projects.length === 0">当前场地暂无比赛项目</view>
|
||||
</view>
|
||||
|
||||
<!-- 已评分统计 -->
|
||||
<!-- 评分统计 -->
|
||||
<view class="score-stats">
|
||||
<text class="stats-text">已评分:</text>
|
||||
<text class="stats-number">{{ scoredCount }}/{{ totalCount }}</text>
|
||||
<text class="stats-label">已评分:</text>
|
||||
<text class="stats-value">{{ scoredCount }}/{{ totalCount }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 选手列表 -->
|
||||
<view class="player-list">
|
||||
<!-- 遍历选手列表 -->
|
||||
<view class="player-list" v-if="projects.length > 0">
|
||||
<!-- 选手卡片 -->
|
||||
<view
|
||||
class="player-card"
|
||||
v-for="player in players"
|
||||
:key="player.athleteId"
|
||||
>
|
||||
<view class="player-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
|
||||
<!-- 已评分:显示我的评分和总分 -->
|
||||
<view class="player-scores" v-if="player.scored">
|
||||
<text class="my-score">我的评分:{{ player.myScore }}</text>
|
||||
<text class="total-score">总分:{{ player.totalScore }}</text>
|
||||
<!-- 已评分状态 -->
|
||||
<template v-if="player.scored">
|
||||
<view class="card-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
<view class="score-tags">
|
||||
<view class="score-tag">
|
||||
<text class="tag-label">我的评分:</text>
|
||||
<text class="tag-value">{{ player.myScore }}</text>
|
||||
</view>
|
||||
<!-- 总分:只有所有裁判都评分完成后才显示 -->
|
||||
<view class="score-tag" v-if="player.scoringComplete">
|
||||
<text class="tag-label">总分:</text>
|
||||
<text class="tag-value">{{ formatScore(player.totalScore) }}</text>
|
||||
</view>
|
||||
<view class="score-tag waiting" v-else>
|
||||
<text class="tag-label">总分:</text>
|
||||
<text class="tag-value">评分中({{ player.scoredJudgeCount || 0 }}/{{ player.requiredJudgeCount || "?" }})</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 未评分:显示评分按钮 -->
|
||||
<button
|
||||
class="score-btn"
|
||||
v-else
|
||||
@click="goToScoreDetail(player)"
|
||||
>
|
||||
评分
|
||||
</button>
|
||||
</view>
|
||||
<!-- 未评分状态 -->
|
||||
<template v-else>
|
||||
<view class="card-header">
|
||||
<view class="player-name">{{ player.name }}</view>
|
||||
<view class="action-row">
|
||||
<button class="score-btn" @click="goToScoreDetail(player)">评分</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="player-info">
|
||||
<view class="info-item">身份证:{{ player.idCard }}</view>
|
||||
<view class="info-item">队伍:{{ player.team }}</view>
|
||||
<view class="info-item">编号:{{ player.number }}</view>
|
||||
<!-- 选手详细信息 -->
|
||||
<view class="player-details">
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">身份证:{{ player.idCard }}</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">队伍:{{ player.team }}</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="detail-text">编号:{{ player.number }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view class="loading-status" v-if="players.length > 0">
|
||||
<view v-if="isLoading" class="loading-text">加载中...</view>
|
||||
<view v-else-if="!hasMore" class="no-more-text">— 没有更多了 —</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="!isLoading && players.length === 0">
|
||||
<text class="empty-text">暂无选手数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -97,137 +135,271 @@ export default {
|
||||
name: ''
|
||||
},
|
||||
judgeId: '',
|
||||
projects: [], // 所有分配的项目列表
|
||||
currentProjectIndex: 0, // 当前选中的项目索引
|
||||
projects: [],
|
||||
currentProjectIndex: 0,
|
||||
players: [],
|
||||
scoredCount: 0,
|
||||
totalCount: 0
|
||||
totalCount: 0,
|
||||
pagination: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
total: 0
|
||||
},
|
||||
isLoading: false,
|
||||
hasMore: true,
|
||||
isFirstLoad: true
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
// 获取全局数据
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
// 加载比赛信息
|
||||
if (!globalData.judgeId || !globalData.token) {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
this.matchInfo = {
|
||||
name: globalData.matchName || '比赛名称',
|
||||
time: globalData.matchTime || '比赛时间'
|
||||
time: globalData.matchTime || ''
|
||||
}
|
||||
|
||||
// 加载场地信息
|
||||
this.venueInfo = {
|
||||
id: globalData.venueId,
|
||||
name: globalData.venueName || '场地'
|
||||
name: globalData.venueName || '第一场地'
|
||||
}
|
||||
|
||||
// 加载项目列表
|
||||
this.projects = globalData.projects || []
|
||||
this.currentProjectIndex = globalData.currentProjectIndex || 0
|
||||
|
||||
// 设置当前项目信息
|
||||
this.updateCurrentProject()
|
||||
|
||||
this.judgeId = globalData.judgeId
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('评分列表页加载:', {
|
||||
judgeId: this.judgeId,
|
||||
venueId: this.venueInfo.id,
|
||||
projectId: this.projectInfo.id,
|
||||
projectsCount: this.projects.length
|
||||
projectId: this.projectInfo.id
|
||||
})
|
||||
}
|
||||
|
||||
// 加载选手列表
|
||||
await this.loadPlayers()
|
||||
await this.loadPlayers(true)
|
||||
this.isFirstLoad = false
|
||||
},
|
||||
|
||||
async onShow() {
|
||||
if (!this.isFirstLoad) {
|
||||
if (config.debug) {
|
||||
console.log('页面显示,刷新数据')
|
||||
}
|
||||
await this.loadPlayers(true)
|
||||
}
|
||||
},
|
||||
|
||||
async onPullDownRefresh() {
|
||||
await this.loadPlayers(true)
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
|
||||
async onReachBottom() {
|
||||
if (this.hasMore && !this.isLoading) {
|
||||
await this.loadMore()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async loadPlayers() {
|
||||
formatDateTime(dateTimeStr) {
|
||||
if (!dateTimeStr) return ''
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
const date = new Date(dateTimeStr)
|
||||
if (isNaN(date.getTime())) return dateTimeStr
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hours = date.getHours()
|
||||
const minutes = date.getMinutes()
|
||||
const paddedMinutes = minutes < 10 ? '0' + minutes : minutes
|
||||
return year + '年' + month + '月' + day + '日 ' + hours + ':' + paddedMinutes
|
||||
} catch (error) {
|
||||
return dateTimeStr
|
||||
}
|
||||
},
|
||||
|
||||
// 🔥 关键改动:使用 dataAdapter 获取选手列表
|
||||
// Mock模式:调用 mock/athlete.js 的 getMyAthletes 函数
|
||||
// API模式:调用 api/athlete.js 的 getMyAthletes 函数(GET /api/mini/athletes)
|
||||
formatScore(score) {
|
||||
if (score === null || score === undefined || score === -1 || score === '-1') {
|
||||
return '--'
|
||||
}
|
||||
if (typeof score === 'string' && !isNaN(parseFloat(score))) {
|
||||
return score
|
||||
}
|
||||
if (typeof score === 'number') {
|
||||
return score.toFixed(3)
|
||||
}
|
||||
return score
|
||||
},
|
||||
|
||||
// 构建请求参数
|
||||
// 优先使用 matchCode(比赛编码),这样后端可以根据邀请码关联查询
|
||||
calculateTotalScore(player) {
|
||||
if (!player.judgeScores || !Array.isArray(player.judgeScores)) {
|
||||
return null
|
||||
}
|
||||
|
||||
const totalJudges = player.totalJudges || 0
|
||||
const scoredCount = player.judgeScores.length
|
||||
|
||||
if (totalJudges === 0 || scoredCount < totalJudges) {
|
||||
return null
|
||||
}
|
||||
|
||||
const scores = player.judgeScores.map(j => parseFloat(j.score)).filter(s => !isNaN(s))
|
||||
|
||||
if (scores.length < 3) {
|
||||
if (scores.length === 0) return null
|
||||
const sum = scores.reduce((a, b) => a + b, 0)
|
||||
return sum / scores.length
|
||||
}
|
||||
|
||||
scores.sort((a, b) => a - b)
|
||||
const trimmedScores = scores.slice(1, -1)
|
||||
const sum = trimmedScores.reduce((a, b) => a + b, 0)
|
||||
const average = sum / trimmedScores.length
|
||||
|
||||
return average
|
||||
},
|
||||
|
||||
isAllJudgesScored(player) {
|
||||
if (!player.judgeScores || !Array.isArray(player.judgeScores)) {
|
||||
return false
|
||||
}
|
||||
const totalJudges = player.totalJudges || 0
|
||||
return totalJudges > 0 && player.judgeScores.length >= totalJudges
|
||||
},
|
||||
|
||||
getDisplayTotalScore(player) {
|
||||
const score = this.calculateTotalScore(player)
|
||||
if (score === null) {
|
||||
return '--'
|
||||
}
|
||||
return score.toFixed(3)
|
||||
},
|
||||
|
||||
getJudgeProgress(player) {
|
||||
const scored = player.judgeScores ? player.judgeScores.length : 0
|
||||
const total = player.totalJudges || '?'
|
||||
return scored + '/' + total
|
||||
},
|
||||
|
||||
handleLogout() {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要退出登录吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.removeStorageSync("judgeInfo")
|
||||
uni.removeStorageSync("token")
|
||||
uni.reLaunch({ url: "/pages/login/login" })
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async handleRefresh() {
|
||||
if (this.isLoading) return
|
||||
uni.showToast({ title: '刷新中...', icon: 'loading', duration: 1000 })
|
||||
await this.loadPlayers(true)
|
||||
uni.showToast({ title: '刷新成功', icon: 'success', duration: 1000 })
|
||||
},
|
||||
|
||||
async loadPlayers(refresh = false) {
|
||||
if (this.isLoading) return
|
||||
try {
|
||||
this.isLoading = true
|
||||
if (refresh) {
|
||||
this.pagination.current = 1
|
||||
this.hasMore = true
|
||||
}
|
||||
if (refresh && this.isFirstLoad) {
|
||||
uni.showLoading({ title: '加载中...', mask: true })
|
||||
}
|
||||
const app = getApp()
|
||||
const globalData = app.globalData || {}
|
||||
|
||||
const params = {
|
||||
// 方案1:使用比赛编码(推荐,后端可以根据邀请码关联)
|
||||
matchCode: globalData.matchCode,
|
||||
|
||||
// 方案2:使用具体的ID(作为备选)
|
||||
competitionId: globalData.matchId,
|
||||
judgeId: this.judgeId,
|
||||
venueId: this.venueInfo.id,
|
||||
projectId: this.projectInfo.id
|
||||
projectId: this.projectInfo.id,
|
||||
current: this.pagination.current,
|
||||
size: this.pagination.size
|
||||
}
|
||||
|
||||
// 移除无效参数
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === undefined || params[key] === null || params[key] === '') {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
|
||||
// 调试信息
|
||||
if (config.debug) {
|
||||
console.log('请求运动员列表参数:', params)
|
||||
console.log('请求选手列表参数:', params)
|
||||
}
|
||||
|
||||
const response = await dataAdapter.getData('getMyAthletes', params)
|
||||
|
||||
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,
|
||||
console.log('选手列表响应:', response)
|
||||
}
|
||||
|
||||
if (refresh && this.isFirstLoad) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
const responseData = response.data || {}
|
||||
const records = responseData.records || response.data || []
|
||||
const total = responseData.total || records.length
|
||||
this.pagination.total = total
|
||||
this.totalCount = total
|
||||
if (refresh) {
|
||||
this.players = records
|
||||
} else {
|
||||
this.players = [...this.players, ...records]
|
||||
}
|
||||
this.scoredCount = this.players.filter(p => p.scored).length
|
||||
this.hasMore = this.players.length < total
|
||||
|
||||
if (config.debug) {
|
||||
console.log('选手列表处理结果:', {
|
||||
total: total,
|
||||
loaded: this.players.length,
|
||||
scored: this.scoredCount,
|
||||
players: this.players
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
console.error('加载选手列表失败:', error)
|
||||
|
||||
uni.showToast({
|
||||
title: error.message || '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.showToast({ title: error.message || '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
goToScoreDetail(player) {
|
||||
// 保存当前选手信息到全局数据
|
||||
const app = getApp()
|
||||
app.globalData.currentAthlete = player
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/score-detail/score-detail'
|
||||
})
|
||||
async loadMore() {
|
||||
if (!this.hasMore || this.isLoading) return
|
||||
this.pagination.current++
|
||||
await this.loadPlayers(false)
|
||||
},
|
||||
|
||||
goToScoreDetail(player) {
|
||||
const app = getApp()
|
||||
app.globalData.currentAthlete = player
|
||||
app.globalData.currentProjectId = this.projectInfo.id
|
||||
uni.navigateTo({ url: '/pages/score-detail/score-detail' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新当前项目信息
|
||||
*/
|
||||
updateCurrentProject() {
|
||||
const currentProject = this.projects[this.currentProjectIndex] || {}
|
||||
this.projectInfo = {
|
||||
@@ -236,37 +408,13 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换项目
|
||||
* @param {Number} index - 项目索引
|
||||
*/
|
||||
async switchProject(index) {
|
||||
// 如果点击的是当前项目,不做处理
|
||||
if (index === this.currentProjectIndex) {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新当前项目索引
|
||||
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()
|
||||
await this.loadPlayers(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +427,7 @@ export default {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
/* ==================== 导航栏 ==================== */
|
||||
.nav-bar {
|
||||
height: 90rpx;
|
||||
background: linear-gradient(135deg, #1B7C5E 0%, #2A9D7E 100%);
|
||||
@@ -294,7 +442,6 @@ export default {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
|
||||
.nav-right {
|
||||
@@ -302,24 +449,24 @@ export default {
|
||||
right: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 30rpx;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.icon-menu,
|
||||
.icon-close {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.logout-btn {
|
||||
font-size: 26rpx;
|
||||
color: #FFFFFF;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.nav-dots, .nav-circle {
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 比赛信息 */
|
||||
/* ==================== 比赛信息 ==================== */
|
||||
.match-info {
|
||||
padding: 30rpx;
|
||||
background-color: #F5F5F5;
|
||||
@@ -328,121 +475,96 @@ export default {
|
||||
.match-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
margin-bottom: 10rpx;
|
||||
color: #1B7C5E;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.match-time {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/* 场地和项目区域 */
|
||||
.venue-section {
|
||||
/* ==================== 场地卡片 ==================== */
|
||||
.venue-card {
|
||||
margin: 0 30rpx 20rpx;
|
||||
background-color: #FFFFFF;
|
||||
margin: 20rpx 30rpx;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.venue-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 20rpx;
|
||||
padding-bottom: 24rpx;
|
||||
border-bottom: 4rpx solid #1B7C5E;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.venue-tab {
|
||||
.venue-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.venue-tab.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -24rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 4rpx;
|
||||
background-color: #1B7C5E;
|
||||
.refresh-link {
|
||||
font-size: 26rpx;
|
||||
color: #4A90D9;
|
||||
}
|
||||
|
||||
.refresh-hint {
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
/* ==================== 项目筛选 - 横向滑动 ==================== */
|
||||
.project-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
.project-row {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
gap: 16rpx;
|
||||
padding: 4rpx 0;
|
||||
}
|
||||
|
||||
.project-btn {
|
||||
padding: 20rpx 40rpx;
|
||||
background-color: #FFFFFF;
|
||||
.project-chip {
|
||||
display: inline-block;
|
||||
padding: 20rpx 32rpx;
|
||||
border: 2rpx solid #1B7C5E;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: #1B7C5E;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background-color: #FFFFFF;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.project-btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.project-btn.active {
|
||||
.project-chip.active {
|
||||
background-color: #1B7C5E;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.project-tip {
|
||||
font-size: 22rpx;
|
||||
color: #FF4D6A;
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 评分统计 */
|
||||
/* ==================== 评分统计 ==================== */
|
||||
.score-stats {
|
||||
padding: 20rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.stats-label {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.stats-text {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.stats-number {
|
||||
.stats-value {
|
||||
font-size: 32rpx;
|
||||
color: #1B7C5E;
|
||||
font-weight: 600;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.warning-tip {
|
||||
padding: 0 30rpx 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
}
|
||||
|
||||
/* 选手列表 */
|
||||
/* ==================== 选手卡片 ==================== */
|
||||
.player-list {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
@@ -450,14 +572,14 @@ export default {
|
||||
.player-card {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.player-header {
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
@@ -468,34 +590,48 @@ export default {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.player-scores {
|
||||
/* ==================== 已评分标签 ==================== */
|
||||
.score-tags {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 8rpx;
|
||||
gap: 16rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.my-score {
|
||||
font-size: 26rpx;
|
||||
.score-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 20rpx;
|
||||
background-color: #F5F5F5;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
}
|
||||
|
||||
.tag-label {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.total-score {
|
||||
font-size: 26rpx;
|
||||
.tag-value {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 600;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.action-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 8rpx;
|
||||
/* ==================== 等待中状态 ==================== */
|
||||
.score-tag.waiting {
|
||||
background-color: #FFF7E6;
|
||||
border-color: #FFD591;
|
||||
}
|
||||
|
||||
.chief-hint {
|
||||
.score-tag.waiting .tag-value {
|
||||
color: #FA8C16;
|
||||
font-size: 24rpx;
|
||||
color: #FF4D6A;
|
||||
}
|
||||
|
||||
/* ==================== 未评分操作 ==================== */
|
||||
.action-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.score-btn {
|
||||
@@ -505,21 +641,58 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.score-btn:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.player-info {
|
||||
/* ==================== 选手详情 ==================== */
|
||||
.player-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
.detail-row {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.detail-text {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* ==================== 加载状态 ==================== */
|
||||
.loading-status {
|
||||
padding: 30rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 26rpx;
|
||||
color: #1B7C5E;
|
||||
}
|
||||
|
||||
.no-more-text {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
/* ==================== 空状态 ==================== */
|
||||
.empty-state {
|
||||
padding: 100rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.no-project-tip {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -247,7 +247,7 @@ export default new DataAdapter()
|
||||
* |---------------------|----------------------|---------------------|---------------|
|
||||
* | login | mockData.login | apiService.login | 登录验证 |
|
||||
* | getMyAthletes | mockData.getMyAthletes | apiService.getMyAthletes | 选手列表(评委) |
|
||||
* | getAthletesForAdmin | mockData.getAthletesForAdmin | apiService.getAthletesForAdmin | 选手列表(裁判长) |
|
||||
* | getAthletesForAdmin | mockData.getAthletesForAdmin | apiService.getAthletesForAdmin | 选手列表(主裁判) |
|
||||
* | submitScore | mockData.submitScore | apiService.submitScore | 提交评分 |
|
||||
* | getScoreDetail | mockData.getScoreDetail | apiService.getScoreDetail | 评分详情 |
|
||||
* | modifyScore | mockData.modifyScore | apiService.modifyScore | 修改评分 |
|
||||
|
||||
@@ -247,7 +247,7 @@ export default new DataAdapter()
|
||||
* |---------------------|----------------------|---------------------|---------------|
|
||||
* | login | mockData.login | apiService.login | 登录验证 |
|
||||
* | getMyAthletes | mockData.getMyAthletes | apiService.getMyAthletes | 选手列表(评委) |
|
||||
* | getAthletesForAdmin | mockData.getAthletesForAdmin | apiService.getAthletesForAdmin | 选手列表(裁判长) |
|
||||
* | getAthletesForAdmin | mockData.getAthletesForAdmin | apiService.getAthletesForAdmin | 选手列表(主裁判) |
|
||||
* | submitScore | mockData.submitScore | apiService.submitScore | 提交评分 |
|
||||
* | getScoreDetail | mockData.getScoreDetail | apiService.getScoreDetail | 评分详情 |
|
||||
* | modifyScore | mockData.modifyScore | apiService.modifyScore | 修改评分 |
|
||||
|
||||
@@ -1,39 +1,36 @@
|
||||
module.exports = {
|
||||
// 输出目录
|
||||
outputDir: 'dist/build/h5',
|
||||
|
||||
// 静态资源目录
|
||||
assetsDir: 'static',
|
||||
|
||||
// 公共路径 - 重要!确保静态资源能正确加载
|
||||
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
|
||||
|
||||
// 生产环境配置
|
||||
productionSourceMap: false,
|
||||
|
||||
// CSS 提取配置
|
||||
css: {
|
||||
extract: true,
|
||||
sourceMap: false
|
||||
},
|
||||
|
||||
// 开发服务器配置
|
||||
devServer: {
|
||||
port: 8080,
|
||||
open: true,
|
||||
host: '0.0.0.0',
|
||||
open: false,
|
||||
disableHostCheck: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
'/mini': {
|
||||
target: 'http://localhost:8123',
|
||||
changeOrigin: true
|
||||
},
|
||||
'/martial': {
|
||||
target: 'http://localhost:8123',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
chainWebpack: config => {
|
||||
// 禁用 gzip 大小报告
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
config.performance.hints(false)
|
||||
}
|
||||
|
||||
// 确保 CSS 文件正确处理
|
||||
config.module
|
||||
.rule('vue')
|
||||
.use('vue-loader')
|
||||
|
||||
Reference in New Issue
Block a user