通过onsuccess判断
<Upload
disabled={
(localStorage.getItem("roleName") - 0) > 4}
action={
window.rootUrlRest + "/editChart"}
data={
{
chartName: this.state.uploadChartName,
author: localStorage.getItem("userName"),
chartType: this.state.uploadChartType,
}}
showUploadList={
{
showRemoveIcon:false}}
onChange={
this.uploadStateChange}
beforeUpload={
this.beforeUpload}
//限制图片上传大小
listType="picture-card"
fileList={
this.state.fileList}
onRemove={
this.handleRemove}
onPreview={
this.handlePreview}
onSuccess={
this.complate}
//加上onSuccess判断
>
{
this.state.disabledUpload === true ? null : uploadMyButton}
</Upload>
//这里res接收的是上传接口返回的参数
//{code: "0", msg: "ok", total: null, listData: null}
complate= res => {
console.log(res);
if(res.code == 0) {
notification[success]({
description: 信息: 操作成功!
});
this.getCharts({
pageNum: 1,
pageSize: 10
})
}else {
notification[error]({
description: 信息: 操作失败!
});
this.getCharts({
pageNum: 1,
pageSize: 10
})
}
this.setState({
disabledUpload: true
})
}