防止key发起多次请求

This commit is contained in:
姜棚 2022-01-10 16:49:53 +08:00
parent 6a5b34afff
commit 814e04a2ea
2 changed files with 7 additions and 35 deletions

View File

@ -64,11 +64,7 @@ export default class acclist extends React.Component{
} }
componentDidMount(e){ componentDidMount(e){
let data = {
page:1,
limit:10
}
this.getKeyCodeList(data);
} }
componentWillMount(){ componentWillMount(){
this.setState({tableHeight:window.innerHeight-430}); this.setState({tableHeight:window.innerHeight-430});
@ -196,7 +192,6 @@ export default class acclist extends React.Component{
} }
tabFn(e){ tabFn(e){
console.log(e)
let status = e > 0 ? e : null let status = e > 0 ? e : null
if(!status) if(!status)
{ {
@ -222,8 +217,6 @@ export default class acclist extends React.Component{
key:rowData.key key:rowData.key
} }
keyUsage(formdata).then((res)=>{ keyUsage(formdata).then((res)=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
let data = { let data = {
@ -277,17 +270,6 @@ export default class acclist extends React.Component{
console.log("当前菜单", cur_nav) console.log("当前菜单", cur_nav)
sessionStorage.setItem('breaknav',JSON.stringify(cur_nav)); sessionStorage.setItem('breaknav',JSON.stringify(cur_nav));
// let formdata={
// key:rowData.key
// }
// getKeyLog(formdata).then((res)=>{
// handelResponse(res,(req,msg)=>{
// },(err)=>{
// console.log(err)
// })
// })
} }

View File

@ -168,13 +168,6 @@ export default class acclist extends React.Component{
Notify.error("手机号格式不正确") Notify.error("手机号格式不正确")
return; return;
} }
// if(!emailReg.test(data.email)){
// Notify.error("邮箱格式不正确")
// return;
// }
postKeyEmail(key_id,data).then((res)=>{ postKeyEmail(key_id,data).then((res)=>{
@ -240,7 +233,7 @@ export default class acclist extends React.Component{
} }
componentDidMount(){ componentDidMount(){
this.getKeyList(); // this.getKeyList();
} }
@ -336,12 +329,10 @@ export default class acclist extends React.Component{
} }
this.setState({page:1,limit:10}) this.setState({page:1,limit:10})
setTimeout(() => { setTimeout(() => {
this.getKeyList(); this.getKeyList();
}, 10); }, 10);
} }
//作废 //作废
delFn(){ delFn(){
@ -546,7 +537,6 @@ linkTo(row){
componentDidUpdate(prevProps,prevState){ componentDidUpdate(prevProps,prevState){
// 参数分别为改变之前的数据状态对象 // 参数分别为改变之前的数据状态对象
if(prevState.key_word!=this.state.key_word &&!this.state.key_word){ if(prevState.key_word!=this.state.key_word &&!this.state.key_word){
this.getKeyList(); this.getKeyList();
} }