king
2022-09-01 a49f4888e0bc09f4e03b1d5e12be19eb2ae8636b
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'}}/>)