|
|
@@ -1,6 +1,6 @@
|
|
|
import '@/assets/styles/base.css'
|
|
|
// 关于路由
|
|
|
-import React from 'react'
|
|
|
+import React, { useEffect } from 'react'
|
|
|
import { Router, Route, Switch } from 'react-router-dom'
|
|
|
import history from './utils/history'
|
|
|
import SpinLoding from './components/SpinLoding'
|
|
|
@@ -11,17 +11,22 @@ import TouchContainer from './components/TouchContainer'
|
|
|
import AsyncSpinLoding from './components/AsyncSpinLoding'
|
|
|
import { Image } from 'antd'
|
|
|
import MessageCom from '@/components/Message'
|
|
|
+import { isMobiileFu } from './utils/history'
|
|
|
+import screenImg from '@/assets/img/landtip.png'
|
|
|
// import Vconsole from 'vconsole'
|
|
|
// new Vconsole()
|
|
|
|
|
|
// import { isLoc, myData } from './utils/http'
|
|
|
const A0base = React.lazy(() => import('./pages/A0base'))
|
|
|
+const A0baseM = React.lazy(() => import('./pages/A0baseM'))
|
|
|
const Home = React.lazy(() => import('./pages/A1home'))
|
|
|
+const HomeM = React.lazy(() => import('./pages/A1homeM'))
|
|
|
const Scene = React.lazy(() => import('./pages/A2scene'))
|
|
|
const Architecture = React.lazy(() => import('./pages/A3architecture'))
|
|
|
const Member = React.lazy(() => import('./pages/A4member'))
|
|
|
const View = React.lazy(() => import('./pages/A5view'))
|
|
|
const Life = React.lazy(() => import('./pages/A6life'))
|
|
|
+const AnimationM = React.lazy(() => import('./pages/A7animationM'))
|
|
|
declare global {
|
|
|
//设置全局属性
|
|
|
interface Window {
|
|
|
@@ -33,19 +38,50 @@ declare global {
|
|
|
export default function App() {
|
|
|
const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (!isMobiileFu()) return
|
|
|
+
|
|
|
+ const rootDom = document.querySelector('#root') as HTMLDivElement
|
|
|
+ if (!rootDom) return
|
|
|
+
|
|
|
+ const setHeight = () => {
|
|
|
+ rootDom.style.height = document.documentElement.clientHeight + 'px'
|
|
|
+ rootDom.style.maxWidth = '500px'
|
|
|
+ rootDom.style.margin = '0 auto'
|
|
|
+ }
|
|
|
+
|
|
|
+ setHeight()
|
|
|
+
|
|
|
+ let timer: ReturnType<typeof setTimeout> | null = null
|
|
|
+ const debouncedSetHeight = () => {
|
|
|
+ if (timer) clearTimeout(timer)
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ setHeight()
|
|
|
+ timer = null
|
|
|
+ }, 150)
|
|
|
+ }
|
|
|
+
|
|
|
+ window.addEventListener('resize', debouncedSetHeight)
|
|
|
+ return () => {
|
|
|
+ window.removeEventListener('resize', debouncedSetHeight)
|
|
|
+ if (timer) clearTimeout(timer)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
{/* 关于路由 */}
|
|
|
<Router history={history}>
|
|
|
<React.Suspense fallback={<SpinLoding />}>
|
|
|
<Switch>
|
|
|
- <Route path='/' component={A0base} exact />
|
|
|
- <Route path='/home' component={Home} exact />
|
|
|
+ <Route path='/' component={isMobiileFu() ? A0baseM : A0base} exact />
|
|
|
+ <Route path='/home' component={isMobiileFu() ? HomeM : Home} exact />
|
|
|
<Route path='/scene' component={Scene} exact />
|
|
|
<Route path='/architecture' component={Architecture} exact />
|
|
|
<Route path='/member' component={Member} exact />
|
|
|
<Route path='/view/:key' component={View} exact />
|
|
|
<Route path='/life' component={Life} exact />
|
|
|
+ <Route path='/animation' component={AnimationM} exact />
|
|
|
<Route path='*' component={NotFound} />
|
|
|
</Switch>
|
|
|
</React.Suspense>
|
|
|
@@ -80,6 +116,14 @@ export default function App() {
|
|
|
) : null}
|
|
|
|
|
|
<MessageCom />
|
|
|
+
|
|
|
+ {/* 横屏提示 */}
|
|
|
+ {isMobiileFu() ? (
|
|
|
+ <div id='ScreenChange'>
|
|
|
+ <img src={screenImg} alt='' />
|
|
|
+ <p>请在竖屏模式浏览</p>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
</>
|
|
|
)
|
|
|
}
|