1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| . . . uploadSuccess = (ret, file) => { if (ret.code === '00') { message.success(file.name + ' 上传成功'); this.props.dispatch({ type: 'caseManage/fetchCaseInfo', payload: { caseId: this.state.selectedKey, }, }); } else { message.error(file.name + ret.msg); } }; . . . const uploadProps = { name: 'files', action: '/case/uploadFiles/' + this.state.selectedKey, accept: 'image/jpg,image/jpeg,image/png,image/bmp,.pdf,.doc,.docx,.xls,.xlsx', multiple: true, onStart(file) { console.log('onStart', file, file.name); }, onError(err) { console.log('onError', err); }, onProgress({ percent }, file) { console.log('onProgress', `${percent}%`, file.name); }, }; . . . <Upload {...uploadProps} onSuccess={this.uploadSuccess}> <Tooltip placement="right" title="允许的类型: jpg,jpeg,png,pdf,doc,docx,xls,xlsx" > <Button size="small"> <Icon type="upload" />选择文件 </Button> </Tooltip> </Upload> . . .
|