Commit 71be248b authored by 王苓芝's avatar 王苓芝

文件格式bug修改

parent 295f309b
...@@ -22,7 +22,6 @@ class PicturesWall extends React.Component { ...@@ -22,7 +22,6 @@ class PicturesWall extends React.Component {
previewVisible: false, previewVisible: false,
previewImage: '', previewImage: '',
fileList: [], fileList: [],
isValid: false,
}; };
async componentDidMount() { async componentDidMount() {
...@@ -44,21 +43,19 @@ class PicturesWall extends React.Component { ...@@ -44,21 +43,19 @@ class PicturesWall extends React.Component {
}; };
beforeUpload = file => { beforeUpload = file => {
console.log('info', file);
const types = ['application/pdf', 'image/png', 'image/jpeg']; const types = ['application/pdf', 'image/png', 'image/jpeg'];
if (types.indexOf(file.type) === -1) { if (types.indexOf(file.type) === -1) {
this.setState({ isValid: false });
message.error('输入格式有问题'); message.error('输入格式有问题');
} }
return types.indexOf(file.type) !== -1; return types.indexOf(file.type) === -1;
}; };
handleChange = info => { handleChange = info => {
console.log('info', info.file); console.log('info-handleChange', info.fileList);
if (!this.state.isValid) { const types = ['application/pdf', 'image/png', 'image/jpeg'];
this.setState({ fileList: [] }); const fileList = info.fileList.filter(item => types.indexOf(item.type) !== -1);
return; this.setState({ fileList });
}
this.setState({ fileList: info.fileList });
}; };
customRequest = ({ file, onError, onSuccess }) => { customRequest = ({ file, onError, onSuccess }) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment