App.tsx 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. import '@/assets/styles/base.css'
  2. // 关于路由
  3. import React, { useCallback, useEffect, useRef } from 'react'
  4. import { Router, Route, Switch } from 'react-router-dom'
  5. import history, { callIframeFu } from './utils/history'
  6. import SpinLoding from './components/SpinLoding'
  7. import store, { RootState } from './store'
  8. import { useDispatch, useSelector } from 'react-redux'
  9. import NotFound from '@/components/NotFound'
  10. import TouchContainer from './components/TouchContainer'
  11. import { envFlag } from './utils/http'
  12. import AsyncSpinLoding from './components/AsyncSpinLoding'
  13. import { Image } from 'antd'
  14. import MessageCom from '@/components/Message'
  15. import { setStoreLangueFu } from './utils/storage'
  16. import { API_getVideo } from './store/action/all'
  17. // import Vconsole from 'vconsole'
  18. // new Vconsole()
  19. // import { isLoc, myData } from './utils/http'
  20. const A1home = React.lazy(() => import('./pages/A1home2'))
  21. const A1_1base = React.lazy(() => import('./pages/A0base'))
  22. const A2yblm = React.lazy(() => import('./pages/A2yblm'))
  23. const A3beie = React.lazy(() => import('./pages/A3beie'))
  24. const A4quanwen = React.lazy(() => import('./pages/A4quanwen'))
  25. const A5wenwu = React.lazy(() => import('./pages/A5wenwu'))
  26. const A6ybwx = React.lazy(() => import('./pages/A6ybwx'))
  27. const A7Wjwj = React.lazy(() => import('./pages/A7wjwj'))
  28. const A6_1_zxys = React.lazy(() => import('./pages/A6ybwx/A6_1_zxys'))
  29. const A6_2_zxzgh = React.lazy(() => import('./pages/A6ybwx/A6_2_zxzgh'))
  30. // 墓影智慧
  31. const A8byzh = React.lazy(() => import('./pages/A8byzh'))
  32. const A9knowlege = React.lazy(() => import('./pages/A9knowlege'))
  33. const text = React.lazy(() => import('./pages/Ztext'))
  34. declare global {
  35. //设置全局属性
  36. interface Window {
  37. //window对象属性
  38. isHH: boolean //加入对象
  39. unityOpenHot: (name: string) => void
  40. unityBack: () => void
  41. }
  42. }
  43. let tempW = document.documentElement.clientWidth
  44. let tempH = document.documentElement.clientHeight
  45. let tempMax = tempW >= tempH ? tempW : tempH
  46. let tempMin = tempW >= tempH ? tempH : tempW
  47. const pageBi = Math.round(Number((tempMax / tempMin).toFixed(2)))
  48. // 设计图按照 844 X 390 来开发
  49. const planSize = {
  50. width: 844,
  51. height: Math.round(Number((844 / pageBi).toFixed(0)))
  52. }
  53. export default function App() {
  54. const dispatch = useDispatch()
  55. // 获取后台管理视频地址
  56. const API_getVideoFu = useCallback(async () => {
  57. dispatch(API_getVideo())
  58. }, [dispatch])
  59. useEffect(() => {
  60. API_getVideoFu()
  61. }, [API_getVideoFu])
  62. const { myData, unityDel } = useSelector((state: RootState) => state.A0Layout)
  63. // 判断是中文还是英文
  64. useEffect(() => {
  65. setStoreLangueFu()
  66. }, [])
  67. useEffect(() => {
  68. // 打包环境 刷新页面从 首页 开始
  69. if (!envFlag && myData.isLdong) {
  70. // #/knowlege?l=look 从后台管理直接打开知识图谱
  71. if (window.location.hash !== '#/' && window.location.hash !== '#/knowlege?l=look') {
  72. window.location.href = window.location.href.split('#')[0] + '#/'
  73. }
  74. }
  75. }, [myData.isLdong])
  76. const lookBigImg = useSelector((state: RootState) => state.A0Layout.lookBigImg)
  77. const isAutoRotating = useRef(false)
  78. // 根元素
  79. const rootRef = useRef<any>(null)
  80. const pageFullChangeFu = useCallback(() => {
  81. let width = document.documentElement.clientWidth
  82. let height = document.documentElement.clientHeight
  83. let isHHTemp = false
  84. if (width >= height) {
  85. if (tempMax - width > 100) return
  86. //横屏
  87. isHHTemp = true
  88. const sizeW = width / planSize.width
  89. let sizeH = height / planSize.height
  90. let moveX = (planSize.width - width) / 2
  91. let moveY = (planSize.height - height) / 2
  92. if (width >= planSize.width) moveX = 0
  93. rootRef.current.style.left = '0'
  94. rootRef.current.style.transform = `translate3d(${-moveX}px,${-moveY}px,0px) scale(${sizeW},${sizeH}) rotate(0deg)`
  95. rootRef.current.style.transformOrigin = 'center'
  96. store.dispatch({
  97. type: 'layout/style',
  98. payload: {
  99. width: planSize.width,
  100. moveX: -moveX,
  101. moveY: -moveY,
  102. sizeW,
  103. sizeH
  104. }
  105. })
  106. } else {
  107. if (tempMax - height > 100) return
  108. // 竖屏
  109. isHHTemp = false
  110. const temp = width
  111. // 用来大场景调整样式
  112. const styleStr = `
  113. #pageIframe #wjwjScene,
  114. #pageIframe #panoramic,
  115. #pageIframe #A7Poem {
  116. width: ${height}px;
  117. height: ${temp}px;
  118. transform: rotate(90deg) translate(-50%, -50%);
  119. transform-origin: left top;
  120. }
  121. `
  122. const styletDom = document.createElement('style')
  123. styletDom.type = 'text/css'
  124. styletDom.id = 'myStyle'
  125. styletDom.innerHTML = styleStr
  126. document.querySelector('html')?.appendChild(styletDom)
  127. width = height
  128. height = temp
  129. const sizeW = width / planSize.width
  130. let sizeH = height / planSize.height
  131. rootRef.current.style.left = '100%'
  132. rootRef.current.style.transform = `rotate(90deg) scale(${sizeW},${sizeH})`
  133. rootRef.current.style.transformOrigin = 'left top'
  134. }
  135. // 横竖屏变化的时候 刷新页面
  136. // if (window.isHH !== isHHTemp) {
  137. // window.location.reload()
  138. // }
  139. store.dispatch({ type: 'layout/isHH', payload: isHHTemp })
  140. }, [])
  141. useEffect(() => {
  142. // 添加状态跟踪自动旋转
  143. let timer: NodeJS.Timeout
  144. window.onModelControlled = () => {
  145. // console.log('djl')
  146. callIframeFu('setModelAutoRotation', 0)
  147. resetTimer()
  148. }
  149. const resetTimer = () => {
  150. clearTimeout(timer)
  151. timer = setTimeout(() => {
  152. if (window.currentChangePanelIndex === 0 || window.currentChangePanelIndex === 4) {
  153. // console.log(window.currentChangePanelIndex)
  154. callIframeFu('setModelAutoRotation', -0.5)
  155. isAutoRotating.current = true
  156. }
  157. }, 3000)
  158. }
  159. // 初始化计时器
  160. setTimeout(() => {
  161. resetTimer()
  162. }, 1000)
  163. return () => {
  164. clearTimeout(timer)
  165. }
  166. }, [])
  167. useEffect(() => {
  168. rootRef.current = document.querySelector('#root')
  169. rootRef.current.style.width = planSize.width + 'px'
  170. rootRef.current.style.height = planSize.height + 'px'
  171. pageFullChangeFu()
  172. window.addEventListener('resize', pageFullChangeFu, false)
  173. }, [pageFullChangeFu])
  174. // 动态根据路由更改背景图
  175. const handleHashChange = () => {
  176. if (window.location.hash === '#/base') {
  177. callIframeFu('changePanel', 0)
  178. callIframeFu('showInscription', -1)
  179. callIframeFu('showHotspot', -1)
  180. window.onModelControlled()
  181. }
  182. if (window.location.hash === '#/yblm') {
  183. callIframeFu('changePanel', 1)
  184. callIframeFu('showInscription', -1)
  185. callIframeFu('showHotspot', -1)
  186. }
  187. if (
  188. window.location.hash === '#/ybwx' ||
  189. window.location.hash === '#/yblm' ||
  190. window.location.hash === '#/wjwj'
  191. ) {
  192. callIframeFu('setModelAutoRotation', 0)
  193. }
  194. if (window.location.hash === '#/beie') {
  195. callIframeFu('changePanel', 3)
  196. callIframeFu('showInscription', 0)
  197. }
  198. if (window.location.hash === '#/quanwen') {
  199. callIframeFu('changePanel', 3)
  200. callIframeFu('showInscription', -1)
  201. }
  202. if (window.location.hash.includes('wenwu')) {
  203. window.onModelControlled()
  204. callIframeFu('changePanel', 4)
  205. callIframeFu('showInscription', -1)
  206. callIframeFu('showHotspot', -1)
  207. }
  208. }
  209. useEffect(() => {
  210. window.addEventListener('hashchange', handleHashChange)
  211. return () => {
  212. window.removeEventListener('hashchange', handleHashChange)
  213. }
  214. }, [])
  215. // 更新unity页面
  216. useEffect(() => {
  217. if (envFlag) {
  218. window.addEventListener('keyup', e => {
  219. if (e.code === 'Enter') {
  220. callIframeFu(
  221. 'refreshAppSettings',
  222. JSON.stringify({
  223. cameraDefaultBlendTime: 0.8,
  224. modelAutoRotationAnimationTime: 0.8,
  225. modelControlAnimationTime: 0.8,
  226. panels: [
  227. {
  228. name: 'Panel1Camera',
  229. camera: {
  230. position: {
  231. x: 0,
  232. y: 0,
  233. z: -13
  234. },
  235. rotation: {
  236. x: 0,
  237. y: 0,
  238. z: 0
  239. },
  240. physicalLensShift: {
  241. x: 0.25,
  242. y: 0
  243. }
  244. },
  245. model: {
  246. rotation: {
  247. x: 0,
  248. y: -180,
  249. z: 0
  250. },
  251. limitScale: {
  252. isLimit: true,
  253. min: 0.2,
  254. max: 1.5
  255. },
  256. limitX: {
  257. isLimit: true,
  258. min: -4.5,
  259. max: 4.5
  260. },
  261. limitY: {
  262. isLimit: true,
  263. min: -8,
  264. max: 8
  265. }
  266. }
  267. },
  268. {
  269. name: 'Panel2Camera',
  270. camera: {
  271. position: {
  272. x: 0,
  273. y: 0,
  274. z: -13
  275. },
  276. physicalLensShift: {
  277. x: 0.2,
  278. y: 0
  279. },
  280. rotation: {
  281. x: 0,
  282. y: 0,
  283. z: 0
  284. }
  285. },
  286. model: {
  287. rotation: {
  288. x: 0,
  289. y: -180,
  290. z: 0
  291. },
  292. limitScale: {
  293. isLimit: true,
  294. min: 0.2,
  295. max: 1.5
  296. },
  297. limitX: {
  298. isLimit: true,
  299. min: -5,
  300. max: 5
  301. },
  302. limitY: {
  303. isLimit: true,
  304. min: -8,
  305. max: 8
  306. }
  307. }
  308. },
  309. {
  310. name: 'Panel3Camera',
  311. camera: {
  312. position: {
  313. x: 0,
  314. y: 0,
  315. z: -13
  316. },
  317. physicalLensShift: {
  318. x: 0,
  319. y: 0
  320. },
  321. rotation: {
  322. x: 0,
  323. y: 0,
  324. z: 0
  325. }
  326. },
  327. model: {
  328. rotation: {
  329. x: 0,
  330. y: -180,
  331. z: 0
  332. },
  333. limitScale: {
  334. isLimit: true,
  335. min: 0.2,
  336. max: 1.5
  337. },
  338. limitX: {
  339. isLimit: true,
  340. min: -10,
  341. max: 10
  342. },
  343. limitY: {
  344. isLimit: true,
  345. min: -8,
  346. max: 8
  347. }
  348. }
  349. },
  350. {
  351. name: 'Panel4Camera',
  352. rotationNotAllowed: true,
  353. camera: {
  354. position: {
  355. x: 0,
  356. y: 0.5,
  357. z: -12
  358. },
  359. physicalLensShift: {
  360. x: 0.2,
  361. y: 0
  362. },
  363. rotation: {
  364. x: 0,
  365. y: 0,
  366. z: 0
  367. }
  368. },
  369. model: {
  370. rotation: {
  371. x: 0,
  372. y: 0,
  373. z: 0
  374. },
  375. limitScale: {
  376. isLimit: true,
  377. min: 0.2,
  378. max: 1.5
  379. },
  380. limitX: {
  381. isLimit: true,
  382. min: -4,
  383. max: 4
  384. },
  385. limitY: {
  386. isLimit: true,
  387. min: -8,
  388. max: 8
  389. }
  390. }
  391. },
  392. {
  393. name: 'Panel5Camera',
  394. camera: {
  395. position: {
  396. x: 0,
  397. y: 0,
  398. z: -14
  399. },
  400. physicalLensShift: {
  401. x: 0,
  402. y: 0
  403. },
  404. rotation: {
  405. x: 0,
  406. y: 0,
  407. z: 0
  408. }
  409. },
  410. model: {
  411. rotation: {
  412. x: 0,
  413. y: -180,
  414. z: 0
  415. },
  416. limitScale: {
  417. isLimit: true,
  418. min: 0.2,
  419. max: 1.5
  420. },
  421. limitX: {
  422. isLimit: true,
  423. min: -15,
  424. max: 15
  425. },
  426. limitY: {
  427. isLimit: true,
  428. min: -8,
  429. max: 8
  430. }
  431. }
  432. }
  433. ],
  434. hotspots: [
  435. {
  436. name: '佛龛',
  437. intensityAnimationTime: 0.8,
  438. startIntensity: 0,
  439. camera: {
  440. position: {
  441. x: 0,
  442. y: 1.6,
  443. z: -9
  444. },
  445. physicalLensShift: {
  446. x: -0.08,
  447. y: 0
  448. },
  449. rotation: {
  450. x: 0,
  451. y: 0,
  452. z: 0
  453. }
  454. },
  455. model: {
  456. rotation: {
  457. x: 0,
  458. y: -180,
  459. z: 0
  460. },
  461. limitScale: {
  462. isLimit: true,
  463. min: 0.2,
  464. max: 1.5
  465. },
  466. limitX: {
  467. isLimit: true,
  468. min: -5,
  469. max: 5
  470. },
  471. limitY: {
  472. isLimit: true,
  473. min: -5,
  474. max: 8
  475. }
  476. }
  477. },
  478. {
  479. name: '佛像',
  480. intensityAnimationTime: 0.8,
  481. startIntensity: 0,
  482. camera: {
  483. physicalLensShift: {
  484. x: -0.1,
  485. y: 0
  486. },
  487. position: {
  488. x: 0,
  489. y: 0.8,
  490. z: -8
  491. },
  492. rotation: {
  493. x: 0,
  494. y: 0,
  495. z: 0
  496. }
  497. },
  498. model: {
  499. rotation: {
  500. x: 0,
  501. y: -180,
  502. z: 0
  503. },
  504. limitScale: {
  505. isLimit: true,
  506. min: 0.2,
  507. max: 1.5
  508. },
  509. limitX: {
  510. isLimit: true,
  511. min: -5,
  512. max: 5
  513. },
  514. limitY: {
  515. isLimit: true,
  516. min: -5,
  517. max: 8
  518. }
  519. }
  520. },
  521. {
  522. name: '佛龛两侧',
  523. intensityAnimationTime: 0.8,
  524. startIntensity: 0,
  525. camera: {
  526. physicalLensShift: {
  527. x: -0.1,
  528. y: 0
  529. },
  530. position: {
  531. x: 0,
  532. y: 0.8,
  533. z: -8
  534. },
  535. rotation: {
  536. x: 0,
  537. y: 0,
  538. z: 0
  539. }
  540. },
  541. model: {
  542. rotation: {
  543. x: 0,
  544. y: -180,
  545. z: 0
  546. },
  547. limitScale: {
  548. isLimit: true,
  549. min: 0.2,
  550. max: 1.5
  551. },
  552. limitX: {
  553. isLimit: true,
  554. min: -5,
  555. max: 5
  556. },
  557. limitY: {
  558. isLimit: true,
  559. min: -5,
  560. max: 8
  561. }
  562. }
  563. },
  564. {
  565. name: '佛龛上部',
  566. intensityAnimationTime: 0.8,
  567. startIntensity: 0,
  568. camera: {
  569. physicalLensShift: {
  570. x: -0.1,
  571. y: 0
  572. },
  573. position: {
  574. x: 0,
  575. y: 3,
  576. z: -8
  577. },
  578. rotation: {
  579. x: 0,
  580. y: 0,
  581. z: 0
  582. }
  583. },
  584. model: {
  585. rotation: {
  586. x: 0,
  587. y: -180,
  588. z: 0
  589. },
  590. limitScale: {
  591. isLimit: true,
  592. min: 0.2,
  593. max: 1.5
  594. },
  595. limitX: {
  596. isLimit: true,
  597. min: -5,
  598. max: 5
  599. },
  600. limitY: {
  601. isLimit: true,
  602. min: 0,
  603. max: 12
  604. }
  605. }
  606. },
  607. {
  608. name: '佛龛下部',
  609. intensityAnimationTime: 0.8,
  610. startIntensity: 0,
  611. camera: {
  612. physicalLensShift: {
  613. x: -0.1,
  614. y: 0
  615. },
  616. position: {
  617. x: 0,
  618. y: -4,
  619. z: -8
  620. },
  621. rotation: {
  622. x: 0,
  623. y: 0,
  624. z: 0
  625. }
  626. },
  627. model: {
  628. rotation: {
  629. x: 0,
  630. y: -180,
  631. z: 0
  632. },
  633. limitScale: {
  634. isLimit: true,
  635. min: 0.2,
  636. max: 1.5
  637. },
  638. limitX: {
  639. isLimit: true,
  640. min: -5,
  641. max: 5
  642. },
  643. limitY: {
  644. isLimit: true,
  645. min: -12,
  646. max: -1
  647. }
  648. }
  649. },
  650. {
  651. name: '畏兽',
  652. intensityAnimationTime: 0.8,
  653. startIntensity: 0,
  654. camera: {
  655. physicalLensShift: {
  656. x: -0.08,
  657. y: 0
  658. },
  659. position: {
  660. x: 0,
  661. y: 2.5,
  662. z: -8
  663. },
  664. rotation: {
  665. x: 0,
  666. y: 0,
  667. z: 0
  668. }
  669. },
  670. model: {
  671. rotation: {
  672. x: 0,
  673. y: -90,
  674. z: 0
  675. },
  676. limitScale: {
  677. isLimit: true,
  678. min: 0.2,
  679. max: 1.5
  680. },
  681. limitX: {
  682. isLimit: true,
  683. min: -5,
  684. max: 5
  685. },
  686. limitY: {
  687. isLimit: true,
  688. min: -1,
  689. max: 8
  690. }
  691. }
  692. },
  693. {
  694. name: '飞天',
  695. intensityAnimationTime: 0.8,
  696. startIntensity: 0,
  697. camera: {
  698. physicalLensShift: {
  699. x: -0.08,
  700. y: 0
  701. },
  702. position: {
  703. x: 0,
  704. y: -0.5,
  705. z: -8
  706. },
  707. rotation: {
  708. x: 0,
  709. y: 0,
  710. z: 0
  711. }
  712. },
  713. model: {
  714. rotation: {
  715. x: 0,
  716. y: -90,
  717. z: 0
  718. },
  719. limitScale: {
  720. isLimit: true,
  721. min: 0.2,
  722. max: 1.5
  723. },
  724. limitX: {
  725. isLimit: true,
  726. min: -5,
  727. max: 5
  728. },
  729. limitY: {
  730. isLimit: true,
  731. min: -6,
  732. max: 5
  733. }
  734. }
  735. },
  736. {
  737. name: '摩尼宝珠',
  738. intensityAnimationTime: 0.8,
  739. startIntensity: 0,
  740. camera: {
  741. physicalLensShift: {
  742. x: -0.08,
  743. y: 0
  744. },
  745. position: {
  746. x: 0,
  747. y: -3,
  748. z: -8
  749. },
  750. rotation: {
  751. x: 0,
  752. y: 0,
  753. z: 0
  754. }
  755. },
  756. model: {
  757. rotation: {
  758. x: 0,
  759. y: -90,
  760. z: 0
  761. },
  762. limitScale: {
  763. isLimit: true,
  764. min: 0.2,
  765. max: 1.5
  766. },
  767. limitX: {
  768. isLimit: true,
  769. min: -5,
  770. max: 5
  771. },
  772. limitY: {
  773. isLimit: true,
  774. min: -8,
  775. max: 3
  776. }
  777. }
  778. }
  779. ],
  780. inscriptions: [
  781. {
  782. name: '碑额',
  783. intensityAnimationTime: 0,
  784. startIntensity: 0,
  785. camera: {
  786. position: {
  787. x: 1.2,
  788. y: 4.3,
  789. z: -5
  790. },
  791. physicalLensShift: {
  792. x: 0.3,
  793. y: 0
  794. },
  795. rotation: {
  796. x: 0,
  797. y: 0,
  798. z: 0
  799. }
  800. },
  801. model: {
  802. rotation: {
  803. x: 0,
  804. y: -90,
  805. z: 0
  806. },
  807. limitScale: {
  808. isLimit: true,
  809. min: 0.2,
  810. max: 1.5
  811. },
  812. limitX: {
  813. isLimit: true,
  814. min: -1,
  815. max: 5
  816. },
  817. limitY: {
  818. isLimit: true,
  819. min: 2,
  820. max: 15
  821. }
  822. }
  823. },
  824. {
  825. name: '碑文1',
  826. intensityAnimationTime: 0,
  827. startIntensity: 0,
  828. camera: {
  829. position: {
  830. x: 1.6,
  831. y: 2.7,
  832. z: -5
  833. },
  834. physicalLensShift: {
  835. x: 0.25,
  836. y: 0
  837. },
  838. rotation: {
  839. x: 0,
  840. y: 0,
  841. z: 0
  842. }
  843. },
  844. model: {
  845. rotation: {
  846. x: 0,
  847. y: -180,
  848. z: 0
  849. },
  850. limitScale: {
  851. isLimit: true,
  852. min: 0.2,
  853. max: 1.5
  854. },
  855. limitX: {
  856. isLimit: true,
  857. min: 0,
  858. max: 5
  859. },
  860. limitY: {
  861. isLimit: true,
  862. min: -3,
  863. max: 9
  864. }
  865. }
  866. },
  867. {
  868. name: '碑文2',
  869. intensityAnimationTime: 0,
  870. startIntensity: 0,
  871. camera: {
  872. position: {
  873. x: 0,
  874. y: 0,
  875. z: -12
  876. },
  877. physicalLensShift: {
  878. x: 0.2,
  879. y: 0
  880. },
  881. rotation: {
  882. x: 0,
  883. y: 0,
  884. z: 0
  885. }
  886. },
  887. model: {
  888. rotation: {
  889. x: 0,
  890. y: 0,
  891. z: 0
  892. },
  893. limitScale: {
  894. isLimit: true,
  895. min: 0.2,
  896. max: 1.5
  897. },
  898. limitX: {
  899. isLimit: true,
  900. min: -5,
  901. max: 5
  902. },
  903. limitY: {
  904. isLimit: true,
  905. min: -8,
  906. max: 8
  907. }
  908. }
  909. },
  910. {
  911. name: '碑文3',
  912. intensityAnimationTime: 0,
  913. startIntensity: 0,
  914. camera: {
  915. position: {
  916. x: 0,
  917. y: 0,
  918. z: -12
  919. },
  920. physicalLensShift: {
  921. x: 0.2,
  922. y: 0
  923. },
  924. rotation: {
  925. x: 0,
  926. y: 0,
  927. z: 0
  928. }
  929. },
  930. model: {
  931. rotation: {
  932. x: 0,
  933. y: 0,
  934. z: 0
  935. },
  936. physicalLensShift: {
  937. x: 0.2,
  938. y: 0
  939. },
  940. limitScale: {
  941. isLimit: true,
  942. min: 0.2,
  943. max: 1.5
  944. },
  945. limitX: {
  946. isLimit: true,
  947. min: -10,
  948. max: 5
  949. },
  950. limitY: {
  951. isLimit: true,
  952. min: -8,
  953. max: 8
  954. }
  955. }
  956. }
  957. ]
  958. }),
  959. 'json'
  960. )
  961. }
  962. })
  963. }
  964. }, [])
  965. return (
  966. <>
  967. {/* 关于路由 */}
  968. <Router history={history}>
  969. <React.Suspense fallback={<SpinLoding />}>
  970. <Switch>
  971. <Route path='/' component={A1home} exact />
  972. <Route path='/base' component={A1_1base} exact />
  973. <Route path='/yblm' component={A2yblm} exact />
  974. <Route path='/beie' component={A3beie} exact />
  975. <Route path='/quanwen' component={A4quanwen} exact />
  976. <Route path='/wenwu' component={A5wenwu} exact />
  977. <Route path='/ybwx' component={A6ybwx} exact />
  978. <Route path='/wjwj' component={A7Wjwj} exact />
  979. <Route path='/zxys' component={A6_1_zxys} exact />
  980. <Route path='/sinicize' component={A6_2_zxzgh} exact />
  981. <Route path='/byzh' component={A8byzh} exact />
  982. <Route path='/knowlege' component={A9knowlege} exact />
  983. <Route path='/text' component={text} exact />
  984. <Route path='*' component={NotFound} />
  985. </Switch>
  986. </React.Suspense>
  987. </Router>
  988. {unityDel ? null : (
  989. <iframe style={{ display: 'none' }} id='modalIframe' title='modal' src=''></iframe>
  990. )}
  991. {/* 发送请求的加载组件 */}
  992. <AsyncSpinLoding />
  993. {/* 所有图片点击预览查看大图 */}
  994. {lookBigImg.show ? (
  995. <Image
  996. preview={{
  997. closeIcon: <img src={require('@/assets/img/closeWithTxt.png')} draggable='false' alt='' />,
  998. imageRender: (originalNode) => (
  999. <div className='previewImage'>
  1000. <TouchContainer className='Ori'>{originalNode}</TouchContainer>
  1001. <div className="ImgFromTxt">{lookBigImg.fromTxt}</div>
  1002. </div>
  1003. ),
  1004. visible: lookBigImg.show,
  1005. src: lookBigImg.url,
  1006. onVisibleChange: value => {
  1007. // 清除仓库信息
  1008. store.dispatch({
  1009. type: 'layout/lookBigImg',
  1010. payload: { url: '', show: false, fromTxt: '' }
  1011. })
  1012. }
  1013. }}
  1014. />
  1015. ) : null}
  1016. <MessageCom />
  1017. </>
  1018. )
  1019. }