App.tsx 30 KB

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