App.tsx 2.3 KB

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