From 66b2f7a5bb1b362dbf9d425faeea52e45f21d2f1 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sun, 28 Nov 2021 17:43:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AE=A2=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/home/home.js | 2 +- src/pages/system/account/list/list.js | 34 +++++++++++++-------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/pages/home/home.js b/src/pages/home/home.js index efba4522..b3d3700a 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -181,7 +181,7 @@ export default class App extends Component { Notify.clear(); Notify.success('退出成功!'); sessionStorage.clear(); - },2000); + },100); } }).catch(err=>{ diff --git a/src/pages/system/account/list/list.js b/src/pages/system/account/list/list.js index d5080f85..3ce6d86a 100644 --- a/src/pages/system/account/list/list.js +++ b/src/pages/system/account/list/list.js @@ -98,24 +98,9 @@ export default class acclistDom extends React.Component{ } ]}] sessionStorage.setItem('breaknav',JSON.stringify(activerou)); - this.getCompanyFn(); + } - //获取公司 - getCompanyFn(){ - let _self=this; - getCompany().then(res=>{ - handelResponse(res,(response,msg)=>{ - let companyList=response.map(item=>{ - return {key:item.id,text:item.company_name} - }); - sessionStorage.setItem('company',JSON.stringify(companyList)); - - },(err)=>{ - }) - }).catch(err=>{ - }); -} onChange = options => { this.setState(options); }; @@ -188,7 +173,19 @@ export default class acclistDom extends React.Component{ }); } editFn(e,row){ - + let _self=this; + getCompany().then(res=>{ + handelResponse(res,(response,msg)=>{ + let companyList=response.map(item=>{ + return {key:item.id,text:item.company_name} + }); + sessionStorage.setItem('company',JSON.stringify(companyList)); + this.props.history.push('/home/system/account-add'); + },(err)=>{ + + }) + }).catch(err=>{ + }); sessionStorage.setItem('pathname2','/home/system/account-add') let activerou=[{'pagetitle':'编辑',items:[ { @@ -200,9 +197,10 @@ export default class acclistDom extends React.Component{ "name": "编辑账号" } ]}] + sessionStorage.setItem('breaknav',JSON.stringify(activerou)); sessionStorage.setItem('dataInfo',JSON.stringify(row)); - this.props.history.push('/home/system/account-add'); + } //重置密码 resetpwd(e,row){ From ba6c1f3fa6b5d43ba4c84cc4ba5a55a10e88ccfb Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sun, 28 Nov 2021 17:52:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=A7=A3=E5=86=B3token=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assets/api.js b/src/assets/api.js index cd6669d4..1f8761d6 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -96,8 +96,9 @@ const req = (method, url, params, responseType) => { case 401: Notify.clear(); Notify.error( "当前信息过期请重新登录"); + sessionStorage.clear(); setTimeout(() => { - window.location.href='./login'; + window.location.href='/login'; }, 3000) break; } From 537690bfb4af0506eef8ffdd480e875fc9b2abe9 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sun, 28 Nov 2021 18:01:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A7=A3=E5=86=B3token=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 6 +++--- src/pages/home/home.js | 26 +++++++++++++------------- src/pages/system/account/list/list.js | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index 1f8761d6..eeef1236 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -87,19 +87,19 @@ const req = (method, url, params, responseType) => { let http = fetch(url, obj).then(res =>{ window.timeshow=res.headers.get('Date-Time'); - console.log(res); if(res.status==200){ return res.json() }else{ + console.log(res); switch (res.status) { // 401: 未登录 case 401: Notify.clear(); - Notify.error( "当前信息过期请重新登录"); + Notify.error( "没有权限,用户登录已失效"); sessionStorage.clear(); setTimeout(() => { window.location.href='/login'; - }, 3000) + }, 2000) break; } } diff --git a/src/pages/home/home.js b/src/pages/home/home.js index b3d3700a..7c171325 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -203,20 +203,20 @@ export default class App extends Component { window.document.addEventListener('mouseover',function(){ window["mydata"].setState({lastTime:new Date().getTime()}); //更新操作时间 }); - timerstop=window.setInterval( window["mydata"].testTime, 1000); - } - testTime(){ - window["mydata"].setState({'currentTime':new Date().getTime()});//更新当前时间 - if( window["mydata"].state.currentTime - window["mydata"].state.lastTime > window["mydata"].state.timeOut){ //判断是否超时 - window.clearInterval(timerstop) - Notify.clear() - Notify.warn('登录失效,请重新登录!') - sessionStorage.clear(); - setTimeout(()=>{ - window["mydata"].props.history.push('/login'); - },5000); - } + // timerstop=window.setInterval( window["mydata"].testTime, 1000); } + // testTime(){ + // window["mydata"].setState({'currentTime':new Date().getTime()});//更新当前时间 + // if( window["mydata"].state.currentTime - window["mydata"].state.lastTime > window["mydata"].state.timeOut){ //判断是否超时 + // window.clearInterval(timerstop) + // Notify.clear() + // Notify.warn('登录失效,请重新登录!') + // sessionStorage.clear(); + // setTimeout(()=>{ + // window["mydata"].props.history.push('/login'); + // },5000); + // } + // } componentWillReceiveProps(nextProps) { if (this.state.noShowSubMenu.indexOf(nextProps.location.pathname) > -1 ) { console.log("不展示") diff --git a/src/pages/system/account/list/list.js b/src/pages/system/account/list/list.js index 3ce6d86a..4e3528fb 100644 --- a/src/pages/system/account/list/list.js +++ b/src/pages/system/account/list/list.js @@ -282,7 +282,7 @@ componentDidUpdate(prevProps,prevState){
{/* */}
-