Home.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="parent-body">
  3. <!-- 热点 -->
  4. <!-- <hot/> -->
  5. <!-- 热点弹出框 -->
  6. <popup />
  7. <!-- 加载初始页面 -->
  8. <div id="gui-thumb"></div>
  9. <!-- 场景canvs主容器 -->
  10. <div id="player"></div>
  11. <!-- 底部菜单 -->
  12. <div id="gui-parent">
  13. <!-- 进度条加载 -->
  14. <gui-loading />
  15. <div id="hot"></div>
  16. <!-- 三维 标签 -->
  17. <div class="widgets-doll-labels"></div>
  18. <div id="gui" v-show="!loading">
  19. <!-- 退出VR模式按钮 -->
  20. <div id="vrOff">
  21. <img id="vrOffImg" src="images/vrOffImg.png" alt="" />
  22. </div>
  23. <!-- 热点列表 -->
  24. <hotspot-list />
  25. <!-- 标题 -->
  26. <v-title />
  27. <!-- 底部菜单 -->
  28. <v-menu :hideTools="hideTools" @toHome="showWelcome = true" />
  29. <!-- 导览 -->
  30. <v-guide />
  31. <!-- logo -->
  32. <div
  33. id="myCompany"
  34. style="
  35. width: 100%;
  36. position: absolute;
  37. bottom: 0px;
  38. text-align: center;
  39. font-size: 14px;
  40. font-family: '微软雅黑';
  41. font-weight: 580;
  42. color: rgba(255, 255, 255, 0.8);
  43. "
  44. >
  45. <!-- 四维时代提供技术支持 -->
  46. </div>
  47. </div>
  48. <!-- vr -->
  49. <web-vr />
  50. <!-- loading -->
  51. <div id="gui-spinner">
  52. <div class="gui-spinner-icon"></div>
  53. </div>
  54. <!-- guimsg -->
  55. <guimsg />
  56. <!-- 错误提示 -->
  57. <v-error />
  58. <vr-con />
  59. <v-other />
  60. <welcome @close="hideWelcome" v-if="showWelcome" />
  61. <div class="loading" v-if="0">
  62. <span>加载中...</span>
  63. </div>
  64. </div>
  65. <!-- 左上方logo -->
  66. <!-- <div class="leftTopLogo" v-show="!isMobile">
  67. <img src="../assets/img/home/logo.png" alt="" />
  68. </div> -->
  69. </div>
  70. </template>
  71. <script>
  72. import popup from "@/views/popup";
  73. import guiLoading from "@/views/gui/loading";
  74. import hotspotList from "@/views/gui/hotspotlist";
  75. import vTitle from "@/views/gui/title";
  76. import vMenu from "@/views/gui/menu";
  77. import vGuide from "@/views/gui/guide";
  78. import webVr from "@/views/gui/webvr";
  79. import guimsg from "@/views/gui/guimsg";
  80. import vError from "@/views/gui/error";
  81. import vrCon from "@/views/gui/vrcon";
  82. import vOther from "@/views/gui/other";
  83. import welcome from "@/components/welcome";
  84. import { addVisitAPI } from "../utils/api";
  85. export default {
  86. name: "Home",
  87. components: {
  88. popup,
  89. guiLoading,
  90. hotspotList,
  91. vTitle,
  92. vMenu,
  93. vGuide,
  94. webVr,
  95. guimsg,
  96. vError,
  97. vrCon,
  98. vOther,
  99. welcome,
  100. },
  101. data() {
  102. return {
  103. showWelcome: false,
  104. hotspots: "",
  105. loading: true,
  106. /** 隐藏热点和右侧工具栏 */
  107. hideTools: false,
  108. };
  109. },
  110. methods: {
  111. hideWelcome() {
  112. this.showWelcome = false;
  113. window.manage.switchBgmState(true);
  114. },
  115. getHotSpotList() {
  116. $.ajax({
  117. url:
  118. g_Prefix +
  119. "data/" +
  120. window.number +
  121. "/hot/js/data.js" +
  122. "?" +
  123. Math.random(),
  124. type: "get",
  125. dataType: "json",
  126. contentType: "application/json",
  127. success: (result) => {
  128. this.hotspots = result;
  129. },
  130. });
  131. },
  132. },
  133. mounted() {
  134. this.$nextTick(() => {
  135. window.evt = document.createEvent("HTMLEvents");
  136. window.evt.initEvent("loadfinish", false, false);
  137. window.addEventListener("loadfinish", () => {
  138. console.error('loadfinish')
  139. this.loading = false;
  140. // document.title = "珠海高新区中共党史学习教育园地线上展厅";
  141. this.getHotSpotList();
  142. window.player.on("openTips", () => {
  143. this.$showTips();
  144. });
  145. window.player.on("openHotspot", (data) => {
  146. this.$showHotspot({
  147. hotspot: this.hotspots[data],
  148. });
  149. });
  150. });
  151. });
  152. },
  153. async created() {
  154. // 雷锋故居场景需求,会携带 hideCover=1
  155. this.hideTools = Boolean(Number(this.$route.query.hideCover));
  156. this.showWelcome = !this.hideTools;
  157. // 发送访问量
  158. try {
  159. await addVisitAPI();
  160. } catch (e) {
  161. console.log(e);
  162. }
  163. },
  164. };
  165. </script>
  166. <style lang="less" scoped>
  167. .parent-body {
  168. width: 100%;
  169. height: 100%;
  170. }
  171. .loading {
  172. position: fixed;
  173. left: 0;
  174. top: 0;
  175. width: 100%;
  176. height: 100%;
  177. z-index: 10000;
  178. background: #000;
  179. > span {
  180. position: absolute;
  181. top: 50%;
  182. left: 50%;
  183. transform: translate(-50%, -50%);
  184. color: #fff;
  185. font-size: 16px;
  186. display: inline-block;
  187. }
  188. }
  189. .leftTopLogo {
  190. pointer-events: none;
  191. position: fixed;
  192. z-index: 11000;
  193. top: 30px;
  194. left: 30px;
  195. }
  196. </style>