Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
9caa7423
提交
9caa7423
authored
9月 16, 2026
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 添加文件下载功能,支持特定类型文件的下载
上级
ff2a2dd8
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
1 行删除
+34
-1
ExperimentCaseResource.vue
...dmin/lab/experiment/components/ExperimentCaseResource.vue
+10
-0
CaseResource.vue
src/modules/student/lab/components/CaseResource.vue
+24
-1
没有找到文件。
src/modules/admin/lab/experiment/components/ExperimentCaseResource.vue
浏览文件 @
9caa7423
...
...
@@ -7,6 +7,7 @@ import {
saveExperimentCaseResourceVisibility
,
unbindExperimentCaseResource
,
}
from
'../api'
import
{
saveAs
}
from
'file-saver'
import
Preview
from
'@/components/Preview.vue'
const
BindDialog
=
defineAsyncComponent
(()
=>
import
(
'./ExperimentCaseResourceDialog.vue'
))
...
...
@@ -41,6 +42,14 @@ function handleView(file: ExperimentCaseResourceFileItem) {
previewVisible
.
value
=
true
}
function
isDownloadableFile
(
file
:
ExperimentCaseResourceFileItem
)
{
return
[
'5'
,
'6'
].
includes
(
String
(
file
.
type
))
}
function
handleDownload
(
file
:
ExperimentCaseResourceFileItem
)
{
saveAs
(
file
.
url
,
file
.
name
)
}
async
function
fetchList
()
{
if
(
!
props
.
experimentId
)
return
loading
.
value
=
true
...
...
@@ -136,6 +145,7 @@ watch(
inactive-value=
"0"
@
change=
"handleVisibilityChange(item)"
/>
<el-button
link
type=
"primary"
@
click=
"handleView(file)"
>
查看
</el-button>
<el-button
v-if=
"isDownloadableFile(file)"
link
type=
"primary"
@
click=
"handleDownload(file)"
>
下载
</el-button>
</div>
</div>
</div>
...
...
src/modules/student/lab/components/CaseResource.vue
浏览文件 @
9caa7423
<
script
setup
lang=
"ts"
>
import
type
{
ExperimentCaseResourceFileType
,
ExperimentCaseResourceType
}
from
'../types'
import
{
Document
}
from
'@element-plus/icons-vue'
import
{
saveAs
}
from
'file-saver'
import
{
getExperimentCaseResourceList
}
from
'../api'
import
Preview
from
'@/components/Preview.vue'
...
...
@@ -34,6 +35,14 @@ function handleView(file: ExperimentCaseResourceFileType) {
previewVisible
.
value
=
true
}
function
isDownloadableFile
(
file
:
ExperimentCaseResourceFileType
)
{
return
[
'5'
,
'6'
].
includes
(
String
(
file
.
type
))
}
function
handleDownload
(
file
:
ExperimentCaseResourceFileType
)
{
saveAs
(
file
.
url
,
file
.
name
)
}
async
function
fetchInfo
()
{
if
(
!
props
.
experiment_id
)
return
loading
.
value
=
true
...
...
@@ -78,7 +87,10 @@ watch(
<div
class=
"case-resource-file__name"
>
{{
file
.
name
}}
</div>
</div>
</div>
<el-button
link
type=
"primary"
@
click=
"handleView(file)"
>
查看
</el-button>
<div
class=
"case-resource-file__actions"
>
<el-button
link
type=
"primary"
@
click=
"handleView(file)"
>
查看
</el-button>
<el-button
v-if=
"isDownloadableFile(file)"
link
type=
"primary"
@
click=
"handleDownload(file)"
>
下载
</el-button>
</div>
</div>
</div>
</div>
...
...
@@ -176,6 +188,13 @@ watch(
min-width
:
0
;
}
.case-resource-file__actions
{
display
:
flex
;
align-items
:
center
;
gap
:
10px
;
flex-shrink
:
0
;
}
.case-resource-file__name
{
font-size
:
13px
;
color
:
#303133
;
...
...
@@ -191,5 +210,9 @@ watch(
flex-direction
:
column
;
align-items
:
stretch
;
}
.case-resource-file__actions
{
justify-content
:
flex-end
;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论