Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
8bff36fb
提交
8bff36fb
authored
5月 08, 2023
作者:
lhh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
9c46ba44
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
94 行增加
和
5 行删除
+94
-5
api.ts
src/modules/student/contest/api.ts
+6
-0
ReportDialog.vue
src/modules/student/contest/components/ReportDialog.vue
+70
-0
Lab.vue
src/modules/student/contest/views/Lab.vue
+8
-0
Index.vue
src/modules/student/lab/views/Index.vue
+10
-5
没有找到文件。
src/modules/student/contest/api.ts
浏览文件 @
8bff36fb
...
...
@@ -86,3 +86,8 @@ export function updateTrainCount(data: { competition_id: string }) {
export
function
getScoreReport
(
params
:
{
competition_id
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/score-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
src/modules/student/contest/components/ReportDialog.vue
0 → 100644
浏览文件 @
8bff36fb
<
script
setup
lang=
"ts"
>
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'
interface
Props
{
data
:
any
}
const
props
=
defineProps
<
Props
>
()
const
detail
=
$ref
(
inject
<
any
>
(
'detail'
))
const
emit
=
defineEmits
<
{
(
e
:
'update'
):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
}
>
()
const
formRef
=
$ref
<
FormInstance
>
()
const
form
=
reactive
<
any
>
({
files
:
[]
})
watchEffect
(()
=>
{
form
.
files
=
detail
?.
file
?
[
detail
.
file
]
:
[]
})
const
rules
=
ref
<
FormRules
>
({
files
:
[{
required
:
true
,
message
:
'请上传实验报告文件'
,
trigger
:
'blur'
}]
})
// 提交
function
handleSubmit
()
{
formRef
?.
validate
().
then
(
update
)
}
// 修改
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'
)
})
}).
then
(()
=>
{
ElMessage
({
message
:
'上传成功'
,
type
:
'success'
})
emit
(
'update'
)
emit
(
'update:modelValue'
,
false
)
})
}
</
script
>
<
template
>
<el-dialog
title=
"上传实验报告"
:close-on-click-modal=
"false"
width=
"600px"
@
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"
>
<template
#
tip
>
实验报告文件只能上传一个,支持格式包含:doc docx pdf ppt pptx,大小不超过50M
</
template
>
</AppUpload>
</el-form-item>
<el-row
justify=
"center"
>
<el-button
type=
"primary"
round
auto-insert-space
@
click=
"handleSubmit"
>
保存
</el-button>
<el-button
round
auto-insert-space
@
click=
"$emit('update:modelValue', false)"
>
取消
</el-button>
</el-row>
</el-form>
</el-dialog>
</template>
src/modules/student/contest/views/Lab.vue
浏览文件 @
8bff36fb
...
...
@@ -12,6 +12,7 @@ const Book = defineAsyncComponent(() => import('../components/Book.vue'))
const
Video
=
defineAsyncComponent
(()
=>
import
(
'../components/Video.vue'
))
const
Discuss
=
defineAsyncComponent
(()
=>
import
(
'../components/Discuss.vue'
))
const
Result
=
defineAsyncComponent
(()
=>
import
(
'../components/Result.vue'
))
const
ReportDialog
=
defineAsyncComponent
(()
=>
import
(
'../components/ReportDialog.vue'
))
const
route
=
useRoute
()
...
...
@@ -122,6 +123,7 @@ 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'
...
...
@@ -131,8 +133,11 @@ const getExperimentId = computed(() => {
?
item
?.
url
.
substring
(
item
?.
url
.
indexOf
(
'experiment_id='
)
+
14
,
item
?.
url
.
length
+
1
)
:
'0'
}
experimentId
=
value
return
value
})
const
reportDialogVisible
=
$ref
(
false
)
</
script
>
<
template
>
...
...
@@ -163,6 +168,7 @@ const getExperimentId = computed(() => {
<el-button
type=
"primary"
:icon=
"HomeFilled"
@
click=
"handleBackHome"
>
返回首页
</el-button>
<div>
<el-button
type=
"primary"
:loading=
"screenshotLoading"
@
click=
"handleCapture"
>
截图
</el-button>
<el-button
type=
"primary"
@
click=
"reportDialogVisible = true"
>
上传实验报告
</el-button>
</div>
</el-row>
</AppCard>
...
...
@@ -189,7 +195,9 @@ const getExperimentId = computed(() => {
</div>
</
template
>
</DragPanel>
<ReportDialog
v-model=
"reportDialogVisible"
:data=
"experimentId"
v-if=
"reportDialogVisible && experimentId"
></ReportDialog>
</template>
<!-- 上传报告 -->
<
style
lang=
"scss"
scoped
>
.close-btn
{
...
...
src/modules/student/lab/views/Index.vue
浏览文件 @
8bff36fb
...
...
@@ -274,7 +274,8 @@ function handleReportPreviewReady() {
<el-button
type=
"primary"
:disabled=
"disabled"
v-if=
"experimentInfo?.report_upload_way === 2 && !experimentInfo?.is_commit_report"
>
v-if=
"experimentInfo?.report_upload_way === 2 && !experimentInfo?.is_commit_report"
>
<router-link
:to=
"`/student/lab/report/$
{form.experiment_id}`" target="_blank">在线实验报告
</router-link>
</el-button>
<el-button
...
...
@@ -308,22 +309,26 @@ function handleReportPreviewReady() {
v-model=
"reportDialogVisible"
:data=
"experimentInfo"
@
update=
"fetchExperimentRecord"
v-if=
"reportDialogVisible && experimentInfo"
></ReportDialog>
v-if=
"reportDialogVisible && experimentInfo"
></ReportDialog>
<ReportFilePreview
v-model=
"reportFilePreviewVisible"
:data=
"experimentInfo"
v-if=
"reportFilePreviewVisible && experimentInfo"
></ReportFilePreview>
v-if=
"reportFilePreviewVisible && experimentInfo"
></ReportFilePreview>
<!-- 实验准备 -->
<PrepareDialog
v-model=
"prepareDialogVisible"
:data=
"experimentInfo"
v-if=
"prepareDialogVisible && experimentInfo"
></PrepareDialog>
v-if=
"prepareDialogVisible && experimentInfo"
></PrepareDialog>
<!-- 实验结果 -->
<ResultDialog
v-model=
"resultDialogVisible"
:data=
"experimentInfo"
v-if=
"resultDialogVisible && experimentInfo"
></ResultDialog>
v-if=
"resultDialogVisible && experimentInfo"
></ResultDialog>
<!-- 导出在线报告 -->
<
template
v-if=
"experimentInfo?.id && isExport"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论