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
9e9ff746
Commit
9e9ff746
authored
May 31, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
study
parent
34311af2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
src/App.js
+3
-4
src/components/study/myCourses/index.js
+0
-6
src/components/study/myCourses/reducers.js
+5
-1
No files found.
src/App.js
View file @
9e9ff746
...
...
@@ -4,7 +4,8 @@ import cookie from 'js-cookie'
import
{
api
}
from
'@/utils'
//拦截ajax请求,返回mock数据
import
mock
from
'@/utils/mock'
/*import mock from '@/utils/mock'
mock()*/
// 默认样式
...
...
@@ -14,14 +15,12 @@ import './assets/css/index.scss';
import
'./assets/font/iconfont.css'
;
export
default
class
App
extends
Component
{
componentDidMount
(){
//平台信息
cookie
.
set
(
'plat'
,
'5'
)
//拦截ajax请求,返回mock数据
mock
()
}
render
(){
return
<
Routes
/>
...
...
src/components/study/myCourses/index.js
View file @
9e9ff746
...
...
@@ -78,20 +78,14 @@ class MyCourses extends PureComponent {
}
componentDidMount
()
{
console
.
log
(
'did mount'
)
this
.
props
.
switchTab
(
false
)
this
.
props
.
fetchCoursesListIfNeeded
();
}
componentWillUnmount
(){
console
.
log
(
'will unmount'
)
this
.
props
.
switchTab
(
true
);
}
componentDidUpdate
()
{
console
.
log
(
'updated'
)
}
loadFunc
=
debounce
(()
=>
{
if
(
this
.
props
.
courseList
.
length
%
10
===
0
)
{
this
.
props
.
fetchCoursesListIfNeeded
();
...
...
src/components/study/myCourses/reducers.js
View file @
9e9ff746
...
...
@@ -18,10 +18,14 @@ export default function myCourses(state = initialState, action) {
switch
(
action
.
type
)
{
case
RECEIVE_MY_COURSES
:
let
{
courseList
,
...
rest
}
=
action
.
payload
return
{...
state
,
...
rest
,
courseList
:
state
.
courseList
.
concat
(
courseList
)}
return
{
...
state
,
...
rest
,
courseList
:
Object
.
keys
(
courseList
).
length
===
0
?
state
.
courseList
:
state
.
courseList
.
concat
(
courseList
)
}
case
SWITCH_TAB
:
return
{...
state
,
switchTab
:
action
.
payload
}
case
NOMORE_COURSE
:
return
{...
state
,
noMore
:
true
}
default
:
return
state
}
...
...
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