Commit 9c0b6752 authored by ddcat1115's avatar ddcat1115

update style & add digitUppercase util

parent 339ea67a
...@@ -222,12 +222,17 @@ function AdvancedForm({ form, dispatch, submitting }) { ...@@ -222,12 +222,17 @@ function AdvancedForm({ form, dispatch, submitting }) {
)} )}
</Form.Item> </Form.Item>
</Col> </Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}> <Col id="timepicker-container" xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.dateRange2}> <Form.Item label={fieldLabels.dateRange2}>
{getFieldDecorator('dateRange2', { {getFieldDecorator('dateRange2', {
rules: [{ required: true, message: '请输入' }], rules: [{ required: true, message: '请输入' }],
})( })(
<TimePicker placeholder="提醒时间" style={{ width: '100%' }} /> <TimePicker
popupClassName={styles.popup}
placeholder="提醒时间"
style={{ width: '100%' }}
getPopupContainer={() => document.getElementById('timepicker-container')}
/>
)} )}
</Form.Item> </Form.Item>
</Col> </Col>
......
import React from 'react'; import React from 'react';
import { Form, Input, Button, Alert, Divider } from 'antd'; import { Form, Input, Button, Alert, Divider } from 'antd';
import { routerRedux } from 'dva/router'; import { routerRedux } from 'dva/router';
import { digitUppercase } from '../../../utils/utils';
import styles from './style.less'; import styles from './style.less';
export default ({ formItemLayout, form, data, dispatch, submitting }) => { export default ({ formItemLayout, form, data, dispatch, submitting }) => {
...@@ -56,7 +57,8 @@ export default ({ formItemLayout, form, data, dispatch, submitting }) => { ...@@ -56,7 +57,8 @@ export default ({ formItemLayout, form, data, dispatch, submitting }) => {
className={styles.stepFormText} className={styles.stepFormText}
label="转账金额" label="转账金额"
> >
<span className={styles.money}>{data.amount}</span> <span className={styles.money}>{data.amount}</span>
<span className={styles.uppercase}>{digitUppercase(data.amount)}</span>
</Form.Item> </Form.Item>
<Divider style={{ margin: '24px 0' }} /> <Divider style={{ margin: '24px 0' }} />
<Form.Item <Form.Item
......
...@@ -64,7 +64,12 @@ ...@@ -64,7 +64,12 @@
} }
.money { .money {
font-family: Helvetica Neue;
font-weight: 500; font-weight: 500;
font-size: 20px; font-size: 20px;
line-height: 14px; line-height: 14px;
} }
.uppercase {
font-size: 12px;
}
...@@ -213,7 +213,7 @@ export default class TableForm extends PureComponent { ...@@ -213,7 +213,7 @@ export default class TableForm extends PureComponent {
}} }}
/> />
<Button <Button
style={{ width: '100%', marginTop: 24 }} style={{ width: '100%', marginTop: 16, marginBottom: 8 }}
type="dashed" type="dashed"
onClick={this.newMember} onClick={this.newMember}
icon="plus" icon="plus"
......
...@@ -88,3 +88,12 @@ ...@@ -88,3 +88,12 @@
color: @text-color-secondary; color: @text-color-secondary;
font-style: normal; font-style: normal;
} }
.popup {
width: ~"calc(100% - 16px)";
:global {
.ant-time-picker-panel-select {
width: 33.33%;
}
}
}
...@@ -79,3 +79,29 @@ export function getRouteData(path) { ...@@ -79,3 +79,29 @@ export function getRouteData(path) {
const nodeList = getPlainNode(dataList.children); const nodeList = getPlainNode(dataList.children);
return nodeList; return nodeList;
} }
export function digitUppercase(n) {
const fraction = ['', ''];
const digit = ['', '', '', '', '', '', '', '', '', ''];
const unit = [
['', '', '亿'],
['', '', '', ''],
];
let num = Math.abs(n);
let s = '';
fraction.forEach((item, index) => {
s += (digit[Math.floor(num * 10 * (10 ** index)) % 10] + item).replace(/零./, '');
});
s = s || '';
num = Math.floor(num);
for (let i = 0; i < unit[0].length && num > 0; i += 1) {
let p = '';
for (let j = 0; j < unit[1].length && num > 0; j += 1) {
p = digit[num % 10] + unit[1][j] + p;
num = Math.floor(num / 10);
}
s = p.replace(/(零.)*零$/, '').replace(/^$/, '') + unit[0][i] + s;
}
return s.replace(/(零.)*零元/, '').replace(/(零.)+/g, '').replace(/^整$/, '零元整');
}
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