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
c4a62a7c
Commit
c4a62a7c
authored
Jul 25, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video
parent
6b58fb66
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
src/components/video/index.js
+20
-16
No files found.
src/components/video/index.js
View file @
c4a62a7c
...
...
@@ -25,7 +25,7 @@ class Video extends Component {
state
=
{
title
:
''
,
courseId
:
null
,
video
_catalog
:
[],
video
List
:
[],
datum
:
[],
currentVideoSrc
:
''
,
activeIndex
:
0
,
...
...
@@ -42,8 +42,9 @@ class Video extends Component {
this
.
setState
({
courseId
:
this
.
courseID
})
this
.
getVideo
Catalog
()
this
.
getVideo
List
()
this
.
getDatumCatalog
()
}
initializePlayer
=
()
=>
{
...
...
@@ -54,10 +55,13 @@ class Video extends Component {
bigPlayButton
:
true
,
textTrackDisplay
:
false
,
posterImage
:
false
,
errorDisplay
:
false
errorDisplay
:
false
,
playbackRates
:
[
'0.75'
,
'1'
,
'1.5'
,
'2'
]
})
this
.
player
.
enableTouchActivity
()
this
.
player
.
on
(
'useractive'
,
function
()
{
console
.
log
(
'active'
);
})
}
componentWillUnmount
()
{
...
...
@@ -69,7 +73,7 @@ class Video extends Component {
handleClick
=
index
=>
{
if
(
this
.
hasAuth
())
{
this
.
setPlayerSrc
(
this
.
state
.
video
_catalog
[
index
][
'play_url'
])
this
.
setPlayerSrc
(
this
.
state
.
video
List
[
index
][
'play_url'
])
this
.
playVideo
()
}
this
.
setState
({
...
...
@@ -78,7 +82,7 @@ class Video extends Component {
}
getVideo
Catalog
=
()
=>
{
getVideo
List
=
()
=>
{
http
.
get
(
`
${
api
.
home
}
/m/course/play/
${
this
.
courseID
}
`
)
.
then
(
res
=>
{
const
data
=
res
.
data
...
...
@@ -86,7 +90,7 @@ class Video extends Component {
this
.
setState
(
state
=>
({
video
_catalog
:
data
.
data
[
'lessons'
],
video
List
:
data
.
data
[
'lessons'
],
currentVideoSrc
:
data
.
data
[
'lessons'
][
state
.
activeIndex
][
'play_url'
],
course
:
data
.
data
.
course
,
courseId
:
data
.
data
.
course
[
'course_id'
],
...
...
@@ -149,8 +153,8 @@ class Video extends Component {
}
lessonAvailable
=
()
=>
{
const
{
video
_catalog
,
activeIndex
}
=
this
.
state
return
video
_catalog
[
activeIndex
][
'video_size'
]
!==
0
const
{
video
List
,
activeIndex
}
=
this
.
state
return
video
List
[
activeIndex
][
'video_size'
]
!==
0
}
getCoursePrice
=
()
=>
{
...
...
@@ -166,16 +170,16 @@ class Video extends Component {
}
playWithAuth
=
()
=>
{
const
{
video
_catalog
,
activeIndex
}
=
this
.
state
const
{
video
List
,
activeIndex
}
=
this
.
state
if
(
this
.
hasAuth
())
{
this
.
setPlayerSrc
(
video
_catalog
[
activeIndex
][
'play_url'
])
this
.
setPlayerSrc
(
video
List
[
activeIndex
][
'play_url'
])
}
}
hasAuth
=
(
index
)
=>
{
const
{
course
,
video
_catalog
,
activeIndex
}
=
this
.
state
let
lesson
=
video
_catalog
[
activeIndex
]
const
{
course
,
video
List
,
activeIndex
}
=
this
.
state
let
lesson
=
video
List
[
activeIndex
]
if
(
!
lesson
[
'is_free'
])
{
if
(
course
[
'is_audition'
])
{
this
.
setState
({
...
...
@@ -205,7 +209,7 @@ class Video extends Component {
render
()
{
let
{
match
,
location
}
=
this
.
props
const
{
video
_catalog
,
activeIndex
,
isAuth
,
salePrice
}
=
this
.
state
const
{
video
List
,
activeIndex
,
isAuth
,
salePrice
}
=
this
.
state
return
(
<
div
className
=
'play'
>
<
HeaderBar
title
=
{
this
.
state
.
title
}
arrow
=
{
true
}
/
>
...
...
@@ -221,7 +225,7 @@ class Video extends Component {
<
div
className
=
'btns'
>
<
button
type
=
'button'
className
=
'purchase-class'
>
¥
{
salePrice
}
购买课程
<
/button
>
<
button
type
=
'button'
className
=
'purchase-episode'
>
¥
{
video
_catalog
.
length
&&
video_catalog
[
activeIndex
][
'class_price'
]}
购买单集
className
=
'purchase-episode'
>
¥
{
video
List
.
length
&&
videoList
[
activeIndex
][
'class_price'
]}
购买单集
<
/button
>
<
/div
>
<
/div
>
...
...
@@ -252,7 +256,7 @@ class Video extends Component {
return
<
VideoCatalog
activeIndex
=
{
this
.
state
.
activeIndex
}
handleClick
=
{
this
.
handleClick
}
videoCatalog
=
{
this
.
state
.
video
_catalog
}
videoCatalog
=
{
this
.
state
.
video
List
}
{...
props
}
/
>
}}
/
>
<
Route
path
=
{
`
${
match
.
path
}
/datum`
}
render
=
{
props
=>
{
...
...
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