fix bugs
This commit is contained in:
136
src/api/martial/attachment.js
Normal file
136
src/api/martial/attachment.js
Normal file
@@ -0,0 +1,136 @@
|
||||
import request from '@/axios';
|
||||
|
||||
// ==================== 赛事附件管理接口 ====================
|
||||
|
||||
/**
|
||||
* 获取附件详情
|
||||
* @param {Number} id - 附件ID
|
||||
*/
|
||||
export const getAttachmentDetail = (id) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/detail',
|
||||
method: 'get',
|
||||
params: { id }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件列表查询(分页)
|
||||
* @param {Number} current - 当前页
|
||||
* @param {Number} size - 每页条数
|
||||
* @param {Object} params - 查询参数
|
||||
*/
|
||||
export const getAttachmentList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
current,
|
||||
size,
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据赛事ID和类型获取附件列表
|
||||
* @param {Number} competitionId - 赛事ID
|
||||
* @param {String} attachmentType - 附件类型:info-赛事发布, rules-赛事规程, schedule-活动日程, results-成绩, medals-奖牌榜, photos-图片直播
|
||||
*/
|
||||
export const getAttachmentsByType = (competitionId, attachmentType) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/getByType',
|
||||
method: 'get',
|
||||
params: { competitionId, attachmentType }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据赛事ID获取所有附件
|
||||
* @param {Number} competitionId - 赛事ID
|
||||
*/
|
||||
export const getAttachmentsByCompetition = (competitionId) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/getByCompetition',
|
||||
method: 'get',
|
||||
params: { competitionId }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改附件
|
||||
* @param {Object} data - 附件数据
|
||||
* @param {Number} data.id - ID(修改时必传)
|
||||
* @param {Number} data.competitionId - 赛事ID
|
||||
* @param {String} data.attachmentType - 附件类型
|
||||
* @param {String} data.fileName - 文件名称
|
||||
* @param {String} data.fileUrl - 文件URL
|
||||
* @param {Number} data.fileSize - 文件大小(字节)
|
||||
* @param {String} data.fileType - 文件类型(扩展名)
|
||||
* @param {Number} data.orderNum - 排序序号
|
||||
* @param {Number} data.status - 状态(1-启用 0-禁用)
|
||||
*/
|
||||
export const submitAttachment = (data) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/submit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存附件
|
||||
* @param {Array} attachments - 附件列表
|
||||
*/
|
||||
export const batchSubmitAttachments = (attachments) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/batchSubmit',
|
||||
method: 'post',
|
||||
data: attachments
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
* @param {String} ids - 附件ID,多个用逗号分隔
|
||||
*/
|
||||
export const removeAttachment = (ids) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/remove',
|
||||
method: 'post',
|
||||
params: { ids }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除赛事的指定类型附件
|
||||
* @param {Number} competitionId - 赛事ID
|
||||
* @param {String} attachmentType - 附件类型
|
||||
*/
|
||||
export const removeAttachmentByType = (competitionId, attachmentType) => {
|
||||
return request({
|
||||
url: '/api/martial/competition/attachment/removeByType',
|
||||
method: 'post',
|
||||
params: { competitionId, attachmentType }
|
||||
})
|
||||
}
|
||||
|
||||
// 附件类型常量
|
||||
export const ATTACHMENT_TYPES = {
|
||||
INFO: 'info', // 赛事发布
|
||||
RULES: 'rules', // 赛事规程
|
||||
SCHEDULE: 'schedule', // 活动日程
|
||||
RESULTS: 'results', // 成绩
|
||||
MEDALS: 'medals', // 奖牌榜
|
||||
PHOTOS: 'photos' // 图片直播
|
||||
}
|
||||
|
||||
// 附件类型标签映射
|
||||
export const ATTACHMENT_TYPE_LABELS = {
|
||||
info: '赛事发布',
|
||||
rules: '赛事规程',
|
||||
schedule: '活动日程',
|
||||
results: '成绩',
|
||||
medals: '奖牌榜',
|
||||
photos: '图片直播'
|
||||
}
|
||||
Reference in New Issue
Block a user