From b73df8bd44ec0bebf01d5086fe6ac26bd99fbe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Fri, 21 Jan 2022 14:12:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/add/add.js | 8 +++++++- src/pages/plan/add/step2.js | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index e90d128b..3f8e0243 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -794,13 +794,19 @@ export default class acclist extends React.Component{ fileChange(e){ // this.initUpload(); - let my_file = e.target.files[0]; + let my_file = e.target.files[0]; this.setState({myfile:my_file}) this.setState({upload_visible:true}) if(my_file.name.indexOf(".xls")||my_file.name.indexOf(".xlsx")||my_file.name.indexOf(".csv")) { + + if(my_file.size > 2048000) + { + Notify.error("文件大小不能大于2M") + return; + } let formdata = new FormData() formdata.append("file",my_file) formdata.append("path","white_list_excel") diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 6ffa2141..41df139d 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -659,6 +659,12 @@ export default class acclist extends React.Component{ if(my_file.name.indexOf(".xls")||my_file.name.indexOf(".xlsx")||my_file.name.indexOf(".csv")) { + if(my_file.size > 5120000) + { + Notify.error("文件大小不能大于2M") + return; + } + let formdata = new FormData() formdata.append("file",my_file) formdata.append("path","white_list_excel") @@ -666,13 +672,10 @@ export default class acclist extends React.Component{ this.setState({file_loading:true}) uploadImg(formdata).then((res)=>{ handelResponse(res,(req,msg)=>{ - let data = { excel:req.path } - this.setState({mobile_excel:req.path}) - getAccessVerification(data).then((res)=>{ this.setState({file_loading:false}) handelResponse(res,(req,msg)=>{