Compare commits

...
25 Commits
Author SHA1 Message Date
DevOps 56a1897b7d fix: 修复选手列表重复问题 - 只查询registrationStatus=0的选手信息记录
根本原因:报名时会创建新的registrationStatus=1参赛记录,而查询选手列表时没有过滤,导致显示重复
解决方案:在查询选手列表时添加registrationStatus=0参数,只查询选手信息库
2026-01-15 17:20:02 +08:00
DevOps 5f68218079 fix: 修复选手/集体列表重复问题,添加集体项目已报名标记
- add-team.vue: 添加选手列表去重逻辑
- event-register.vue: loadTeamList添加去重和已报名标记
- event-register.vue: toggleTeam添加已报名警告
- 集体项目UI显示已报名标签
2026-01-15 16:52:08 +08:00
DevOps 82deb8b4f9 fix: 选手列表去重并显示已报名标记
- loadPlayerList 添加按身份证去重逻辑
- 查询已报名选手并标记 hasRegistered
- UI 显示"已报名"标签
- 选择已报名选手时弹出警告

Closes #3, Closes #4
2026-01-15 15:57:08 +08:00
DevOpsandfactory-droid[bot] 076aa287bd fix: 报名时强制验证联系人是否已选择
- 在goToStep3方法中添加selectedContact验证
- 未选择联系人时显示提示并阻止提交
- 修复Issue #2

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-15 15:57:08 +08:00
DevOpsandfactory-droid[bot] d8c255d69d 出场顺序:显示预计出场时间和状态样式
- 显示预计出场时间(单位 | 时间)
- 状态样式:已完成(绿色)、进行中(橙色)、待出场(灰色)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-15 15:57:08 +08:00
Z-WICK 7c4507c3ed sync changes: 出场顺序优化、联系人功能 2026-01-15 15:57:08 +08:00
DevOpsandfactory-droid[bot] 412069524e fix: 新增联系人后刷新列表
- 问题2: 在onShow生命周期中自动刷新联系人列表

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-08 16:08:39 +08:00
DevOpsandfactory-droid[bot] 53cc4600a8 重构项4: 小程序出场顺序页面改用真实数据
- 修改api/schedule.js添加getScheduleStatus和getLineup方法
- 重写event-lineup.vue,从硬编码mock数据改为调用后端API
- 添加编排未完成状态的友好提示

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-08 15:42:55 +08:00
DevOpsandfactory-droid[bot] 3b05e7fc28 fix: 新增选手时传递createUser字段
- 在add-player页面提交选手时添加createUser字段
- 确保选手记录能正确关联到当前登录用户
- 解决新增选手后无法在列表中显示的问题

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-06 17:58:38 +08:00
DevOpsandfactory-droid[bot] 0ab8312bbb fix: 比赛结束后不允许报名
- 修改getStatus方法,增加比赛结束时间检查
- 如果比赛已结束,即使报名时间还在有效期内,也显示报名已结束

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-05 17:49:28 +08:00
DevOpsandfactory-droid[bot] 13eb311575 feat: add contact management and various bug fixes
- Add contact API methods in athlete.js
- Add contact list display in common-info.vue
- Update add-contact.vue for contact creation
- Create edit-contact page for contact editing
- Fix event-register.vue with contact picker modal
- Fix home.vue registration status display
- Fix my-registration.vue cert modal display

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-01-05 15:12:04 +08:00
DevOps 4eddc5a194 fix(event-players): 修复选手列表API响应处理 2025-12-31 15:20:59 +08:00
DevOps c249c9e213 fix(my-registration): 修复信息展示不全问题
- 地址过长时显示省略号
- 空字段显示"暂无"
2025-12-31 14:38:06 +08:00
DevOps 5911a55432 fix(registration): API层添加teamIds字段支持集体报名 2025-12-31 13:48:26 +08:00
DevOps adbafedb5b fix(register): 确保集体项目报名时传递type字段
- 在项目列表中保存type字段
- 跳转报名页面时传递完整的项目信息(包含type)
- 确保集体项目报名时显示集体选择而非选手选择
2025-12-31 13:30:39 +08:00
DevOps a56ca34cc3 fix(team): 修复编辑集体时id字段丢失的问题
- 将id字段改为teamId,与后端DTO保持一致
- 使用String类型传递teamId和memberIds,避免精度丢失
2025-12-31 13:10:17 +08:00
DevOps 1e053f62c0 feat(team): 添加集体编辑页面 2025-12-31 11:51:39 +08:00
DevOps bb0f620d12 fix(team): 修复删除集体时参数传递问题 2025-12-31 11:40:51 +08:00
DevOps ecb9fcba6b fix(registration): 修复我的报名跳转赛事详情时传递错误ID的问题 2025-12-31 10:56:26 +08:00
DevOps 3baa14a6b6 feat(registration): 支持集体项目报名
- 修改event-register页面支持集体项目
- 根据项目类型(个人/集体)显示不同选择界面
- 添加集体API到athlete.js
- 集体项目报名时选择集体而非选手
2025-12-30 18:02:19 +08:00
DevOps b5a8c811aa fix(add-player): 修复新增选手页面问题
- 移除一直显示的悬浮提示弹窗 (Issue #8)
- 添加登录状态检查
- 优化表单验证逻辑
- 改进错误提示显示方式
2025-12-30 17:26:46 +08:00
DevOps c6c9f9a5d1 feat(common-info): 添加集体标签页
- 在常用信息页面添加集体Tab
- 创建新增集体页面(add-team)
- 支持集体成员管理
- 修复Issue #6: 常用信息标签页里没有集体
2025-12-30 17:20:29 +08:00
DevOps d22944e575 fix(select-event): 根据参赛类型过滤项目列表
- 单人赛只显示type=1的项目
- 集体赛只显示type=2的项目
- 修复Issue #5: 单人/集体比赛区分问题
2025-12-30 17:16:44 +08:00
DevOps 5a09cceab0 docs: 更新README,简化内容并更新域名 2025-12-29 14:21:52 +08:00
DevOpsandClaude Opus 4.5 541c770f27 fix: 修复赛事规程下载文件无后缀问题
- event-rules页面H5环境使用a标签download属性指定文件名
- 修复api.config.js生产环境API地址配置
- 优化多个页面的附件展示

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 15:45:30 +08:00
22 changed files with 3032 additions and 1748 deletions
+55 -235
View File
@@ -1,251 +1,71 @@
# 武术赛事报名系统
# 武术赛事管理系统 - 用户端
基于uniapp框架开发的武术赛事报名系统,支持H5和微信小程序。
基于 UniApp 开发的武术赛事报名小程序,支持 H5 和微信小程序。
## 项目概述
## 在线访问
本项目是一个完整的武术赛事报名管理系统,实现了从赛事浏览、报名到信息管理的完整流程。
| 服务 | 地址 |
|------|------|
| 用户端 H5 | https://martial.aitisai.com |
| 后端 API | https://martial-api.aitisai.com |
### 技术栈
## 功能特点
- **框架**: uniapp
- 赛事浏览与搜索
- 在线报名与支付
- 选手信息管理
- 报名记录查询
- 赛事详情查看
## 技术栈
- **框架**: UniApp
- **平台**: H5、微信小程序
- **样式**: SCSS、rpx响应式单位
- **版本**: 2.0
- **样式**: SCSS
## 快速开始
```bash
# 安装依赖
npm install
# H5 开发
npm run dev:h5
# 微信小程序开发
npm run dev:mp-weixin
# 构建 H5
npm run build:h5
```
## 项目结构
```
martial-mini/
├── pages/ # 页面目录
│ ├── home/ # 首页(武术赛事通)
│ ├── profile/ # 个人中心
│ ├── common-info/ # 常用信息
│ ├── add-player/ # 新增选手
│ ├── edit-player/ # 编辑选手
│ ├── add-contact/ # 新增联系人
│ ├── my-registration/ # 我的报名
── event-list/ # 全部赛事列表
│ ├── event-detail/ # 赛事详情
│ ├── register-type/ # 选择报名类型
│ ├── select-event/ # 选择报名项目
│ └── event-register/ # 赛事报名流程
├── components/ # 公共组件目录
│ ├── custom-navbar/ # 自定义导航栏
│ ├── custom-tabs/ # Tab切换组件
│ └── confirm-modal/ # 确认弹窗组件
├── static/ # 静态资源目录
│ └── images/ # 图片资源
├── image/ # 设计稿图片
├── App.vue # 应用主组件
├── main.js # 应用入口文件
├── pages.json # 页面配置
├── manifest.json # 应用配置
├── uni.scss # 全局样式变量
├── index.html # H5入口页面
├── package.json # 项目依赖配置
├── check-pages.js # 页面完成度检查工具
└── README.md # 项目说明文档
├── pages/
│ ├── home/ # 首页
│ ├── profile/ # 个人中心
│ ├── event-list/ # 赛事列表
│ ├── event-detail/ # 赛事详情
│ ├── event-register/ # 赛事报名
│ ├── my-registration/ # 我的报名
│ ├── add-player/ # 新增选手
── common-info/ # 常用信息
├── components/ # 公共组件
├── static/ # 静态资源
├── pages.json # 页面配置
└── manifest.json # 应用配置
```
## 功能模块
## 相关仓库
### 1. 首页(武术赛事通)
- 轮播图展示
- 精品赛事列表
- 赛事状态显示(报名中/已结束)
- 快速报名入口
| 仓库 | 说明 |
|------|------|
| [martial-master](https://git.waypeak.work/martial/martial-master) | 后端 API |
| [martial-web](https://git.waypeak.work/martial/martial-web) | 管理后台 |
| [martial-admin-mini](https://git.waypeak.work/martial/martial-admin-mini) | 裁判端小程序 |
### 2. 个人中心
- 用户信息展示
- 我的报名入口
- 常用信息管理
- 修改密码
- 联系我们
- 退出登录
---
### 3. 常用信息管理
- 选手信息管理(新增/编辑/删除)
- 集体信息管理
- 联系人信息管理
- Tab切换界面
### 4. 选手管理
- 证件类型选择(身份证)
- 姓名输入
- 证件号码输入(18位身份证号验证)
- 队伍名称输入
- 表单验证提示
### 5. 联系人管理
- 证件信息
- 手机号码(格式验证)
- 邮箱地址
- 联系地址
- 设置默认联系人开关
### 6. 我的报名
- 全部/待开始/进行中/已结束 Tab切换
- 赛事状态标签
- 赛事详细信息展示
- 参赛选手列表
- 查看证件功能
### 7. 赛事列表
- 搜索功能
- 日期筛选
- 地区筛选
- 赛事卡片展示
- 报名状态显示
### 8. 赛事详情
- 赛事基本信息
- 功能网格入口:
- 信息发布
- 赛事规程
- 活动日程
- 参赛选手
- 比赛实况
- 出场顺序
- 成绩
- 奖牌榜
- 图片直播
- 报名按钮
### 9. 报名流程
- **选择报名类型**:单人赛/集体赛
- **选择报名项目**:多选项目,显示价格
- **报名三步骤**
1. 选择选手信息(可新增/编辑/删除选手)
2. 订单支付(显示赛事信息、联系人、参赛选手、总价)
3. 报名成功(显示选手编号信息)
## 设计特点
### 配色方案
- 主题色:#C93639(中国红)
- 文字色:#333333(深灰)、#666666(中灰)、#999999(浅灰)
- 背景色:#f5f5f5(浅灰背景)、#ffffff(白色)
### 样式规范
- 使用rpx响应式单位,自适应不同屏幕
- 圆角统一:16rpx(常规)、24rpx(大圆角)
- 间距统一:30rpx(页面内边距)
- 字体大小:
- 标题:36-38rpx
- 正文:28-32rpx
- 辅助文字:24-26rpx
### UI组件
- 自定义导航栏(支持返回按钮、标题、右侧操作区)
- Tab切换组件(带下划线指示器)
- 确认弹窗组件(取消/确定)
- 表单输入组件
- 按钮组件(主按钮/禁用按钮)
## 开发说明
### 环境要求
- Node.js 12+
- HBuilderX(推荐)或 VSCode + uni-app插件
### 安装依赖
```bash
npm install
```
### 运行项目
#### H5开发
```bash
npm run dev:h5
```
#### 微信小程序开发
```bash
npm run dev:mp-weixin
```
### 构建项目
#### 构建H5
```bash
npm run build:h5
```
#### 构建微信小程序
```bash
npm run build:mp-weixin
```
### 检查页面完成度
```bash
node check-pages.js
```
## 页面列表
1. **首页** - `/pages/home/home`
2. **个人中心** - `/pages/profile/profile`
3. **常用信息** - `/pages/common-info/common-info`
4. **新增选手** - `/pages/add-player/add-player`
5. **编辑选手** - `/pages/edit-player/edit-player`
6. **新增联系人** - `/pages/add-contact/add-contact`
7. **我的报名** - `/pages/my-registration/my-registration`
8. **全部赛事列表** - `/pages/event-list/event-list`
9. **赛事详情** - `/pages/event-detail/event-detail`
10. **选择报名类型** - `/pages/register-type/register-type`
11. **选择报名项目** - `/pages/select-event/select-event`
12. **赛事报名流程** - `/pages/event-register/event-register`
## 注意事项
1. 所有静态页面已完成,数据为模拟数据
2. 实际开发时需要对接后端API接口
3. 图片资源需要替换为实际的设计图
4. 部分功能(如支付)需要集成第三方SDK
5. 微信小程序需要配置appid和相关权限
## 后续开发建议
1. **接口对接**
- 用户登录/注册
- 赛事列表获取
- 报名信息提交
- 支付接口对接
2. **功能完善**
- 图片上传功能
- 消息通知
- 数据缓存优化
- 错误处理机制
3. **性能优化**
- 图片懒加载
- 列表虚拟滚动
- 页面预加载
4. **用户体验**
- 加载动画
- 骨架屏
- 下拉刷新
- 上拉加载更多
## 检查报告
运行 `node check-pages.js` 可查看详细的页面完成度报告。
当前完成度:**100%** ✓
- 配置文件:7/7 完成
- 公共组件:3/3 完成
- 页面文件:12/12 完成
## 版本信息
- 版本号:V 2.0
- 开发时间:2025年1月
## 许可证
MIT License
**最后更新**: 2024-12-29
-11
View File
@@ -77,7 +77,6 @@
"version": "7.28.5",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz",
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
@@ -2856,7 +2855,6 @@
"resolved": "https://registry.npmjs.org/@vue/cli-service/-/cli-service-4.5.19.tgz",
"integrity": "sha512-+Wpvj8fMTCt9ZPOLu5YaLkFCQmB4MrZ26aRmhhKiCQ/4PMoL6mLezfqdt6c+m2htM+1WV5RunRo+0WHl2DfwZA==",
"dev": true,
"peer": true,
"dependencies": {
"@intervolga/optimize-cssnano-plugin": "^1.0.5",
"@soda/friendly-errors-webpack-plugin": "^1.7.1",
@@ -3517,7 +3515,6 @@
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
@@ -4414,7 +4411,6 @@
"url": "https://github.com/sponsors/ai"
}
],
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -5334,7 +5330,6 @@
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz",
"integrity": "sha512-Uh7crJAco3AjBvgAy9Z75CjK8IG+gxaErro71THQ+vv/bl4HaQcpkexAY8KVW/T6D2W2IRr+couF/knIRkZMIQ==",
"dev": true,
"peer": true,
"dependencies": {
"cacache": "^12.0.3",
"find-cache-dir": "^2.1.0",
@@ -7382,7 +7377,6 @@
"resolved": "https://registry.npmjs.org/file-loader/-/file-loader-4.3.0.tgz",
"integrity": "sha512-aKrYPYjF1yG3oX0kWRrqrSMfgftm7oJW5M+m4owoldH5C51C0RkIwB++JbRvEW3IU6/ZG5n8UvEcdgwOt2UOWA==",
"dev": true,
"peer": true,
"dependencies": {
"loader-utils": "^1.2.3",
"schema-utils": "^2.5.0"
@@ -8454,7 +8448,6 @@
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.5.2.tgz",
"integrity": "sha512-q5oYdzjKUIPQVjOosjgvCHQOv9Ett9CYYHlgvJeXG0qQvdSojnBq4vAdQBwn1+yGveAwHCoe/rMR86ozX3+c2A==",
"peer": true,
"dependencies": {
"@types/html-minifier-terser": "^5.0.0",
"@types/tapable": "^1.0.5",
@@ -11314,7 +11307,6 @@
"version": "2.16.105",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.16.105.tgz",
"integrity": "sha512-J4dn41spsAwUxCpEoVf6GVoz908IAA3mYiLmNxg8J9kfRXc2jxpbUepcP0ocp0alVNLFthTAM8DZ1RaHh8sU0A==",
"license": "Apache-2.0",
"dependencies": {
"dommatrix": "^1.0.3",
"web-streams-polyfill": "^3.2.1"
@@ -11436,7 +11428,6 @@
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz",
"integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==",
"dev": true,
"peer": true,
"dependencies": {
"picocolors": "^0.2.1",
"source-map": "^0.6.1"
@@ -13063,7 +13054,6 @@
"resolved": "https://registry.npmjs.org/sass/-/sass-1.96.0.tgz",
"integrity": "sha512-8u4xqqUeugGNCYwr9ARNtQKTOj4KmYiJAVKXf2CTIivTCR51j96htbMKWDru8H5SaQWpyVgTfOF8Ylyf5pun1Q==",
"dev": true,
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@@ -16080,7 +16070,6 @@
"version": "4.47.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.47.0.tgz",
"integrity": "sha512-td7fYwgLSrky3fI1EuU5cneU4+pbH6GgOfuKNS1tNPcfdGinGELAqsb/BP4nnvZyKSG2i/xFGU7+n2PvZA8HJQ==",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.9.0",
"@webassemblyjs/helper-module-context": "1.9.0",
+51 -8
View File
@@ -7,8 +7,6 @@ import request from '@/utils/request.js'
export default {
/**
* 获取选手列表
* @param {Object} params 查询参数 { current, size, competitionId, name }
* @returns {Promise}
*/
getAthleteList(params = {}) {
return request.get('/martial/athlete/list', {
@@ -20,8 +18,6 @@ export default {
/**
* 获取选手详情
* @param {String|Number} id 选手ID
* @returns {Promise}
*/
getAthleteDetail(id) {
return request.get('/martial/athlete/detail', { id })
@@ -29,8 +25,6 @@ export default {
/**
* 新增或修改选手
* @param {Object} data 选手数据
* @returns {Promise}
*/
submitAthlete(data) {
return request.post('/martial/athlete/submit', data)
@@ -38,12 +32,61 @@ export default {
/**
* 删除选手
* @param {String|Array} ids 选手ID或ID数组
* @returns {Promise}
*/
removeAthlete(ids) {
return request.post('/martial/athlete/remove', {
ids: Array.isArray(ids) ? ids.join(',') : ids
})
},
// ========== 集体/团队相关 API ==========
getTeamList(params = {}) {
return request.get('/martial/team/list', {
current: params.current || 1,
size: params.size || 100,
...params
})
},
getTeamDetail(id) {
return request.get('/martial/team/detail', { id })
},
saveTeam(data) {
return request.post('/martial/team/submit', data)
},
removeTeam(id) {
return request.post('/martial/team/remove?id=' + id, {})
},
// ========== 联系人相关 API ==========
getContactList(params = {}) {
return request.get('/martial/contact/list', {
current: params.current || 1,
size: params.size || 100,
...params
})
},
getContactDetail(id) {
return request.get('/martial/contact/detail', { id })
},
saveContact(data) {
return request.post('/martial/contact/submit', data)
},
removeContact(id) {
return request.post('/martial/contact/remove?ids=' + id, {})
},
/**
* 获取已报名选手列表(用于检查重复报名)
*/
getRegisteredAthletes(params = {}) {
return request.get('/martial/athlete/registered', params)
}
}
+5 -14
View File
@@ -7,26 +7,23 @@ import request from '@/utils/request.js'
export default {
/**
* 提交报名订单
* @param {Object} data 报名数据 { competitionId, projectIds, athleteIds, contactPhone, totalAmount }
* @returns {Promise}
*/
submitRegistration(data) {
// 处理数组参数:将数组转换为逗号分隔的字符串
const formattedData = {
orderNo: data.orderNo,
competitionId: data.competitionId,
projectIds: Array.isArray(data.projectIds) ? data.projectIds.join(',') : data.projectIds,
athleteIds: Array.isArray(data.athleteIds) ? data.athleteIds.join(',') : data.athleteIds,
athleteIds: Array.isArray(data.athleteIds) ? data.athleteIds.join(',') : (data.athleteIds || ''),
teamIds: Array.isArray(data.teamIds) ? data.teamIds.join(',') : (data.teamIds || ''),
contactPhone: data.contactPhone,
totalAmount: data.totalAmount
}
console.log('=== API层转换后的数据 ===')
console.log('订单号:', formattedData.orderNo)
console.log('转换前 projectIds:', data.projectIds)
console.log('转换后 projectIds:', formattedData.projectIds)
console.log('转换前 athleteIds:', data.athleteIds)
console.log('转换后 athleteIds:', formattedData.athleteIds)
console.log('projectIds:', formattedData.projectIds)
console.log('athleteIds:', formattedData.athleteIds)
console.log('teamIds:', formattedData.teamIds)
console.log('最终发送到后端的完整数据:', formattedData)
return request.post('/martial/registrationOrder/submit', formattedData)
@@ -34,8 +31,6 @@ export default {
/**
* 获取报名订单列表
* @param {Object} params 查询参数 { current, size, status }
* @returns {Promise}
*/
getRegistrationList(params = {}) {
return request.get('/martial/registrationOrder/list', {
@@ -47,8 +42,6 @@ export default {
/**
* 获取报名订单详情
* @param {String|Number} id 订单ID
* @returns {Promise}
*/
getRegistrationDetail(id) {
return request.get('/martial/registrationOrder/detail', { id })
@@ -56,8 +49,6 @@ export default {
/**
* 取消报名
* @param {String|Array} ids 订单ID或ID数组
* @returns {Promise}
*/
cancelRegistration(ids) {
return request.post('/martial/registrationOrder/remove', {
+25 -2
View File
@@ -10,7 +10,7 @@ import request from '@/utils/request.js'
*/
export function getScheduleResult(competitionId) {
return request.get('/martial/schedule/result', {
params: { competitionId }
competitionId
})
}
@@ -91,6 +91,27 @@ export function saveDispatch(data) {
return request.post('/martial/schedule/save-dispatch', data)
}
/**
* 获取编排状态(小程序用)
* @param {Number} competitionId - 赛事ID
*/
export function getScheduleStatus(competitionId) {
return request.get('/mini/schedule/status', {
competitionId
})
}
/**
* 获取出场顺序(小程序用)
* @param {Number} competitionId - 赛事ID
* @param {Number} projectId - 项目ID (可选)
*/
export function getLineup(competitionId, projectId, orderId) {
return request.get('/mini/schedule/lineup', {
competitionId, projectId, orderId
})
}
export default {
getScheduleResult,
triggerAutoArrange,
@@ -99,5 +120,7 @@ export default {
moveScheduleGroup,
getDispatchData,
adjustOrder,
saveDispatch
saveDispatch,
getScheduleStatus,
getLineup
}
+31 -232
View File
@@ -1,236 +1,35 @@
{
"pages": [
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
},
{
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "武术赛事通",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/profile/profile",
"style": {
"navigationBarTitleText": "个人中心",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/change-password/change-password",
"style": {
"navigationBarTitleText": "修改密码",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/common-info/common-info",
"style": {
"navigationBarTitleText": "常用信息",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/add-player/add-player",
"style": {
"navigationBarTitleText": "新增选手",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/edit-player/edit-player",
"style": {
"navigationBarTitleText": "编辑选手",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/add-contact/add-contact",
"style": {
"navigationBarTitleText": "新增联系人",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/my-registration/my-registration",
"style": {
"navigationBarTitleText": "我的报名",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-list/event-list",
"style": {
"navigationBarTitleText": "全部赛事列表",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-detail/event-detail",
"style": {
"navigationBarTitleText": "赛事详情",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/select-event/select-event",
"style": {
"navigationBarTitleText": "选择报名项目",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-register/event-register",
"style": {
"navigationBarTitleText": "赛事报名",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/register-type/register-type",
"style": {
"navigationBarTitleText": "选择报名",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-info/event-info",
"style": {
"navigationBarTitleText": "信息发布",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-info-detail/event-info-detail",
"style": {
"navigationBarTitleText": "信息详情",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-rules/event-rules",
"style": {
"navigationBarTitleText": "赛事规程",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-schedule/event-schedule",
"style": {
"navigationBarTitleText": "活动日程",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-players/event-players",
"style": {
"navigationBarTitleText": "参赛选手",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-live/event-live",
"style": {
"navigationBarTitleText": "比赛实况",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-lineup/event-lineup",
"style": {
"navigationBarTitleText": "出场顺序",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-score/event-score",
"style": {
"navigationBarTitleText": "成绩",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-medals/event-medals",
"style": {
"navigationBarTitleText": "奖牌榜",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/attachment-view/attachment-view",
"style": {
"navigationBarTitleText": "附件查看",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/event-photos/event-photos",
"style": {
"navigationBarTitleText": "图片直播",
"navigationBarBackgroundColor": "#C93639",
"navigationBarTextStyle": "white"
}
}
{"path": "pages/login/login", "style": {"navigationBarTitleText": "登录", "navigationStyle": "custom"}},
{"path": "pages/register/register", "style": {"navigationBarTitleText": "注册", "navigationStyle": "custom"}},
{"path": "pages/home/home", "style": {"navigationBarTitleText": "武术赛事通", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/profile/profile", "style": {"navigationBarTitleText": "个人中心", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/change-password/change-password", "style": {"navigationBarTitleText": "修改密码", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/common-info/common-info", "style": {"navigationBarTitleText": "常用信息", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/add-player/add-player", "style": {"navigationBarTitleText": "新增选手", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/add-team/add-team", "style": {"navigationBarTitleText": "新增集体", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/edit-team/edit-team", "style": {"navigationBarTitleText": "编辑集体", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/edit-player/edit-player", "style": {"navigationBarTitleText": "编辑选手", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/add-contact/add-contact", "style": {"navigationBarTitleText": "新增联系人", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/edit-contact/edit-contact", "style": {"navigationBarTitleText": "编辑联系人", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/my-registration/my-registration", "style": {"navigationBarTitleText": "我的报名", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-list/event-list", "style": {"navigationBarTitleText": "全部赛事列表", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-detail/event-detail", "style": {"navigationBarTitleText": "赛事详情", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/select-event/select-event", "style": {"navigationBarTitleText": "选择报名项目", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-register/event-register", "style": {"navigationBarTitleText": "赛事报名", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/register-type/register-type", "style": {"navigationBarTitleText": "选择报名", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-info/event-info", "style": {"navigationBarTitleText": "信息发布", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-info-detail/event-info-detail", "style": {"navigationBarTitleText": "信息详情", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-rules/event-rules", "style": {"navigationBarTitleText": "赛事规程", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-schedule/event-schedule", "style": {"navigationBarTitleText": "活动日程", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-players/event-players", "style": {"navigationBarTitleText": "参赛选手", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-live/event-live", "style": {"navigationBarTitleText": "比赛实况", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-lineup/event-lineup", "style": {"navigationBarTitleText": "出场顺序", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-score/event-score", "style": {"navigationBarTitleText": "成绩", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-medals/event-medals", "style": {"navigationBarTitleText": "奖牌榜", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/attachment-view/attachment-view", "style": {"navigationBarTitleText": "附件查看", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}},
{"path": "pages/event-photos/event-photos", "style": {"navigationBarTitleText": "图片直播", "navigationBarBackgroundColor": "#C93639", "navigationBarTextStyle": "white"}}
],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "武术赛事",
"navigationBarBackgroundColor": "#C93639",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#C93639",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "static/images/首页灰@3x.png",
"selectedIconPath": "static/images/首页亮@3x.png"
},
{
"pagePath": "pages/profile/profile",
"text": "个人中心",
"iconPath": "static/images/个人中心灰@3x.png",
"selectedIconPath": "static/images/个人中心亮@3x.png"
}
]
}
"globalStyle": {"navigationBarTextStyle": "white", "navigationBarTitleText": "武术赛事", "navigationBarBackgroundColor": "#C93639", "backgroundColor": "#F8F8F8"},
"tabBar": {"color": "#999999", "selectedColor": "#C93639", "backgroundColor": "#ffffff", "borderStyle": "black", "list": [{"pagePath": "pages/home/home", "text": "首页", "iconPath": "static/images/首页灰@3x.png", "selectedIconPath": "static/images/首页亮@3x.png"}, {"pagePath": "pages/profile/profile", "text": "个人中心", "iconPath": "static/images/个人中心灰@3x.png", "selectedIconPath": "static/images/个人中心亮@3x.png"}]}
}
+75 -143
View File
@@ -13,82 +13,46 @@
<view class="form-item">
<view class="form-label">姓名</view>
<view class="form-value">
<input
class="form-input"
v-model="formData.name"
placeholder="请输入姓名"
placeholder-class="placeholder"
/>
<input class="form-input" v-model="formData.name" placeholder="请输入姓名" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">证件号码</view>
<view class="form-value">
<input
class="form-input"
v-model="formData.idCard"
placeholder="请输入身份证号码"
placeholder-class="placeholder"
/>
<input class="form-input" v-model="formData.idCard" placeholder="请输入身份证号码" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">手机号码</view>
<view class="form-value">
<input
class="form-input"
v-model="formData.phone"
placeholder="请输入手机号码"
placeholder-class="placeholder"
type="number"
/>
<input class="form-input" v-model="formData.phone" placeholder="请输入手机号码" placeholder-class="placeholder" type="number" />
</view>
</view>
<view class="form-item">
<view class="form-label">邮箱</view>
<view class="form-value">
<input
class="form-input"
v-model="formData.email"
placeholder="请输入邮箱"
placeholder-class="placeholder"
/>
<input class="form-input" v-model="formData.email" placeholder="请输入邮箱" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">地址</view>
<view class="form-value">
<input
class="form-input"
v-model="formData.address"
placeholder="请输入地址"
placeholder-class="placeholder"
/>
<input class="form-input" v-model="formData.address" placeholder="请输入地址" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item switch-item">
<view class="form-label">设置为默认联系人</view>
<view class="form-value">
<switch
:checked="formData.isDefault"
@change="handleSwitchChange"
color="#C93639"
/>
<switch :checked="formData.isDefault" @change="handleSwitchChange" color="#C93639" />
</view>
</view>
</view>
<!-- 提示信息 -->
<view class="hint-message" v-if="showHint">
<text class="hint-icon"></text>
<text class="hint-text">{{ hintText }}</text>
</view>
<!-- Toast提示 -->
<view class="toast-message" v-if="showToast">
<text class="toast-text">{{ toastMessage }}</text>
@@ -96,13 +60,16 @@
<!-- 按钮 -->
<view class="btn-wrapper">
<view class="btn save-btn disabled" v-if="!isFormValid">保存</view>
<view class="btn save-btn" v-else @click="handleSave">保存</view>
<view class="btn save-btn" :class="{ disabled: !isFormValid || saving }" @click="handleSave">
{{ saving ? '保存中...' : '保存' }}
</view>
</view>
</view>
</template>
<script>
import athleteAPI from '@/api/athlete.js';
export default {
data() {
return {
@@ -115,27 +82,20 @@ export default {
address: '',
isDefault: false
},
showHint: false,
hintText: '',
showToast: false,
toastMessage: '',
showIdTypePicker: false
saving: false
};
},
computed: {
isFormValid() {
return (
this.formData.name &&
this.formData.idCard &&
this.formData.phone &&
this.validateIdCard(this.formData.idCard) &&
this.validatePhone(this.formData.phone)
);
return this.formData.name && this.formData.idCard && this.formData.phone &&
this.validateIdCard(this.formData.idCard) && this.validatePhone(this.formData.phone);
}
},
methods: {
validateIdCard(idCard) {
return /^\d{18}$/.test(idCard);
return /^\d{17}[\dXx]$/.test(idCard);
},
validatePhone(phone) {
return /^1\d{10}$/.test(phone);
@@ -143,38 +103,64 @@ export default {
handleSwitchChange(e) {
this.formData.isDefault = e.detail.value;
},
handleSave() {
if (!this.isFormValid) {
if (this.formData.phone && !this.validatePhone(this.formData.phone)) {
this.toastMessage = '手机号码格式不正确';
this.showToast = true;
setTimeout(() => {
this.showToast = false;
}, 2000);
} else if (this.formData.idCard && !this.validateIdCard(this.formData.idCard)) {
this.toastMessage = '身份证号码格式不正确';
this.showToast = true;
setTimeout(() => {
this.showToast = false;
}, 2000);
} else {
this.hintText = '请完善信息';
this.showHint = true;
setTimeout(() => {
this.showHint = false;
}, 2000);
}
showToastMsg(msg) {
this.toastMessage = msg;
this.showToast = true;
setTimeout(() => { this.showToast = false; }, 2000);
},
async handleSave() {
if (!this.isFormValid || this.saving) return;
if (!this.validatePhone(this.formData.phone)) {
this.showToastMsg('手机号码格式不正确');
return;
}
if (!this.validateIdCard(this.formData.idCard)) {
this.showToastMsg('身份证号码格式不正确');
return;
}
// 实际保存逻辑
uni.showToast({
title: '保存成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
this.saving = true;
try {
await athleteAPI.saveContact(this.formData);
uni.showToast({ title: '保存成功', icon: 'success' });
// Set flag to notify previous page
uni.setStorageSync('contactListNeedRefresh', true);
// Notify previous page to refresh contact list
try {
const pages = getCurrentPages();
console.log('页面栈长度:', pages.length);
console.log('页面栈:', pages);
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
console.log('上一页:', prevPage);
// Try different ways to access the component
const vm = prevPage.$vm || prevPage;
console.log('vm:', vm);
if (vm && typeof vm.loadContactList === 'function') {
console.log('调用 loadContactList');
vm.loadContactList();
} else if (vm && vm.$refs && vm.$refs.page && typeof vm.$refs.page.loadContactList === 'function') {
console.log('通过 $refs 调用');
vm.$refs.page.loadContactList();
}
}
} catch (e) {
console.error('通知上一页失败:', e);
}
// Also emit event as backup
uni.$emit('contactAdded');
setTimeout(() => { uni.navigateBack(); }, 1500);
} catch (err) {
console.error('保存联系人失败:', err);
this.showToastMsg('保存失败,请重试');
} finally {
this.saving = false;
}
}
}
};
@@ -201,13 +187,8 @@ export default {
border-bottom: 1rpx solid #f5f5f5;
}
.form-item:last-child {
border-bottom: none;
}
.switch-item {
padding: 30rpx;
}
.form-item:last-child { border-bottom: none; }
.switch-item { padding: 30rpx; }
.form-label {
width: 180rpx;
@@ -228,38 +209,8 @@ export default {
color: #333333;
}
.placeholder {
color: #cccccc;
}
.arrow {
font-size: 40rpx;
color: #cccccc;
margin-left: 10rpx;
}
.hint-message {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 30rpx 50rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
gap: 15rpx;
z-index: 9999;
}
.hint-icon {
font-size: 40rpx;
}
.hint-text {
font-size: 28rpx;
}
.placeholder { color: #cccccc; }
.arrow { font-size: 40rpx; color: #cccccc; margin-left: 10rpx; }
.toast-message {
position: fixed;
@@ -273,26 +224,7 @@ export default {
z-index: 9999;
}
.toast-text {
font-size: 28rpx;
}
.info-text {
margin: 20rpx 30rpx;
text-align: center;
}
.info-hint {
font-size: 24rpx;
color: #C93639;
}
.warning-text {
margin: 20rpx 30rpx;
text-align: center;
font-size: 24rpx;
color: #C93639;
}
.toast-text { font-size: 28rpx; }
.btn-wrapper {
position: fixed;
+75 -151
View File
@@ -72,29 +72,16 @@
</view>
</view>
<!-- 错误提示 -->
<view class="error-hints" v-if="errors.length > 0">
<view class="error-item" v-for="(error, index) in errors" :key="index">
<text class="error-label">{{ error.label }}</text>
<text class="error-msg">{{ error.message }}</text>
<!-- 错误提示 - 只在有具体错误时显示 -->
<view class="error-hints" v-if="validationErrors.length > 0">
<view class="error-item" v-for="(error, index) in validationErrors" :key="index">
<text class="error-text">{{ error }}</text>
</view>
</view>
<!-- 提示信息 -->
<view class="hint-message" v-if="showHint">
<text class="hint-icon"></text>
<text class="hint-text">请完善信息</text>
</view>
<!-- Toast提示 -->
<view class="toast-message" v-if="showToast">
<text class="toast-text">{{ toastMessage }}</text>
</view>
<!-- 按钮 -->
<view class="btn-wrapper">
<view class="btn save-btn disabled" v-if="!isFormValid">保存</view>
<view class="btn save-btn" v-else @click="handleSave">保存</view>
<view class="btn save-btn" :class="{ disabled: !isFormValid }" @click="handleSave">保存</view>
</view>
<!-- 证件类型选择器 -->
@@ -114,6 +101,7 @@
<script>
import athleteAPI from '@/api/athlete.js'
import { getUserInfo, getToken } from '@/utils/auth.js'
export default {
data() {
@@ -128,25 +116,17 @@ export default {
},
competitionId: '',
projectIds: [],
errors: [],
showHint: false,
showToast: false,
toastMessage: '',
validationErrors: [],
showIdTypePicker: false
};
},
onLoad(options) {
// 接收赛事ID和项目ID
if (options.competitionId) {
this.competitionId = options.competitionId
}
if (options.projectIds) {
this.projectIds = options.projectIds.split(',').map(id => parseInt(id))
this.projectIds = options.projectIds.split(',')
}
console.log('新增选手页面接收参数:', {
competitionId: this.competitionId,
projectIds: this.projectIds
})
},
computed: {
isFormValid() {
@@ -162,153 +142,138 @@ export default {
}
},
watch: {
'formData.name'(val) {
this.validateForm();
},
'formData.idCard'(val) {
this.validateForm();
},
'formData.team'(val) {
this.validateForm();
},
'formData.organization'(val) {
this.validateForm();
this.updateValidationErrors();
},
'formData.phone'(val) {
this.validateForm();
this.updateValidationErrors();
}
},
methods: {
validateIdCard(idCard) {
// 身份证号验证:18位,最后一位可以是数字或字母X
return /^\d{17}[\dXx]$/.test(idCard);
if (!idCard) return false;
if (!/^\d{17}[\dXx]$/.test(idCard)) return false;
const year = parseInt(idCard.substring(6, 10))
const month = parseInt(idCard.substring(10, 12))
const day = parseInt(idCard.substring(12, 14))
if (month < 1 || month > 12) return false;
if (day < 1 || day > 31) return false;
const currentYear = new Date().getFullYear()
if (year < 1900 || year > currentYear) return false;
const date = new Date(year, month - 1, day)
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
return false;
}
return true;
},
validatePhone(phone) {
// 手机号验证:11位数字
return /^1[3-9]\d{9}$/.test(phone);
},
validateForm() {
this.errors = [];
this.showHint = false;
if (!this.formData.name || !this.formData.idCard || !this.formData.team || !this.formData.organization || !this.formData.phone) {
this.showHint = true;
if (!this.formData.name || !this.formData.idCard || !this.formData.team || !this.formData.organization || !this.formData.phone) {
this.errors.push({
label: '有空文本时弹出:',
message: '按钮置灰'
});
}
}
updateValidationErrors() {
this.validationErrors = [];
if (this.formData.idCard && !this.validateIdCard(this.formData.idCard)) {
this.errors.push({
label: '身份证不足18位:',
message: '按钮置灰'
});
this.errors.push({
label: '输入不合法:',
message: '按钮置灰'
});
this.validationErrors.push('身份证号码格式不正确');
}
if (this.formData.phone && !this.validatePhone(this.formData.phone)) {
this.errors.push({
label: '手机号格式不正确:',
message: '按钮置灰'
});
this.validationErrors.push('手机号格式不正确');
}
},
handleIdTypeChange(e) {
this.formData.idType = '身份证';
this.showIdTypePicker = false;
},
/**
* 从身份证号中提取信息
*/
extractInfoFromIdCard(idCard) {
if (!idCard || idCard.length !== 18) {
return {
gender: null,
age: null,
birthDate: null
}
return { gender: null, age: null, birthDate: null }
}
// 提取出生日期
const year = idCard.substring(6, 10)
const month = idCard.substring(10, 12)
const day = idCard.substring(12, 14)
const birthDate = `${year}-${month}-${day}`
// 计算年龄
const birthYear = parseInt(year)
const currentYear = new Date().getFullYear()
const age = currentYear - birthYear
// 提取性别(倒数第二位,奇数为男,偶数为女)
const genderCode = parseInt(idCard.substring(16, 17))
const gender = genderCode % 2 === 1 ? 1 : 2
return {
gender,
age,
birthDate
}
return { gender, age, birthDate }
},
async handleSave() {
if (!this.isFormValid) {
uni.showToast({
title: '请完善信息',
icon: 'none'
})
return;
}
// Check login status
const token = getToken()
if (!token) {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/login/login'
})
}, 1500)
return;
}
try {
// 从身份证号中提取信息
const info = this.extractInfoFromIdCard(this.formData.idCard)
// 调用API保存选手信息(使用后端实体类的字段名)
const userInfo = getUserInfo()
const submitData = {
playerName: this.formData.name,
idCard: this.formData.idCard,
teamName: this.formData.team,
organization: this.formData.organization,
contactPhone: this.formData.phone,
idCardType: 1, // 身份证类型固定为1
idCardType: 1,
gender: info.gender,
age: info.age,
birthDate: info.birthDate
birthDate: info.birthDate,
createUser: userInfo ? userInfo.userId : null
}
// 如果有赛事ID和项目ID,一起提交
if (this.competitionId) {
submitData.competitionId = parseInt(this.competitionId)
submitData.competitionId = this.competitionId
}
if (this.projectIds && this.projectIds.length > 0) {
// 如果有多个项目,取第一个项目ID
submitData.projectId = this.projectIds[0]
}
console.log('提交选手数据:', submitData)
await athleteAPI.submitAthlete(submitData)
// 保存成功
uni.showToast({
title: '保存成功',
icon: 'success'
})
// 延迟返回上一页
setTimeout(() => {
uni.navigateBack()
}, 1500)
} catch (err) {
console.error('保存选手失败:', err)
// 显示错误提示
this.toastMessage = '保存失败,请重试'
this.showToast = true
setTimeout(() => {
this.showToast = false
}, 2000)
uni.showToast({
title: err.message || '保存失败,请重试',
icon: 'none'
})
}
}
}
@@ -370,64 +335,23 @@ export default {
}
.error-hints {
margin: 30rpx;
padding: 30rpx;
background-color: #fff;
border-radius: 16rpx;
margin: 0 30rpx;
padding: 20rpx;
background-color: #fff3f3;
border-radius: 8rpx;
}
.error-item {
margin-bottom: 15rpx;
margin-bottom: 10rpx;
}
.error-label {
.error-item:last-child {
margin-bottom: 0;
}
.error-text {
font-size: 26rpx;
color: #C93639;
margin-right: 10rpx;
}
.error-msg {
font-size: 26rpx;
color: #C93639;
}
.hint-message {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 30rpx 50rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
gap: 15rpx;
z-index: 9999;
}
.hint-icon {
font-size: 40rpx;
}
.hint-text {
font-size: 28rpx;
}
.toast-message {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 30rpx 50rpx;
border-radius: 16rpx;
z-index: 9999;
}
.toast-text {
font-size: 28rpx;
}
.btn-wrapper {
+384
View File
@@ -0,0 +1,384 @@
<template>
<view class="add-team-page">
<view class="form-section">
<view class="form-item">
<view class="form-label required">集体名称</view>
<input
class="form-input"
type="text"
v-model="formData.name"
placeholder="请输入集体名称"
/>
</view>
<view class="form-item">
<view class="form-label">备注</view>
<textarea
class="form-textarea"
v-model="formData.remark"
placeholder="请输入备注信息"
></textarea>
</view>
</view>
<!-- 成员列表 -->
<view class="member-section">
<view class="section-header">
<text class="section-title">成员列表</text>
<view class="add-member-btn" @click="showMemberPicker = true">
<text>+ 添加成员</text>
</view>
</view>
<view class="member-list" v-if="formData.members.length > 0">
<view class="member-item" v-for="(member, index) in formData.members" :key="index">
<view class="member-info">
<text class="member-name">{{ member.name }}</text>
</view>
<view class="remove-btn" @click="removeMember(index)">移除</view>
</view>
</view>
<view class="empty-members" v-else>
<text>暂无成员请添加</text>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-btn-wrapper">
<view class="submit-btn" @click="handleSubmit">保存</view>
</view>
<!-- 成员选择弹窗 -->
<view class="member-picker-mask" v-if="showMemberPicker" @click="showMemberPicker = false">
<view class="member-picker" @click.stop>
<view class="picker-header">
<text class="picker-title">选择成员</text>
<text class="picker-close" @click="showMemberPicker = false">×</text>
</view>
<view class="picker-list">
<view
class="picker-item"
v-for="(player, index) in availablePlayers"
:key="index"
@click="addMember(player)"
>
<text>{{ player.name }}</text>
<text class="add-icon">+</text>
</view>
<view class="empty-picker" v-if="availablePlayers.length === 0">
<text>暂无可选成员</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import athleteAPI from '@/api/athlete.js';
import { getUserInfo } from '@/utils/auth.js';
export default {
data() {
return {
formData: {
name: '',
remark: '',
members: []
},
playerList: [],
showMemberPicker: false
};
},
computed: {
availablePlayers() {
const memberIds = this.formData.members.map(m => m.id)
return this.playerList.filter(p => !memberIds.includes(p.id))
}
},
onLoad() {
this.loadPlayerList()
},
methods: {
async loadPlayerList() {
try {
const userInfo = getUserInfo()
if (!userInfo || !userInfo.userId) return
const res = await athleteAPI.getAthleteList({
current: 1,
size: 100,
createUser: userInfo.userId,
registrationStatus: 0 // Only query player info records
})
let list = []
if (res.records) {
list = res.records
} else if (Array.isArray(res)) {
list = res
}
// Deduplicate by id
const seen = new Set()
list = list.filter(item => {
const key = item.id
if (seen.has(key)) return false
seen.add(key)
return true
})
this.playerList = list.map(item => ({
id: item.id,
name: item.name || item.playerName
}))
} catch (err) {
console.error('加载选手列表失败:', err)
}
},
addMember(player) {
this.formData.members.push({
id: player.id,
name: player.name
})
this.showMemberPicker = false
},
removeMember(index) {
this.formData.members.splice(index, 1)
},
async handleSubmit() {
if (!this.formData.name) {
uni.showToast({
title: '请输入集体名称',
icon: 'none'
})
return
}
if (this.formData.members.length === 0) {
uni.showToast({
title: '请添加至少一名成员',
icon: 'none'
})
return
}
try {
const userInfo = getUserInfo()
const data = {
teamName: this.formData.name,
remark: this.formData.remark,
memberIds: this.formData.members.map(m => m.id),
createUser: userInfo?.userId
}
if (athleteAPI.saveTeam) {
await athleteAPI.saveTeam(data)
}
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
} catch (err) {
console.error('保存失败:', err)
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
}
}
};
</script>
<style lang="scss" scoped>
.add-team-page {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 150rpx;
}
.form-section {
background-color: #fff;
padding: 30rpx;
margin-bottom: 20rpx;
}
.form-item {
margin-bottom: 30rpx;
}
.form-label {
font-size: 28rpx;
color: #333;
margin-bottom: 15rpx;
}
.form-label.required::before {
content: '*';
color: #C93639;
margin-right: 5rpx;
}
.form-input {
width: 100%;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
}
.form-textarea {
width: 100%;
height: 200rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 20rpx;
font-size: 28rpx;
}
.member-section {
background-color: #fff;
padding: 30rpx;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.section-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
}
.add-member-btn {
color: #C93639;
font-size: 28rpx;
}
.member-list {
margin-top: 20rpx;
}
.member-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
margin-bottom: 15rpx;
}
.member-name {
font-size: 28rpx;
color: #333;
}
.remove-btn {
color: #C93639;
font-size: 26rpx;
}
.empty-members {
text-align: center;
padding: 50rpx;
color: #999;
font-size: 28rpx;
}
.submit-btn-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx;
background-color: #fff;
}
.submit-btn {
background-color: #C93639;
color: #fff;
text-align: center;
padding: 30rpx;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: bold;
}
.member-picker-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
display: flex;
align-items: flex-end;
}
.member-picker {
width: 100%;
background-color: #fff;
border-radius: 20rpx 20rpx 0 0;
max-height: 70vh;
}
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.picker-title {
font-size: 32rpx;
font-weight: bold;
}
.picker-close {
font-size: 40rpx;
color: #999;
}
.picker-list {
max-height: 60vh;
overflow-y: auto;
}
.picker-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.add-icon {
color: #C93639;
font-size: 36rpx;
}
.empty-picker {
text-align: center;
padding: 50rpx;
color: #999;
}
</style>
+192 -63
View File
@@ -6,10 +6,10 @@
<!-- 新增按钮 -->
<view class="add-btn-wrapper" @click="handleAdd">
<text class="add-icon"></text>
<text class="add-text">{{ currentTab === 0 ? '新增选手' : '新增联系人' }}</text>
<text class="add-text">{{ addButtonText }}</text>
</view>
<!-- 选手列表 -->
<!-- 选手列表 (Tab 0) -->
<view class="player-list" v-if="currentTab === 0 && playerList.length > 0">
<view class="player-item" v-for="(item, index) in playerList" :key="index">
<view class="player-info">
@@ -21,7 +21,7 @@
<image class="action-icon" src="/static/images/编辑@3x.png" mode="aspectFit"></image>
<text>编辑</text>
</view>
<view class="action-btn delete-btn" @click.stop="handleDelete(item)">
<view class="action-btn delete-btn" @click.stop="handleDelete(item, 'player')">
<image class="action-icon" src="/static/images/删除@3x.png" mode="aspectFit"></image>
<text>删除</text>
</view>
@@ -29,21 +29,69 @@
</view>
</view>
<!-- 空状态 -->
<!-- 选手空状态 -->
<view class="empty-state" v-if="currentTab === 0 && playerList.length === 0">
<text class="empty-text">暂无选手信息</text>
</view>
<!-- 联系人Tab内容 -->
<view class="empty-state" v-if="currentTab === 1">
<!-- 集体列表 (Tab 1) -->
<view class="player-list" v-if="currentTab === 1 && teamList.length > 0">
<view class="player-item" v-for="(item, index) in teamList" :key="index">
<view class="player-info">
<view class="player-name">{{ item.name }}</view>
<view class="player-id">成员数{{ item.memberCount || 0 }}</view>
</view>
<view class="player-actions">
<view class="action-btn edit-btn" @click.stop="handleEditTeam(item)">
<image class="action-icon" src="/static/images/编辑@3x.png" mode="aspectFit"></image>
<text>编辑</text>
</view>
<view class="action-btn delete-btn" @click.stop="handleDelete(item, 'team')">
<image class="action-icon" src="/static/images/删除@3x.png" mode="aspectFit"></image>
<text>删除</text>
</view>
</view>
</view>
</view>
<!-- 集体空状态 -->
<view class="empty-state" v-if="currentTab === 1 && teamList.length === 0">
<text class="empty-text">暂无集体信息</text>
</view>
<!-- 联系人列表 (Tab 2) -->
<view class="player-list" v-if="currentTab === 2 && contactList.length > 0">
<view class="player-item" v-for="(item, index) in contactList" :key="index">
<view class="player-info">
<view class="player-name">
{{ item.name }}
<text class="default-tag" v-if="item.isDefault">默认</text>
</view>
<view class="player-id">手机{{ item.phone }}</view>
</view>
<view class="player-actions">
<view class="action-btn edit-btn" @click.stop="handleEditContact(item)">
<image class="action-icon" src="/static/images/编辑@3x.png" mode="aspectFit"></image>
<text>编辑</text>
</view>
<view class="action-btn delete-btn" @click.stop="handleDelete(item, 'contact')">
<image class="action-icon" src="/static/images/删除@3x.png" mode="aspectFit"></image>
<text>删除</text>
</view>
</view>
</view>
</view>
<!-- 联系人空状态 -->
<view class="empty-state" v-if="currentTab === 2 && contactList.length === 0">
<text class="empty-text">暂无联系人信息</text>
</view>
<!-- 删除确认弹窗 -->
<confirm-modal
:show="showDeleteModal"
title="删除选手"
content="确定要删除该选手吗?"
:title="deleteModalTitle"
:content="deleteModalContent"
@cancel="showDeleteModal = false"
@confirm="confirmDelete"
></confirm-modal>
@@ -69,53 +117,66 @@ export default {
},
data() {
return {
tabs: ['选手', '联系人'],
tabs: ['选手', '集体', '联系人'],
currentTab: 0,
playerList: [],
teamList: [],
contactList: [],
showDeleteModal: false,
showSuccessToast: false,
currentItem: null
currentItem: null,
deleteType: 'player'
};
},
computed: {
addButtonText() {
if (this.currentTab === 0) return '新增选手'
if (this.currentTab === 1) return '新增集体'
return '新增联系人'
},
deleteModalTitle() {
if (this.deleteType === 'team') return '删除集体'
if (this.deleteType === 'contact') return '删除联系人'
return '删除选手'
},
deleteModalContent() {
if (this.deleteType === 'team') return '确定要删除该集体吗?'
if (this.deleteType === 'contact') return '确定要删除该联系人吗?'
return '确定要删除该选手吗?'
}
},
onLoad() {
this.loadPlayerList()
this.loadTeamList()
this.loadContactList()
},
onShow() {
// 从新增/编辑页面返回时重新加载列表
this.loadPlayerList()
this.loadTeamList()
this.loadContactList()
},
methods: {
/**
* 加载选手列表
*/
async loadPlayerList() {
try {
// 获取当前用户信息
const userInfo = getUserInfo()
if (!userInfo || !userInfo.userId) {
console.error('未获取到用户信息')
uni.showToast({
title: '请先登录',
icon: 'none'
})
return
}
if (!userInfo || !userInfo.userId) return
const res = await athleteAPI.getAthleteList({
current: 1,
size: 100,
createUser: userInfo.userId // 只查询当前用户创建的选手
createUser: userInfo.userId
})
let list = []
if (res.records) {
list = res.records
} else if (Array.isArray(res)) {
list = res
}
// 数据映射
this.playerList = list.map(item => ({
let list = res.records || (Array.isArray(res) ? res : [])
// Deduplicate by idCard
const seen = new Set()
const uniqueList = list.filter(item => {
const idCard = item.idCard || item.idCardNumber
if (idCard && seen.has(idCard)) return false
if (idCard) seen.add(idCard)
return true
})
this.playerList = uniqueList.map(item => ({
id: item.id,
name: item.name || item.playerName,
idCard: item.idCard || item.idCardNumber,
@@ -128,53 +189,113 @@ export default {
}
},
async loadTeamList() {
try {
const userInfo = getUserInfo()
if (!userInfo || !userInfo.userId) return
if (athleteAPI.getTeamList) {
const res = await athleteAPI.getTeamList({
current: 1,
size: 100,
createUser: userInfo.userId
})
let list = res.records || (Array.isArray(res) ? res : [])
this.teamList = list.map(item => ({
id: item.id,
name: item.name || item.teamName,
memberCount: item.memberCount || item.members?.length || 0
}))
}
} catch (err) {
console.error('加载集体列表失败:', err)
this.teamList = []
}
},
async loadContactList() {
try {
const userInfo = getUserInfo()
if (!userInfo || !userInfo.userId) return
if (athleteAPI.getContactList) {
const res = await athleteAPI.getContactList({
current: 1,
size: 100,
createUser: userInfo.userId
})
let list = res.records || (Array.isArray(res) ? res : [])
this.contactList = list.map(item => ({
id: item.id,
name: item.name,
phone: item.phone,
idCard: item.idCard,
email: item.email,
address: item.address,
isDefault: item.isDefault
}))
}
} catch (err) {
console.error('加载联系人列表失败:', err)
this.contactList = []
}
},
handleTabChange(index) {
this.currentTab = index;
},
handleAdd() {
if (this.currentTab === 0) {
uni.navigateTo({
url: '/pages/add-player/add-player'
});
uni.navigateTo({ url: '/pages/add-player/add-player' });
} else if (this.currentTab === 1) {
uni.navigateTo({
url: '/pages/add-contact/add-contact'
});
uni.navigateTo({ url: '/pages/add-team/add-team' });
} else if (this.currentTab === 2) {
uni.navigateTo({ url: '/pages/add-contact/add-contact' });
}
},
handleEdit(item) {
uni.navigateTo({
url: '/pages/edit-player/edit-player?id=' + item.id
});
uni.navigateTo({ url: '/pages/edit-player/edit-player?id=' + item.id });
},
handleDelete(item) {
handleEditTeam(item) {
uni.navigateTo({ url: '/pages/edit-team/edit-team?id=' + item.id });
},
handleEditContact(item) {
uni.navigateTo({ url: '/pages/edit-contact/edit-contact?id=' + item.id });
},
handleDelete(item, type) {
this.currentItem = item;
this.deleteType = type;
this.showDeleteModal = true;
},
async confirmDelete() {
this.showDeleteModal = false;
try {
// 调用删除API
await athleteAPI.removeAthlete(this.currentItem.id)
// 从列表中移除
const index = this.playerList.findIndex(item => item.id === this.currentItem.id);
if (index > -1) {
this.playerList.splice(index, 1);
if (this.deleteType === 'team') {
if (athleteAPI.removeTeam) {
await athleteAPI.removeTeam(this.currentItem.id)
}
const index = this.teamList.findIndex(item => item.id === this.currentItem.id);
if (index > -1) this.teamList.splice(index, 1);
} else if (this.deleteType === 'contact') {
if (athleteAPI.removeContact) {
await athleteAPI.removeContact(this.currentItem.id)
}
const index = this.contactList.findIndex(item => item.id === this.currentItem.id);
if (index > -1) this.contactList.splice(index, 1);
} else {
await athleteAPI.removeAthlete(this.currentItem.id)
const index = this.playerList.findIndex(item => item.id === this.currentItem.id);
if (index > -1) this.playerList.splice(index, 1);
}
// 显示成功提示
this.showSuccessToast = true;
setTimeout(() => {
this.showSuccessToast = false;
}, 2000);
setTimeout(() => { this.showSuccessToast = false; }, 2000);
} catch (err) {
console.error('删除选手失败:', err)
uni.showToast({
title: '删除失败',
icon: 'none'
})
console.error('删除失败:', err)
uni.showToast({ title: '删除失败', icon: 'none' })
}
}
}
@@ -227,6 +348,18 @@ export default {
font-weight: bold;
color: #333333;
margin-bottom: 10rpx;
display: flex;
align-items: center;
gap: 10rpx;
}
.default-tag {
font-size: 22rpx;
color: #fff;
background-color: #C93639;
padding: 4rpx 12rpx;
border-radius: 6rpx;
font-weight: normal;
}
.player-id {
@@ -260,10 +393,6 @@ export default {
border-color: #C93639;
}
.icon {
font-size: 28rpx;
}
.action-icon {
width: 28rpx;
height: 28rpx;
+249
View File
@@ -0,0 +1,249 @@
<template>
<view class="add-contact-page">
<view class="form-container">
<view class="form-item" @click="showIdTypePicker = true">
<view class="form-label">证件类型</view>
<view class="form-value">
<text>{{ formData.idType }}</text>
<text class="arrow"></text>
</view>
</view>
<view class="form-item">
<view class="form-label">姓名</view>
<view class="form-value">
<input class="form-input" v-model="formData.name" placeholder="请输入姓名" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">证件号码</view>
<view class="form-value">
<input class="form-input" v-model="formData.idCard" placeholder="请输入身份证号码" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">手机号码</view>
<view class="form-value">
<input class="form-input" v-model="formData.phone" placeholder="请输入手机号码" placeholder-class="placeholder" type="number" />
</view>
</view>
<view class="form-item">
<view class="form-label">邮箱</view>
<view class="form-value">
<input class="form-input" v-model="formData.email" placeholder="请输入邮箱" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-label">地址</view>
<view class="form-value">
<input class="form-input" v-model="formData.address" placeholder="请输入地址" placeholder-class="placeholder" />
</view>
</view>
<view class="form-item switch-item">
<view class="form-label">设置为默认联系人</view>
<view class="form-value">
<switch :checked="formData.isDefault" @change="handleSwitchChange" color="#C93639" />
</view>
</view>
</view>
<view class="toast-message" v-if="showToast">
<text class="toast-text">{{ toastMessage }}</text>
</view>
<view class="btn-wrapper">
<view class="btn save-btn" :class="{ disabled: !isFormValid || saving }" @click="handleSave">
{{ saving ? '保存中...' : '保存' }}
</view>
</view>
</view>
</template>
<script>
import athleteAPI from '@/api/athlete.js';
export default {
data() {
return {
contactId: null,
formData: {
idType: '身份证',
name: '',
idCard: '',
phone: '',
email: '',
address: '',
isDefault: false
},
showToast: false,
toastMessage: '',
saving: false
};
},
computed: {
isFormValid() {
return this.formData.name && this.formData.idCard && this.formData.phone &&
this.validateIdCard(this.formData.idCard) && this.validatePhone(this.formData.phone);
}
},
onLoad(options) {
if (options.id) {
this.contactId = options.id;
this.loadContactDetail();
}
},
methods: {
validateIdCard(idCard) {
return /^\d{17}[\dXx]$/.test(idCard);
},
validatePhone(phone) {
return /^1\d{10}$/.test(phone);
},
handleSwitchChange(e) {
this.formData.isDefault = e.detail.value;
},
showToastMsg(msg) {
this.toastMessage = msg;
this.showToast = true;
setTimeout(() => { this.showToast = false; }, 2000);
},
async loadContactDetail() {
try {
const res = await athleteAPI.getContactDetail(this.contactId);
if (res) {
this.formData = {
idType: res.idType || '身份证',
name: res.name || '',
idCard: res.idCard || '',
phone: res.phone || '',
email: res.email || '',
address: res.address || '',
isDefault: res.isDefault || false
};
}
} catch (err) {
console.error('加载联系人详情失败:', err);
this.showToastMsg('加载失败');
}
},
async handleSave() {
if (!this.isFormValid || this.saving) return;
if (!this.validatePhone(this.formData.phone)) {
this.showToastMsg('手机号码格式不正确');
return;
}
if (!this.validateIdCard(this.formData.idCard)) {
this.showToastMsg('身份证号码格式不正确');
return;
}
this.saving = true;
try {
const data = { ...this.formData, id: this.contactId };
await athleteAPI.saveContact(data);
uni.showToast({ title: '保存成功', icon: 'success' });
setTimeout(() => { uni.navigateBack(); }, 1500);
} catch (err) {
console.error('保存联系人失败:', err);
this.showToastMsg('保存失败,请重试');
} finally {
this.saving = false;
}
}
}
};
</script>
<style lang="scss" scoped>
.add-contact-page {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 200rpx;
}
.form-container {
background-color: #fff;
margin: 30rpx;
border-radius: 16rpx;
overflow: hidden;
}
.form-item {
display: flex;
align-items: center;
padding: 35rpx 30rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.form-item:last-child { border-bottom: none; }
.switch-item { padding: 30rpx; }
.form-label {
width: 180rpx;
font-size: 30rpx;
color: #333333;
}
.form-value {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
}
.form-input {
flex: 1;
font-size: 30rpx;
color: #333333;
}
.placeholder { color: #cccccc; }
.arrow { font-size: 40rpx; color: #cccccc; margin-left: 10rpx; }
.toast-message {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 30rpx 50rpx;
border-radius: 16rpx;
z-index: 9999;
}
.toast-text { font-size: 28rpx; }
.btn-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx;
background-color: #f5f5f5;
}
.btn {
width: 100%;
text-align: center;
padding: 30rpx;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: bold;
}
.save-btn {
background-color: #C93639;
color: #fff;
}
.save-btn.disabled {
background-color: rgba(201, 54, 57, 0.5);
}
</style>
+401
View File
@@ -0,0 +1,401 @@
<template>
<view class="add-team-page">
<view class="form-section">
<view class="form-item">
<view class="form-label required">集体名称</view>
<input
class="form-input"
type="text"
v-model="formData.name"
placeholder="请输入集体名称"
/>
</view>
<view class="form-item">
<view class="form-label">备注</view>
<textarea
class="form-textarea"
v-model="formData.remark"
placeholder="请输入备注信息"
></textarea>
</view>
</view>
<!-- 成员列表 -->
<view class="member-section">
<view class="section-header">
<text class="section-title">成员列表</text>
<view class="add-member-btn" @click="showMemberPicker = true">
<text>+ 添加成员</text>
</view>
</view>
<view class="member-list" v-if="formData.members.length > 0">
<view class="member-item" v-for="(member, index) in formData.members" :key="index">
<view class="member-info">
<text class="member-name">{{ member.name }}</text>
</view>
<view class="remove-btn" @click="removeMember(index)">移除</view>
</view>
</view>
<view class="empty-members" v-else>
<text>暂无成员请添加</text>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-btn-wrapper">
<view class="submit-btn" @click="handleSubmit">保存</view>
</view>
<!-- 成员选择弹窗 -->
<view class="member-picker-mask" v-if="showMemberPicker" @click="showMemberPicker = false">
<view class="member-picker" @click.stop>
<view class="picker-header">
<text class="picker-title">选择成员</text>
<text class="picker-close" @click="showMemberPicker = false">×</text>
</view>
<view class="picker-list">
<view
class="picker-item"
v-for="(player, index) in availablePlayers"
:key="index"
@click="addMember(player)"
>
<text>{{ player.name }}</text>
<text class="add-icon">+</text>
</view>
<view class="empty-picker" v-if="availablePlayers.length === 0">
<text>暂无可选成员</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import athleteAPI from '@/api/athlete.js';
import { getUserInfo } from '@/utils/auth.js';
export default {
data() {
return {
teamId: null,
formData: {
name: '',
remark: '',
members: []
},
playerList: [],
showMemberPicker: false
};
},
computed: {
availablePlayers() {
const memberIds = this.formData.members.map(m => m.id)
return this.playerList.filter(p => !memberIds.includes(p.id))
}
},
onLoad(options) {
if (options.id) {
this.teamId = options.id
this.loadTeamDetail()
}
this.loadPlayerList()
},
methods: {
async loadTeamDetail() {
try {
const res = await athleteAPI.getTeamDetail(this.teamId)
if (res) {
this.formData.name = res.teamName || res.name || ''
this.formData.remark = res.remark || ''
if (res.members && Array.isArray(res.members)) {
this.formData.members = res.members.map(m => ({
id: m.id,
name: m.name || m.playerName
}))
}
}
} catch (err) {
console.error('加载集体详情失败:', err)
uni.showToast({
title: '加载失败',
icon: 'none'
})
}
},
async loadPlayerList() {
try {
const userInfo = getUserInfo()
if (!userInfo || !userInfo.userId) return
const res = await athleteAPI.getAthleteList({
current: 1,
size: 100,
createUser: userInfo.userId
})
let list = []
if (res.records) {
list = res.records
} else if (Array.isArray(res)) {
list = res
}
this.playerList = list.map(item => ({
id: item.id,
name: item.name || item.playerName
}))
} catch (err) {
console.error('加载选手列表失败:', err)
}
},
addMember(player) {
this.formData.members.push({
id: player.id,
name: player.name
})
this.showMemberPicker = false
},
removeMember(index) {
this.formData.members.splice(index, 1)
},
async handleSubmit() {
if (!this.formData.name) {
uni.showToast({
title: '请输入集体名称',
icon: 'none'
})
return
}
if (this.formData.members.length === 0) {
uni.showToast({
title: '请添加至少一名成员',
icon: 'none'
})
return
}
try {
const userInfo = getUserInfo()
const data = {
teamId: this.teamId ? String(this.teamId) : null,
teamName: this.formData.name,
remark: this.formData.remark,
memberIds: this.formData.members.map(m => String(m.id)),
createUser: userInfo?.userId
}
console.log('Submitting team data:', JSON.stringify(data))
await athleteAPI.saveTeam(data)
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
} catch (err) {
console.error('保存失败:', err)
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
}
}
};
</script>
<style lang="scss" scoped>
.add-team-page {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 150rpx;
}
.form-section {
background-color: #fff;
padding: 30rpx;
margin-bottom: 20rpx;
}
.form-item {
margin-bottom: 30rpx;
}
.form-label {
font-size: 28rpx;
color: #333;
margin-bottom: 15rpx;
}
.form-label.required::before {
content: '*';
color: #C93639;
margin-right: 5rpx;
}
.form-input {
width: 100%;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
}
.form-textarea {
width: 100%;
height: 200rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 20rpx;
font-size: 28rpx;
}
.member-section {
background-color: #fff;
padding: 30rpx;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.section-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
}
.add-member-btn {
color: #C93639;
font-size: 28rpx;
}
.member-list {
margin-top: 20rpx;
}
.member-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
margin-bottom: 15rpx;
}
.member-name {
font-size: 28rpx;
color: #333;
}
.remove-btn {
color: #C93639;
font-size: 26rpx;
}
.empty-members {
text-align: center;
padding: 50rpx;
color: #999;
font-size: 28rpx;
}
.submit-btn-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx;
background-color: #fff;
}
.submit-btn {
background-color: #C93639;
color: #fff;
text-align: center;
padding: 30rpx;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: bold;
}
.member-picker-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
display: flex;
align-items: flex-end;
}
.member-picker {
width: 100%;
background-color: #fff;
border-radius: 20rpx 20rpx 0 0;
max-height: 70vh;
}
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.picker-title {
font-size: 32rpx;
font-weight: bold;
}
.picker-close {
font-size: 40rpx;
color: #999;
}
.picker-list {
max-height: 60vh;
overflow-y: auto;
}
.picker-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.add-icon {
color: #C93639;
font-size: 36rpx;
}
.empty-picker {
text-align: center;
padding: 50rpx;
color: #999;
}
</style>
+3 -1
View File
@@ -82,6 +82,7 @@ export default {
data() {
return {
eventId: '',
orderId: '',
eventInfo: {
id: '',
title: '',
@@ -96,6 +97,7 @@ export default {
onLoad(options) {
if (options.id) {
this.eventId = options.id
this.orderId = options.orderId || null
this.loadEventDetail(options.id)
}
},
@@ -192,7 +194,7 @@ export default {
if (url) {
// 跳转时传递赛事ID
uni.navigateTo({
url: `${url}?eventId=${this.eventId}`
url: `${url}?eventId=${this.eventId}&orderId=${this.orderId || ""}`
})
} else {
uni.showToast({
+244 -76
View File
@@ -1,5 +1,27 @@
<template>
<view class="event-info-page">
<!-- 附件下载区 -->
<view class="attachments-section" v-if="attachments.length > 0">
<view class="section-title">
<text class="title-icon">📎</text>
<text class="title-text">相关附件</text>
</view>
<view class="attachments-list">
<view class="attachment-item" v-for="(file, index) in attachments" :key="index" @click="downloadFile(file)">
<view class="file-info">
<text class="file-icon">{{ getFileIcon(file.fileType) }}</text>
<view class="file-details">
<text class="file-name">{{ file.fileName }}</text>
<text class="file-size">{{ file.fileSize }}</text>
</view>
</view>
<view class="download-btn">
<text class="download-icon"></text>
</view>
</view>
</view>
</view>
<!-- 信息列表 -->
<view class="info-list">
<view class="info-item" v-for="(item, index) in infoList" :key="index" @click="handleItemClick(item)">
@@ -13,7 +35,7 @@
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="infoList.length === 0">
<view class="empty-state" v-if="infoList.length === 0 && attachments.length === 0">
<text class="empty-text">暂无信息发布</text>
</view>
</view>
@@ -21,21 +43,57 @@
<script>
import infoAPI from '@/api/info.js'
import competitionAPI from '@/api/competition.js'
export default {
data() {
return {
eventId: '',
infoList: []
infoList: [],
attachments: []
};
},
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId
this.loadInfoList(options.eventId)
this.loadAttachments(options.eventId)
}
},
methods: {
/**
* 加载附件列表
*/
async loadAttachments(eventId) {
try {
const res = await competitionAPI.getAttachments({
competitionId: eventId,
type: 'info'
})
let list = []
if (res && Array.isArray(res)) {
list = res
} else if (res && res.records) {
list = res.records
} else if (res && res.data && Array.isArray(res.data)) {
list = res.data
}
if (list.length > 0) {
this.attachments = list.map(file => ({
id: file.id,
fileName: file.fileName || file.name,
fileUrl: file.fileUrl || file.url,
fileSize: this.formatFileSize(file.fileSize || file.size),
fileType: file.fileType || this.getFileType(file.fileName || file.name)
}))
}
} catch (err) {
console.error('加载附件失败:', err)
}
},
/**
* 加载信息发布列表
*/
@@ -50,11 +108,6 @@ export default {
list = res
}
// 如果后端没有数据,使用模拟数据
if (list.length === 0) {
list = this.getMockData()
}
// 数据映射
this.infoList = list.map(item => ({
id: item.id,
@@ -66,81 +119,100 @@ export default {
}))
} catch (err) {
console.error('加载信息列表失败:', err)
// 加载失败时使用模拟数据
const list = this.getMockData()
this.infoList = list.map(item => ({
id: item.id,
type: this.getInfoType(item.info_type || item.type),
typeText: this.getInfoTypeText(item.info_type || item.type),
title: item.title,
desc: item.content,
time: this.formatTime(item.publishTime)
}))
}
},
/**
* 获取模拟数据
* 下载文件
*/
getMockData() {
return [
{
id: 1,
info_type: 3,
title: '重要通知:赛事报名截止时间变更',
content: '由于场馆调整,本次赛事报名截止时间延长至2025年12月20日,请各位选手抓紧时间报名。如有疑问,请联系赛事组委会。',
publishTime: '2025-01-10 09:00:00'
downloadFile(file) {
const fileExt = file.fileType || this.getFileType(file.fileName) || 'pdf'
// #ifdef H5
const link = document.createElement('a')
link.href = file.fileUrl
link.download = file.fileName
link.target = '_blank'
link.style.display = 'none'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
uni.showToast({
title: '开始下载',
icon: 'success'
})
return
// #endif
// #ifndef H5
uni.showLoading({ title: '准备下载' })
uni.downloadFile({
url: file.fileUrl,
success: (res) => {
if (res.statusCode === 200) {
uni.openDocument({
filePath: res.tempFilePath,
fileType: fileExt,
success: () => {
uni.hideLoading()
uni.showToast({ title: '打开成功', icon: 'success' })
},
fail: (err) => {
uni.hideLoading()
console.error('打开文件失败:', err)
uni.showToast({ title: '打开失败', icon: 'none' })
}
})
}
},
{
id: 2,
info_type: 1,
title: '参赛选手须知',
content: '请各位参赛选手提前1小时到达比赛场地进行检录,携带身份证原件及复印件。比赛期间请遵守赛场纪律,服从裁判判决。',
publishTime: '2025-01-09 14:30:00'
},
{
id: 3,
info_type: 2,
title: '比赛场地及交通指引',
content: '本次赛事在市体育中心举行,地址:XX市XX区XX路100号。可乘坐地铁2号线至体育中心站下车,或乘坐公交车88路、99路至体育中心站。场馆提供免费停车位。',
publishTime: '2025-01-08 16:00:00'
},
{
id: 4,
info_type: 1,
title: '赛前训练安排通知',
content: '为方便各位选手熟悉场地,组委会安排在比赛前一天(12月24日)下午14:00-17:00开放场地供选手训练。请需要训练的选手提前联系组委会预约。',
publishTime: '2025-01-07 10:20:00'
},
{
id: 5,
info_type: 2,
title: '比赛流程及注意事项',
content: '比赛采用淘汰赛制,分为预赛、半决赛和决赛三个阶段。每场比赛时长为5分钟,选手需提前做好热身准备。比赛过程中严禁使用违禁器材。',
publishTime: '2025-01-06 11:45:00'
},
{
id: 6,
info_type: 1,
title: '医疗保障及安全提示',
content: '赛事现场配备专业医疗团队和救护车,设有医疗服务点。建议选手自备常用药品,如有特殊疾病请提前告知组委会。比赛前请充分热身,避免受伤。',
publishTime: '2025-01-05 15:10:00'
},
{
id: 7,
info_type: 3,
title: '关于赛事直播安排的通知',
content: '本次赛事将进行全程网络直播,届时可通过官方网站和APP观看。精彩瞬间将在赛后剪辑发布,敬请期待!',
publishTime: '2025-01-04 13:00:00'
},
{
id: 8,
info_type: 2,
title: '志愿者招募公告',
content: '赛事组委会现招募志愿者50名,负责现场引导、秩序维护、后勤保障等工作。有意者请扫描海报二维码报名,报名截止时间为12月15日。',
publishTime: '2025-01-03 09:30:00'
fail: (err) => {
uni.hideLoading()
console.error('下载失败:', err)
uni.showToast({ title: '下载失败', icon: 'none' })
}
]
})
// #endif
},
/**
* 获取文件类型
*/
getFileType(fileName) {
if (!fileName) return 'pdf'
const ext = fileName.split('.').pop().toLowerCase()
return ext
},
/**
* 获取文件图标
*/
getFileIcon(fileType) {
const iconMap = {
'pdf': '📕',
'doc': '📘',
'docx': '📘',
'xls': '📗',
'xlsx': '📗',
'ppt': '📙',
'pptx': '📙',
'txt': '📄',
'zip': '📦',
'rar': '📦'
}
return iconMap[fileType] || '📄'
},
/**
* 格式化文件大小
*/
formatFileSize(bytes) {
if (!bytes || bytes === 0) return '0 B'
if (typeof bytes === 'string') return bytes
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i]
},
/**
@@ -190,7 +262,6 @@ export default {
},
handleItemClick(item) {
// 跳转到信息详情页
uni.navigateTo({
url: `/pages/event-info-detail/event-info-detail?id=${item.id}&type=${item.type}&typeText=${encodeURIComponent(item.typeText)}&title=${encodeURIComponent(item.title)}&content=${encodeURIComponent(item.desc)}&time=${encodeURIComponent(item.time)}`
})
@@ -206,6 +277,103 @@ export default {
padding: 20rpx 30rpx;
}
// 区块标题
.section-title {
display: flex;
align-items: center;
gap: 10rpx;
margin-bottom: 20rpx;
padding: 0 10rpx;
}
.title-icon {
font-size: 32rpx;
}
.title-text {
font-size: 30rpx;
font-weight: bold;
color: #333333;
}
// 附件下载区
.attachments-section {
margin-bottom: 30rpx;
}
.attachments-list {
display: flex;
flex-direction: column;
gap: 15rpx;
}
.attachment-item {
background-color: #fff;
border-radius: 16rpx;
padding: 25rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s;
&:active {
background-color: #f8f8f8;
transform: scale(0.98);
}
}
.file-info {
display: flex;
align-items: center;
gap: 20rpx;
flex: 1;
min-width: 0;
}
.file-icon {
font-size: 48rpx;
flex-shrink: 0;
}
.file-details {
display: flex;
flex-direction: column;
gap: 8rpx;
flex: 1;
min-width: 0;
}
.file-name {
font-size: 28rpx;
color: #333333;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-size {
font-size: 24rpx;
color: #999999;
}
.download-btn {
width: 60rpx;
height: 60rpx;
background-color: #C93639;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.download-icon {
font-size: 32rpx;
color: #fff;
}
.info-list {
display: flex;
flex-direction: column;
+175 -122
View File
@@ -1,135 +1,135 @@
<template>
<view class="event-lineup-page">
<!-- 组别选择 -->
<view class="group-tabs">
<view
class="group-tab"
v-for="(group, index) in groups"
:key="index"
:class="{ active: currentGroup === index }"
@click="currentGroup = index"
>
{{ group }}
</view>
<view v-if="loading" class="loading-container">
<text>加载中...</text>
</view>
<!-- 出场顺序列表 -->
<view class="lineup-list">
<view class="lineup-item" v-for="(item, index) in currentLineup" :key="index">
<view class="lineup-order">
<view class="order-number">{{ item.order }}</view>
<text class="order-text"></text>
</view>
<view class="lineup-info">
<view class="lineup-name">{{ item.name }}</view>
<view class="lineup-detail">
<text class="detail-item">{{ item.team }}</text>
<text class="divider">|</text>
<text class="detail-item">{{ item.time }}</text>
</view>
</view>
<view class="lineup-status" :class="item.status">
{{ item.statusText }}
<view v-else-if="!isScheduleCompleted" class="not-ready">
<view class="not-ready-icon">📋</view>
<text class="not-ready-text">赛程编排尚未完成</text>
<text class="not-ready-hint">请等待赛事组织方完成编排后查看</text>
</view>
<template v-else>
<!-- 组别选择 -->
<view class="group-tabs">
<view
class="group-tab"
v-for="(group, index) in groups"
:key="index"
:class="{ active: currentGroupIndex === index }"
@click="currentGroupIndex = index"
>
{{ group.groupName }}
</view>
</view>
</view>
<!-- 出场顺序列表 -->
<view class="lineup-list" v-if="currentGroup">
<view class="group-header">
<text class="group-venue">{{ currentGroup.venueName }}</text>
<text class="group-time">{{ currentGroup.timeSlot }}</text>
<text class="group-table">表号: {{ currentGroup.tableNo }}</text>
</view>
<view class="lineup-item" v-for="(item, index) in currentGroup.participants" :key="index">
<view class="lineup-order">
<view class="order-number">{{ item.order }}</view>
<text class="order-text"></text>
</view>
<view class="lineup-info">
<view class="lineup-name">{{ item.playerName }}</view>
<view class="lineup-detail">
<text class="detail-item">{{ item.organization }}</text>
<text class="detail-divider" v-if="item.estimatedTime"> | </text>
<text class="detail-item" v-if="item.estimatedTime">{{ item.estimatedTime }}</text>
</view>
</view>
<view class="lineup-status" :class="item.status">
{{ getStatusText(item.status) }}
</view>
</view>
<view v-if="!currentGroup.participants || currentGroup.participants.length === 0" class="empty-list">
<text>暂无参赛者信息</text>
</view>
</view>
</template>
</view>
</template>
<script>
import { getScheduleStatus, getLineup } from '@/api/schedule.js'
export default {
data() {
return {
currentGroup: 0,
groups: ['男子A组', '男子B组', '女子A组'],
lineups: {
0: [
{
order: 1,
name: '张三',
team: '北京队',
time: '09:00',
status: 'finished',
statusText: '已完成'
},
{
order: 2,
name: '李四',
team: '上海队',
time: '09:15',
status: 'finished',
statusText: '已完成'
},
{
order: 3,
name: '王五',
team: '广东队',
time: '09:30',
status: 'ongoing',
statusText: '进行中'
},
{
order: 4,
name: '赵六',
team: '天津队',
time: '09:45',
status: 'waiting',
statusText: '待出场'
},
{
order: 5,
name: '刘七',
team: '江苏队',
time: '10:00',
status: 'waiting',
statusText: '待出场'
}
],
1: [
{
order: 1,
name: '孙八',
team: '浙江队',
time: '10:30',
status: 'waiting',
statusText: '待出场'
},
{
order: 2,
name: '周九',
team: '湖北队',
time: '10:45',
status: 'waiting',
statusText: '待出场'
}
],
2: [
{
order: 1,
name: '小红',
team: '四川队',
time: '14:00',
status: 'waiting',
statusText: '待出场'
},
{
order: 2,
name: '小芳',
team: '河南队',
time: '14:15',
status: 'waiting',
statusText: '待出场'
}
]
}
};
eventId: '',
orderId: '',
loading: true,
isScheduleCompleted: false,
currentGroupIndex: 0,
groups: []
}
},
computed: {
currentLineup() {
return this.lineups[this.currentGroup] || [];
currentGroup() {
return this.groups[this.currentGroupIndex] || null
}
},
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId
this.orderId = options.orderId || null
this.checkScheduleStatus()
}
},
methods: {
async checkScheduleStatus() {
try {
const res = await getScheduleStatus(this.eventId)
if (res) {
this.isScheduleCompleted = res.isCompleted
if (this.isScheduleCompleted) {
await this.loadLineup()
}
}
} catch (error) {
console.error('检查编排状态失败:', error)
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
this.loading = false
}
},
async loadLineup() {
try {
const res = await getLineup(this.eventId, null, this.orderId)
if (res && res.groups) {
this.groups = res.groups
}
} catch (error) {
console.error('加载出场顺序失败:', error)
}
},
getStatusText(status) {
const map = {
'waiting': '待出场',
'未签到': '待出场',
'已完成': '已完成',
'进行中': '进行中',
'异常': '异常',
'ongoing': '进行中',
'finished': '已完成'
}
return map[status] || '待出场'
}
}
};
}
</script>
<style lang="scss" scoped>
@@ -138,6 +138,38 @@ export default {
background-color: #f5f5f5;
}
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 300rpx;
color: #666;
}
.not-ready {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 40rpx;
}
.not-ready-icon {
font-size: 80rpx;
margin-bottom: 30rpx;
}
.not-ready-text {
font-size: 32rpx;
color: #333;
margin-bottom: 15rpx;
}
.not-ready-hint {
font-size: 26rpx;
color: #999;
}
.group-tabs {
background-color: #fff;
display: flex;
@@ -166,6 +198,21 @@ export default {
padding: 0 30rpx 20rpx;
}
.group-header {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx 30rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.group-venue, .group-time, .group-table {
font-size: 26rpx;
color: #666;
}
.lineup-item {
background-color: #fff;
border-radius: 16rpx;
@@ -216,10 +263,6 @@ export default {
color: #666666;
}
.divider {
margin: 0 10rpx;
}
.lineup-status {
padding: 8rpx 20rpx;
border-radius: 8rpx;
@@ -227,18 +270,28 @@ export default {
flex-shrink: 0;
}
.lineup-status.finished {
.lineup-status.finished,
.lineup-status.已完成 {
background-color: #E8F5E9;
color: #4CAF50;
}
.lineup-status.ongoing {
.lineup-status.ongoing,
.lineup-status.进行中 {
background-color: #FFF3E0;
color: #FF9800;
}
.lineup-status.waiting {
.lineup-status.waiting,
.lineup-status.未签到 {
background-color: #F5F5F5;
color: #999999;
}
.empty-list {
text-align: center;
padding: 60rpx;
color: #999;
font-size: 28rpx;
}
</style>
+15 -14
View File
@@ -133,23 +133,24 @@ export default {
}
const res = await athleteAPI.getAthleteList(params)
console.log('=== 选手列表响应 ===', res)
if (res.code === 200 && res.data) {
const records = res.data.records || []
// request.js already extracts data.data, so res is the actual data
const records = res.records || res || []
if (isLoadMore) {
this.playersList = [...this.playersList, ...records]
} else {
this.playersList = records
this.page = 1
}
this.totalCount = res.data.total || 0
this.hasMore = this.playersList.length < this.totalCount
// 统计已确认人数
this.confirmedCount = this.playersList.filter(p => p.registrationStatus === 1).length
if (isLoadMore) {
this.playersList = [...this.playersList, ...records]
} else {
this.playersList = Array.isArray(records) ? records : []
this.page = 1
}
this.totalCount = res.total || this.playersList.length
this.hasMore = this.playersList.length < this.totalCount
// 统计已确认人数
this.confirmedCount = this.playersList.filter(p => p.registrationStatus === 1).length
} catch (error) {
console.error('加载选手列表失败:', error)
uni.showToast({
File diff suppressed because it is too large Load Diff
+44 -110
View File
@@ -71,40 +71,60 @@ export default {
data() {
return {
eventId: '',
// 附件列表
attachments: [],
// 规程章节列表
rulesList: []
};
},
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId
this.loadRulesData()
this.loadAttachments(options.eventId)
this.loadRulesData(options.eventId)
}
},
methods: {
/**
* 加载规程数据
* 加载附件列表
*/
async loadRulesData() {
async loadAttachments(eventId) {
try {
// 调用API获取规程数据
const res = await competitionAPI.getCompetitionRules(this.eventId)
const res = await competitionAPI.getAttachments({
competitionId: eventId,
type: 'rules'
})
// 处理附件数据
if (res.attachments && res.attachments.length > 0) {
this.attachments = res.attachments.map(file => ({
id: file.id,
fileName: file.name || file.fileName,
fileUrl: file.url || file.fileUrl,
fileSize: this.formatFileSize(file.size || file.fileSize),
fileType: this.getFileType(file.name || file.fileName)
}))
let list = []
if (res && Array.isArray(res)) {
list = res
} else if (res && res.records) {
list = res.records
} else if (res && res.data && Array.isArray(res.data)) {
list = res.data
}
if (list.length > 0) {
this.attachments = list.map(file => ({
id: file.id,
fileName: file.fileName || file.name,
fileUrl: file.fileUrl || file.url,
fileSize: this.formatFileSize(file.fileSize || file.size),
fileType: file.fileType || this.getFileType(file.fileName || file.name)
}))
}
} catch (err) {
console.error('加载附件失败:', err)
}
},
/**
* 加载规程数据
*/
async loadRulesData(eventId) {
try {
const res = await competitionAPI.getCompetitionRules(eventId)
// 处理规程内容数据
if (res.chapters && res.chapters.length > 0) {
if (res && res.chapters && res.chapters.length > 0) {
this.rulesList = res.chapters.map(chapter => ({
chapter: chapter.chapterNumber || chapter.number,
title: chapter.title || chapter.name,
@@ -114,76 +134,9 @@ export default {
}
} catch (err) {
console.error('加载规程数据失败:', err)
// 如果API失败,使用模拟数据
this.loadMockData()
}
},
/**
* 加载模拟数据(用于开发测试)
*/
loadMockData() {
this.attachments = [
{
id: '1',
fileName: '2025年郑州武术大赛规程.pdf',
fileUrl: 'https://example.com/rules.pdf',
fileSize: '2.5 MB',
fileType: 'pdf'
},
{
id: '2',
fileName: '参赛报名表.docx',
fileUrl: 'https://example.com/form.docx',
fileSize: '156 KB',
fileType: 'docx'
}
]
this.rulesList = [
{
chapter: '第一章',
title: '总则',
expanded: false,
contents: [
'1.1 本次比赛遵循国际武术联合会竞赛规则。',
'1.2 所有参赛选手必须持有效证件参赛。',
'1.3 参赛选手须服从裁判判决,不得有违规行为。'
]
},
{
chapter: '第二章',
title: '参赛资格',
expanded: false,
contents: [
'2.1 参赛选手年龄须在18-45周岁之间。',
'2.2 参赛选手须持有武术等级证书或相关证明。',
'2.3 参赛选手须通过健康检查,身体状况良好。'
]
},
{
chapter: '第三章',
title: '比赛规则',
expanded: false,
contents: [
'3.1 比赛采用单败淘汰制。',
'3.2 每场比赛时间为3分钟,分3局进行。',
'3.3 得分规则按照国际标准执行。'
]
},
{
chapter: '第四章',
title: '奖项设置',
expanded: false,
contents: [
'4.1 各组别设金、银、铜牌各一枚。',
'4.2 设最佳表现奖、体育道德风尚奖等特别奖项。',
'4.3 所有参赛选手均可获得参赛证书。'
]
}
]
},
/**
* 切换章节展开/收起
*/
@@ -195,14 +148,12 @@ export default {
* 下载文件
*/
downloadFile(file) {
// 获取文件后缀
const fileExt = file.fileType || this.getFileType(file.fileName) || 'pdf'
// #ifdef H5
// H5环境:直接使用a标签下载,确保文件名带后缀
const link = document.createElement('a')
link.href = file.fileUrl
link.download = file.fileName // 设置下载文件名(带后缀)
link.download = file.fileName
link.target = '_blank'
link.style.display = 'none'
document.body.appendChild(link)
@@ -216,37 +167,22 @@ export default {
// #endif
// #ifndef H5
// 非H5环境
uni.showLoading({
title: '准备下载'
})
// 下载文件
uni.showLoading({ title: '准备下载' })
uni.downloadFile({
url: file.fileUrl,
success: (res) => {
if (res.statusCode === 200) {
// 保存文件到本地
const filePath = res.tempFilePath
// 打开文档
uni.openDocument({
filePath: filePath,
filePath: res.tempFilePath,
fileType: fileExt,
success: () => {
uni.hideLoading()
uni.showToast({
title: '打开成功',
icon: 'success'
})
uni.showToast({ title: '打开成功', icon: 'success' })
},
fail: (err) => {
uni.hideLoading()
console.error('打开文件失败:', err)
uni.showToast({
title: '打开失败',
icon: 'none'
})
uni.showToast({ title: '打开失败', icon: 'none' })
}
})
}
@@ -254,10 +190,7 @@ export default {
fail: (err) => {
uni.hideLoading()
console.error('下载失败:', err)
uni.showToast({
title: '下载失败',
icon: 'none'
})
uni.showToast({ title: '下载失败', icon: 'none' })
}
})
// #endif
@@ -267,6 +200,7 @@ export default {
* 获取文件类型
*/
getFileType(fileName) {
if (!fileName) return 'pdf'
const ext = fileName.split('.').pop().toLowerCase()
return ext
},
+281 -292
View File
@@ -1,7 +1,29 @@
<template>
<view class="event-schedule-page">
<!-- 附件下载区 -->
<view class="attachments-section" v-if="attachments.length > 0">
<view class="section-title">
<text class="title-icon">📎</text>
<text class="title-text">日程附件</text>
</view>
<view class="attachments-list">
<view class="attachment-item" v-for="(file, index) in attachments" :key="index" @click="downloadFile(file)">
<view class="file-info">
<text class="file-icon">{{ getFileIcon(file.fileType) }}</text>
<view class="file-details">
<text class="file-name">{{ file.fileName }}</text>
<text class="file-size">{{ file.fileSize }}</text>
</view>
</view>
<view class="download-btn">
<text class="download-icon"></text>
</view>
</view>
</view>
</view>
<!-- 日期选择器 -->
<view class="date-tabs">
<view class="date-tabs" v-if="dates.length > 0">
<view
class="date-tab"
v-for="(date, index) in dates"
@@ -15,7 +37,7 @@
</view>
<!-- 日程时间线 -->
<view class="schedule-timeline">
<view class="schedule-timeline" v-if="currentSchedule.length > 0">
<view class="timeline-item" v-for="(item, index) in currentSchedule" :key="index">
<view class="time-dot"></view>
<view class="time-line" v-if="index < currentSchedule.length - 1"></view>
@@ -29,11 +51,18 @@
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="attachments.length === 0 && dates.length === 0">
<text class="empty-icon">📅</text>
<text class="empty-text">暂无日程安排</text>
</view>
</view>
</template>
<script>
import infoAPI from '@/api/info.js'
import competitionAPI from '@/api/competition.js'
export default {
data() {
@@ -41,7 +70,8 @@ export default {
eventId: '',
currentDate: 0,
dates: [],
schedules: {}
schedules: {},
attachments: []
};
},
computed: {
@@ -52,6 +82,7 @@ export default {
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId
this.loadAttachments(options.eventId)
this.loadScheduleDates(options.eventId)
}
},
@@ -63,6 +94,132 @@ export default {
}
},
methods: {
/**
* 加载附件列表
*/
async loadAttachments(eventId) {
try {
const res = await competitionAPI.getAttachments({
competitionId: eventId,
type: 'schedule'
})
let list = []
if (res && Array.isArray(res)) {
list = res
} else if (res && res.records) {
list = res.records
} else if (res && res.data && Array.isArray(res.data)) {
list = res.data
}
if (list.length > 0) {
this.attachments = list.map(file => ({
id: file.id,
fileName: file.fileName || file.name,
fileUrl: file.fileUrl || file.url,
fileSize: this.formatFileSize(file.fileSize || file.size),
fileType: file.fileType || this.getFileType(file.fileName || file.name)
}))
}
} catch (err) {
console.error('加载附件失败:', err)
}
},
/**
* 下载文件
*/
downloadFile(file) {
const fileExt = file.fileType || this.getFileType(file.fileName) || 'pdf'
// #ifdef H5
const link = document.createElement('a')
link.href = file.fileUrl
link.download = file.fileName
link.target = '_blank'
link.style.display = 'none'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
uni.showToast({
title: '开始下载',
icon: 'success'
})
return
// #endif
// #ifndef H5
uni.showLoading({ title: '准备下载' })
uni.downloadFile({
url: file.fileUrl,
success: (res) => {
if (res.statusCode === 200) {
uni.openDocument({
filePath: res.tempFilePath,
fileType: fileExt,
success: () => {
uni.hideLoading()
uni.showToast({ title: '打开成功', icon: 'success' })
},
fail: (err) => {
uni.hideLoading()
console.error('打开文件失败:', err)
uni.showToast({ title: '打开失败', icon: 'none' })
}
})
}
},
fail: (err) => {
uni.hideLoading()
console.error('下载失败:', err)
uni.showToast({ title: '下载失败', icon: 'none' })
}
})
// #endif
},
/**
* 获取文件类型
*/
getFileType(fileName) {
if (!fileName) return 'pdf'
const ext = fileName.split('.').pop().toLowerCase()
return ext
},
/**
* 获取文件图标
*/
getFileIcon(fileType) {
const iconMap = {
'pdf': '📕',
'doc': '📘',
'docx': '📘',
'xls': '📗',
'xlsx': '📗',
'ppt': '📙',
'pptx': '📙',
'txt': '📄',
'zip': '📦',
'rar': '📦'
}
return iconMap[fileType] || '📄'
},
/**
* 格式化文件大小
*/
formatFileSize(bytes) {
if (!bytes || bytes === 0) return '0 B'
if (typeof bytes === 'string') return bytes
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i]
},
/**
* 加载日程日期列表
*/
@@ -77,9 +234,8 @@ export default {
list = res
}
// 如果后端没有数据,使用模拟数据
if (list.length === 0) {
list = this.getMockScheduleData()
return
}
// 提取唯一日期
@@ -93,7 +249,7 @@ export default {
// 格式化日期选项卡并排序
this.dates = Array.from(dateSet)
.sort((a, b) => new Date(a) - new Date(b)) // 按日期升序排序
.sort((a, b) => new Date(a) - new Date(b))
.map(date => {
const d = new Date(date)
const month = d.getMonth() + 1
@@ -119,7 +275,7 @@ export default {
this.schedules[dateIndex].push({
time: this.formatTime(item.scheduleTime || item.schedule_time || item.time),
timeRaw: item.scheduleTime || item.schedule_time || item.time, // 保存原始时间用于排序
timeRaw: item.scheduleTime || item.schedule_time || item.time,
title: item.eventName || item.event_name || item.title || item.activityName || item.scheduleName,
location: item.venue || item.location || ''
})
@@ -141,59 +297,6 @@ export default {
}
} catch (err) {
console.error('加载日程日期失败:', err)
// 加载失败时使用模拟数据
const list = this.getMockScheduleData()
// 提取唯一日期
const dateSet = new Set()
list.forEach(item => {
if (item.scheduleDate) {
dateSet.add(item.scheduleDate)
}
})
// 格式化日期选项卡并排序
this.dates = Array.from(dateSet)
.sort((a, b) => new Date(a) - new Date(b)) // 按日期升序排序
.map(date => {
const d = new Date(date)
const month = d.getMonth() + 1
const day = d.getDate()
const weekDay = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][d.getDay()]
return {
date: date,
day: `${month}${day}`,
text: weekDay
}
})
// 按日期分组日程
list.forEach(item => {
const dateIndex = this.dates.findIndex(d => d.date === item.scheduleDate)
if (dateIndex >= 0) {
if (!this.schedules[dateIndex]) {
this.schedules[dateIndex] = []
}
this.schedules[dateIndex].push({
time: this.formatTime(item.scheduleTime),
timeRaw: item.scheduleTime, // 保存原始时间用于排序
title: item.eventName,
location: item.venue || ''
})
}
})
// 对每个日期内的日程按时间排序
Object.keys(this.schedules).forEach(dateIndex => {
this.schedules[dateIndex].sort((a, b) => {
const timeA = a.timeRaw || a.time
const timeB = b.timeRaw || b.time
return timeA.localeCompare(timeB)
})
})
}
},
@@ -226,7 +329,6 @@ export default {
return timeA.localeCompare(timeB)
})
// 触发视图更新
this.$forceUpdate()
}
} catch (err) {
@@ -240,17 +342,14 @@ export default {
formatTime(timeStr) {
if (!timeStr) return ''
// 如果已经是 HH:MM 格式
if (/^\d{2}:\d{2}$/.test(timeStr)) {
return timeStr
}
// 如果是 HH:MM:SS 格式,直接截取前5位
if (/^\d{2}:\d{2}:\d{2}$/.test(timeStr)) {
return timeStr.substring(0, 5)
}
// 尝试解析完整的日期时间字符串
const date = new Date(timeStr)
if (!isNaN(date.getTime())) {
const hours = String(date.getHours()).padStart(2, '0')
@@ -258,235 +357,7 @@ export default {
return `${hours}:${minutes}`
}
// 如果无法解析,返回原字符串
return timeStr
},
/**
* 获取模拟日程数据
*/
getMockScheduleData() {
return [
// 第一天:2025-12-25 (报到日)
{
id: 2001,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '08:00',
eventName: '运动员报到',
venue: '赛事组委会接待处',
status: 1
},
{
id: 2002,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '09:00',
eventName: '领取参赛证件及装备',
venue: '赛事组委会接待处',
status: 1
},
{
id: 2003,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '10:00',
eventName: '赛前技术会议',
venue: '会议室A',
status: 1
},
{
id: 2004,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '14:00',
eventName: '场地开放训练',
venue: '主赛场',
status: 1
},
{
id: 2005,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '16:00',
eventName: '裁判员培训会',
venue: '会议室B',
status: 1
},
{
id: 2006,
competitionId: 200,
scheduleDate: '2025-12-25',
scheduleTime: '18:00',
eventName: '开幕式彩排',
venue: '主赛场',
status: 1
},
// 第二天:2025-12-26 (正式比赛第一天)
{
id: 2007,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '07:30',
eventName: '运动员检录',
venue: '检录处',
status: 1
},
{
id: 2008,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '08:30',
eventName: '开幕式',
venue: '主赛场',
status: 1
},
{
id: 2009,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '09:00',
eventName: '男子长拳预赛',
venue: '主赛场',
status: 1
},
{
id: 2010,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '10:30',
eventName: '女子长拳预赛',
venue: '主赛场',
status: 1
},
{
id: 2011,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '12:00',
eventName: '午休',
venue: '',
status: 1
},
{
id: 2012,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '14:00',
eventName: '男子太极拳预赛',
venue: '主赛场',
status: 1
},
{
id: 2013,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '15:30',
eventName: '女子太极拳预赛',
venue: '主赛场',
status: 1
},
{
id: 2014,
competitionId: 200,
scheduleDate: '2025-12-26',
scheduleTime: '17:00',
eventName: '当日赛事总结会',
venue: '会议室A',
status: 1
},
// 第三天:2025-12-27 (正式比赛第二天 - 决赛日)
{
id: 2015,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '07:30',
eventName: '运动员检录',
venue: '检录处',
status: 1
},
{
id: 2016,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '08:30',
eventName: '男子长拳半决赛',
venue: '主赛场',
status: 1
},
{
id: 2017,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '10:00',
eventName: '女子长拳半决赛',
venue: '主赛场',
status: 1
},
{
id: 2018,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '12:00',
eventName: '午休',
venue: '',
status: 1
},
{
id: 2019,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '14:00',
eventName: '男子长拳决赛',
venue: '主赛场',
status: 1
},
{
id: 2020,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '15:00',
eventName: '女子长拳决赛',
venue: '主赛场',
status: 1
},
{
id: 2021,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '16:00',
eventName: '男子太极拳决赛',
venue: '主赛场',
status: 1
},
{
id: 2022,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '17:00',
eventName: '女子太极拳决赛',
venue: '主赛场',
status: 1
},
{
id: 2023,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '18:00',
eventName: '颁奖典礼',
venue: '主赛场',
status: 1
},
{
id: 2024,
competitionId: 200,
scheduleDate: '2025-12-27',
scheduleTime: '19:00',
eventName: '闭幕式',
venue: '主赛场',
status: 1
}
]
}
}
};
@@ -498,6 +369,104 @@ export default {
background-color: #f5f5f5;
}
// 区块标题
.section-title {
display: flex;
align-items: center;
gap: 10rpx;
margin-bottom: 20rpx;
padding: 0 10rpx;
}
.title-icon {
font-size: 32rpx;
}
.title-text {
font-size: 30rpx;
font-weight: bold;
color: #333333;
}
// 附件下载区
.attachments-section {
padding: 20rpx 30rpx;
margin-bottom: 10rpx;
}
.attachments-list {
display: flex;
flex-direction: column;
gap: 15rpx;
}
.attachment-item {
background-color: #fff;
border-radius: 16rpx;
padding: 25rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s;
&:active {
background-color: #f8f8f8;
transform: scale(0.98);
}
}
.file-info {
display: flex;
align-items: center;
gap: 20rpx;
flex: 1;
min-width: 0;
}
.file-icon {
font-size: 48rpx;
flex-shrink: 0;
}
.file-details {
display: flex;
flex-direction: column;
gap: 8rpx;
flex: 1;
min-width: 0;
}
.file-name {
font-size: 28rpx;
color: #333333;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-size {
font-size: 24rpx;
color: #999999;
}
.download-btn {
width: 60rpx;
height: 60rpx;
background-color: #C93639;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.download-icon {
font-size: 32rpx;
color: #fff;
}
.date-tabs {
background-color: #fff;
display: flex;
@@ -594,4 +563,24 @@ export default {
.location-icon {
font-size: 22rpx;
}
// 空状态
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 0;
gap: 20rpx;
}
.empty-icon {
font-size: 120rpx;
opacity: 0.3;
}
.empty-text {
font-size: 28rpx;
color: #999999;
}
</style>
+18 -2
View File
@@ -138,7 +138,7 @@ export default {
matchTime: this.formatTimeRange(startTime, endTime) ||
item.matchTime || item.competitionTime || '待定',
registerCount: item.registrationCount || item.registerCount || item.signUpCount || item.totalParticipants || '0',
status: this.getStatus(item.status)
status: this.getStatus(item.status, regEndTime, endTime)
}
})
@@ -174,12 +174,28 @@ export default {
* @param {Number|String} status 状态码
* @returns {String}
*/
getStatus(status) {
getStatus(status, regEndTime, competitionEndTime) {
// 根据后端状态码映射为前端需要的状态
// 1: 报名中, 2: 进行中, 3: 已结束
if (status === 3 || status === '3' || status === 'finished') {
return 'finished'
}
// 根据比赛结束时间判断是否已结束
if (competitionEndTime) {
const compEndDate = new Date(competitionEndTime)
const now = new Date()
if (now > compEndDate) {
return 'finished'
}
}
// 根据报名结束时间判断是否已结束
if (regEndTime) {
const endDate = new Date(regEndTime)
const now = new Date()
if (now > endDate) {
return 'finished'
}
}
return 'open'
},
+127 -13
View File
@@ -19,22 +19,22 @@
<view class="event-info">
<text class="label">地点</text>
<text class="value">{{ item.location }}</text>
<text class="value location-text">{{ item.location || "暂无" }}</text>
</view>
<view class="event-info">
<text class="label">比赛时间</text>
<text class="value">{{ item.matchTime }}</text>
<text class="value">{{ item.matchTime || "暂无" }}</text>
</view>
<view class="event-info">
<text class="label">报名项目</text>
<text class="value">{{ item.projects }}</text>
<text class="value">{{ item.projects || "暂无" }}</text>
</view>
<view class="event-info">
<text class="label">联系人</text>
<text class="value">{{ item.contact }}</text>
<text class="value">{{ item.contact || "暂无" }}</text>
</view>
<view class="event-info">
@@ -42,8 +42,8 @@
<text class="value participants">{{ item.participants }}</text>
</view>
<view class="event-footer" v-if="item.status === 'ongoing'">
<view class="register-note">
<view class="event-footer">
<view class="register-note" v-if="item.status === 'ongoing'">
<text>点击后进入赛事详情页面</text>
</view>
<view class="view-cert-btn" @click.stop="handleViewCert(item)">
@@ -58,6 +58,26 @@
<view class="empty-state" v-if="filteredList.length === 0">
<text class="empty-text">暂无报名记录</text>
</view>
<!-- 证件弹窗 -->
<view class="cert-modal" v-if="showCertModal" @click="closeCertModal">
<view class="cert-modal-content" @click.stop>
<view class="cert-modal-header">
<text class="cert-modal-title">参赛选手证件</text>
<text class="cert-close-icon" @click="closeCertModal"></text>
</view>
<scroll-view class="cert-modal-body" scroll-y>
<view class="cert-athlete-item" v-for="(athlete, index) in certAthleteList" :key="index">
<view class="cert-athlete-name">{{ athlete.playerName }}</view>
<view class="cert-athlete-info">性别{{ athlete.gender === 1 ? '男' : '女' }}</view>
<view class="cert-athlete-info">身份证{{ athlete.idCard || '暂无' }}</view>
</view>
<view class="cert-empty" v-if="certAthleteList.length === 0">
<text>暂无选手信息</text>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
@@ -80,7 +100,9 @@ export default {
current: 1,
size: 20
},
hasMore: true
hasMore: true,
showCertModal: false,
certAthleteList: []
};
},
onLoad() {
@@ -235,7 +257,8 @@ export default {
) || '',
projects: item.projectNames || this.formatProjects(item.projects) || '',
contact: item.contactPhone || item.contactPerson || '',
participants: item.athleteNames || `${item.totalParticipants || 0}`
participants: item.athleteNames || `${item.totalParticipants || 0}`,
athleteList: item.athleteList || []
}
},
@@ -318,14 +341,24 @@ export default {
},
goToEventDetail(item) {
uni.navigateTo({
url: '/pages/event-detail/event-detail?id=' + item.id
url: '/pages/event-detail/event-detail?id=' + item.competitionId + '&orderId=' + item.id
});
},
handleViewCert(item) {
uni.showToast({
title: '查看证件',
icon: 'none'
});
// Get athlete list from the item
if (item.athleteList && item.athleteList.length > 0) {
this.certAthleteList = item.athleteList;
this.showCertModal = true;
} else {
uni.showToast({
title: '暂无选手证件信息',
icon: 'none'
});
}
},
closeCertModal() {
this.showCertModal = false;
this.certAthleteList = [];
}
}
};
@@ -396,6 +429,14 @@ export default {
flex: 1;
}
.location-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
max-width: 480rpx;
}
.participants {
word-break: break-all;
}
@@ -438,4 +479,77 @@ export default {
font-size: 28rpx;
color: #999999;
}
/* Cert Modal Styles */
.cert-modal {
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;
}
.cert-modal-content {
background-color: #fff;
border-radius: 16rpx;
width: 85%;
max-height: 70vh;
overflow: hidden;
}
.cert-modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.cert-modal-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.cert-close-icon {
font-size: 36rpx;
color: #999;
cursor: pointer;
}
.cert-modal-body {
max-height: 50vh;
padding: 20rpx 30rpx;
}
.cert-athlete-item {
padding: 20rpx;
background-color: #f9f9f9;
border-radius: 12rpx;
margin-bottom: 20rpx;
}
.cert-athlete-name {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.cert-athlete-info {
font-size: 26rpx;
color: #666;
margin-bottom: 6rpx;
}
.cert-empty {
text-align: center;
padding: 40rpx;
color: #999;
}
</style>
+24 -7
View File
@@ -39,19 +39,27 @@ export default {
onLoad(options) {
if (options.eventId) {
this.eventId = options.eventId;
this.loadProjectList(options.eventId)
}
if (options.type) {
this.type = options.type;
}
if (this.eventId) {
this.loadProjectList(this.eventId)
}
},
methods: {
/**
* 加载报名项目列表
*/
async loadProjectList(eventId) {
try {
const res = await competitionAPI.getProjectList({ competitionId: eventId })
const params = { competitionId: eventId }
// Filter by participation type: single=1, team=2
if (this.type === 'single') {
params.type = 1
} else if (this.type === 'team') {
params.type = 2
}
const res = await competitionAPI.getProjectList(params)
let list = []
if (res.records) {
@@ -60,11 +68,11 @@ export default {
list = res
}
// 数据映射
this.projectList = list.map(item => ({
id: item.id,
name: item.name || item.projectName,
price: item.price || item.registrationFee || 0,
type: item.type || (this.type === 'team' ? 2 : 1),
selected: false
}))
} catch (err) {
@@ -80,6 +88,7 @@ export default {
item.selected = !item.selected;
this.$forceUpdate();
},
handleRegister() {
const selectedProjects = this.projectList.filter(item => item.selected);
if (selectedProjects.length === 0) {
@@ -90,8 +99,16 @@ export default {
return;
}
// Include type in selected projects data
const projectsData = selectedProjects.map(p => ({
id: p.id,
name: p.name,
price: p.price,
type: p.type
}))
uni.navigateTo({
url: `/pages/event-register/event-register?eventId=${this.eventId}&projects=${encodeURIComponent(JSON.stringify(selectedProjects))}`
url: `/pages/event-register/event-register?eventId=${this.eventId}&projects=${encodeURIComponent(JSON.stringify(projectsData))}`
});
}
}