|
@@ -6,7 +6,7 @@
|
|
|
<el-col :span="24" class="one">
|
|
|
<a-list :loading="loading" :grid="{ gutter: 14, column: 4 }" :data-source="list">
|
|
|
<template #renderItem="{ item }">
|
|
|
- <el-col :span="24" class="list" @click="toView(item)">
|
|
|
+ <el-col :span="24" class="list">
|
|
|
<el-col :span="24" class="name textOver">
|
|
|
<el-tooltip effect="dark" :content="item.name" placement="top">
|
|
|
{{ item.match_name || '暂无比赛名称' }}
|
|
@@ -14,17 +14,24 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two_1">
|
|
|
<span>比赛日期:</span>
|
|
|
- {{ item.match_time || '暂无' }}
|
|
|
+ {{ getTime(item.match_time) }}
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two_1">
|
|
|
- <span>组织单位:</span>
|
|
|
- {{ item.organization || '暂无组织单位' }}
|
|
|
+ <span>报名费:</span>
|
|
|
+ {{ item.money || '暂无' }}
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two_1 textOver">
|
|
|
<span>报名时间:</span>
|
|
|
{{ item.time || '暂无' }}
|
|
|
</el-col>
|
|
|
+ <el-col :span="24" class="two_1 two_2 textOver">
|
|
|
+ <span>赛事状态:</span>
|
|
|
+ {{ getDict(item.status, 'status') }}
|
|
|
+ </el-col>
|
|
|
<el-col :span="24" class="bottom">
|
|
|
+ <el-button @click.stop="toDel(item)" type="danger" size="small">
|
|
|
+ 取消报名
|
|
|
+ </el-button>
|
|
|
<el-button @click.stop="toView(item)" type="primary" size="small">
|
|
|
查看赛事详情
|
|
|
</el-button>
|
|
@@ -73,7 +80,7 @@ let skip = 0
|
|
|
let limit = inject('limit')
|
|
|
const total = ref(0)
|
|
|
// 字典表
|
|
|
-const cardTypeList = ref([])
|
|
|
+const statusList = ref([])
|
|
|
// 查看
|
|
|
const toView = (item) => {
|
|
|
router.push({ path: '/innovation/detail', query: { id: item.match } })
|
|
@@ -87,9 +94,9 @@ onMounted(async () => {
|
|
|
})
|
|
|
const searchOther = async () => {
|
|
|
let result
|
|
|
- // 证件类型
|
|
|
- result = await dictDataStore.query({ code: 'cardType', is_use: '0' })
|
|
|
- if ($checkRes(result)) cardTypeList.value = result.data
|
|
|
+ // 赛事状态
|
|
|
+ result = await dictDataStore.query({ code: 'matchStatus', is_use: '0' })
|
|
|
+ if ($checkRes(result)) statusList.value = result.data
|
|
|
}
|
|
|
const search = async (query = { skip: 0, limit }) => {
|
|
|
const info = {
|
|
@@ -97,18 +104,45 @@ const search = async (query = { skip: 0, limit }) => {
|
|
|
limit: query.limit,
|
|
|
user: user.value._id
|
|
|
}
|
|
|
- const res = await store.query(info)
|
|
|
+ const res = await store.sign(info)
|
|
|
if (res.errcode == '0') {
|
|
|
list.value = res.data
|
|
|
total.value = res.total
|
|
|
}
|
|
|
}
|
|
|
+// 时间
|
|
|
+const getTime = (data) => {
|
|
|
+ if (data) return `${data[0]} 至 ${data[1]}`
|
|
|
+}
|
|
|
// 字典数据转换
|
|
|
const getDict = (data, model) => {
|
|
|
let res
|
|
|
- if (model == 'cardType') res = cardTypeList.value.find((f) => f.value == data)
|
|
|
+ if (model == 'status') res = statusList.value.find((f) => f.value == data)
|
|
|
return get(res, 'label')
|
|
|
}
|
|
|
+// 取消报名
|
|
|
+const toDel = async (item) => {
|
|
|
+ if (item.status != '2') {
|
|
|
+ ElMessageBox.alert('确定取消该比赛的报名?', '取消报名', {
|
|
|
+ confirmButtonText: 'OK',
|
|
|
+ callback: async () => {
|
|
|
+ const res = await store.del(item._id)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ await search({ skip, limit })
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: `比赛: ${item.match_name}已取消`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: '该比赛报名已结束无法取消报名!',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
const currentPage = ref(1)
|
|
|
// 分页
|
|
|
const changePage = (page = currentPage.value) => {
|
|
@@ -131,7 +165,7 @@ const sizeChange = (limits) => {
|
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
|
|
|
border-radius: 2px;
|
|
|
width: 285px;
|
|
|
- height: 180px;
|
|
|
+ height: 190px;
|
|
|
margin-bottom: 15px;
|
|
|
cursor: pointer;
|
|
|
transition: all 0.3s;
|
|
@@ -163,6 +197,9 @@ const sizeChange = (limits) => {
|
|
|
color: #525a68;
|
|
|
}
|
|
|
}
|
|
|
+ .two_2 {
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
|
|
|
.bottom {
|
|
|
margin: 10px;
|