diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js index 69a309ee..c3a06034 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js @@ -162,7 +162,15 @@ export default class adduserinfo extends React.Component{ _self.setState({headImg:''}) } }; - + onUploadError = (type, data) => { + if (type === 'overMaxAmount') { + Notify.clear(); + Notify.error(`最多可上传 ${data.maxAmount} 张图片`); + } else if (type === 'overMaxSize') { + Notify.clear(); + Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); + } + }; //选择销售人员 onsaleChange(e){ let model2 = this.state.model @@ -829,19 +837,21 @@ this.setState({pwdtype:e}); { this.state.defaultFileList[0].src.includes('lsxd')?({this.onUploadChange(e)}} onUpload={this.onUpload} - defaultFileList={this.state.defaultFileList} + defaultFileList={this.state.defaultFileList} + onError={this.onUploadError} />):({this.onUploadChange(e)}} - onUpload={this.onUpload} + onUpload={this.onUpload} + onError={this.onUploadError} />) } diff --git a/src/pages/system/account/add/adduserinfo/adduserinfo.js b/src/pages/system/account/add/adduserinfo/adduserinfo.js index 62ed44f5..9d69b4cf 100644 --- a/src/pages/system/account/add/adduserinfo/adduserinfo.js +++ b/src/pages/system/account/add/adduserinfo/adduserinfo.js @@ -160,6 +160,16 @@ export default class adduserinfo extends React.Component{ Notify.error('请完善表单数据'); } } + onUploadError = (type, data) => { + if (type === 'overMaxAmount') { + Notify.clear(); + Notify.error(`最多可上传 ${data.maxAmount} 张图片`); + } else if (type === 'overMaxSize') { + Notify.clear(); + Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); + } + }; + //选择图片 onUploadChange(files){ let _self=this; @@ -475,20 +485,22 @@ export default class adduserinfo extends React.Component{ { this.state.defaultFileList[0].src==''?{this.onUploadChange(e)}} onUpload={this.onUpload} + onError={this.onUploadError} />:{this.onUploadChange(e)}} onUpload={this.onUpload} defaultFileList={this.state.defaultFileList} + onError={this.onUploadError} /> }