diff --git a/src/components/DescriptionList/index.less b/src/components/DescriptionList/index.less index f7dc320391fa507b1e1f14a39a53ac13b74a5656..a8f88a3df10f710346b9b00d1f07892f2df91554 100644 --- a/src/components/DescriptionList/index.less +++ b/src/components/DescriptionList/index.less @@ -31,6 +31,7 @@ } .detail { + width: 100%; padding-bottom: 16px; color: @text-color; display: table-cell; diff --git a/src/components/EditableItem/index.js b/src/components/EditableItem/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b5efcd8b1d4c1f79d1c4a3b4b78f62c797775a9a --- /dev/null +++ b/src/components/EditableItem/index.js @@ -0,0 +1,54 @@ +import React, { PureComponent } from 'react'; +import { Input, Icon } from 'antd'; +import styles from './index.less'; + +export default class EditableItem extends PureComponent { + state = { + value: this.props.value, + editable: false, + }; + handleChange = (e) => { + const value = e.target.value; + this.setState({ value }); + } + check = () => { + this.setState({ editable: false }); + if (this.props.onChange) { + this.props.onChange(this.state.value); + } + } + edit = () => { + this.setState({ editable: true }); + } + render() { + const { value, editable } = this.state; + return ( +
+ { + editable ? +
+ + +
+ : +
+ {value || ' '} + +
+ } +
+ ); + } +} diff --git a/src/components/EditableItem/index.less b/src/components/EditableItem/index.less new file mode 100644 index 0000000000000000000000000000000000000000..8c068686b07ffafca347c3d0a6480628ca95e346 --- /dev/null +++ b/src/components/EditableItem/index.less @@ -0,0 +1,25 @@ +@import "~antd/lib/style/themes/default.less"; + +.editableItem { + line-height: @input-height-base; + display: table; + width: 100%; + margin-top: (@font-size-base * @line-height-base - @input-height-base) / 2; + + .wrapper { + display: table-row; + + & > * { + display: table-cell; + } + + & > *:first-child { + width: 85%; + } + + .icon { + cursor: pointer; + text-align: right; + } + } +} diff --git a/src/components/PageHeader/index.less b/src/components/PageHeader/index.less index 962479e5d7d43314f1ac7aa89223e14e69e780e5..6f9a90d57de15c85d0833fb51eef46d15ec913c9 100644 --- a/src/components/PageHeader/index.less +++ b/src/components/PageHeader/index.less @@ -42,10 +42,6 @@ .action { margin-left: 56px; min-width: 266px; - - button:not(:last-child) { - margin-right: 8px; - } } .title, .action, .content, .extraContent, .main { diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 8097854e7a9d04a4ef7c0d2802b1a86eefaad03b..21633d6251b76c5c8f113c9d393a06a652947271 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -3,9 +3,11 @@ import { connect } from 'dva'; import { Button, Menu, Dropdown, Icon, Row, Col, Steps, Card, Popover, Badge, Table, Tooltip } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import DescriptionList from '../../components/DescriptionList'; +import EditableItem from '../../components/EditableItem'; import styles from './AdvancedProfile.less'; const { Step } = Steps; +const ButtonGroup = Button.Group; const { Description } = DescriptionList; const menu = ( @@ -18,13 +20,16 @@ const menu = ( const action = (
+ + + + + + + - - - -
); @@ -44,10 +49,11 @@ const extra = ( const description = ( 曲丽丽 - 12421 + XX 服务 2017-07-07 + 12421 2017-07-07 ~ 2017-08-08 - 修改公司地址:浙江省杭州市西湖区工专路 + 请于两个工作日内确认 ); @@ -195,7 +201,9 @@ export default class AdvancedProfile extends Component { 付小小 32943898021309809423 3321944288191034921 - 18322193472 + + + 曲丽丽 18100000000 浙江省杭州市西湖区黄姑山路工专路交叉路口