{"size": 859, "ext": "js", "max_stars_repo_path": "src/page/404.js", "max_stars_repo_name": "zhangjiayuchenli/my-project", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/page/404.js", "max_issues_repo_name": "zhangjiayuchenli/my-project", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/page/404.js", "max_forks_repo_name": "zhangjiayuchenli/my-project", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.976744186, "max_line_length": 71, "alphanum_fraction": 0.5867287544}
import React from 'react';
import Link from 'umi/link';

import Exception from '@/components/Exception';

class Exception404 extends React.Component {
  state = {
    redirect: '/'
  }

  componentWillMount() {
    this.handleRedirect();
  }

  /** 根据不同用户类型404返回的首页界面也不同 */
  handleRedirect = () =>
  {
      const types=localStorage.getItem('types')
      if( types=== 'teacher')
      {
        this.setState({ redirect: '/dashboard/teacher/student' })
      }
      else if(types=== 'stu')
      {
        this.setState({ redirect: '/dashboard/student/studentInfo' })
      }
      else {
        this.setState({ redirect: '/dashboard/admin/student' })
      }
  }

  render()
    {

      const { redirect } = this.state;
      return (
        <Exception type="404" linkElement={Link} redirect={redirect} />
      )
    }

}
export default Exception404;
