| | |
| | | compress: 'false', |
| | | fileType: 'text', |
| | | showprogress: false, |
| | | maxSize: 0, |
| | | filelist: [] |
| | | } |
| | | |
| | |
| | | filelist, |
| | | compress, |
| | | limit: config.limit || 2, |
| | | maxSize: config.maxSize || 0, |
| | | maxFile: maxFile, |
| | | fileType: config.fileType || 'text' |
| | | }) |
| | |
| | | } |
| | | |
| | | beforeUpload = (file) => { |
| | | const { accepts, compress, limit, rduri } = this.state |
| | | const { accepts, compress, limit, rduri, maxSize } = this.state |
| | | |
| | | if (accepts && file.name) { |
| | | let pass = false |
| | |
| | | return false |
| | | } |
| | | } |
| | | if (maxSize) { |
| | | let fileSize = file.size / 1024 / 1024 |
| | | |
| | | if (fileSize > maxSize) { |
| | | setTimeout(() => { |
| | | this.onFail(`文件大小不可超过${maxSize}M`) |
| | | }, 10) |
| | | return false |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showprogress: true, |