From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 十月 2022 14:41:06 +0800 Subject: [PATCH] 2022-10-12 --- src/router/index.js | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 5d1c87e..d923557 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -46,7 +46,7 @@ {path: '/billprint/:param', name: 'billprint', component: BillPrint, auth: true}, {path: '/docprint/:menuId', name: 'docprint', component: BillPrint, auth: false}, {path: '/docprint/:menuId/:id', name: 'docprint', component: BillPrint, auth: false}, - {path: '/mainparams/:menuId', name: 'mainparams', component: MainParams, auth: false}, + {path: '/tab/:menuId', name: 'tab', component: MainParams, auth: false}, {path: '/role/:param', name: 'role', component: RoleManage, auth: true}, {path: '/hs', name: 'hs', component: SystemFunc, auth: true}, {path: '/interface', name: 'interface', component: Interface, auth: true} @@ -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