Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
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
baiguangyao
mr-julyedu
Commits
bbade3c8
Commit
bbade3c8
authored
Sep 09, 2019
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pre' of gitlab.julyedu.com:baiguangyao/mr-julyedu into pre
parents
96e4a556
e1002955
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
16 deletions
+46
-16
src/components/video/index.js
+46
-16
No files found.
src/components/video/index.js
View file @
bbade3c8
...
@@ -88,7 +88,7 @@ class Video extends Component {
...
@@ -88,7 +88,7 @@ class Video extends Component {
currentVideoSrc
:
''
,
currentVideoSrc
:
''
,
activeIndex
:
0
,
activeIndex
:
0
,
isAuth
:
true
,
isAuth
:
true
,
course
:
{},
course
:
{},
// course.course_id 为 0 或 '' 时 为免费课程
salePrice
:
null
,
salePrice
:
null
,
vCourseId
:
null
,
vCourseId
:
null
,
isLoading
:
true
,
isLoading
:
true
,
...
@@ -369,9 +369,6 @@ class Video extends Component {
...
@@ -369,9 +369,6 @@ class Video extends Component {
this
.
ws
=
new
WebSocket
(
API
[
"process-api"
]);
this
.
ws
=
new
WebSocket
(
API
[
"process-api"
]);
this
.
ws
.
addEventListener
(
'error'
,
()
=>
{
this
.
ws
.
addEventListener
(
'error'
,
()
=>
{
this
.
ws
=
null
this
.
ws
=
null
/*setTimeout(() => {
this.setupWS();
}, 1000)*/
})
})
this
.
ws
.
addEventListener
(
'close'
,
()
=>
{
this
.
ws
.
addEventListener
(
'close'
,
()
=>
{
if
(
this
.
reconnect
)
{
if
(
this
.
reconnect
)
{
...
@@ -403,21 +400,53 @@ class Video extends Component {
...
@@ -403,21 +400,53 @@ class Video extends Component {
})
})
}
}
//告诉服务端
切换视频
//告诉服务端
计算进度 普通课程不发送
countSchedule
=
()
=>
{
countSchedule
=
()
=>
{
this
.
sendMessage
({
const
{
videoList
,
activeIndex
,
vCourseId
,
course
=
{}}
=
this
.
state
mtype
:
'count_schedule'
,
if
(
!
this
.
state
.
course
.
course_id
)
{
uid
:
this
.
props
.
user
.
data
.
uid
,
console
.
log
(
'免费课程 拦截'
);
token
:
this
.
token
,
return
;
platform
:
5
}
})
if
(
course
.
is_aist
)
{
}
// 返现课程
this
.
sendMessage
({
mtype
:
'count_schedule'
,
uid
:
this
.
props
.
user
.
data
.
uid
,
token
:
this
.
token
,
platform
:
5
})
}
else
{
// 普通课程
this
.
sendMessage
({
mtype
:
'c_count_schedule'
,
uid
:
this
.
props
.
user
.
data
.
uid
,
token
:
this
.
token
,
platform
:
5
,
video_id
:
videoList
[
activeIndex
][
'id'
],
course_id
:
this
.
courseID
,
v_course_id
:
vCourseId
,
})
}
}
// 发送时间消息
sendWatchTime
=
(
sec
,
rate
)
=>
{
sendWatchTime
=
(
sec
,
rate
)
=>
{
const
{
videoList
,
activeIndex
,
vCourseId
}
=
this
.
state
const
{
videoList
,
activeIndex
,
vCourseId
,
course
=
{}}
=
this
.
state
// 免费课程不发送
if
(
!
course
.
course_id
)
{
console
.
log
(
'免费课程 拦截'
);
return
;
}
// 时间为0 不发送消息
if
(
Number
(
sec
)
===
0
)
{
return
;
}
let
info_type
=
'c_watch_time'
;
if
(
course
.
is_aist
)
{
info_type
=
'watch_time'
;
}
this
.
sendMessage
({
this
.
sendMessage
({
mtype
:
'watch_time'
,
mtype
:
info_type
,
rate
,
rate
,
time
:
sec
,
time
:
sec
,
video_id
:
videoList
[
activeIndex
][
'id'
],
video_id
:
videoList
[
activeIndex
][
'id'
],
...
@@ -464,6 +493,7 @@ class Video extends Component {
...
@@ -464,6 +493,7 @@ class Video extends Component {
this
.
player
.
addChild
(
'CustomPlayButtonCover'
)
this
.
player
.
addChild
(
'CustomPlayButtonCover'
)
this
.
player
.
on
(
'ready'
,
()
=>
{
this
.
player
.
on
(
'ready'
,
()
=>
{
this
.
recordSocket
.
emit
(
'load'
,
this
.
recordUserInfo
())
this
.
recordSocket
.
emit
(
'load'
,
this
.
recordUserInfo
())
this
.
countSchedule
();
})
})
this
.
player
.
on
(
'ratechange'
,
()
=>
{
this
.
player
.
on
(
'ratechange'
,
()
=>
{
this
.
currentPlaybackRate
=
this
.
player
.
playbackRate
()
this
.
currentPlaybackRate
=
this
.
player
.
playbackRate
()
...
@@ -505,7 +535,7 @@ class Video extends Component {
...
@@ -505,7 +535,7 @@ class Video extends Component {
return
return
}
}
this
.
countSchedule
()
this
.
countSchedule
()
;
// 计算进度
this
.
setState
(
this
.
setState
(
{
{
...
...
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