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

文件格式bug修改

parent 295f309b
......@@ -22,7 +22,6 @@ class PicturesWall extends React.Component {
previewVisible: false,
previewImage: '',
fileList: [],
isValid: false,
};
async componentDidMount() {
......@@ -44,21 +43,19 @@ class PicturesWall extends React.Component {
};
beforeUpload = file => {
console.log('info', file);
const types = ['application/pdf', 'image/png', 'image/jpeg'];
if (types.indexOf(file.type) === -1) {
this.setState({ isValid: false });
message.error('输入格式有问题');
}
return types.indexOf(file.type) !== -1;
return types.indexOf(file.type) === -1;
};
handleChange = info => {
console.log('info', info.file);
if (!this.state.isValid) {
this.setState({ fileList: [] });
return;
}
this.setState({ fileList: info.fileList });
console.log('info-handleChange', info.fileList);
const types = ['application/pdf', 'image/png', 'image/jpeg'];
const fileList = info.fileList.filter(item => types.indexOf(item.type) !== -1);
this.setState({ fileList });
};
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