Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
080a190e
提交
080a190e
authored
9月 26, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 新增参赛选手训练计数
上级
da7840f8
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
5 行删除
+12
-5
api.ts
src/modules/student/contest/api.ts
+5
-0
ContestItem.vue
src/modules/student/contest/components/ContestItem.vue
+7
-5
没有找到文件。
src/modules/student/contest/api.ts
浏览文件 @
080a190e
...
...
@@ -71,3 +71,8 @@ export function getExperimentRecord(params: { competition_id: string }) {
export
function
uploadExperimentPicture
(
data
:
{
competition_id
:
string
;
pictures
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/student/competition/save-pictures'
,
data
)
}
// 参赛选手训练计数
export
function
updateTrainCount
(
data
:
{
competition_id
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/student/competition/train-count'
,
data
)
}
src/modules/student/contest/components/ContestItem.vue
浏览文件 @
080a190e
...
...
@@ -2,7 +2,7 @@
import
type
{
Contest
}
from
'../types'
import
dayjs
from
'dayjs'
import
{
contestMode
}
from
'@/utils/dictionary'
import
{
updateTrainCount
}
from
'../api'
interface
Props
{
data
:
Contest
}
...
...
@@ -19,7 +19,11 @@ const modeText = $computed(() => {
const
canTrain
=
$computed
(()
=>
{
return
dayjs
().
isBefore
(
dayjs
(
parseInt
(
props
.
data
.
end_range
)
*
1000
))
})
function
handleTrain
()
{
// 训练计数
updateTrainCount
({
competition_id
:
props
.
data
.
id
})
router
.
push
({
path
:
`/student/contest/lab/
${
props
.
data
.
id
}
`
})
}
// 是否可以报名
const
canJoin
=
$computed
(()
=>
{
return
dayjs
().
isBefore
(
dayjs
(
parseInt
(
props
.
data
.
apply_expiration_date
)
*
1000
))
...
...
@@ -45,9 +49,7 @@ function handleJoin() {
<li>
参赛形式:
{{
modeText
}}
</li>
<li>
所属学校:
{{
data
.
org_name
}}
</li>
</ul>
<router-link
:to=
"`/student/contest/lab/$
{data.id}?name=${data.name}`" v-if="canTrain">
<el-button
round
type=
"primary"
>
我要训练
</el-button>
</router-link>
<el-button
round
type=
"primary"
@
click=
"handleTrain"
v-if=
"canTrain"
>
我要训练
</el-button>
</
template
>
<
template
v-else
>
<el-button
round
:disabled=
"!canJoin"
type=
"primary"
@
click=
"handleJoin"
>
我要报名
</el-button>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论