From 5aac48d596b4e2adeade8160a40e179aeadb3f81 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Wed, 15 Dec 2021 17:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=96=B9=E5=BC=8F=E9=98=B2=E6=8A=96=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/loginPhone.js | 46 +++++++++++++------ src/pages/system/account/list/delAuth.js | 5 +- .../system/subAccount/add/adduserinfo/tree.js | 17 +++++-- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/pages/login/loginPhone.js b/src/pages/login/loginPhone.js index 72e30c89..80cf905e 100644 --- a/src/pages/login/loginPhone.js +++ b/src/pages/login/loginPhone.js @@ -96,30 +96,50 @@ function FormDom(props) { } //发送短信验证码 const sendCode=()=>{ + let startTime=localStorage.getItem('now'); + console.log(100,startTime); + if(!startTime){ + sendCodeApi(); + }else{ + let stopTime=startTime*1+60000;//一分钟后的时间戳 + let currentime=new Date().getTime(); //点击获取当前的时间戳 + if(currentime-startTime<=stopTime-startTime){//一分钟内 + Notify.clear(); + Notify.warn('发送过于频繁,请稍后再试'); + console.log(109,currentime-startTime<=stopTime-startTime); + }else{ + localStorage.removeItem('now'); + sendCodeApi(); + } + } + } + const sendCodeApi=()=>{ let data={ mobile:phone } postsendLoginCode(data).then(res=>{ handelResponse(res,(response,msg)=>{ - + let clickNow=new Date().getTime();//当前时间 + localStorage.setItem('now',clickNow); + let timer=60; + let timecount=setInterval(()=>{ + let timerId=timer--; + if(timerId>0){ + setYzmcode(timerId+'s'); + setDisabled(true); + }else{ + setYzmcode('获取验证码'); + setDisabled(false); + clearInterval(timecount); + } + },1000); },(err)=>{ Notify.error(err) + localStorage.setItem('now',new Date().getTime()); }) }).catch(err=>{ }); - let timer=60; - let timecount=setInterval(()=>{ - let timerId=timer--; - if(timerId>0){ - setYzmcode(timerId+'s'); - setDisabled(true); - }else{ - setYzmcode('获取验证码'); - setDisabled(false); - clearInterval(timecount); - } - },1000); } const changephone=(e)=>{ let reg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/; diff --git a/src/pages/system/account/list/delAuth.js b/src/pages/system/account/list/delAuth.js index f7588746..47beda85 100644 --- a/src/pages/system/account/list/delAuth.js +++ b/src/pages/system/account/list/delAuth.js @@ -98,10 +98,9 @@ export default class acclistDom extends React.Component{ this.getAutnMan(this.props.deldata.id); //下级 setTimeout(()=>{ if(this.state.levelAuth){ - - this.setState({authperson:this.state.levelAuthdata,loadshow:true}); + this.setState({authperson:this.state.levelAuthdata,loadshow:true,authWay:1}); }else{ - this.setState({authperson:this.state.downLeveldata,loadshow:true}); + this.setState({authperson:this.state.downLeveldata,loadshow:true,authWay:0}); } },300); } diff --git a/src/pages/system/subAccount/add/adduserinfo/tree.js b/src/pages/system/subAccount/add/adduserinfo/tree.js index 107476d8..53d54b1e 100644 --- a/src/pages/system/subAccount/add/adduserinfo/tree.js +++ b/src/pages/system/subAccount/add/adduserinfo/tree.js @@ -55,8 +55,10 @@ export default class tree extends React.Component{ handelResponse(res,(response,msg)=>{ const menu_data=response.filter(item=>item.children.length>0); if(_self.props.enum==0){//新增){ + _self.setState({checked:true}); let checkList=[]; menu_data.forEach(item=>{ + checkList.push(item.id); if(item.children){ item.children.forEach(item1=>{ @@ -70,9 +72,17 @@ export default class tree extends React.Component{ } }) _self.setState({ - checked:true,checkedKeys:checkList + checkedKeys:checkList }) - + }else{ + _self.setState({checked:true}); + menu_data.forEach(it=>{ + if(_self.props.rules.indexOf(it.id)==-1){ + _self.setState({checked:false}) + return false + } + }) + _self.setState({checkedKeys:_self.props.rules}); } _self.setState({menu_data}); }) @@ -80,9 +90,6 @@ export default class tree extends React.Component{ } componentWillMount(){ this.getMenuFn(); - if(this.props.enum==1){ - this.setState({checkedKeys:this.props.rules}); - } } render(){ const { checkedKeys, disabledCheckedKeys } = this.state;