index.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { defineComponent, ref } from 'vue';
  2. import JsScript from '@/components/js-script';
  3. import Cover from '../cover';
  4. import Title from './components/title';
  5. import WebVr from './components/web-vr';
  6. import Other from './components/other';
  7. import Guide from './components/guide';
  8. import Vrcon from './components/vrcon';
  9. import Menu from './components/menu';
  10. import GuiLoading from './components/gui-loading';
  11. import Popup from './components/popup';
  12. import HotSpotList from './components/hot-spot-list';
  13. import './index.scss';
  14. export default defineComponent({
  15. name: 'home',
  16. components: {
  17. Title,
  18. WebVr,
  19. Other,
  20. Vrcon,
  21. GuiLoading,
  22. JsScript,
  23. Popup,
  24. },
  25. setup() {
  26. const manageJsLoaded = ref(false);
  27. const hotJsLoaded = ref(false);
  28. const coverVisible = ref(true);
  29. return {
  30. coverVisible,
  31. manageJsLoaded,
  32. hotJsLoaded,
  33. };
  34. },
  35. render() {
  36. return (
  37. <div class="home">
  38. {/* 封面 */}
  39. {this.coverVisible && (
  40. <Cover
  41. onClose={() => {
  42. this.coverVisible = false;
  43. }}
  44. />
  45. )}
  46. {/* 进度条加载 */}
  47. <GuiLoading />
  48. {/* 加载初始页面 */}
  49. <div id="gui-thumb" />
  50. {/* 热点弹出框 */}
  51. <Popup />
  52. {/* 场景canvs主容器 */}
  53. <div id="player" />
  54. {/* 底部菜单 */}
  55. <div id="gui-parent">
  56. {/* 热点气泡 */}
  57. <div id="hot" />
  58. <div id="gui" style="display: none;">
  59. {/* 标题 */}
  60. <Title />
  61. {/* 热点列表 */}
  62. <HotSpotList />
  63. {/* 底部菜单 */}
  64. <Menu onShowCover={() => (this.coverVisible = true)} />
  65. {/* 导览 */}
  66. <Guide />
  67. </div>
  68. <WebVr />
  69. <Vrcon />
  70. <Other />
  71. </div>
  72. {/* TODO: 没有控制权,耦合严重;放在此处为了防止元素未渲染导致报错 */}
  73. <JsScript src="./js/manage.js" onLoad={() => (this.manageJsLoaded = true)} />
  74. {this.manageJsLoaded && (
  75. <>
  76. <JsScript src="./js/Hot.js" onLoad={() => (this.hotJsLoaded = true)} />
  77. {this.hotJsLoaded && (
  78. <>
  79. <JsScript src="./js/main_2020_show.js" />
  80. {/* 延迟加载 */}
  81. <JsScript src="./js/lib/player-0.0.12.min.js" />
  82. <JsScript src="./js/lib/Tween.js" />
  83. <JsScript src="./js/SpecialScene.js" />
  84. <JsScript src="./js/loadCAD.js" />
  85. </>
  86. )}
  87. </>
  88. )}
  89. </div>
  90. );
  91. },
  92. });