|
@@ -14,8 +14,15 @@ const A3banquet = React.lazy(() => import('./pages/A3banquet'))
|
|
|
const A4dance = React.lazy(() => import('./pages/A4dance'))
|
|
|
const A5chef = React.lazy(() => import('./pages/A5chef'))
|
|
|
const B1more = React.lazy(() => import('./pages/B1more'))
|
|
|
-const Text = React.lazy(() => import('./pages/Text'))
|
|
|
|
|
|
+// 云起图仙居 等热点集合页面
|
|
|
+const B2hots = React.lazy(() => import('./pages/B2hots'))
|
|
|
+// 云气图
|
|
|
+const B3yun = React.lazy(() => import('./pages/B3yun'))
|
|
|
+// 仙居
|
|
|
+const B4xian = React.lazy(() => import('./pages/B4xian'))
|
|
|
+
|
|
|
+const Text = React.lazy(() => import('./pages/Text'))
|
|
|
declare global {
|
|
|
//设置全局属性
|
|
|
interface Window {
|
|
@@ -24,6 +31,20 @@ declare global {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+let tempW = document.documentElement.clientWidth
|
|
|
+let tempH = document.documentElement.clientHeight
|
|
|
+
|
|
|
+let tempMax = tempW >= tempH ? tempW : tempH
|
|
|
+let tempMin = tempW >= tempH ? tempH : tempW
|
|
|
+
|
|
|
+const pageBi = Math.round(Number((tempMax / tempMin).toFixed(2)))
|
|
|
+
|
|
|
+// 设计图按照 844 X 390 来开发
|
|
|
+const planSize = {
|
|
|
+ width: 844,
|
|
|
+ height: Math.round(Number((844 / pageBi).toFixed(0)))
|
|
|
+}
|
|
|
+
|
|
|
export default function App() {
|
|
|
useEffect(() => {
|
|
|
// 打包环境 刷新页面从 首页 开始
|
|
@@ -37,11 +58,6 @@ export default function App() {
|
|
|
// 根元素
|
|
|
const rootRef = useRef<any>(null)
|
|
|
|
|
|
- // 是否是横屏,默认是false
|
|
|
- // const isHH = useSelector((state: RootState) => state.A0Layout.isHH)
|
|
|
-
|
|
|
- const timeRef = useRef(-1)
|
|
|
-
|
|
|
const pageFullChangeFu = useCallback(() => {
|
|
|
let width = document.documentElement.clientWidth
|
|
|
let height = document.documentElement.clientHeight
|
|
@@ -51,44 +67,45 @@ export default function App() {
|
|
|
if (width >= height) {
|
|
|
//横屏
|
|
|
isHHTemp = true
|
|
|
+ const sizeW = width / planSize.width
|
|
|
+ let sizeH = height / planSize.height
|
|
|
+
|
|
|
+ let moveX = (planSize.width - width) / 2
|
|
|
+ let moveY = (planSize.height - height) / 2
|
|
|
+
|
|
|
+ if (width >= planSize.width) moveX = 0
|
|
|
rootRef.current.style.left = '0'
|
|
|
- rootRef.current.style.transform = 'rotate(0deg)'
|
|
|
- // 最大宽度1200px
|
|
|
- // if (width >= 1200) {
|
|
|
- // width = 1200
|
|
|
- // height = 675
|
|
|
- // }
|
|
|
+ rootRef.current.style.transform = `translate(${-moveX}px,${-moveY}px) scale(${sizeW},${sizeH}) rotate(0deg)`
|
|
|
+ rootRef.current.style.transformOrigin = 'center'
|
|
|
} else {
|
|
|
// 竖屏
|
|
|
- // width = width >= 800 ? 800 : width
|
|
|
isHHTemp = false
|
|
|
const temp = width
|
|
|
width = height
|
|
|
height = temp
|
|
|
+
|
|
|
+ const sizeW = width / planSize.width
|
|
|
+ let sizeH = height / planSize.height
|
|
|
+
|
|
|
rootRef.current.style.left = '100%'
|
|
|
- rootRef.current.style.transform = 'rotate(90deg)'
|
|
|
+ rootRef.current.style.transform = `rotate(90deg) scale(${sizeW},${sizeH})`
|
|
|
+
|
|
|
rootRef.current.style.transformOrigin = 'left top'
|
|
|
}
|
|
|
|
|
|
// 横竖屏变化的时候 刷新页面
|
|
|
|
|
|
- // 待完善
|
|
|
// if (window.isHH !== isHHTemp) {
|
|
|
// window.location.reload()
|
|
|
// }
|
|
|
|
|
|
store.dispatch({ type: 'layout/isHH', payload: isHHTemp })
|
|
|
- clearTimeout(timeRef.current)
|
|
|
- timeRef.current = window.setTimeout(() => {
|
|
|
- rootRef.current.style.width = width + 'px'
|
|
|
- rootRef.current.style.height = height + 'px'
|
|
|
- }, 100)
|
|
|
}, [])
|
|
|
|
|
|
useEffect(() => {
|
|
|
rootRef.current = document.querySelector('#root')
|
|
|
- rootRef.current.style.width = document.documentElement.clientWidth + 'px'
|
|
|
- rootRef.current.style.height = document.documentElement.clientHeight + 'px'
|
|
|
+ rootRef.current.style.width = planSize.width + 'px'
|
|
|
+ rootRef.current.style.height = planSize.height + 'px'
|
|
|
|
|
|
pageFullChangeFu()
|
|
|
window.addEventListener('resize', pageFullChangeFu, false)
|
|
@@ -106,6 +123,9 @@ export default function App() {
|
|
|
<Route path='/dance' component={A4dance} exact />
|
|
|
<Route path='/chef' component={A5chef} exact />
|
|
|
<Route path='/more' component={B1more} exact />
|
|
|
+ <Route path='/hots' component={B2hots} exact />
|
|
|
+ <Route path='/yun' component={B3yun} exact />
|
|
|
+ <Route path='/xian' component={B4xian} exact />
|
|
|
<Route path='/text' component={Text} exact />
|
|
|
<Route path='*' component={NotFound} />
|
|
|
</Switch>
|