同一个账号一分钟内只能请求一次验证码,选择子账号交接,排除禁用状态

This commit is contained in:
red-deng-deng 2021-12-16 10:04:52 +08:00
parent 5aac48d596
commit c6b042c732
2 changed files with 18 additions and 12 deletions

View File

@ -97,18 +97,22 @@ function FormDom(props) {
//发送短信验证码
const sendCode=()=>{
let startTime=localStorage.getItem('now');
console.log(100,startTime);
let sendPhone=localStorage.getItem('phone');
if(!startTime){
sendCodeApi();
}else{
if(sendPhone==phone){
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');
localStorage.removeItem('phone');
sendCodeApi();
}
}else{
sendCodeApi();
}
}
@ -121,6 +125,7 @@ function FormDom(props) {
handelResponse(res,(response,msg)=>{
let clickNow=new Date().getTime();//当前时间
localStorage.setItem('now',clickNow);
localStorage.setItem('phone',phone);
let timer=60;
let timecount=setInterval(()=>{
let timerId=timer--;
@ -136,6 +141,7 @@ function FormDom(props) {
},(err)=>{
Notify.error(err)
localStorage.setItem('now',new Date().getTime());
localStorage.setItem('phone',phone);
})
}).catch(err=>{

View File

@ -78,7 +78,7 @@ export default class acclistDom extends React.Component{
}
getsubAppoint(aid,data).then(res=>{
handelResponse(res,(response,msg)=>{
let authdata=response.data;
let authdata=response.data.filter(item=>item.status==1);
let authData=authdata.map(item=>{
return {
text:item.real_name,