Commit f8028599 authored by afc163's avatar afc163

Lots of improvement

parent 224e5667
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
}, },
"lint-staged": { "lint-staged": {
"**/*.{js,jsx}": "lint-staged:js", "**/*.{js,jsx}": "lint-staged:js",
"**/*.less": "stylelint --syntax less", "**/*.less": "stylelint --syntax less"
"src/**/demo/*.md": "lint-staged:demo"
} }
} }
import React from 'react'; import React from 'react';
import { Icon } from 'antd'; import { Icon } from 'antd';
import classNames from 'classnames';
import styles from './index.less';
const IconUp = ({ color }) => ( const IconUp = ({ color, className, ...rest }) => (
<Icon <Icon
style={{ {...rest}
color: (color === false) ? 'rgba(0,0,0,0.43)' : '#00a854', className={classNames(styles.normal, className, {
fontSize: 12, [styles.up]: color !== false,
transform: 'scale(0.83)', })}
}}
type="caret-up" type="caret-up"
/> />
); );
const IconDown = ({ color }) => ( const IconDown = ({ color, className, ...rest }) => (
<Icon <Icon
style={{ {...rest}
color: (color === false) ? 'rgba(0,0,0,0.43)' : '#f04134', className={classNames(styles.normal, className, {
fontSize: 12, [styles.down]: color !== false,
transform: 'scale(0.83)', })}
}}
type="caret-down" type="caret-down"
/> />
); );
......
@import "~antd/lib/style/themes/default.less";
.normal {
color: @text-color-secondary;
font-size: 12px;
transform: scale(83%);
}
.up {
color: @green-6;
}
.down {
color: @red-6;
}
...@@ -22,8 +22,8 @@ export default ({ theme, title, subTitle, total, subTotal, status, suffix, ...re ...@@ -22,8 +22,8 @@ export default ({ theme, title, subTitle, total, subTotal, status, suffix, ...re
{ {
(status || subTotal) && ( (status || subTotal) && (
<span className={styles.subTotal}> <span className={styles.subTotal}>
{status && <Icon type={`caret-${status}`} />}
{subTotal} {subTotal}
{status && <Icon type={`caret-${status}`} />}
</span> </span>
) )
} }
......
...@@ -9,12 +9,15 @@ ...@@ -9,12 +9,15 @@
margin-left: 4px; margin-left: 4px;
} }
h4 { h4 {
color: @heading-color; color: @text-color;
font-size: @font-size-lg;
margin-bottom: 16px; margin-bottom: 16px;
transition: all .3s;
} }
h6 { h6 {
color: @text-color-secondary; color: @text-color-secondary;
font-size: @font-size-base; font-size: @font-size-base;
font-weight: normal;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
.textOverflow(); .textOverflow();
...@@ -33,12 +36,13 @@ ...@@ -33,12 +36,13 @@
} }
.subTotal { .subTotal {
color: @text-color-secondary; color: @text-color-secondary;
font-size: @font-size-base; font-size: @font-size-lg;
vertical-align: top; vertical-align: top;
margin-right: 0;
i { i {
font-size: 12px; font-size: 12px;
transform: scale(0.82); transform: scale(0.82);
margin-right: 4px; margin-left: 4px;
} }
} }
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
right: 0; right: 0;
} }
.title { .title {
margin-bottom: 16px; margin-bottom: 8px;
} }
.total { .total {
opacity: 0; opacity: 0;
......
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import { Icon } from 'antd';
import classNames from 'classnames';
import { Icon, Tooltip } from 'antd';
import styles from './index.less'; import styles from './index.less';
const Item = ({ title, flag, children, ...rest }, { mini }) => { const Item = ({ title, flag, children, ...rest }) => {
const map = {
xs: 0,
sm: 0,
md: 0,
lg: 0,
xlg: 0,
xl: 0,
xxl: 0,
};
if (mini && mini.forEach) {
mini.forEach((size) => {
map[size] = 1;
});
}
const clsObj = {};
Object.keys(map).forEach((k) => {
clsObj[styles[k]] = map[k];
});
const clsString = classNames(styles.trendItem, {
[styles.mini]: (typeof mini === 'boolean' && mini),
...clsObj,
});
const miniContent = (
<Tooltip title={children}>
<span className={styles.title}>{title}</span>
{ flag && <span className={styles[flag]}><Icon type={`caret-${flag}`} /></span>}
</Tooltip>
);
return ( return (
<div {...rest} className={clsString}> <div {...rest} className={styles.trendItem}>
<div className={styles.content}> <div className={styles.content}>
<span className={styles.title}>{title}</span> <span className={styles.title}>{title}</span>
<span className={styles.value}>{children}</span> <span className={styles.value}>{children}</span>
{flag && <span className={styles[flag]}><Icon type={`caret-${flag}`} /></span>} {flag && <span className={styles[flag]}><Icon type={`caret-${flag}`} /></span>}
</div> </div>
<div className={styles.miniContent}>
{miniContent}
</div>
</div> </div>
); );
}; };
Item.contextTypes = {
mini: PropTypes.oneOfType([
PropTypes.array,
PropTypes.bool,
]),
};
class Trend extends React.Component { class Trend extends React.Component {
getChildContext() {
return {
mini: this.props.mini,
};
}
render() { render() {
const { colorType, children, mini, ...rest } = this.props; const { colorType, children, ...rest } = this.props;
return ( return (
<div <div
className={colorType ? (styles[`trend${colorType}`] || styles.trend) : styles.trend} className={colorType ? (styles[`trend${colorType}`] || styles.trend) : styles.trend}
...@@ -80,13 +29,6 @@ class Trend extends React.Component { ...@@ -80,13 +29,6 @@ class Trend extends React.Component {
} }
} }
Trend.childContextTypes = {
mini: PropTypes.oneOfType([
PropTypes.array,
PropTypes.bool,
]),
};
Trend.Item = Item; Trend.Item = Item;
export default Trend; export default Trend;
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
.trendItem { .trendItem {
display: inline-block; display: inline-block;
margin-right: 24px;
color: @text-color; color: @text-color;
font-size: @font-size-base; font-size: @font-size-base;
line-height: 22px; line-height: 22px;
height: 22px; height: 22px;
& + & {
margin-left: 16px;
}
.content { .content {
display: block; display: block;
} }
...@@ -54,108 +56,3 @@ ...@@ -54,108 +56,3 @@
color: @text-color; color: @text-color;
} }
} }
.mini {
.content {
display: none;
}
.miniContent {
display: block;
}
}
.reset() {
.trendItem {
.content {
display: block;
}
.miniContent {
display: none;
}
}
}
@media screen and (max-width: @screen-xxl) {
.reset();
.xxl {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
@media screen and (max-width: @screen-xl) {
.reset();
.xl {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
@media screen and (max-width: @screen-lg) {
.reset();
.lg {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
// xlg
@media screen and (max-width: 1400px) {
.reset();
.xlg {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
@media screen and (max-width: @screen-md) {
.reset();
.md {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
@media screen and (max-width: @screen-sm) {
.reset();
.sm {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
@media screen and (max-width: @screen-xs) {
.reset();
.xs {
.content {
display: none;
}
.miniContent {
display: block;
}
}
}
...@@ -15,11 +15,11 @@ const extra = ( ...@@ -15,11 +15,11 @@ const extra = (
您提交的内容有如下错误: 您提交的内容有如下错误:
</div> </div>
<div style={{ marginBottom: 16 }}> <div style={{ marginBottom: 16 }}>
<Icon style={{ color: '#f04134', marginRight: 8 }} type="close-circle-o" />您的账户已被冻结 <Icon style={{ color: '#f5222d', marginRight: 8 }} type="close-circle-o" />您的账户已被冻结
<a style={{ marginLeft: 16 }}>立即解冻 <Icon type="right" /></a> <a style={{ marginLeft: 16 }}>立即解冻 <Icon type="right" /></a>
</div> </div>
<div> <div>
<Icon style={{ color: '#f04134', marginRight: 8 }} type="close-circle-o" />您的账户还不具备申请资格 <Icon style={{ color: '#f5222d', marginRight: 8 }} type="close-circle-o" />您的账户还不具备申请资格
<a style={{ marginLeft: 16 }}>立即升级 <Icon type="right" /></a> <a style={{ marginLeft: 16 }}>立即升级 <Icon type="right" /></a>
</div> </div>
</div> </div>
......
...@@ -9,9 +9,3 @@ body { ...@@ -9,9 +9,3 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
:global {
.ant-tabs-tab-active {
font-weight: 500;
}
}
...@@ -153,6 +153,7 @@ export default class Analysis extends Component { ...@@ -153,6 +153,7 @@ export default class Analysis extends Component {
dataIndex: 'count', dataIndex: 'count',
key: 'count', key: 'count',
sorter: (a, b) => a.count - b.count, sorter: (a, b) => a.count - b.count,
className: styles.alignRight,
}, },
{ {
title: '周涨幅', title: '周涨幅',
...@@ -160,8 +161,16 @@ export default class Analysis extends Component { ...@@ -160,8 +161,16 @@ export default class Analysis extends Component {
key: 'range', key: 'range',
sorter: (a, b) => a.range - b.range, sorter: (a, b) => a.range - b.range,
render: (text, record) => ( render: (text, record) => (
<span style={{ textAlign: 'right' }}>{text}% {record.status === 1 ? <IconDown /> : <IconUp />}</span> <span>
{text}%
{
record.status === 1
? <IconDown style={{ marginLeft: 8 }} />
: <IconUp style={{ marginLeft: 8 }} />
}
</span>
), ),
className: styles.alignRight,
}, },
]; ];
...@@ -173,7 +182,7 @@ export default class Analysis extends Component { ...@@ -173,7 +182,7 @@ export default class Analysis extends Component {
<NumberInfo <NumberInfo
title={data.name} title={data.name}
subTitle="转化率" subTitle="转化率"
total={`${data.cvr * 100}%`} total={<span style={{ top: '-6px', position: 'relative' }}>{data.cvr * 100}%</span>}
theme={(currentKey !== data.name) && 'light'} theme={(currentKey !== data.name) && 'light'}
/> />
</Col> </Col>
...@@ -212,7 +221,7 @@ export default class Analysis extends Component { ...@@ -212,7 +221,7 @@ export default class Analysis extends Component {
footer={<Field label="日均销售额" value={`¥${numeral(12423).format('0,0')}`} />} footer={<Field label="日均销售额" value={`¥${numeral(12423).format('0,0')}`} />}
contentHeight={46} contentHeight={46}
> >
<Trend colorType="gray" mini={['xlg', 'md']}> <Trend colorType="gray">
<Trend.Item title="周同比" flag="up">12%</Trend.Item> <Trend.Item title="周同比" flag="up">12%</Trend.Item>
<Trend.Item title="日环比" flag="down">11%</Trend.Item> <Trend.Item title="日环比" flag="down">11%</Trend.Item>
</Trend> </Trend>
...@@ -256,7 +265,7 @@ export default class Analysis extends Component { ...@@ -256,7 +265,7 @@ export default class Analysis extends Component {
action={<Tooltip title="指标说明"><Icon type="info-circle-o" /></Tooltip>} action={<Tooltip title="指标说明"><Icon type="info-circle-o" /></Tooltip>}
total="78%" total="78%"
footer={ footer={
<Trend mini={['xlg', 'md']}> <Trend>
<Trend.Item title="周同比" flag="up">12.3%</Trend.Item> <Trend.Item title="周同比" flag="up">12.3%</Trend.Item>
<Trend.Item title="日环比" flag="down">11%</Trend.Item> <Trend.Item title="日环比" flag="down">11%</Trend.Item>
</Trend> </Trend>
...@@ -347,7 +356,14 @@ export default class Analysis extends Component { ...@@ -347,7 +356,14 @@ export default class Analysis extends Component {
<Row gutter={68}> <Row gutter={68}>
<Col sm={12} xs={24} style={{ marginBottom: 24 }}> <Col sm={12} xs={24} style={{ marginBottom: 24 }}>
<NumberInfo <NumberInfo
subTitle={<span>搜索用户数 <Icon style={{ marginLeft: 8 }} type="info-circle-o" /></span>} subTitle={
<span>
搜索用户数
<Tooltip title="指标文案">
<Icon style={{ marginLeft: 8 }} type="info-circle-o" />
</Tooltip>
</span>
}
total={numeral(12321).format('0,0')} total={numeral(12321).format('0,0')}
status="up" status="up"
subTotal={17.1} subTotal={17.1}
...@@ -374,7 +390,7 @@ export default class Analysis extends Component { ...@@ -374,7 +390,7 @@ export default class Analysis extends Component {
</Row> </Row>
<Table <Table
rowKey={record => record.index} rowKey={record => record.index}
size="middle" size="small"
columns={columns} columns={columns}
dataSource={searchData} dataSource={searchData}
pagination={{ pagination={{
...@@ -405,7 +421,7 @@ export default class Analysis extends Component { ...@@ -405,7 +421,7 @@ export default class Analysis extends Component {
)} )}
style={{ marginTop: 24 }} style={{ marginTop: 24 }}
> >
<div style={{ marginTop: 32, marginBottom: 100 }}> <div style={{ marginTop: 8, marginBottom: 77 }}>
<Pie <Pie
hasLegend hasLegend
title="销售额" title="销售额"
......
...@@ -123,6 +123,15 @@ ...@@ -123,6 +123,15 @@
right: 6px; right: 6px;
} }
} }
:global(.ant-tabs-tab-active) h4 {
color: @primary-color;
}
}
td.alignRight,
th.alignRight {
text-align: right!important;
} }
@media screen and (max-width: @screen-lg) { @media screen and (max-width: @screen-lg) {
......
...@@ -144,7 +144,7 @@ export default class Monitor extends PureComponent { ...@@ -144,7 +144,7 @@ export default class Monitor extends PureComponent {
</Card> </Card>
</Col> </Col>
<Col xl={8} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}> <Col xl={8} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
<Card title="热门搜索" bordered={false}> <Card title="热门搜索" bordered={false} bodyStyle={{ overflow: 'hidden' }}>
<TagCloud <TagCloud
data={tags} data={tags}
height={161} height={161}
......
...@@ -9,11 +9,11 @@ const extra = ( ...@@ -9,11 +9,11 @@ const extra = (
您提交的内容有如下错误 您提交的内容有如下错误
</div> </div>
<div style={{ marginBottom: 16 }}> <div style={{ marginBottom: 16 }}>
<Icon style={{ color: '#f04134', marginRight: 8 }} type="close-circle-o" />您的账户已被冻结 <Icon style={{ color: '#f5222d', marginRight: 8 }} type="close-circle-o" />您的账户已被冻结
<a style={{ marginLeft: 16 }}>立即解冻 <Icon type="right" /></a> <a style={{ marginLeft: 16 }}>立即解冻 <Icon type="right" /></a>
</div> </div>
<div> <div>
<Icon style={{ color: '#f04134', marginRight: 8 }} type="close-circle-o" />您的账户还不具备申请资格 <Icon style={{ color: '#f5222d', marginRight: 8 }} type="close-circle-o" />您的账户还不具备申请资格
<a style={{ marginLeft: 16 }}>立即升级 <Icon type="right" /></a> <a style={{ marginLeft: 16 }}>立即升级 <Icon type="right" /></a>
</div> </div>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment