Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
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
李俊赕
self-support
Commits
87b1a945
Commit
87b1a945
authored
May 14, 2021
by
林文清
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:视频观看进度问题
parent
f758184f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
62 deletions
+68
-62
section.vue
src/pages/learn/section.vue
+68
-62
No files found.
src/pages/learn/section.vue
View file @
87b1a945
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<view
class=
"scroll_box"
>
<view
class=
"scroll_box"
>
<scroll-view
scroll-x
@
scroll=
"scroll"
:scroll-left=
"scrollValue"
>
<scroll-view
scroll-x
@
scroll=
"scroll"
:scroll-left=
"scrollValue"
>
<view
class=
"item_list"
:class=
"
{'item_list_active': item.isActive}"
<view
class=
"item_list"
:class=
"
{'item_list_active': item.isActive}"
v-for="(item, index) in sectionList" :key="index" @click="goNext(item
, $event
)">
v-for="(item, index) in sectionList" :key="index" @click="goNext(item)">
<view
class=
""
style=
"font-size: 24rpx;"
>
{{
item
.
title
}}
</view>
<view
class=
""
style=
"font-size: 24rpx;"
>
{{
item
.
title
}}
</view>
<view
class=
""
style=
"font-size: 26rpx;margin-top: 16rpx;"
>
<view
class=
""
style=
"font-size: 26rpx;margin-top: 16rpx;"
>
{{
item
.
intro
}}
{{
item
.
intro
}}
...
@@ -93,13 +93,14 @@
...
@@ -93,13 +93,14 @@
},
},
gklog
:
''
,
gklog
:
''
,
videoTotalTime
:
0
,
videoTotalTime
:
0
,
howTimeToUpdateLearnedStatus
:
10
,
//设置几秒提交一次状态
howTimeToUpdateLearnedStatus
:
5
,
//设置几秒提交一次状态
status
:
1
,
//是否已学习默认1已学习
status
:
0
,
//是否已学习默认1已学习
isLearned
:
false
,
//默认设置观看1/2就是已学
isLearned
:
false
,
//默认设置观看1/2就是已学
old
:
{
old
:
{
scrollTop
:
null
scrollTop
:
null
},
},
scrollValue
:
0
scrollValue
:
0
,
nowTime
:
0
};
};
},
},
computed
:
{
computed
:
{
...
@@ -110,10 +111,10 @@
...
@@ -110,10 +111,10 @@
onLoad
(
e
)
{
onLoad
(
e
)
{
this
.
section_id
=
e
.
section_id
this
.
section_id
=
e
.
section_id
this
.
params
.
course_id
=
e
.
course_id
this
.
params
.
course_id
=
e
.
course_id
this
.
getCapterDetails
()
this
.
getSectionInfo
({
this
.
getSectionInfo
({
section_id
:
e
.
section_id
section_id
:
e
.
section_id
})
})
this
.
getCapterDetails
()
},
},
onReady
:
function
(
res
)
{
onReady
:
function
(
res
)
{
this
.
videoContext
=
uni
.
createVideoContext
(
"courseVideo"
);
this
.
videoContext
=
uni
.
createVideoContext
(
"courseVideo"
);
...
@@ -124,7 +125,10 @@
...
@@ -124,7 +125,10 @@
console
.
log
(
e
)
console
.
log
(
e
)
this
.
old
.
scrollTop
=
e
.
detail
.
scrollTop
this
.
old
.
scrollTop
=
e
.
detail
.
scrollTop
},
},
goNext
(
info
,
e
)
{
goNext
(
info
)
{
if
(
this
.
status
==
1
){
console
.
log
(
'已学'
);
}
//切换成下一个
//切换成下一个
this
.
getSectionInfo
({
this
.
getSectionInfo
({
section_id
:
info
.
id
section_id
:
info
.
id
...
@@ -170,6 +174,42 @@
...
@@ -170,6 +174,42 @@
playerReadied
(
player
)
{
playerReadied
(
player
)
{
player
.
currentTime
(
this
.
gklog
)
player
.
currentTime
(
this
.
gklog
)
},
},
//获取章节详情
getCapterDetails
()
{
let
that
=
this
this
.
$u
.
api
.
ChapterDetails
(
this
.
params
)
.
then
((
res
)
=>
{
if
(
res
.
code
!=
200
)
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
}
if
(
res
.
data
)
{
that
.
sectionList
=
res
.
data
[
0
].
section
that
.
courseTotal
=
that
.
sectionList
.
length
let
length
=
that
.
sectionList
.
length
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
that
.
sectionList
[
i
].
title
=
"第"
+
(
i
+
1
)
+
"节"
that
.
sectionList
[
i
].
intro
=
that
.
sectionList
[
i
].
name
that
.
sectionList
[
i
].
isActive
=
that
.
section_id
==
that
.
sectionList
[
i
].
id
?
true
:
false
}
this
.
changeActiveAction
()
}
})
.
catch
((
err
)
=>
{
uni
.
showToast
({
title
:
err
,
icon
:
"none"
})
that
.
isLoadMore
=
false
if
(
that
.
params
.
start
>
0
)
{
that
.
page
-=
5
}
})
},
getSectionInfo
(
param
)
{
getSectionInfo
(
param
)
{
this
.
$u
.
api
this
.
$u
.
api
.
CourseSection
(
param
)
.
CourseSection
(
param
)
...
@@ -184,6 +224,7 @@
...
@@ -184,6 +224,7 @@
this
.
sectionInfo
=
res
.
data
this
.
sectionInfo
=
res
.
data
console
.
log
(
"----节信息----"
)
console
.
log
(
"----节信息----"
)
console
.
log
(
this
.
sectionInfo
)
console
.
log
(
this
.
sectionInfo
)
this
.
nextSectionId
=
this
.
sectionInfo
.
nextSectionId
let
wareVal
=
this
.
sectionInfo
.
ware
let
wareVal
=
this
.
sectionInfo
.
ware
this
.
courseTitle
=
res
.
data
.
name
this
.
courseTitle
=
res
.
data
.
name
this
.
courseDesc
=
res
.
data
.
content
.
replace
(
/<p.*
?
>|<
\/
p>/ig
,
""
)
this
.
courseDesc
=
res
.
data
.
content
.
replace
(
/<p.*
?
>|<
\/
p>/ig
,
""
)
...
@@ -193,11 +234,10 @@
...
@@ -193,11 +234,10 @@
this
.
teacherImage
=
res
.
data
.
teachers
[
0
].
avatar
this
.
teacherImage
=
res
.
data
.
teachers
[
0
].
avatar
this
.
teacherIntro
=
res
.
data
.
teachers
[
0
].
intro
.
replace
(
/<.*
?
>|<
\/
.*
?
>/ig
,
""
)
this
.
teacherIntro
=
res
.
data
.
teachers
[
0
].
intro
.
replace
(
/<.*
?
>|<
\/
.*
?
>/ig
,
""
)
this
.
params
.
course_id
=
res
.
data
.
course_id
this
.
params
.
course_id
=
res
.
data
.
course_id
this
.
nextSectionId
=
this
.
sectionInfo
.
nextSectionId
if
(
wareVal
==
"0"
)
{
if
(
wareVal
==
"0"
)
{
let
coureWareList
=
res
.
data
.
courseware
let
coureWareList
=
res
.
data
.
courseware
this
.
courseSrc
=
coureWareList
[
0
].
src
this
.
courseSrc
=
coureWareList
[
0
].
src
this
.
videoTotalTime
=
parseInt
(
JSON
.
parse
(
coureWareList
[
0
].
info
).
time
)
this
.
videoTotalTime
=
parseInt
(
JSON
.
parse
(
coureWareList
[
0
].
info
).
time
)
-
1
;
console
.
log
(
'视频时长信息:'
+
this
.
videoTotalTime
)
console
.
log
(
'视频时长信息:'
+
this
.
videoTotalTime
)
}
}
}
}
...
@@ -210,61 +250,27 @@
...
@@ -210,61 +250,27 @@
})
})
},
},
updateLearnedStatus
(
nowTime
)
{
updateLearnedStatus
(
nowTime
)
{
if
(
this
.
gklog
!=
nowTime
&&
nowTime
%
this
.
howTimeToUpdateLearnedStatus
==
0
)
{
let
param
=
{
let
howLongIsLearned
=
parseInt
(
this
.
videoTotalTime
/
2
)
section_id
:
this
.
section_id
,
if
(
nowTime
<
howLongIsLearned
)
{
video_time
:
nowTime
,
this
.
status
=
0
status
:
this
.
status
}
else
if
(
this
.
isLearned
)
{
};
return
nowTime
=
parseInt
(
nowTime
);
}
else
{
if
(
nowTime
==
this
.
nowTime
){
this
.
status
=
1
return
}
let
param
=
{
section_id
:
this
.
section_id
,
video_time
:
nowTime
,
status
:
this
.
status
};
this
.
$u
.
api
.
updateLearnCourses
(
param
).
then
((
res
)
=>
{}).
catch
((
err
)
=>
{
console
.
log
(
err
)
});
}
}
},
this
.
nowTime
=
nowTime
;
//获取章节详情
if
(
this
.
status
==
1
||
nowTime
<
5
){
getCapterDetails
()
{
return
let
that
=
this
}
this
.
$u
.
api
if
(
nowTime
==
this
.
videoTotalTime
){
.
ChapterDetails
(
this
.
params
)
param
.
status
=
this
.
status
=
1
.
then
((
res
)
=>
{
}
else
if
(
nowTime
%
this
.
howTimeToUpdateLearnedStatus
!=
0
){
if
(
res
.
code
!=
200
)
{
return
uni
.
showToast
({
}
title
:
res
.
message
,
this
.
$u
.
api
.
updateLearnCourses
(
param
).
then
((
res
)
=>
{}).
catch
((
err
)
=>
{
icon
:
"none"
console
.
log
(
err
)
})
});
}
if
(
res
.
data
)
{
that
.
sectionList
=
res
.
data
[
0
].
section
that
.
courseTotal
=
that
.
sectionList
.
length
let
length
=
that
.
sectionList
.
length
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
that
.
sectionList
[
i
].
title
=
"第"
+
(
i
+
1
)
+
"节"
that
.
sectionList
[
i
].
intro
=
that
.
sectionList
[
i
].
name
that
.
sectionList
[
i
].
isActive
=
that
.
section_id
==
that
.
sectionList
[
i
].
id
?
true
:
false
}
this
.
changeActiveAction
()
}
})
.
catch
((
err
)
=>
{
uni
.
showToast
({
title
:
err
,
icon
:
"none"
})
that
.
isLoadMore
=
false
if
(
that
.
params
.
start
>
0
)
{
that
.
page
-=
5
}
})
},
},
},
},
}
}
...
...
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