| | |
| | | |
| | | 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) |
| | |
| | | isauth = true |
| | | } |
| | | |
| | | if (isauth) { |
| | | if (userId && isauth) { |
| | | return (<item.component {...props}/>) |
| | | } else { |
| | | return (<Redirect to={{ pathname: '/login'}}/>) |