From a49f4888e0bc09f4e03b1d5e12be19eb2ae8636b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 01 九月 2022 18:05:27 +0800 Subject: [PATCH] 2022-09-01 --- src/router/index.js | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index a4a55f7..d923557 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,10 +54,11 @@ export default class RouteConfig extends Component { controlRoute (item, props) { - if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆 + if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆 return (<item.component {...props}/>) } + let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鐧诲綍淇℃伅鏄惁瀛樺湪锛屾敞鐢ㄦ埛鍙兘淇濆瓨涓婚〉閾炬帴 let authCode = localStorage.getItem(window.location.href.split('#')[0] + 'AuthCode') // 鍒ゆ柇绯荤粺鏄惁鍦ㄦ巿鏉冩湡闄愬唴 let _s = md5('mksoft' + moment().format('YYYYMMDD')) let isauth = authCode && authCode.includes(_s) @@ -68,7 +69,7 @@ isauth = true } - if (isauth) { + if (userId && isauth) { return (<item.component {...props}/>) } else { return (<Redirect to={{ pathname: '/login'}}/>) -- Gitblit v1.8.0