Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
1f2376cd
提交
1f2376cd
authored
1月 31, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 学生端实训指导修改为展示多条数据
上级
5ed1f450
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
70 行增加
和
16 行删除
+70
-16
api.ts
src/modules/student/lab/api.ts
+2
-2
Book.vue
src/modules/student/lab/components/Book.vue
+68
-14
没有找到文件。
src/modules/student/lab/api.ts
浏览文件 @
1f2376cd
...
@@ -16,8 +16,8 @@ export function getExperimentCase(params: { experiment_id: string }) {
...
@@ -16,8 +16,8 @@ export function getExperimentCase(params: { experiment_id: string }) {
}
}
// 获取实验指导书
// 获取实验指导书
export
function
getExperimentBook
(
params
:
{
experiment_id
:
string
})
{
export
function
getExperimentBook
List
(
params
:
{
experiment_id
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/student/experiment-book/
detail
'
,
{
params
})
return
httpRequest
.
get
(
'/api/lab/v1/student/experiment-book/
list
'
,
{
params
})
}
}
// 获取实验视频
// 获取实验视频
...
...
src/modules/student/lab/components/Book.vue
浏览文件 @
1f2376cd
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
ExperimentBookType
}
from
'../types'
import
type
{
ExperimentBookType
}
from
'../types'
import
{
Document
,
CloseBold
}
from
'@element-plus/icons-vue'
import
Preview
from
'@/components/Preview.vue'
import
Preview
from
'@/components/Preview.vue'
import
{
getExperimentBook
}
from
'../api'
import
{
getExperimentBook
List
}
from
'../api'
import
{
useLog
}
from
'@/composables/useLog'
import
{
useLog
}
from
'@/composables/useLog'
const
log
=
useLog
()
const
log
=
useLog
()
...
@@ -12,29 +13,82 @@ interface Props {
...
@@ -12,29 +13,82 @@ interface Props {
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
let
detail
=
$ref
<
ExperimentBookType
>
(
)
let
list
=
$ref
<
ExperimentBookType
[]
>
([]
)
function
fetchInfo
()
{
function
fetchInfo
()
{
if
(
!
props
.
experiment_id
)
return
if
(
!
props
.
experiment_id
)
return
getExperimentBook
({
experiment_id
:
props
.
experiment_id
}).
then
(
res
=>
{
getExperimentBookList
({
experiment_id
:
props
.
experiment_id
}).
then
(
res
=>
{
detail
=
res
.
data
.
detail
list
=
res
.
data
.
items
})
}
watchEffect
(()
=>
{
fetchInfo
()
})
let
currentRaw
=
$ref
<
ExperimentBookType
|
undefined
>
()
let
show
=
$ref
(
false
)
// 预览
function
handleView
(
row
:
ExperimentBookType
)
{
currentRaw
=
row
show
=
true
// 日志上送
// 日志上送
log
.
upload
({
log
.
upload
({
event
:
'file_event'
,
event
:
'file_event'
,
action
:
'experiment_book_stu_watch_action'
,
action
:
'experiment_book_stu_watch_action'
,
data
:
{
data
:
{
experiment_id
:
props
.
experiment_id
,
course_id
:
props
.
course_id
,
book_id
:
row
.
id
}
experiment_id
:
props
.
experiment_id
,
course_id
:
props
.
course_id
,
book_id
:
detail
?.
id
}
})
})
})
}
}
watchEffect
(()
=>
{
// 关闭
fetchInfo
()
function
handleClose
()
{
})
show
=
false
}
</
script
>
</
script
>
<
template
>
<
template
>
<Preview
:url=
"detail.url"
v-if=
"props.experiment_id && detail?.id"
></Preview>
<div
v-if=
"props.experiment_id && list.length"
>
<ul
class=
"book-list"
>
<li
v-for=
"item in list"
:key=
"item.id"
@
click=
"handleView(item)"
>
<el-icon><Document
/></el-icon>
<p>
{{
item
.
name
}}
</p>
</li>
</ul>
</div>
<el-empty
description=
"暂无数据"
v-else
/>
<el-empty
description=
"暂无数据"
v-else
/>
<!-- 预览 -->
<div
class=
"book-preview"
v-if=
"show && currentRaw"
>
<div
class=
"book-preview__close"
@
click=
"handleClose"
>
<el-button
type=
"info"
circle
:icon=
"CloseBold"
/>
</div>
<Preview
:url=
"currentRaw.url"
></Preview>
</div>
</
template
>
</
template
>
<
style
lang=
"scss"
>
.book-list
{
li
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
10px
;
font-size
:
14px
;
cursor
:
pointer
;
.el-icon
{
margin-right
:
5px
;
}
}
}
.book-preview
{
position
:
absolute
;
top
:
15px
;
left
:
15px
;
right
:
15px
;
bottom
:
15px
;
background-color
:
#fff
;
}
.book-preview__close
{
position
:
absolute
;
right
:
-12px
;
top
:
-12px
;
font-size
:
20px
;
color
:
#fff
;
cursor
:
pointer
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论