|
|
@ -24,10 +24,15 @@ export default class UploadList extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
handleClose(file) {
|
|
|
|
handleClose = (file) => {
|
|
|
|
this.props.onRemove(file);
|
|
|
|
this.props.onRemove(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handlePreview = (file, e) => {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
return this.props.onPreview(file);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
componentDidUpdate() {
|
|
|
|
if (this.props.listType !== 'picture' && this.props.listType !== 'picture-card') {
|
|
|
|
if (this.props.listType !== 'picture' && this.props.listType !== 'picture-card') {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -66,6 +71,7 @@ export default class UploadList extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
icon = (<a className={`${prefixCls}-list-item-thumbnail`}
|
|
|
|
icon = (<a className={`${prefixCls}-list-item-thumbnail`}
|
|
|
|
|
|
|
|
onClick={(e) => this.handlePreview(file, e)}
|
|
|
|
href={file.url}
|
|
|
|
href={file.url}
|
|
|
|
target="_blank"><img src={file.thumbUrl || file.url} alt={file.name} /></a>
|
|
|
|
target="_blank"><img src={file.thumbUrl || file.url} alt={file.name} /></a>
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -88,13 +94,13 @@ export default class UploadList extends React.Component {
|
|
|
|
<div className={`${prefixCls}-list-item-info`}>
|
|
|
|
<div className={`${prefixCls}-list-item-info`}>
|
|
|
|
{icon}
|
|
|
|
{icon}
|
|
|
|
{file.url
|
|
|
|
{file.url
|
|
|
|
? <a href={file.url} target="_blank" className={`${prefixCls}-list-item-name`}>{file.name}</a>
|
|
|
|
? <a onClick={(e) => this.handlePreview(file, e)} href={file.url} target="_blank" className={`${prefixCls}-list-item-name`}>{file.name}</a>
|
|
|
|
: <span className={`${prefixCls}-list-item-name`}>{file.name}</span>}
|
|
|
|
: <span className={`${prefixCls}-list-item-name`}>{file.name}</span>}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.props.listType === 'picture-card' && file.status !== 'uploading'
|
|
|
|
this.props.listType === 'picture-card' && file.status !== 'uploading'
|
|
|
|
? (
|
|
|
|
? (
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
<a href={file.url} target="_blank" style={{ pointerEvents: file.url ? '' : 'none' }}><Icon type="eye-o" /></a>
|
|
|
|
<a onClick={(e) => this.handlePreview(file, e)} href={file.url} target="_blank" style={{ pointerEvents: file.url ? '' : 'none' }}><Icon type="eye-o" /></a>
|
|
|
|
<Icon type="delete" onClick={() => this.handleClose(file)} />
|
|
|
|
<Icon type="delete" onClick={() => this.handleClose(file)} />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
) : <Icon type="cross" onClick={() => this.handleClose(file)} />
|
|
|
|
) : <Icon type="cross" onClick={() => this.handleClose(file)} />
|
|
|
|