king
2022-10-12 53b9fb93d0376eb02bb996935f1720b4e95cd897
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'}}/>)