|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React from 'react';
|
2
|
|
-import { Upload, Icon, message } from 'antd';
|
|
2
|
+import { Upload, Icon, message, Modal } from 'antd';
|
3
|
3
|
import './style.less';
|
4
|
4
|
import { uploaderProps } from '../../utils/upload';
|
5
|
5
|
|
|
@@ -41,9 +41,12 @@ class ImageUpload extends React.Component {
|
41
|
41
|
}
|
42
|
42
|
};
|
43
|
43
|
|
|
44
|
+ handleCancel = () => this.setState({ previewVisible: false });
|
|
45
|
+
|
44
|
46
|
handlePreview = async file => {
|
|
47
|
+ console.log(file)
|
45
|
48
|
this.setState({
|
46
|
|
- previewImage: file.response,
|
|
49
|
+ previewImage: file.url,
|
47
|
50
|
previewVisible: true,
|
48
|
51
|
});
|
49
|
52
|
};
|
|
@@ -56,6 +59,7 @@ class ImageUpload extends React.Component {
|
56
|
59
|
);
|
57
|
60
|
|
58
|
61
|
return (
|
|
62
|
+ <>
|
59
|
63
|
<Upload
|
60
|
64
|
{...uploaderProps}
|
61
|
65
|
listType="picture-card"
|
|
@@ -66,6 +70,10 @@ class ImageUpload extends React.Component {
|
66
|
70
|
>
|
67
|
71
|
{this.state.fileList.length >= 1 ? null : uploadButton}
|
68
|
72
|
</Upload>
|
|
73
|
+ <Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
|
|
74
|
+ <img alt="example" style={{ width: '100%' }} src={this.state.previewImage} />
|
|
75
|
+ </Modal>
|
|
76
|
+ </>
|
69
|
77
|
);
|
70
|
78
|
}
|
71
|
79
|
}
|