Home.vue 4.3 KB

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