|
@@ -1,8 +1,8 @@
|
|
import '@/assets/styles/base.css'
|
|
import '@/assets/styles/base.css'
|
|
// 关于路由
|
|
// 关于路由
|
|
-import React, { useCallback, useEffect } from 'react'
|
|
|
|
|
|
+import React, { useCallback, useEffect, useState } from 'react'
|
|
import { Router, Route, Switch } from 'react-router-dom'
|
|
import { Router, Route, Switch } from 'react-router-dom'
|
|
-import history, { isMobileFu } from './utils/history'
|
|
|
|
|
|
+import history, { isMobileFu, myUrl } from './utils/history'
|
|
import SpinLoding from './components/SpinLoding'
|
|
import SpinLoding from './components/SpinLoding'
|
|
import AsyncSpinLoding from './components/AsyncSpinLoding'
|
|
import AsyncSpinLoding from './components/AsyncSpinLoding'
|
|
|
|
|
|
@@ -12,8 +12,33 @@ import MessageCom from './components/Message'
|
|
import screenImg from '@/assets/img/landtip.png'
|
|
import screenImg from '@/assets/img/landtip.png'
|
|
|
|
|
|
const A1home = React.lazy(() => import('./pages/A1home'))
|
|
const A1home = React.lazy(() => import('./pages/A1home'))
|
|
|
|
+const A2details = React.lazy(() => import('./pages/A2details'))
|
|
|
|
+
|
|
|
|
+// const scriptArr = [`${myUrl}videoJs/jsmpeg.min.js`, `${myUrl}videoJs/f-video.js`]
|
|
|
|
|
|
export default function App() {
|
|
export default function App() {
|
|
|
|
+ // 动态加载 js
|
|
|
|
+ // const [lodingJs, setLodingJs] = useState(0)
|
|
|
|
+
|
|
|
|
+ const [isSucc, setIsSucc] = useState(true)
|
|
|
|
+
|
|
|
|
+ // 加载2个js
|
|
|
|
+ // useEffect(() => {
|
|
|
|
+ // if (lodingJs < scriptArr.length) {
|
|
|
|
+ // let script = document.createElement('script')
|
|
|
|
+ // script.type = 'text/javascript'
|
|
|
|
+ // script.src = scriptArr[lodingJs]
|
|
|
|
+ // document.head.appendChild(script)
|
|
|
|
+ // script.onload = () => {
|
|
|
|
+ // setLodingJs(lodingJs + 1)
|
|
|
|
+ // if (lodingJs === scriptArr.length - 1) {
|
|
|
|
+ // // 加载完了最后一个
|
|
|
|
+ // setIsSucc(true)
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }, [lodingJs])
|
|
|
|
+
|
|
// 从仓库中获取查看图片的信息
|
|
// 从仓库中获取查看图片的信息
|
|
// const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
|
|
// const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
|
|
|
|
|
|
@@ -32,14 +57,17 @@ export default function App() {
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
{/* 关于路由 */}
|
|
{/* 关于路由 */}
|
|
- <Router history={history}>
|
|
|
|
- <React.Suspense fallback={<SpinLoding />}>
|
|
|
|
- <Switch>
|
|
|
|
- {/* <Route path='/codeSucc/:id' component={A3codeSucc} /> */}
|
|
|
|
- <Route path='/' component={A1home} />
|
|
|
|
- </Switch>
|
|
|
|
- </React.Suspense>
|
|
|
|
- </Router>
|
|
|
|
|
|
+ {isSucc ? (
|
|
|
|
+ <Router history={history}>
|
|
|
|
+ <React.Suspense fallback={<SpinLoding />}>
|
|
|
|
+ <Switch>
|
|
|
|
+ {/* <Route path='/codeSucc/:id' component={A3codeSucc} /> */}
|
|
|
|
+ <Route path='/info/:id' component={A2details} />
|
|
|
|
+ <Route path='/' component={A1home} exact />
|
|
|
|
+ </Switch>
|
|
|
|
+ </React.Suspense>
|
|
|
|
+ </Router>
|
|
|
|
+ ) : null}
|
|
|
|
|
|
{/* 发送请求的加载组件 */}
|
|
{/* 发送请求的加载组件 */}
|
|
<AsyncSpinLoding />
|
|
<AsyncSpinLoding />
|