Home.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <!-- @click="musicPlay" @touchstart="musicPlay" -->
  3. <div class="parent-body">
  4. <!-- 热点 -->
  5. <!-- <hot/> -->
  6. <!-- 热点弹出框 -->
  7. <popup />
  8. <!-- 加载初始页面 -->
  9. <div id="gui-thumb"></div>
  10. <!-- 场景canvs主容器 -->
  11. <div id="player"></div>
  12. <MiniMapDecorator class="mini-map-decorator"></MiniMapDecorator>
  13. <!-- 底部菜单 -->
  14. <div id="gui-parent" :class="{ guiParent: pageFlag }">
  15. <!-- 进度条加载 -->
  16. <gui-loading />
  17. <div id="hot"></div>
  18. <div id="gui" style="display: none">
  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. <h1 v-if="!isMobile">
  29. 安徽省纪录小康工程数据库云展馆
  30. </h1>
  31. <!-- 底部菜单 -->
  32. <v-menu @hndeMenu="hndeMenu" />
  33. <!-- 导览 -->
  34. <v-guide :pageFlag="pageFlag" />
  35. <!-- logo -->
  36. <div
  37. id="myCompany"
  38. style="
  39. width: 100%;
  40. position: absolute;
  41. bottom: 0px;
  42. text-align: center;
  43. font-size: 14px;
  44. font-family: '微软雅黑';
  45. font-weight: 580;
  46. color: rgba(255, 255, 255, 0.8);
  47. "
  48. >
  49. <!-- 四维时代提供技术支持 -->
  50. </div>
  51. </div>
  52. <!-- vr -->
  53. <web-vr />
  54. <!-- loading -->
  55. <!-- <div id="gui-spinner">
  56. <div class="gui-spinner-icon"></div>
  57. </div> -->
  58. <!-- guimsg -->
  59. <guimsg />
  60. <!-- 错误提示 -->
  61. <v-error />
  62. <vr-con />
  63. <v-other />
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import popup from "@/views/popup";
  69. import guiLoading from "@/views/gui/loading";
  70. import hotspotList from "@/views/gui/hotspotlist";
  71. import vTitle from "@/views/gui/title";
  72. import vMenu from "@/views/gui/menu";
  73. import vGuide from "@/views/gui/guide";
  74. import webVr from "@/views/gui/webvr";
  75. import guimsg from "@/views/gui/guimsg";
  76. import vError from "@/views/gui/error";
  77. import vrCon from "@/views/gui/vrcon";
  78. import vOther from "@/views/gui/other";
  79. import MiniMapDecorator from "@/components/MiniMapDecorator.vue";
  80. export default {
  81. name: "Home",
  82. components: {
  83. popup,
  84. guiLoading,
  85. hotspotList,
  86. vTitle,
  87. vMenu,
  88. vGuide,
  89. webVr,
  90. guimsg,
  91. vError,
  92. vrCon,
  93. vOther,
  94. MiniMapDecorator,
  95. },
  96. data() {
  97. return {
  98. hotspots: "",
  99. loading: true,
  100. // 控制页面宽度(通过菜单的展开和隐藏)
  101. pageFlag: false,
  102. // 控制背景音乐
  103. musicFlag: true,
  104. };
  105. },
  106. methods: {
  107. musicPlay() {
  108. if (this.musicFlag) window.manage.switchBgmState(true);
  109. this.musicFlag = false;
  110. },
  111. // 控制背景音乐播放👆
  112. hndeMenu(val) {
  113. this.pageFlag = val;
  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. this.loading = false;
  139. this.getHotSpotList();
  140. window.player.on("openTips", () => {
  141. this.$showTips();
  142. });
  143. window.player.on("openHotspot", (data) => {
  144. console.log('open hotspot');
  145. this.$showHotspot({
  146. hotspot: this.hotspots[data],
  147. });
  148. });
  149. });
  150. });
  151. },
  152. created() {
  153. // 移动端和pc端的切换
  154. if (
  155. window.navigator.userAgent.match(
  156. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  157. )
  158. ) {
  159. // 移动端
  160. if (window.location.href.includes("web")) {
  161. window.location.href = window.location.href.replace("web", "webM");
  162. setTimeout(() => {
  163. location.reload(true);
  164. }, 1000);
  165. }
  166. }
  167. },
  168. };
  169. </script>
  170. <style lang="less" scoped>
  171. .mini-map-decorator {
  172. position: fixed;
  173. top: 28px;
  174. right: 20px;
  175. width: 237px !important;
  176. height: 149px !important;
  177. backdrop-filter: blur(10px);
  178. z-index: 998;
  179. }
  180. .parent-body {
  181. position: relative;
  182. width: 100%;
  183. height: 100%;
  184. > #gui-parent {
  185. > #gui {
  186. > h1 {
  187. position: absolute;
  188. z-index: 1;
  189. top: 23px;
  190. left: 50%;
  191. transform: translateX(-50%);
  192. background: rgba(0,0,0,0.45);
  193. border-radius: 33px;
  194. font-size: 16px;
  195. color: #FFFFFF;
  196. padding: 9px 29px;
  197. }
  198. }
  199. }
  200. > .guiParent {
  201. width: 100% !important;
  202. }
  203. }
  204. /deep/#drawer {
  205. transition: all 0.3s;
  206. }
  207. </style>