import '@/assets/styles/base.css'
// 关于路由
import React from 'react'
import { Router, Route, Switch } from 'react-router-dom'
import history from './utils/history'
import AuthRoute from './components/AuthRoute'
import SpinLoding from './components/SpinLoding'
import AsyncSpinLoding from './components/AsyncSpinLoding'
import UpAsyncLoding from './components/UpAsyncLoding'
import MessageCom from './components/Message'
const Layout = React.lazy(() => import('./pages/Layout'))
const Login = React.lazy(() => import('./pages/Login'))

export default function App() {
  return (
    <>
      {/* 关于路由 */}
      <Router history={history}>
        <React.Suspense fallback={<SpinLoding />}>
          <Switch>
            {/* 测试页面 */}
            <Route path='/' component={Login} exact />
            <Route path='/login' component={Login} />
            <AuthRoute path='/' component={Layout} />
          </Switch>
        </React.Suspense>
      </Router>

      {/* 发送请求的加载组件 */}
      <AsyncSpinLoding />

      {/* 上传附件的进度条元素 */}
      <UpAsyncLoding />

      {/* antd 轻提示 ---兼容360浏览器 */}
      <MessageCom />
    </>
  )
}
