Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea_resources_pc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
tea_resources_pc
Commits
e0efe642
Commit
e0efe642
authored
Aug 26, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
res-2.0-b(1)视频播放去掉自动播放,(2)第一次播放完后可以拖拽进度条
parent
794dcce5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
index.vue
src/views/lessionLearn/index.vue
+31
-18
No files found.
src/views/lessionLearn/index.vue
View file @
e0efe642
...
...
@@ -409,6 +409,7 @@ export default {
},
data
()
{
return
{
videoDrag
:
false
,
// 视频是否可以拖动(当视频看完后视频可以拖动)
Appraisal
:
''
,
firstCurrent
:
{},
// 播放页面播放的视频对象
unitView
:
false
,
...
...
@@ -1184,6 +1185,12 @@ export default {
// * @param sectionKey 点击的当前节的数组索引(Number)
*/
sectionClick
(
section
,
chapterIndex
)
{
console
.
log
(
'section'
,
section
)
if
(
section
.
isComplete
===
'1'
)
{
this
.
videoDrag
=
true
}
else
{
this
.
videoDrag
=
false
}
this
.
firstCurrent
=
section
// 播放页面播放的视频对象
console
.
log
(
section
,
chapterIndex
)
/* // 先判断章节的sort排序值是否正确,有误则结束执行以下代码。
...
...
@@ -1412,24 +1419,25 @@ export default {
},
/** 视频播放完自动播放下一个视频*/
playNextVideo
()
{
// console.log('next', this.chapterList)
// console.log('now', this.firstCurrent)
const
flattenedArray
=
this
.
flattenTree
(
this
.
chapterList
)
// 获取有videoUrl的对象数组
const
flattenedArrayAll
=
this
.
flattenTreeAll
(
this
.
chapterList
)
// 获取全部对象数组
// 获取当前对象在数组中的索引
const
currentIndex
=
flattenedArray
.
findIndex
(
obj
=>
obj
.
businessId
===
this
.
firstCurrent
.
businessId
)
// console.log('currentIndex', currentIndex)
if
(
currentIndex
+
1
<=
flattenedArray
.
length
-
1
)
{
const
nextVideo
=
flattenedArray
[
currentIndex
+
1
]
// 自动播放的下一个视频对象
const
parentSort
=
flattenedArrayAll
.
filter
(
item
=>
item
.
businessId
===
nextVideo
.
pid
)
// console.log('parentSort', parentSort)
// console.log('parentSort', parentSort[0].sort)
// console.log('nextVideo', nextVideo)
this
.
sectionClick
(
nextVideo
,
parentSort
[
0
].
sort
)
}
// console.log('flattenedArray', flattenedArray)
// console.log('flattenedArrayAll', flattenedArrayAll)
this
.
currentSection
.
isComplete
=
'1'
// // console.log('next', this.chapterList)
// // console.log('now', this.firstCurrent)
// const flattenedArray = this.flattenTree(this.chapterList) // 获取有videoUrl的对象数组
// const flattenedArrayAll = this.flattenTreeAll(this.chapterList) // 获取全部对象数组
//
// // 获取当前对象在数组中的索引
// const currentIndex = flattenedArray.findIndex(obj => obj.businessId === this.firstCurrent.businessId)
// // console.log('currentIndex', currentIndex)
// if (currentIndex + 1
<=
flattenedArray
.
length
-
1
)
{
// const nextVideo = flattenedArray[currentIndex + 1] // 自动播放的下一个视频对象
// const parentSort = flattenedArrayAll.filter(item => item.businessId === nextVideo.pid)
// // console.log('parentSort', parentSort)
// // console.log('parentSort', parentSort[0].sort)
// // console.log('nextVideo', nextVideo)
// this.sectionClick(nextVideo, parentSort[0].sort)
// }
// // console.log('flattenedArray', flattenedArray)
// // console.log('flattenedArrayAll', flattenedArrayAll)
},
/** 获取有videoUrl的对象数组*/
flattenTree
(
treeData
)
{
...
...
@@ -1472,6 +1480,11 @@ export default {
onPlayerTimeupdate
(
player
)
{
this
.
currentPlayTime
=
player
.
currentTime
()
this
.
maxPosition
=
this
.
maxPosition
<
player
.
currentTime
()
?
player
.
currentTime
()
:
this
.
maxPosition
if
(
this
.
videoDrag
===
true
)
{
const
vjsProgress
=
document
.
getElementsByClassName
(
'vjs-progress-control'
)
vjsProgress
[
0
].
style
.
pointerEvents
=
'auto'
vjsProgress
[
0
].
style
.
cursor
=
'default'
}
// console.log('player Timeupdate!', player.currentTime(), this.allPlayTime)
if
((
this
.
currentPlayTime
+
1
)
>=
this
.
allPlayTime
)
{
const
vjsProgress
=
document
.
getElementsByClassName
(
'vjs-progress-control'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment