import { Icon } from 'antd'; import isEmpty from 'lodash/isEmpty'; import { WeaUpload } from 'ecCom'; import isArray from 'lodash/isArray'; import './index.less'; import { i18n } from '../../../pc4mobx/hrm/public/i18n'; class Main extends React.Component { static defaultProps={ tip: i18n.label.pictureSizeSuggestedInfo, } constructor(props) { super(props); this.state = { value: props.value || '', }; } componentWillReceiveProps(nextProps) { if ('value' in this.props && this.state.value !== nextProps.value) { this.setState({ value: nextProps.value }); } } close() { let { domkey } = this.props; this.setState({ value: '' }); this.props.onChange && this.props.onChange('', domkey); } onChange(id, datas) { let { domkey } = this.props; // 每个WeaSwitch的key let value = ''; if (isArray(datas) && !isEmpty(datas)) { let data = datas.pop(); value = data.fileidCode; } else { value = datas.fileidCode; } this.setState({ value }); this.props.onChange && this.props.onChange(value, domkey); } render() { const { tip, nohelpful } = this.props; const { value } = this.state; return (