import {Icon} from 'antd' import isEmpty from 'lodash/isEmpty' import {WeaUpload} from 'ecCom'; import isArray from 'lodash/isArray' import "../style/upload.less"; import {i18n} from '../public/i18n'; import {WeaLocaleProvider} from 'ecCom'; import {addContentPath} from '../../../util/index.js' const getLabel = WeaLocaleProvider.getLabel; 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() { this.setState({value: ''}); this.props.onChange && this.props.onChange(''); } onChange(datas) { let value = ''; if (isArray(datas) && !isEmpty(datas)) { value = `${datas.pop()}`; }else{ value = datas; } this.setState({value}); this.props.onChange && this.props.onChange(value); } render() { const {tip} = this.props; const {value} = this.state; return (