2021-10-25 17:45:14 +08:00
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import React, { Component } from 'react';
|
2021-11-16 14:35:18 +08:00
|
|
|
import { HashRouter as Router, Route, Link } from "react-router-dom";
|
2021-10-25 17:45:14 +08:00
|
|
|
import "./App.css"
|
|
|
|
import "./assets/comm.css"
|
2021-10-29 14:47:23 +08:00
|
|
|
import {Redirect} from "react-router-dom";
|
2021-12-03 15:03:49 +08:00
|
|
|
|
2021-10-29 14:47:23 +08:00
|
|
|
import login from './pages/login/login';
|
|
|
|
import home from './pages/home/home';
|
2021-12-02 19:34:28 +08:00
|
|
|
import errpage from "./pages/errpage/errpage"
|
2021-10-25 17:45:14 +08:00
|
|
|
export default class App extends Component {
|
|
|
|
state = {
|
|
|
|
pathname:'',
|
|
|
|
};
|
|
|
|
componentWillMount(){
|
|
|
|
const pathname=window.location.href.lastIndexOf('\/');
|
|
|
|
const pathnamestr=window.location.href.substr(pathname);
|
|
|
|
this.setState({pathname:`${pathnamestr}`});
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2021-10-29 14:47:23 +08:00
|
|
|
<Router>
|
2021-11-02 09:32:55 +08:00
|
|
|
<Route path="/login" exact={true} component={login} />
|
2021-11-06 13:36:21 +08:00
|
|
|
<Route path="/home" component={home} />
|
2021-11-02 09:32:55 +08:00
|
|
|
<Route exact={true} path="/" render={
|
2021-10-29 14:47:23 +08:00
|
|
|
()=> (
|
|
|
|
<Redirect to="/login"/>)}>
|
|
|
|
</Route>
|
2021-12-02 19:34:28 +08:00
|
|
|
<Route component={errpage} />
|
2021-10-25 17:45:14 +08:00
|
|
|
</Router>
|
|
|
|
);
|
|
|
|
}
|
2021-10-25 11:49:03 +08:00
|
|
|
}
|
|
|
|
|