From 3e7676879b72d86bc2f8e3766e823d62356349e5 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sun, 28 Nov 2021 14:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adddistributorinfo/adddistributorinfo.js | 24 +++++++++++++------ .../account/add/adduserinfo/adduserinfo.js | 18 +++++++++++--- 2 files changed, 32 insertions(+), 10 deletions(-) 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} /> }