From 402532cd98cc3634ddb52ccbd0dff6fccfb11f78 Mon Sep 17 00:00:00 2001 From: niko <644506165@qq.com> Date: Mon, 16 Oct 2017 03:19:24 -0500 Subject: [PATCH] Dashboard: design update (#18) * update analysis * update monitor * update workplace --- mock/chart.js | 2 +- src/components/ActiveChart/index.js | 4 ++- src/components/Charts/MiniArea/index.js | 32 ++++++++++++++++----- src/components/Charts/NumberInfo/index.js | 4 +-- src/components/Charts/NumberInfo/index.less | 6 ++++ src/components/Charts/Radar/index.js | 6 ++-- src/routes/Dashboard/Analysis.js | 31 +++++++++++++------- src/routes/Dashboard/Analysis.less | 30 ++++++++++++++++++- src/routes/Dashboard/Monitor.js | 24 +++++++++------- src/routes/Dashboard/Monitor.less | 4 +-- src/routes/Dashboard/Workplace.js | 8 ++++-- src/routes/Dashboard/Workplace.less | 17 ++++++++++- 12 files changed, 127 insertions(+), 41 deletions(-) diff --git a/mock/chart.js b/mock/chart.js index d28c5521..43eec3cf 100644 --- a/mock/chart.js +++ b/mock/chart.js @@ -3,7 +3,7 @@ import moment from 'moment'; // mock data const visitData = []; const beginDay = new Date().getTime(); -for (let i = 0; i < 20; i += 1) { +for (let i = 0; i < 7; i += 1) { visitData.push({ x: moment(new Date(beginDay + (1000 * 60 * 60 * 24 * i))).format('YYYY-MM-DD'), y: Math.floor(Math.random() * 100) + 10, diff --git a/src/components/ActiveChart/index.js b/src/components/ActiveChart/index.js index e615d662..916a322d 100644 --- a/src/components/ActiveChart/index.js +++ b/src/components/ActiveChart/index.js @@ -46,7 +46,9 @@ export default class ActiveChart extends PureComponent { { + const item = ev.items[0]; + const { title } = item; + item.title = ''; + item.name = ''; + item.value = `${title} : ${item.value}`; + }); + if (line) { - chart.line().position('x*y').color(color).shape('smooth'); + const view2 = chart.createView(); + view2.source(data, dataConfig); + view2.line().position('x*y').color(borderColor).size(borderWidth) + .shape('smooth'); + view2.tooltip(false); } chart.render(); diff --git a/src/components/Charts/NumberInfo/index.js b/src/components/Charts/NumberInfo/index.js index 473796b2..507d9d5e 100644 --- a/src/components/Charts/NumberInfo/index.js +++ b/src/components/Charts/NumberInfo/index.js @@ -4,7 +4,7 @@ import classNames from 'classnames'; import styles from './index.less'; -export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) => ( +export default ({ theme, title, subTitle, total, subTotal, status, suffix, ...rest }) => (
}
{subTitle}
- {total} + {total}{suffix && {suffix}} { (status || subTotal) && ( diff --git a/src/components/Charts/NumberInfo/index.less b/src/components/Charts/NumberInfo/index.less index c1dfcba8..0ee56f91 100644 --- a/src/components/Charts/NumberInfo/index.less +++ b/src/components/Charts/NumberInfo/index.less @@ -2,6 +2,12 @@ @import "../../../utils/utils.less"; .numberInfo { + .suffix { + color: @text-color; + font-size: 16px; + font-style: normal; + margin-left: 4px; + } h4 { color: @heading-color; margin-bottom: 16px; diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js index 351a1010..1da52c38 100644 --- a/src/components/Charts/Radar/index.js +++ b/src/components/Charts/Radar/index.js @@ -55,6 +55,8 @@ class Radar extends PureComponent { tickCount = 4, margin = [16, 30, 16, 30] } = this.props; + const colors = ['#1890FF', '#FACC14', '#2FC25B']; + if (!data || (data && data.length < 1)) { return; } @@ -93,8 +95,8 @@ class Radar extends PureComponent { }, }); - chart.line().position('label*value').color('name'); - chart.point().position('label*value').color('name').shape('circle'); + chart.line().position('label*value').color('name', colors); + chart.point().position('label*value').color('name', colors).shape('circle'); chart.render(); diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js index ef3dd84e..4a9dca74 100644 --- a/src/routes/Dashboard/Analysis.js +++ b/src/routes/Dashboard/Analysis.js @@ -208,8 +208,7 @@ export default class Analysis extends Component { contentHeight={46} > @@ -335,7 +334,8 @@ export default class Analysis extends Component { /> @@ -349,7 +349,8 @@ export default class Analysis extends Component { /> @@ -371,17 +372,24 @@ export default class Analysis extends Component { + {iconGroup} +
+ + 全部渠道 + 线上 + 门店 + +
+
+ )} style={{ marginTop: 24 }} > - - 全部渠道 - 线上 - 门店 - -
+
- + @@ -60,16 +61,17 @@ export default class Monitor extends PureComponent {
- map + map
- + @@ -81,13 +83,13 @@ export default class Monitor extends PureComponent { > { - switch (val) { + switch (parseInt(val, 10)) { case 20: return '差'; case 40: return '中'; case 60: - return '量'; + return '良'; case 80: return '优'; default: @@ -95,14 +97,14 @@ export default class Monitor extends PureComponent { } }} title="核销率" - height={164} + height={180} percent={87} />
- + - + - + } - title={{item.title}} + title={( + + + {item.title} + + )} description={item.description} />
diff --git a/src/routes/Dashboard/Workplace.less b/src/routes/Dashboard/Workplace.less index 586a7ffb..467242f4 100644 --- a/src/routes/Dashboard/Workplace.less +++ b/src/routes/Dashboard/Workplace.less @@ -107,16 +107,31 @@ .projectList { :global { .ant-card-meta-description { + color: @text-color-secondary; font-size: 12px; min-height: 36px; } } + .cardTitle { + :global { + .ant-avatar { + position: relative; + top: 5px; + } + } + a { + color: @heading-color; + margin-left: 12px; + &:hover { + color: @primary-color; + } + } + } .projectGrid { width: 33.33%; } .projectItemContent { display: flex; - padding-left: 48px; margin-top: 12px; overflow: hidden; font-size: 12px; -- GitLab