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 {
...
@@ -25,7 +25,7 @@ class Video extends Component {
state
=
{
state
=
{
title
:
''
,
title
:
''
,
courseId
:
null
,
courseId
:
null
,
video
_catalog
:
[],
video
List
:
[],
datum
:
[],
datum
:
[],
currentVideoSrc
:
''
,
currentVideoSrc
:
''
,
activeIndex
:
0
,
activeIndex
:
0
,
...
@@ -42,8 +42,9 @@ class Video extends Component {
...
@@ -42,8 +42,9 @@ class Video extends Component {
this
.
setState
({
this
.
setState
({
courseId
:
this
.
courseID
courseId
:
this
.
courseID
})
})
this
.
getVideo
Catalog
()
this
.
getVideo
List
()
this
.
getDatumCatalog
()
this
.
getDatumCatalog
()
}
}
initializePlayer
=
()
=>
{
initializePlayer
=
()
=>
{
...
@@ -54,10 +55,13 @@ class Video extends Component {
...
@@ -54,10 +55,13 @@ class Video extends Component {
bigPlayButton
:
true
,
bigPlayButton
:
true
,
textTrackDisplay
:
false
,
textTrackDisplay
:
false
,
posterImage
:
false
,
posterImage
:
false
,
errorDisplay
:
false
errorDisplay
:
false
,
playbackRates
:
[
'0.75'
,
'1'
,
'1.5'
,
'2'
]
})
})
this
.
player
.
enableTouchActivity
()
this
.
player
.
enableTouchActivity
()
this
.
player
.
on
(
'useractive'
,
function
()
{
console
.
log
(
'active'
);
})
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
...
@@ -69,7 +73,7 @@ class Video extends Component {
...
@@ -69,7 +73,7 @@ class Video extends Component {
handleClick
=
index
=>
{
handleClick
=
index
=>
{
if
(
this
.
hasAuth
())
{
if
(
this
.
hasAuth
())
{
this
.
setPlayerSrc
(
this
.
state
.
video
_catalog
[
index
][
'play_url'
])
this
.
setPlayerSrc
(
this
.
state
.
video
List
[
index
][
'play_url'
])
this
.
playVideo
()
this
.
playVideo
()
}
}
this
.
setState
({
this
.
setState
({
...
@@ -78,7 +82,7 @@ class Video extends Component {
...
@@ -78,7 +82,7 @@ class Video extends Component {
}
}
getVideo
Catalog
=
()
=>
{
getVideo
List
=
()
=>
{
http
.
get
(
`
${
api
.
home
}
/m/course/play/
${
this
.
courseID
}
`
)
http
.
get
(
`
${
api
.
home
}
/m/course/play/
${
this
.
courseID
}
`
)
.
then
(
res
=>
{
.
then
(
res
=>
{
const
data
=
res
.
data
const
data
=
res
.
data
...
@@ -86,7 +90,7 @@ class Video extends Component {
...
@@ -86,7 +90,7 @@ class Video extends Component {
this
.
setState
(
this
.
setState
(
state
=>
({
state
=>
({
video
_catalog
:
data
.
data
[
'lessons'
],
video
List
:
data
.
data
[
'lessons'
],
currentVideoSrc
:
data
.
data
[
'lessons'
][
state
.
activeIndex
][
'play_url'
],
currentVideoSrc
:
data
.
data
[
'lessons'
][
state
.
activeIndex
][
'play_url'
],
course
:
data
.
data
.
course
,
course
:
data
.
data
.
course
,
courseId
:
data
.
data
.
course
[
'course_id'
],
courseId
:
data
.
data
.
course
[
'course_id'
],
...
@@ -149,8 +153,8 @@ class Video extends Component {
...
@@ -149,8 +153,8 @@ class Video extends Component {
}
}
lessonAvailable
=
()
=>
{
lessonAvailable
=
()
=>
{
const
{
video
_catalog
,
activeIndex
}
=
this
.
state
const
{
video
List
,
activeIndex
}
=
this
.
state
return
video
_catalog
[
activeIndex
][
'video_size'
]
!==
0
return
video
List
[
activeIndex
][
'video_size'
]
!==
0
}
}
getCoursePrice
=
()
=>
{
getCoursePrice
=
()
=>
{
...
@@ -166,16 +170,16 @@ class Video extends Component {
...
@@ -166,16 +170,16 @@ class Video extends Component {
}
}
playWithAuth
=
()
=>
{
playWithAuth
=
()
=>
{
const
{
video
_catalog
,
activeIndex
}
=
this
.
state
const
{
video
List
,
activeIndex
}
=
this
.
state
if
(
this
.
hasAuth
())
{
if
(
this
.
hasAuth
())
{
this
.
setPlayerSrc
(
video
_catalog
[
activeIndex
][
'play_url'
])
this
.
setPlayerSrc
(
video
List
[
activeIndex
][
'play_url'
])
}
}
}
}
hasAuth
=
(
index
)
=>
{
hasAuth
=
(
index
)
=>
{
const
{
course
,
video
_catalog
,
activeIndex
}
=
this
.
state
const
{
course
,
video
List
,
activeIndex
}
=
this
.
state
let
lesson
=
video
_catalog
[
activeIndex
]
let
lesson
=
video
List
[
activeIndex
]
if
(
!
lesson
[
'is_free'
])
{
if
(
!
lesson
[
'is_free'
])
{
if
(
course
[
'is_audition'
])
{
if
(
course
[
'is_audition'
])
{
this
.
setState
({
this
.
setState
({
...
@@ -205,7 +209,7 @@ class Video extends Component {
...
@@ -205,7 +209,7 @@ class Video extends Component {
render
()
{
render
()
{
let
{
match
,
location
}
=
this
.
props
let
{
match
,
location
}
=
this
.
props
const
{
video
_catalog
,
activeIndex
,
isAuth
,
salePrice
}
=
this
.
state
const
{
video
List
,
activeIndex
,
isAuth
,
salePrice
}
=
this
.
state
return
(
return
(
<
div
className
=
'play'
>
<
div
className
=
'play'
>
<
HeaderBar
title
=
{
this
.
state
.
title
}
arrow
=
{
true
}
/
>
<
HeaderBar
title
=
{
this
.
state
.
title
}
arrow
=
{
true
}
/
>
...
@@ -221,7 +225,7 @@ class Video extends Component {
...
@@ -221,7 +225,7 @@ class Video extends Component {
<
div
className
=
'btns'
>
<
div
className
=
'btns'
>
<
button
type
=
'button'
className
=
'purchase-class'
>
¥
{
salePrice
}
购买课程
<
/button
>
<
button
type
=
'button'
className
=
'purchase-class'
>
¥
{
salePrice
}
购买课程
<
/button
>
<
button
type
=
'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
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -252,7 +256,7 @@ class Video extends Component {
...
@@ -252,7 +256,7 @@ class Video extends Component {
return
<
VideoCatalog
return
<
VideoCatalog
activeIndex
=
{
this
.
state
.
activeIndex
}
activeIndex
=
{
this
.
state
.
activeIndex
}
handleClick
=
{
this
.
handleClick
}
handleClick
=
{
this
.
handleClick
}
videoCatalog
=
{
this
.
state
.
video
_catalog
}
videoCatalog
=
{
this
.
state
.
video
List
}
{...
props
}
/
>
{...
props
}
/
>
}}
/
>
}}
/
>
<
Route
path
=
{
`
${
match
.
path
}
/datum`
}
render
=
{
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