From c9827f238bc4c5be626712508b845a58cf9f36e2 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Mon, 29 Nov 2021 14:27:44 +0800 Subject: [PATCH 1/2] =?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 | 27 +++++++++++++++------------ src/pages/home/home.js | 4 +++- src/pages/login/loginform.js | 4 +--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index c7257324..f0aa3233 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -90,21 +90,24 @@ const req = (method, url, params, responseType) => { if(res.status==200){ return res.json() }else{ - console.log(res); switch (res.status) { // 401: 未登录 case 401: - Notify.clear(); - Notify.error( "没有权限"); - break; - case 403: - Notify.clear(); - Notify.error( "用户登录已失效,请重新登录"); - sessionStorage.clear(); - setTimeout(() => { - window.location.href='/login'; - }, 2000) - break; + res.json().then(response =>{ + if(response.code==403){ + Notify.clear(); + Notify.error(response.message); + setTimeout(() => { + window.location.href='/login'; + }, 2000) + }else if(response.code==401){ + Notify.clear(); + Notify.error(response.message); + } + } + ).catch(); + + break; } } diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 85d2b2cf..001f993e 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -203,6 +203,8 @@ 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(){ @@ -247,7 +249,7 @@ export default class App extends Component { this.setState({pathname:'/extension'})}>推广 */} -
帮助中心
+
帮助中心
{/* 用户头像信息 */}
diff --git a/src/pages/login/loginform.js b/src/pages/login/loginform.js index eb443243..e7ebd620 100644 --- a/src/pages/login/loginform.js +++ b/src/pages/login/loginform.js @@ -40,10 +40,8 @@ function FormDom(props) { items:[{path:'/home/plan-list',name:'营销计划管理'}] }] sessionStorage.setItem('menulinklist',JSON.stringify(arr)); - let {authorization}=response; - sessionStorage.setItem('authorization',authorization); + sessionStorage.setItem('activeMenu',"营销计划管理"); sessionStorage.setItem('linkshowname',"营销计划管理"); - setTimeout(()=>{ props.history.push('/home/plan-list') },1000); From 528b300bc06c8bd447413bfb355ce71f3cbefbf8 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Mon, 29 Nov 2021 14:28:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3token=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/home/home.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 001f993e..c7348163 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -253,6 +253,7 @@ export default class App extends Component { {/* 用户头像信息 */}
+ {/* 帮助中心 */} {/* {!this.state.userInfo.head?