Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
ad38d93f
Commit
ad38d93f
authored
Jul 22, 2018
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimization: use state to control rendering time
parent
f3b77d43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
.gitignore
.gitignore
+2
-0
src/pages/Dashboard/Analysis.js
src/pages/Dashboard/Analysis.js
+9
-3
src/pages/layouts/LoadingPage.js
src/pages/layouts/LoadingPage.js
+1
-3
No files found.
.gitignore
View file @
ad38d93f
...
@@ -34,3 +34,5 @@ functions/mock
...
@@ -34,3 +34,5 @@ functions/mock
.umi
.umi
.umi-production
.umi-production
# screenshot
screenshot
\ No newline at end of file
src/pages/Dashboard/Analysis.js
View file @
ad38d93f
...
@@ -61,6 +61,7 @@ class Analysis extends Component {
...
@@ -61,6 +61,7 @@ class Analysis extends Component {
this
.
state
=
{
this
.
state
=
{
salesType
:
'
all
'
,
salesType
:
'
all
'
,
currentTabKey
:
''
,
currentTabKey
:
''
,
loading
:
true
,
rangePickerValue
:
getTimeDistance
(
'
year
'
),
rangePickerValue
:
getTimeDistance
(
'
year
'
),
};
};
}
}
...
@@ -77,6 +78,11 @@ class Analysis extends Component {
...
@@ -77,6 +78,11 @@ class Analysis extends Component {
dispatch
({
dispatch
({
type
:
'
chart/fetch
'
,
type
:
'
chart/fetch
'
,
});
});
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
});
},
1000
);
});
});
}
}
...
@@ -137,8 +143,8 @@ class Analysis extends Component {
...
@@ -137,8 +143,8 @@ class Analysis extends Component {
}
}
render
()
{
render
()
{
const
{
rangePickerValue
,
salesType
,
currentTabKey
}
=
this
.
state
;
const
{
rangePickerValue
,
salesType
,
loading
:
propsLoding
,
currentTabKey
}
=
this
.
state
;
const
{
chart
,
loading
}
=
this
.
props
;
const
{
chart
,
loading
:
stateLoading
}
=
this
.
props
;
const
{
const
{
visitData
,
visitData
,
visitData2
,
visitData2
,
...
@@ -150,7 +156,7 @@ class Analysis extends Component {
...
@@ -150,7 +156,7 @@ class Analysis extends Component {
salesTypeDataOnline
,
salesTypeDataOnline
,
salesTypeDataOffline
,
salesTypeDataOffline
,
}
=
chart
;
}
=
chart
;
const
loading
=
propsLoding
||
stateLoading
;
const
salesPieData
=
const
salesPieData
=
salesType
===
'
all
'
salesType
===
'
all
'
?
salesTypeData
?
salesTypeData
...
...
src/pages/layouts/LoadingPage.js
View file @
ad38d93f
...
@@ -31,9 +31,7 @@ function formatter(data, parentPath = '', parentAuthority, parentName) {
...
@@ -31,9 +31,7 @@ function formatter(data, parentPath = '', parentAuthority, parentName) {
return
result
;
return
result
;
});
});
}
}
/**
// get meun map data
* 根据菜单取得重定向地址.
*/
const
MenuData
=
formatter
(
routerConfig
[
1
].
routes
);
const
MenuData
=
formatter
(
routerConfig
[
1
].
routes
);
class
LoadingPage
extends
PureComponent
{
class
LoadingPage
extends
PureComponent
{
...
...
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