|
|
@@ -7,10 +7,11 @@ import SpinLoding from './components/SpinLoding'
|
|
|
import store, { RootState } from './store'
|
|
|
import { useSelector } from 'react-redux'
|
|
|
import NotFound from '@/components/NotFound'
|
|
|
-import { baseURL, envFlag, isLoc, myData } from './utils/http'
|
|
|
+import { baseURL, envFlag, isLoc } from './utils/http'
|
|
|
import AsyncSpinLoding from './components/AsyncSpinLoding'
|
|
|
import { Image } from 'antd'
|
|
|
import MessageCom from '@/components/Message'
|
|
|
+import { setStoreLangueFu } from './utils/storage'
|
|
|
|
|
|
// import Vconsole from 'vconsole'
|
|
|
// new Vconsole()
|
|
|
@@ -52,6 +53,13 @@ const planSize = {
|
|
|
}
|
|
|
|
|
|
export default function App() {
|
|
|
+ const {myData} = useSelector((state: RootState) => state.A0Layout)
|
|
|
+
|
|
|
+ // 判断是中文还是英文
|
|
|
+ useEffect(() => {
|
|
|
+ setStoreLangueFu()
|
|
|
+ }, [])
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
// 打包环境 刷新页面从 首页 开始
|
|
|
if (!isLoc && myData.isLdong) {
|
|
|
@@ -59,7 +67,7 @@ export default function App() {
|
|
|
window.location.href = window.location.href.split('#')[0] + '#/'
|
|
|
}
|
|
|
}
|
|
|
- }, [])
|
|
|
+ }, [myData.isLdong])
|
|
|
|
|
|
const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
|
|
|
|
|
|
@@ -199,54 +207,52 @@ export default function App() {
|
|
|
}
|
|
|
}, [])
|
|
|
|
|
|
-
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
// 添加状态跟踪自动旋转
|
|
|
- let timer: NodeJS.Timeout;
|
|
|
+ let timer: NodeJS.Timeout
|
|
|
|
|
|
window.onModelControlled = () => {
|
|
|
- callIframeFu('setModelAutoRotation', 0);
|
|
|
+ callIframeFu('setModelAutoRotation', 0)
|
|
|
resetTimer()
|
|
|
}
|
|
|
|
|
|
const resetTimer = () => {
|
|
|
// 清除现有计时器
|
|
|
- if (timer) clearTimeout(timer);
|
|
|
+ if (timer) clearTimeout(timer)
|
|
|
|
|
|
// 重置计时器并检查旋转状态
|
|
|
timer = setTimeout(() => {
|
|
|
if (window.currentChangePanelIndex === 0 || window.currentChangePanelIndex === 4) {
|
|
|
- console.log(window.currentChangePanelIndex);
|
|
|
- callIframeFu('setModelAutoRotation', -0.5);
|
|
|
- isAutoRotating.current = true;
|
|
|
+ console.log(window.currentChangePanelIndex)
|
|
|
+ callIframeFu('setModelAutoRotation', -0.5)
|
|
|
+ isAutoRotating.current = true
|
|
|
}
|
|
|
- }, 3000);
|
|
|
+ }, 3000)
|
|
|
|
|
|
// 如果正在旋转则取消
|
|
|
if (isAutoRotating.current) {
|
|
|
- callIframeFu('setModelAutoRotation', 0);
|
|
|
- isAutoRotating.current = false;
|
|
|
+ callIframeFu('setModelAutoRotation', 0)
|
|
|
+ isAutoRotating.current = false
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
// 初始化计时器
|
|
|
- resetTimer();
|
|
|
+ resetTimer()
|
|
|
|
|
|
// 操作事件监听
|
|
|
const handleUserAction = () => {
|
|
|
- resetTimer();
|
|
|
- };
|
|
|
+ resetTimer()
|
|
|
+ }
|
|
|
|
|
|
- document.addEventListener('click', handleUserAction);
|
|
|
- document.addEventListener('touchstart', handleUserAction);
|
|
|
+ document.addEventListener('click', handleUserAction)
|
|
|
+ document.addEventListener('touchstart', handleUserAction)
|
|
|
|
|
|
return () => {
|
|
|
- clearTimeout(timer);
|
|
|
- document.removeEventListener('click', handleUserAction);
|
|
|
- document.removeEventListener('touchstart', handleUserAction);
|
|
|
- };
|
|
|
- }, []);
|
|
|
+ clearTimeout(timer)
|
|
|
+ document.removeEventListener('click', handleUserAction)
|
|
|
+ document.removeEventListener('touchstart', handleUserAction)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
|
|
|
document.addEventListener('click', () => {
|
|
|
if (window.currentChangePanelIndex === 0 || window.currentChangePanelIndex === 4) {
|
|
|
@@ -255,8 +261,6 @@ export default function App() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 更新unity页面
|
|
|
useEffect(() => {
|
|
|
if (envFlag) {
|
|
|
@@ -264,8 +268,7 @@ export default function App() {
|
|
|
if (e.code === 'Enter') {
|
|
|
callIframeFu(
|
|
|
'refreshAppSettings',
|
|
|
- JSON.stringify(
|
|
|
- {
|
|
|
+ JSON.stringify({
|
|
|
panels: [
|
|
|
{
|
|
|
name: 'DefaultVirtualCamera',
|
|
|
@@ -579,7 +582,8 @@ export default function App() {
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
- }),'json'
|
|
|
+ }),
|
|
|
+ 'json'
|
|
|
)
|
|
|
}
|
|
|
})
|