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
8f9b0049
Commit
8f9b0049
authored
Sep 07, 2017
by
nikogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽离定时器图表为上层组件
parent
148a9b2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
93 deletions
+114
-93
src/components/ActiveChart/index.js
src/components/ActiveChart/index.js
+77
-0
src/components/ActiveChart/index.less
src/components/ActiveChart/index.less
+34
-0
src/routes/Dashboard/Monitor.js
src/routes/Dashboard/Monitor.js
+3
-61
src/routes/Dashboard/Monitor.less
src/routes/Dashboard/Monitor.less
+0
-32
No files found.
src/components/ActiveChart/index.js
0 → 100644
View file @
8f9b0049
import
React
,
{
PureComponent
}
from
'
react
'
;
import
{
NumberInfo
,
MiniArea
}
from
'
../Charts
'
;
import
{
fixedZero
}
from
'
../../utils/utils
'
;
import
styles
from
'
./index.less
'
;
function
getActiveData
()
{
const
activeData
=
[];
for
(
let
i
=
0
;
i
<
24
;
i
+=
1
)
{
activeData
.
push
({
x
:
`
${
fixedZero
(
i
)}
:00`
,
y
:
(
i
*
50
)
+
(
Math
.
floor
(
Math
.
random
()
*
200
)),
});
}
return
activeData
;
}
export
default
class
ActiveChart
extends
PureComponent
{
state
=
{
activeData
:
getActiveData
(),
}
componentDidMount
()
{
setInterval
(()
=>
{
this
.
setState
({
activeData
:
getActiveData
(),
});
},
1000
);
}
render
()
{
const
{
activeData
=
[]
}
=
this
.
state
;
return
(
<
div
className
=
{
styles
.
activeChart
}
>
<
NumberInfo
subTitle
=
"
目标评估
"
total
=
"
有望达到预期
"
/>
<
div
style
=
{{
marginTop
:
32
}}
>
<
MiniArea
animate
=
{
false
}
line
color
=
"
#5DD1DD
"
height
=
{
84
}
yAxis
=
{{
tickCount
:
3
,
tickLine
:
false
,
labels
:
false
,
title
:
false
,
line
:
false
,
}}
data
=
{
activeData
}
/
>
<
/div
>
{
activeData
&&
(
<
div
className
=
{
styles
.
activeChartGrid
}
>
<
p
>
{[...
activeData
].
sort
()[
activeData
.
length
-
1
].
y
+
200
}
亿元
<
/p
>
<
p
>
{[...
activeData
].
sort
()[
Math
.
floor
(
activeData
.
length
/
2
)].
y
}
亿元
<
/p
>
<
/div
>
)
}
{
activeData
&&
(
<
div
className
=
{
styles
.
activeChartLegend
}
>
<
span
>
00
:
00
<
/span
>
<
span
>
{
activeData
[
Math
.
floor
(
activeData
.
length
/
2
)].
x
}
<
/span
>
<
span
>
{
activeData
[
activeData
.
length
-
1
].
x
}
<
/span
>
<
/div
>
)
}
<
/div
>
);
}
}
src/components/ActiveChart/index.less
0 → 100644
View file @
8f9b0049
@import "~antd/lib/style/themes/default.less";
@import "../../utils/utils.less";
.activeChart {
position: relative;
}
.activeChartGrid {
p {
position: absolute;
top: 80px;
}
p:last-child {
top: 115px;
}
}
.activeChartLegend {
position: relative;
font-size: 0;
margin-top: 8px;
height: 20px;
line-height: 20px;
span {
display: inline-block;
font-size: 12px;
text-align: center;
width: 33.33%;
}
span:first-child {
text-align: left;
}
span:last-child {
text-align: right;
}
}
src/routes/Dashboard/Monitor.js
View file @
8f9b0049
...
@@ -7,21 +7,11 @@ import { NumberInfo, MiniArea, Pie, WaterWave, Gauge } from '../../components/Ch
...
@@ -7,21 +7,11 @@ import { NumberInfo, MiniArea, Pie, WaterWave, Gauge } from '../../components/Ch
import
MapChart
from
'
../../components/MapChart
'
;
import
MapChart
from
'
../../components/MapChart
'
;
import
TagCloud
from
'
../../components/TagCloud
'
;
import
TagCloud
from
'
../../components/TagCloud
'
;
import
Countdown
from
'
../../components/Countdown
'
;
import
Countdown
from
'
../../components/Countdown
'
;
import
ActiveChart
from
'
../../components/ActiveChart
'
;
import
{
fixedZero
}
from
'
../../utils/utils
'
;
import
{
fixedZero
}
from
'
../../utils/utils
'
;
import
styles
from
'
./Monitor.less
'
;
import
styles
from
'
./Monitor.less
'
;
function
getActiveData
()
{
const
activeData
=
[];
for
(
let
i
=
0
;
i
<
24
;
i
+=
1
)
{
activeData
.
push
({
x
:
`
${
fixedZero
(
i
)}
:00`
,
y
:
(
i
*
50
)
+
(
Math
.
floor
(
Math
.
random
()
*
200
)),
});
}
return
activeData
;
}
const
MapData
=
[];
const
MapData
=
[];
for
(
let
i
=
0
;
i
<
50
;
i
+=
1
)
{
for
(
let
i
=
0
;
i
<
50
;
i
+=
1
)
{
MapData
.
push
({
MapData
.
push
({
...
@@ -36,23 +26,13 @@ const targetTime = new Date().getTime() + 3900000;
...
@@ -36,23 +26,13 @@ const targetTime = new Date().getTime() + 3900000;
monitor
:
state
.
monitor
,
monitor
:
state
.
monitor
,
}))
}))
export
default
class
Monitor
extends
PureComponent
{
export
default
class
Monitor
extends
PureComponent
{
state
=
{
activeData
:
getActiveData
(),
}
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
dispatch
({
this
.
props
.
dispatch
({
type
:
'
monitor/fetchTags
'
,
type
:
'
monitor/fetchTags
'
,
});
});
setInterval
(()
=>
{
this
.
setState
({
activeData
:
getActiveData
(),
});
},
1000
);
}
}
render
()
{
render
()
{
const
{
activeData
=
[]
}
=
this
.
state
;
const
{
monitor
}
=
this
.
props
;
const
{
monitor
}
=
this
.
props
;
const
{
tags
}
=
monitor
;
const
{
tags
}
=
monitor
;
...
@@ -96,45 +76,7 @@ export default class Monitor extends PureComponent {
...
@@ -96,45 +76,7 @@ export default class Monitor extends PureComponent {
<
/Col
>
<
/Col
>
<
Col
lg
=
{
8
}
md
=
{
24
}
sm
=
{
24
}
xs
=
{
24
}
>
<
Col
lg
=
{
8
}
md
=
{
24
}
sm
=
{
24
}
xs
=
{
24
}
>
<
Card
title
=
"
活动情况预测
"
style
=
{{
marginBottom
:
24
}}
bordered
=
{
false
}
>
<
Card
title
=
"
活动情况预测
"
style
=
{{
marginBottom
:
24
}}
bordered
=
{
false
}
>
<
div
className
=
{
styles
.
activeChart
}
>
<
ActiveChart
/>
<
NumberInfo
subTitle
=
"
目标评估
"
total
=
"
有望达到预期
"
/>
<
div
style
=
{{
marginTop
:
32
}}
>
<
MiniArea
animate
=
{
false
}
line
color
=
"
#5DD1DD
"
height
=
{
84
}
yAxis
=
{{
tickCount
:
3
,
tickLine
:
false
,
labels
:
false
,
title
:
false
,
line
:
false
,
}}
data
=
{
activeData
}
/
>
<
/div
>
{
activeData
&&
(
<
div
className
=
{
styles
.
activeChartGrid
}
>
<
p
>
{[...
activeData
].
sort
()[
activeData
.
length
-
1
].
y
+
200
}
亿元
<
/p
>
<
p
>
{[...
activeData
].
sort
()[
Math
.
floor
(
activeData
.
length
/
2
)].
y
}
亿元
<
/p
>
<
/div
>
)
}
{
activeData
&&
(
<
div
className
=
{
styles
.
activeChartLegend
}
>
<
span
>
00
:
00
<
/span
>
<
span
>
{
activeData
[
Math
.
floor
(
activeData
.
length
/
2
)].
x
}
<
/span
>
<
span
>
{
activeData
[
activeData
.
length
-
1
].
x
}
<
/span
>
<
/div
>
)
}
<
/div
>
<
/Card
>
<
/Card
>
<
Card
<
Card
title
=
"
券核效率
"
title
=
"
券核效率
"
...
...
src/routes/Dashboard/Monitor.less
View file @
8f9b0049
@import "~antd/lib/style/themes/default.less";
@import "~antd/lib/style/themes/default.less";
@import "../../utils/utils.less";
@import "../../utils/utils.less";
.activeChart {
position: relative;
}
.activeChartGrid {
p {
position: absolute;
top: 80px;
}
p:last-child {
top: 115px;
}
}
.activeChartLegend {
position: relative;
font-size: 0;
margin-top: 8px;
height: 20px;
line-height: 20px;
span {
display: inline-block;
font-size: 12px;
text-align: center;
width: 33.33%;
}
span:first-child {
text-align: left;
}
span:last-child {
text-align: right;
}
}
.mapChart {
.mapChart {
padding-top: 46px;
padding-top: 46px;
height: 436px;
height: 436px;
...
...
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