2022-08-17 15:48:25 +08:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import { HashRouter as Router, Route } from 'react-router-dom'
|
|
|
|
import './App.css'
|
|
|
|
import './assets/comm.css'
|
|
|
|
import { Redirect } from 'react-router-dom'
|
|
|
|
import { lazy, Suspense } from 'react'
|
|
|
|
import { FullScreenLoading } from 'zent'
|
|
|
|
const Home = lazy(() => import('./pages/home/home'))
|
|
|
|
const Login = lazy(() => import('./pages/login/login'))
|
|
|
|
const ErrPage = lazy(() => import('./pages/errpage/errpage'))
|
|
|
|
const EdittemPlate = lazy(() =>
|
|
|
|
import('./pages/exchangepage/edittemplate/main.js')
|
|
|
|
)
|
2021-10-25 17:45:14 +08:00
|
|
|
export default class App extends Component {
|
|
|
|
state = {
|
2022-08-17 15:48:25 +08:00
|
|
|
pathname: ''
|
|
|
|
}
|
|
|
|
componentWillMount() {
|
|
|
|
const pathname = window.location.href.lastIndexOf('/')
|
|
|
|
const pathnamestr = window.location.href.substr(pathname)
|
|
|
|
this.setState({ pathname: `${pathnamestr}` })
|
2021-10-25 17:45:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2022-08-17 15:48:25 +08:00
|
|
|
<Router>
|
|
|
|
<Suspense
|
|
|
|
fallback={
|
|
|
|
<FullScreenLoading loading icon='circle' iconText='加载中...' />
|
|
|
|
}>
|
|
|
|
<Route path='/login' exact={true} component={Login} />
|
|
|
|
<Route path='/edittemplate' exact={true} component={EdittemPlate} />
|
|
|
|
<Route path='/home' component={Home} />
|
|
|
|
<Route
|
|
|
|
exact={true}
|
|
|
|
path='/'
|
|
|
|
render={() => <Redirect to='/login' />}></Route>
|
|
|
|
<Route component={ErrPage} />
|
|
|
|
</Suspense>
|
2021-10-25 17:45:14 +08:00
|
|
|
</Router>
|
2022-08-17 15:48:25 +08:00
|
|
|
)
|
2021-10-25 17:45:14 +08:00
|
|
|
}
|
2021-10-25 11:49:03 +08:00
|
|
|
}
|