App.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import '@/assets/styles/base.css'
  2. // 关于路由
  3. import React from 'react'
  4. import { Router, Route, Switch } from 'react-router-dom'
  5. import history from './utils/history'
  6. import AuthRoute from './components/AuthRoute'
  7. import SpinLoding from './components/SpinLoding'
  8. import AsyncSpinLoding from './components/AsyncSpinLoding'
  9. import { Image } from 'antd'
  10. import { useSelector } from 'react-redux'
  11. import store, { RootState } from './store'
  12. import UpAsyncLoding from './components/UpAsyncLoding'
  13. import MessageCom from './components/Message'
  14. import LookDom from './components/LookDom'
  15. import Zexport from './components/Zexport'
  16. const Layout = React.lazy(() => import('./pages/Layout'))
  17. const Login = React.lazy(() => import('./pages/Login'))
  18. export default function App() {
  19. // 从仓库中获取查看图片的信息
  20. const { lookBigImg, exInfo } = useSelector((state: RootState) => state.A0Layout)
  21. return (
  22. <>
  23. {/* 关于路由 */}
  24. <Router history={history}>
  25. <React.Suspense fallback={<SpinLoding />}>
  26. <Switch>
  27. <Route path='/login' component={Login} />
  28. {/* 打印页面 */}
  29. {/* <Route
  30. path='/logPage/:key'
  31. component={React.lazy(() => import('./pages/W_log/index'))}
  32. /> */}
  33. <AuthRoute path='/' component={Layout} />
  34. </Switch>
  35. </React.Suspense>
  36. </Router>
  37. {/* 发送请求的加载组件 */}
  38. <AsyncSpinLoding />
  39. {/* 所有图片点击预览查看大图 */}
  40. {lookBigImg.show ? (
  41. <Image
  42. preview={{
  43. visible: lookBigImg.show,
  44. src: lookBigImg.url,
  45. onVisibleChange: value => {
  46. // 清除仓库信息
  47. store.dispatch({
  48. type: 'layout/lookBigImg',
  49. payload: { url: '', show: false }
  50. })
  51. }
  52. }}
  53. />
  54. ) : null}
  55. {/* 上传附件的进度条元素 */}
  56. <UpAsyncLoding />
  57. {/* 查看视频音频 */}
  58. <LookDom />
  59. {/* antd 轻提示 ---兼容360浏览器 */}
  60. <MessageCom />
  61. {/* 所有批量导出 */}
  62. {exInfo.show ? <Zexport /> : null}
  63. </>
  64. )
  65. }