Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
48f7c858
提交
48f7c858
authored
5月 08, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 修改大赛训练的上传实验报告
上级
8bff36fb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
51 行增加
和
27 行删除
+51
-27
api.ts
src/modules/student/contest/api.ts
+20
-4
Book.vue
src/modules/student/contest/components/Book.vue
+1
-1
ReportDialog.vue
src/modules/student/contest/components/ReportDialog.vue
+24
-15
Lab.vue
src/modules/student/contest/views/Lab.vue
+6
-7
没有找到文件。
src/modules/student/contest/api.ts
浏览文件 @
48f7c858
...
...
@@ -87,7 +87,24 @@ export function getScoreReport(params: { competition_id: string }) {
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/score-report'
,
{
params
})
}
// 获取实验报告
export
function
getExperimentReport
(
params
:
{
competition_id
:
string
;
platform_key
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/train-report'
,
{
params
})
}
// 上传实验报告
export
function
uploadExperimentReport
(
data
:
{
experiment_id
:
string
;
file
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/student/experiment-record/upload-report'
,
data
)
}
\ No newline at end of file
export
function
uploadExperimentReport
(
data
:
{
competition_id
:
string
platform_key
:
string
name
:
string
url
:
string
size
:
number
desc
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/student/competition/save-train-report'
,
data
)
}
// 删除实验报告
export
function
deleteExperimentReport
(
data
:
{
id
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/student/competition/delete-train-report'
,
data
)
}
src/modules/student/contest/components/Book.vue
浏览文件 @
48f7c858
<
script
setup
lang=
"ts"
>
import
type
{
ExperimentBookType
}
from
'../types'
import
{
CloseBold
}
from
'@element-plus/icons-vue'
import
{
Document
,
CloseBold
}
from
'@element-plus/icons-vue'
import
Preview
from
'@/components/Preview.vue'
import
{
getExperimentBooks
}
from
'../api'
...
...
src/modules/student/contest/components/ReportDialog.vue
浏览文件 @
48f7c858
<
script
setup
lang=
"ts"
>
import
type
{
Contest
}
from
'../types'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
import
type
{
ExperimentRecord
}
from
'../types'
import
{
ElMessage
}
from
'element-plus'
import
dayjs
from
'dayjs'
import
{
uploadExperimentReport
}
from
'../api'
import
{
getExperimentReport
,
uploadExperimentReport
}
from
'../api'
interface
Props
{
data
:
any
data
:
Contest
}
const
props
=
defineProps
<
Props
>
()
const
detail
=
$ref
(
inject
<
any
>
(
'detail'
))
const
emit
=
defineEmits
<
{
(
e
:
'update'
):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
}
>
()
const
route
=
useRoute
()
const
formRef
=
$ref
<
FormInstance
>
()
const
form
=
reactive
<
any
>
({
files
:
[]
})
watchEffect
(()
=>
{
form
.
files
=
detail
?.
file
?
[
detail
.
file
]
:
[]
})
async
function
fetchInfo
()
{
const
res
=
await
getExperimentReport
({
competition_id
:
props
.
data
.
id
,
platform_key
:
route
.
query
.
type
as
string
})
const
detail
=
res
.
data
.
detail
form
.
files
=
detail
.
id
?
[
detail
]
:
[]
}
onMounted
(
fetchInfo
)
const
rules
=
ref
<
FormRules
>
({
files
:
[{
required
:
true
,
message
:
'请上传实验报告文件'
,
trigger
:
'blur'
}]
})
...
...
@@ -34,8 +41,12 @@ function handleSubmit() {
const
update
=
()
=>
{
const
[
file
]
=
form
.
files
uploadExperimentReport
({
experiment_id
:
props
.
data
,
file
:
JSON
.
stringify
({
name
:
file
.
name
,
url
:
file
.
url
,
upload_time
:
dayjs
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
})
competition_id
:
props
.
data
.
id
,
platform_key
:
route
.
query
.
type
as
string
,
name
:
file
.
name
,
url
:
file
.
url
,
size
:
file
.
size
,
desc
:
file
.
name
}).
then
(()
=>
{
ElMessage
({
message
:
'上传成功'
,
type
:
'success'
})
emit
(
'update'
)
...
...
@@ -49,15 +60,13 @@ const update = () => {
title=
"上传实验报告"
:close-on-click-modal=
"false"
width=
"600px"
@
update:modelValue=
"$emit('update:modelValue')"
>
@
update:modelValue=
"$emit('update:modelValue')"
>
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"rules"
>
<el-form-item
label=
"实验报告文件"
prop=
"files"
>
<AppUpload
v-model=
"form.files"
:limit=
"1"
accept=
".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.pdf,application/pdf,.ppt,.pptx,application/vnd.ms-powerpoint"
>
accept=
".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.pdf,application/pdf,.ppt,.pptx,application/vnd.ms-powerpoint"
>
<template
#
tip
>
实验报告文件只能上传一个,支持格式包含:doc docx pdf ppt pptx,大小不超过50M
</
template
>
</AppUpload>
</el-form-item>
...
...
src/modules/student/contest/views/Lab.vue
浏览文件 @
48f7c858
...
...
@@ -123,7 +123,6 @@ const handleShowHead = function () {
isHeadShow
=
!
isHeadShow
}
let
experimentId
=
$ref
(
''
)
const
getExperimentId
=
computed
(()
=>
{
const
item
=
competition
?.
train_platform_configs
.
find
((
item
:
any
)
=>
item
.
platform_key
===
route
.
query
.
type
)
let
value
=
'0'
...
...
@@ -133,7 +132,6 @@ const getExperimentId = computed(() => {
?
item
?.
url
.
substring
(
item
?.
url
.
indexOf
(
'experiment_id='
)
+
14
,
item
?.
url
.
length
+
1
)
:
'0'
}
experimentId
=
value
return
value
})
...
...
@@ -179,15 +177,13 @@ const reportDialogVisible = $ref(false)
<path
class=
"path-wapper"
d=
"M0 0l14.12 8.825A4 4 0 0116 12.217v61.566a4 4 0 01-1.88 3.392L0 86V0z"
fill=
"#f8f9fa"
></path>
fill=
"#f8f9fa"
></path>
<path
class=
"path-arrow"
style=
"transform: rotate(180deg); transform-origin: center"
d=
"M10.758 48.766a.778.778 0 000-1.127L6.996 43l3.762-4.639a.778.778 0 000-1.127.85.85 0 00-1.172 0l-4.344 5.202a.78.78 0 000 1.128l4.344 5.202a.85.85 0 001.172 0z"
fill=
"#8D9EA7"
fill-rule=
"nonzero"
></path>
fill-rule=
"nonzero"
></path>
</g>
</svg>
</div>
...
...
@@ -195,7 +191,10 @@ const reportDialogVisible = $ref(false)
</div>
</
template
>
</DragPanel>
<ReportDialog
v-model=
"reportDialogVisible"
:data=
"experimentId"
v-if=
"reportDialogVisible && experimentId"
></ReportDialog>
<ReportDialog
v-model=
"reportDialogVisible"
:data=
"competition"
v-if=
"reportDialogVisible && competition"
></ReportDialog>
</template>
<!-- 上传报告 -->
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论