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
25943c4d
Commit
25943c4d
authored
Aug 08, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
c61460e4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
82 deletions
+109
-82
src/common/Loading/index.js
+9
-0
src/components/coupons/index.js
+1
-1
src/components/study/myCourses/actions.js
+8
-2
src/components/study/myCourses/index.js
+81
-74
src/components/study/myCourses/reducers.js
+7
-2
src/components/video/index.js
+3
-3
No files found.
src/common/Loading/index.js
View file @
25943c4d
...
...
@@ -17,6 +17,15 @@ class Loading extends Component {
isLoading
:
true
}
componentDidMount
()
{
if
(
!
this
.
props
.
isLoading
){
this
.
setState
({
isLoading
:
false
})
}
}
componentDidUpdate
(
prevProps
)
{
let
{
isLoading
,
fake
}
=
this
.
props
if
(
!
isLoading
)
{
...
...
src/components/coupons/index.js
View file @
25943c4d
...
...
@@ -62,7 +62,7 @@ class UseCoupon extends PureComponent {
if
(
this
.
state
.
showUseButton
)
{
this
.
setState
({
couponList
:
[...
state
.
couponList
,
coupon
],
couponList
:
[...
this
.
state
.
couponList
,
coupon
],
redeemCode
:
''
})
}
else
{
...
...
src/components/study/myCourses/actions.js
View file @
25943c4d
...
...
@@ -22,6 +22,7 @@ export const fetchCoursesListIfNeeded = () => (dispatch, getState) => {
}
export
const
getMyCourses
=
payload
=>
dispatch
=>
{
dispatch
(
startFetchingCourses
)
return
http
.
get
(
`
${
api
.
home
}
/m/my_course/
${
payload
.
page
}
/
${
payload
.
num
}
`
)
.
then
(
res
=>
{
const
{
data
,
code
,
msg
}
=
res
.
data
...
...
@@ -51,4 +52,9 @@ export const switchTab = payload => ({
export
const
NOMORE_COURSE
=
'NOMORE_COURSES'
export
const
nomoreCourse
=
()
=>
({
type
:
NOMORE_COURSE
})
\ No newline at end of file
})
export
const
START_FETCHING_COURSES
=
'START_FETCHING_COURSES'
export
const
startFetchingCourses
=
()
=>
{
return
{
type
:
START_FETCHING_COURSES
,
payload
:
{
isLoading
:
true
}}
}
\ No newline at end of file
src/components/study/myCourses/index.js
View file @
25943c4d
...
...
@@ -7,6 +7,7 @@ import { fetchCoursesListIfNeeded, switchTab } from "./actions"
import
InfiniteScroll
from
'react-infinite-scroller'
import
{
debounce
}
from
'lodash'
import
{
Link
}
from
'react-router-dom'
import
{
Loading
}
from
"@/common"
;
function
getStudyTime
(
seconds
)
{
...
...
@@ -69,7 +70,11 @@ const Bottom = React.memo(({item}) => {
class
MyCourses
extends
PureComponent
{
list
;
list
state
=
{
isLoading
:
true
}
handleClick
=
id
=>
{
this
.
props
.
history
.
push
(
`/play/video?id=
${
id
}
`
)
...
...
@@ -95,79 +100,80 @@ class MyCourses extends PureComponent {
render
()
{
let
list
=
this
.
props
.
courseList
if
(
list
&&
list
.
length
!==
0
)
{
return
(
<>
<
div
className
=
"my-course-uid"
>
{
`加群请备注您的学号:
${
this
.
props
.
user
.
data
.
uid
}
`
}
<
/div
>
<
InfiniteScroll
pageStart
=
{
0
}
hasMore
=
{
true
}
loadMore
=
{
this
.
loadFunc
}
useWindow
=
{
false
}
>
<
ul
ref
=
{
el
=>
this
.
list
=
el
}
>
{
list
.
map
((
item
,
index
)
=>
{
const
Info
=
(
<
div
className
=
"info"
>
<
div
className
=
'title'
>
{
item
.
course_title
}
<
/div
>
{
item
.
is_aist
?
<
div
className
=
'contact'
>
助教微信:
{
item
.
assist_weixin
}
<
/div
>
:
<
div
className
=
'contact'
>
QQ
群:
{
item
.
course_qq
}
<
/div
>
}
{
item
.
is_aist
&&
item
.
aist_schedule
&&
<
div
className
=
"process-status"
>
<
div
className
=
"process-wrapper"
>
<
div
className
=
"process-bar"
style
=
{{
width
:
`
${
parseFloat
(
item
.
aist_schedule
)}
%`
}}
/
>
return
<
Loading
isLoading
=
{
this
.
props
.
isLoading
}
>
{
list
&&
list
.
length
!==
0
?
<>
<
div
className
=
"my-course-uid"
>
{
`加群请备注您的学号:
${
this
.
props
.
user
.
data
.
uid
}
`
}
<
/div
>
<
InfiniteScroll
pageStart
=
{
0
}
hasMore
=
{
true
}
loadMore
=
{
this
.
loadFunc
}
useWindow
=
{
false
}
>
<
ul
ref
=
{
el
=>
this
.
list
=
el
}
>
{
list
.
map
((
item
,
index
)
=>
{
const
Info
=
(
<
div
className
=
"info"
>
<
div
className
=
'title'
>
{
item
.
course_title
}
<
/div
>
{
item
.
is_aist
?
<
div
className
=
'contact'
>
助教微信:
{
item
.
assist_weixin
}
<
/div
>
:
<
div
className
=
'contact'
>
QQ
群:
{
item
.
course_qq
}
<
/div
>
}
{
item
.
is_aist
&&
item
.
aist_schedule
&&
<
div
className
=
"process-status"
>
<
div
className
=
"process-wrapper"
>
<
div
className
=
"process-bar"
style
=
{{
width
:
`
${
parseFloat
(
item
.
aist_schedule
)}
%`
}}
/
>
<
/div
>
<
div
className
=
"process-text"
>
{
item
.
aist_schedule
}
<
/div
>
<
/div
>
<
div
className
=
"process-text"
>
{
item
.
aist_schedule
}
<
/div
>
<
/div
>
}
<
Bottom
item
=
{
item
}
/
>
<
/div
>
)
const
status
=
(
item
.
is_aist
&&
<
span
className
=
'status'
>
返现
<
/span
>
)
return
(
<
VList
img
=
{
item
.
image_name
}
handleClick
=
{
this
.
handleClick
}
{...
item
}
key
=
{
index
}
info
=
{
Info
}
status
=
{
status
}
id
=
{
item
[
'course_id'
]}
/
>
)
})
}
<
/ul
>
<
/InfiniteScroll
>
{
list
.
length
%
10
!==
0
?
<
AddCourse
addCourseClick
=
{
this
.
addCourseClick
}
/
>
:
null
}
<
/
>
)
}
else
{
return
(
<
div
className
=
"empty"
>
<
p
><
i
className
=
'iconfont iconfish'
/><
/p
>
<
p
className
=
'empty-prompt'
>
还是咸鱼一条,快去翻身
~<
/p
>
<
p
>
<
Link
className
=
'select-course'
to
=
'/classify'
>
去选课
<
/Link
>
<
/p
>
<
/div
>
)
}
}
<
Bottom
item
=
{
item
}
/
>
<
/div
>
)
const
status
=
(
item
.
is_aist
&&
<
span
className
=
'status'
>
返现
<
/span
>
)
return
(
<
VList
img
=
{
item
.
image_name
}
handleClick
=
{
this
.
handleClick
}
{...
item
}
key
=
{
index
}
info
=
{
Info
}
status
=
{
status
}
id
=
{
item
[
'course_id'
]}
/
>
)
})
}
<
/ul
>
<
/InfiniteScroll
>
{
list
.
length
%
10
!==
0
?
<
AddCourse
addCourseClick
=
{
this
.
addCourseClick
}
/
>
:
null
}
<
/
>
:
<
div
className
=
"empty"
>
<
p
><
i
className
=
'iconfont iconfish'
/><
/p
>
<
p
className
=
'empty-prompt'
>
还是咸鱼一条,快去翻身
~<
/p
>
<
p
>
<
Link
className
=
'select-course'
to
=
'/classify'
>
去选课
<
/Link
>
<
/p
>
<
/div
>
}
<
/Loading
>
}
}
...
...
@@ -175,7 +181,8 @@ class MyCourses extends PureComponent {
export
default
connect
(
state
=>
({
courseList
:
state
.
myCourses
.
courseList
,
user
:
state
.
user
user
:
state
.
user
,
isLoading
:
state
.
myCourses
.
isLoading
}),
{
fetchCoursesListIfNeeded
,
...
...
src/components/study/myCourses/reducers.js
View file @
25943c4d
import
{
RECEIVE_MY_COURSES
,
SWITCH_TAB
,
NOMORE_COURSE
NOMORE_COURSE
,
START_FETCHING_COURSES
}
from
'./actions'
const
initialState
=
{
...
...
@@ -11,6 +12,7 @@ const initialState = {
statusCode
:
0
,
msg
:
''
,
noMore
:
false
,
isLoading
:
true
}
...
...
@@ -20,8 +22,11 @@ export default function myCourses(state = initialState, action) {
let
{
courseList
,
...
rest
}
=
action
.
payload
return
{
...
state
,
...
rest
,
courseList
:
Object
.
keys
(
courseList
).
length
===
0
?
state
.
courseList
:
state
.
courseList
.
concat
(
courseList
)
courseList
:
Object
.
keys
(
courseList
).
length
===
0
?
state
.
courseList
:
state
.
courseList
.
concat
(
courseList
),
isLoading
:
false
}
case
START_FETCHING_COURSES
:
return
{...
state
,
...
action
.
payload
}
case
SWITCH_TAB
:
return
{...
state
,
switchTab
:
action
.
payload
}
case
NOMORE_COURSE
:
...
...
src/components/video/index.js
View file @
25943c4d
...
...
@@ -101,7 +101,7 @@ class Video extends Component {
this
.
ws
=
new
WebSocket
(
'ws://process-test.julyedu.com:9502'
);
this
.
ws
.
addEventListener
(
'error'
,
()
=>
{
this
.
ws
=
null
this
.
setupWS
();
//
this.setupWS();
})
this
.
ws
.
addEventListener
(
'open'
,
()
=>
{
console
.
log
(
'open'
);
...
...
@@ -109,7 +109,7 @@ class Video extends Component {
this
.
ws
.
addEventListener
(
'close'
,
()
=>
{
if
(
this
.
reconnect
){
this
.
ws
=
null
this
.
setupWS
()
//
this.setupWS()
}
clearInterval
(
this
.
timer
)
})
...
...
@@ -332,7 +332,7 @@ class Video extends Component {
}
}
hasAuth
=
(
index
)
=>
{
hasAuth
=
()
=>
{
const
{
course
,
videoList
,
activeIndex
}
=
this
.
state
let
lesson
=
videoList
[
activeIndex
]
if
(
!
lesson
[
'is_free'
])
{
...
...
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