|
|
@@ -7,13 +7,11 @@ import SpinLoding from './components/SpinLoding'
|
|
|
import store, { RootState } from './store'
|
|
|
import { useSelector } from 'react-redux'
|
|
|
import NotFound from '@/components/NotFound'
|
|
|
-import { baseURL, isLoc, myData } from './utils/http'
|
|
|
+import { baseURL, envFlag, isLoc, myData } from './utils/http'
|
|
|
import AsyncSpinLoding from './components/AsyncSpinLoding'
|
|
|
import { Image } from 'antd'
|
|
|
import MessageCom from '@/components/Message'
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// import Vconsole from 'vconsole'
|
|
|
// new Vconsole()
|
|
|
|
|
|
@@ -29,7 +27,6 @@ const A7Wjwj = React.lazy(() => import('./pages/A7wjwj'))
|
|
|
const A6_1_zxys = React.lazy(() => import('./pages/A6ybwx/A6_1_zxys'))
|
|
|
const A6_2_zxzgh = React.lazy(() => import('./pages/A6ybwx/A6_2_zxzgh'))
|
|
|
|
|
|
-
|
|
|
declare global {
|
|
|
//设置全局属性
|
|
|
interface Window {
|
|
|
@@ -40,8 +37,6 @@ declare global {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
let tempW = document.documentElement.clientWidth
|
|
|
let tempH = document.documentElement.clientHeight
|
|
|
|
|
|
@@ -68,7 +63,6 @@ export default function App() {
|
|
|
|
|
|
const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
|
|
|
|
|
|
-
|
|
|
// 根元素
|
|
|
const rootRef = useRef<any>(null)
|
|
|
|
|
|
@@ -173,34 +167,365 @@ export default function App() {
|
|
|
|
|
|
// 动态根据路由更改背景图
|
|
|
const handleHashChange = () => {
|
|
|
-
|
|
|
if (window.location.hash === '#/base') {
|
|
|
callIframeFu('changePanel', 0)
|
|
|
callIframeFu('showInscription', -1)
|
|
|
callIframeFu('showHotspot', -1)
|
|
|
- };
|
|
|
+ }
|
|
|
if (window.location.hash === '#/yblm') {
|
|
|
callIframeFu('changePanel', 1)
|
|
|
callIframeFu('showInscription', -1)
|
|
|
callIframeFu('showHotspot', -1)
|
|
|
- };
|
|
|
- if (window.location.hash === '#/beie') { callIframeFu('changePanel', 3); callIframeFu('showInscription', 0) }
|
|
|
+ }
|
|
|
+ if (window.location.hash === '#/beie') {
|
|
|
+ callIframeFu('changePanel', 3)
|
|
|
+ callIframeFu('showInscription', 0)
|
|
|
+ }
|
|
|
if (window.location.hash === '#/quanwen') {
|
|
|
- callIframeFu('changePanel', 3);
|
|
|
+ callIframeFu('changePanel', 3)
|
|
|
callIframeFu('showInscription', -1)
|
|
|
}
|
|
|
if (window.location.hash === '#/wenwu') {
|
|
|
callIframeFu('changePanel', 4)
|
|
|
callIframeFu('showInscription', -1)
|
|
|
callIframeFu('showHotspot', -1)
|
|
|
- };
|
|
|
- };
|
|
|
+ }
|
|
|
+ }
|
|
|
useEffect(() => {
|
|
|
- window.addEventListener('hashchange', handleHashChange);
|
|
|
+ window.addEventListener('hashchange', handleHashChange)
|
|
|
return () => {
|
|
|
- window.removeEventListener('hashchange', handleHashChange);
|
|
|
- };
|
|
|
- }, []);
|
|
|
+ window.removeEventListener('hashchange', handleHashChange)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ // 更新unity页面
|
|
|
+ useEffect(() => {
|
|
|
+ if (envFlag) {
|
|
|
+ window.addEventListener('keyup', e => {
|
|
|
+ if (e.code === 'Enter') {
|
|
|
+ callIframeFu(
|
|
|
+ 'refreshAppSettings',
|
|
|
+ JSON.stringify(
|
|
|
+ {
|
|
|
+ panels: [
|
|
|
+ {
|
|
|
+ name: 'DefaultVirtualCamera',
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Panel1Camera',
|
|
|
+ cameraOrthographicSize: 4,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: -10,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Panel2Camera',
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Panel3Camera',
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Panel4Camera',
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Panel5Camera',
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rotationNotAllowed: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ hotspots: [
|
|
|
+ {
|
|
|
+ name: '佛龛',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 1.1,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '佛像',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 0,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '佛龛两侧',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 0,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '佛龛上部',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 2,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '佛龛下部',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: -1,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -180,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '畏兽',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 2,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -90,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '飞天',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 0,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -90,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '摩尼宝珠',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 5,
|
|
|
+ viewportX: 0.5,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: -1,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: -90,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ inscriptions: [
|
|
|
+ {
|
|
|
+ name: '碑额',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 2,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 4.4,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '碑文1',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 2,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: 0,
|
|
|
+ position: {
|
|
|
+ y: 3.6,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '碑文2',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ position: {
|
|
|
+ y: 0,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '碑文3',
|
|
|
+ camera: {
|
|
|
+ cameraOrthographicSize: 9,
|
|
|
+ viewportX: 0,
|
|
|
+ offset: -10,
|
|
|
+ position: {
|
|
|
+ y: 0,
|
|
|
+ z: -50
|
|
|
+ }
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ rotation: {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ z: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }),'json'
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
@@ -249,7 +574,6 @@ export default function App() {
|
|
|
) : null}
|
|
|
|
|
|
<MessageCom />
|
|
|
-
|
|
|
</>
|
|
|
)
|
|
|
}
|