|
|
@@ -1,74 +1,27 @@
|
|
|
-import React, { useEffect, useRef, useState } from 'react'
|
|
|
+import React, { useEffect } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
+import { useParams } from 'react-router-dom'
|
|
|
+import A5Three from './PageSon/A5Three'
|
|
|
+import A5list from './PageSon/A5list'
|
|
|
+import A5model from './PageSon/A5model'
|
|
|
+import A5atlas from './PageSon/A5atlas'
|
|
|
import MenuSider from '@/components/MenuSider'
|
|
|
|
|
|
-const fullNum = {
|
|
|
- width: window.innerWidth,
|
|
|
- height: window.innerHeight
|
|
|
-}
|
|
|
+export type A5pageType = 'three' | 'list' | 'model' | 'atlas'
|
|
|
|
|
|
function A5view() {
|
|
|
- const iframeDom = useRef<any>(null)
|
|
|
-
|
|
|
- const [txt, setTxt] = useState({
|
|
|
- title: '',
|
|
|
- show: false
|
|
|
- })
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- // 点击图片
|
|
|
- ;(window as any).clickObject = (val: any) => {
|
|
|
- console.log('000', val)
|
|
|
- }
|
|
|
- // 鼠标移入
|
|
|
- ;(window as any).hoverObject = (name: any) => {
|
|
|
- setTxt({
|
|
|
- title: name,
|
|
|
- show: true
|
|
|
- })
|
|
|
- }
|
|
|
- // 鼠标移出
|
|
|
- ;(window as any).mouseoutObject = () => {
|
|
|
- setTxt({
|
|
|
- title: '',
|
|
|
- show: false
|
|
|
- })
|
|
|
- }
|
|
|
+ const { key } = useParams<{ key: A5pageType }>()
|
|
|
|
|
|
- const txtDom: any = document.querySelector('.txt')
|
|
|
-
|
|
|
- if (txtDom) {
|
|
|
- // 获取鼠标坐标
|
|
|
- ;(window as any).mouseLoc = (x: any, y: any) => {
|
|
|
- // console.log("ppp", x, y);
|
|
|
- // 最大X值
|
|
|
- const maxX = fullNum.width - 200
|
|
|
- let xRes = x >= maxX ? maxX : x
|
|
|
- // xRes = xRes - 100 <= 0 ? 0 : xRes - 100;
|
|
|
- // 最大y值
|
|
|
- const domHeight = txtDom.clientHeight
|
|
|
- const maxY = fullNum.height - domHeight
|
|
|
- let yRes = y >= maxY ? maxY : y
|
|
|
- // yRes = yRes - domHeight / 2 <= 0 ? 0 : yRes - domHeight / 2;
|
|
|
- txtDom.style.top = yRes + 'px'
|
|
|
- txtDom.style.left = xRes + 'px'
|
|
|
- }
|
|
|
- }
|
|
|
- }, [])
|
|
|
+ // useEffect(() => {
|
|
|
+ // console.log('-------', key)
|
|
|
+ // }, [key])
|
|
|
|
|
|
return (
|
|
|
<div className={styles.A5view}>
|
|
|
- <iframe
|
|
|
- id='iframe'
|
|
|
- ref={iframeDom}
|
|
|
- title='3d'
|
|
|
- src='./three/index.html'
|
|
|
- frameBorder='0'
|
|
|
- ></iframe>
|
|
|
- <div className='txt' style={{ opacity: txt.show ? 0.8 : 0 }}>
|
|
|
- <h2>{txt.title}</h2>
|
|
|
- </div>
|
|
|
-
|
|
|
+ {key === 'three' ? <A5Three /> : null}
|
|
|
+ {key === 'list' ? <A5list /> : null}
|
|
|
+ {key === 'model' ? <A5model /> : null}
|
|
|
+ {key === 'atlas' ? <A5atlas /> : null}
|
|
|
<MenuSider isSidebarOpen={false} />
|
|
|
</div>
|
|
|
)
|