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;