Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-learn
Commits
cca727b2
提交
cca727b2
authored
8月 04, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
e7d4f66f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
16 行删除
+42
-16
CoursePlayerChapter.vue
src/modules/course/components/CoursePlayerChapter.vue
+8
-1
CoursePlayerPPT.vue
src/modules/course/components/CoursePlayerPPT.vue
+15
-13
CoursePlayerVideo.vue
src/modules/course/components/CoursePlayerVideo.vue
+2
-0
CoursePlayer.vue
src/modules/course/views/CoursePlayer.vue
+17
-2
没有找到文件。
src/modules/course/components/CoursePlayerChapter.vue
浏览文件 @
cca727b2
...
...
@@ -7,6 +7,7 @@ import type { CourseChapterType } from '../types'
interface
Props
{
chapterList
:
CourseChapterType
[]
pptList
:
PptType
[]
pptIndex
:
number
}
const
props
=
defineProps
<
Props
>
()
...
...
@@ -58,7 +59,12 @@ function formatDuration(duration: number | undefined) {
</el-tab-pane>
<el-tab-pane
label=
"讲义"
name=
"ppt"
v-if=
"pptList && pptList.length"
>
<ul
class=
"lecture-list"
>
<li
v-for=
"item in pptList"
:key=
"item.url"
@
click=
"$emit('clickPPT', item)"
>
<li
v-for=
"(item, index) in pptList"
:class=
"
{ 'is-active': index === pptIndex }"
:key="item.url"
@click="$emit('clickPPT', item)"
>
<img
:src=
"`$
{item.url}?x-oss-process=image/resize,m_fill,h_128,w_218`" loading="lazy" />
<span>
{{
formatDuration
(
item
.
point
)
}}
</span>
</li>
...
...
@@ -142,6 +148,7 @@ function formatDuration(duration: number | undefined) {
}
}
img
{
display
:
block
;
width
:
100%
;
}
span
{
...
...
src/modules/course/components/CoursePlayerPPT.vue
浏览文件 @
cca727b2
<
template
>
<div
class=
"ppt-player"
>
<template
v-if=
"ppt
s
.length"
>
<template
v-if=
"ppt
List
.length"
>
<div
class=
"ppt-player-preview"
>
<img
:src=
"pptUrl"
v-if=
"pptUrl"
/>
</div>
...
...
@@ -9,14 +9,14 @@
<template
v-if=
"currentIndex >= 0"
>
<i
class=
"el-icon-arrow-left"
@
click=
"prev"
></i>
</
template
>
<
template
v-if=
"currentIndex + 1 < ppt
s
.length"
>
<
template
v-if=
"currentIndex + 1 < ppt
List
.length"
>
<i
class=
"el-icon-arrow-right"
@
click=
"next"
></i>
</
template
>
</div>
<div
class=
"ppt-player-controls__pages"
>
<span
class=
"is-active"
>
{{ currentIndex + 1 }}
</span>
/
<span>
{{ ppt
s
.length }}
</span
<span>
{{ ppt
List
.length }}
</span
>
页
</div>
<div
class=
"ppt-player-controls__tools"
>
...
...
@@ -38,13 +38,15 @@
</div>
</template>
<
script
setup
>
defineProps
({
pptList
:
{
type
:
Array
},
index
:
{
type
:
Number
,
default
:
0
}
})
</
script
>
<
script
>
export
default
{
name
:
'ppt-player'
,
props
:
{
ppts
:
{
type
:
Array
},
index
:
{
type
:
Number
,
default
:
0
}
},
data
()
{
return
{
currentIndex
:
this
.
index
,
...
...
@@ -63,7 +65,7 @@ export default {
},
computed
:
{
pptUrl
()
{
return
this
.
ppt
s
[
this
.
currentIndex
]
?
this
.
ppts
[
this
.
currentIndex
].
ppt_url
:
''
return
this
.
ppt
List
[
this
.
currentIndex
]
?
this
.
pptList
[
this
.
currentIndex
].
ppt_url
:
''
}
},
methods
:
{
...
...
@@ -71,22 +73,22 @@ export default {
this
.
currentIndex
=
index
},
getIndex
(
index
)
{
return
Math
.
min
(
this
.
ppt
s
.
length
-
1
,
Math
.
max
(
0
,
index
))
return
Math
.
min
(
this
.
ppt
List
.
length
-
1
,
Math
.
max
(
0
,
index
))
},
prev
()
{
this
.
currentIndex
=
this
.
getIndex
(
this
.
currentIndex
-
1
)
this
.
isSync
=
false
},
next
(
e
)
{
next
()
{
this
.
currentIndex
=
this
.
getIndex
(
this
.
currentIndex
+
1
)
this
.
isSync
=
false
},
onToggleSync
(
e
)
{
onToggleSync
()
{
this
.
isSync
=
!
this
.
isSync
},
setVideoTime
(
e
)
{
setVideoTime
()
{
this
.
isSync
=
true
this
.
$emit
(
'videoSyncTime'
,
this
.
ppt
s
[
this
.
currentIndex
].
ppt_point
)
this
.
$emit
(
'videoSyncTime'
,
this
.
ppt
List
[
this
.
currentIndex
].
ppt_point
)
},
// 全屏
fullscreen
()
{
...
...
src/modules/course/components/CoursePlayerVideo.vue
浏览文件 @
cca727b2
...
...
@@ -15,6 +15,7 @@ interface Props {
const
props
=
defineProps
<
Props
>
()
const
emit
=
defineEmits
<
{
(
e
:
'updateResource'
,
resource
:
CourseResourceType
|
undefined
):
void
(
e
:
'timeupdate'
,
time
:
number
):
void
}
>
()
const
options
=
$ref
<
VideoJsPlayerOptions
>
()
...
...
@@ -198,6 +199,7 @@ function onLoadedData() {
function
onTimeUpdate
()
{
const
time
=
Math
.
floor
(
videoJsPlayer
?.
currentTime
()
??
0
)
if
(
!
time
||
videoJsPlayer
?.
paused
())
return
emit
(
'timeupdate'
,
time
)
console
.
log
(
'onTimeUpdate'
,
time
)
// 更新观看累计时长
if
(
time
!==
progress
.
current_playing_time
)
{
...
...
src/modules/course/views/CoursePlayer.vue
浏览文件 @
cca727b2
...
...
@@ -62,6 +62,11 @@ const pptList = $computed(() => {
function
onUpdateResource
(
resource
:
CourseResourceType
|
undefined
)
{
currentVideoResource
=
resource
}
let
pptIndex
=
$ref
<
number
>
(
0
)
function
onTimeUpdate
(
time
:
number
)
{
const
index
=
pptList
.
findIndex
(
item
=>
item
.
point
>
time
)
pptIndex
=
index
!==
-
1
?
index
-
1
:
pptList
.
length
-
1
}
// ppt点击
function
onClickPPT
(
ppt
:
PptType
)
{
videoJsPlayer
?.
currentTime
(
ppt
.
point
)
...
...
@@ -80,7 +85,12 @@ function toggleSidebar() {
</div>
<div
class=
"course-player-bd"
>
<div
class=
"course-player-main"
v-loading=
"loading"
>
<CoursePlayerVideo
:chapterList=
"chapterList"
:key=
"sectionId"
@
updateResource=
"onUpdateResource"
/>
<CoursePlayerVideo
:chapterList=
"chapterList"
:key=
"sectionId"
@
updateResource=
"onUpdateResource"
@
timeupdate=
"onTimeUpdate"
/>
<el-tabs>
<el-tab-pane
label=
"课件"
>
<CoursePlayerResourceList
:list=
"detail.coursewares"
/>
...
...
@@ -104,7 +114,12 @@ function toggleSidebar() {
</div>
<div
class=
"course-player-aside"
:class=
"
{ 'is-hidden': !sidebarVisible }">
<div
class=
"course-player-aside__inner"
>
<CoursePlayerChapter
:chapterList=
"chapterList"
:pptList=
"pptList"
@
clickPPT=
"onClickPPT"
/>
<CoursePlayerChapter
:chapterList=
"chapterList"
:pptList=
"pptList"
:pptIndex=
"pptIndex"
@
clickPPT=
"onClickPPT"
/>
</div>
<div
class=
"toggle-button"
:class=
"
{ 'is-hidden': !sidebarVisible }" @click="toggleSidebar">
<el-icon>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论