Home.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div
  3. class="parent-body"
  4. @click="musicPlay"
  5. @touchstart="musicPlay"
  6. >
  7. <!-- 热点弹出框 -->
  8. <popup />
  9. <!-- 加载初始页面——也并没有什么卵用 -->
  10. <div id="gui-thumb" />
  11. <!-- 场景canvs主容器 -->
  12. <div id="player" />
  13. <!-- <MiniMapDecorator
  14. v-show="!isShowPano"
  15. class="mini-map-decorator"
  16. /> -->
  17. <!-- 底部菜单 -->
  18. <div
  19. v-show="!isShowPano"
  20. id="gui-parent"
  21. >
  22. <!-- 进度条加载 -->
  23. <gui-loading />
  24. <div id="hot" />
  25. <div
  26. id="gui"
  27. style="display: none"
  28. >
  29. <!-- 退出VR模式按钮 -->
  30. <div id="vrOff">
  31. <img
  32. id="vrOffImg"
  33. src="@/assets/images/vrOffImg.png"
  34. alt=""
  35. >
  36. </div>
  37. <!-- 热点列表 -->
  38. <hotspot-list />
  39. <!-- 通用样式的标题,代码里必须有,但其实没有显示 -->
  40. <v-title />
  41. <!-- 针对本项目需求的标题 -->
  42. <!-- 底部菜单 -->
  43. <v-menu class="v-menu" />
  44. <!-- 导览 -->
  45. <v-guide class="v-guide" />
  46. <!-- logo -->
  47. <div
  48. id="myCompany"
  49. style="
  50. width: 100%;
  51. position: absolute;
  52. bottom: 0px;
  53. text-align: center;
  54. font-size: 14px;
  55. font-family: '微软雅黑';
  56. font-weight: 580;
  57. color: rgba(255, 255, 255, 0.8);
  58. "
  59. >
  60. <!-- 四维时代提供技术支持 -->
  61. </div>
  62. </div>
  63. <!-- vr -->
  64. <web-vr />
  65. <!-- loading -->
  66. <!-- <div id="gui-spinner">
  67. <div class="gui-spinner-icon"></div>
  68. </div> -->
  69. <!-- guimsg -->
  70. <guimsg />
  71. <!-- 错误提示 -->
  72. <v-error />
  73. <vr-con />
  74. <v-other />
  75. </div>
  76. <transition name="fade-out">
  77. <div
  78. v-if="isShowPano"
  79. class="pano-layer"
  80. >
  81. <!-- 全景图 -->
  82. <iframe
  83. class="pano"
  84. src="https://zzbbh.4dage.com/SWKK/show.html?id=WK1628651656780496896&vr=fd720_7cJ6ECymB"
  85. frameborder="0"
  86. />
  87. <button
  88. class="begin"
  89. @click="onClickBegin"
  90. >
  91. <img
  92. class=""
  93. src="@/assets/images/begin-explore.png"
  94. alt=""
  95. draggable="false"
  96. >
  97. </button>
  98. </div>
  99. </transition>
  100. </div>
  101. </template>
  102. <script>
  103. import popup from "@/views/popup"
  104. import guiLoading from "@/views/gui/loading"
  105. import hotspotList from "@/views/gui/hotspotlist"
  106. import vTitle from "@/views/gui/title"
  107. import vMenu from "@/views/gui/menu"
  108. import vGuide from "@/views/gui/guide"
  109. import webVr from "@/views/gui/webvr"
  110. import guimsg from "@/views/gui/guimsg"
  111. import vError from "@/views/gui/error"
  112. import vrCon from "@/views/gui/vrcon"
  113. import vOther from "@/views/gui/other"
  114. // import MiniMapDecorator from "@/views/gui/MiniMapDecorator.vue"
  115. export default {
  116. name: "Home",
  117. components: {
  118. popup,
  119. guiLoading,
  120. hotspotList,
  121. vTitle,
  122. vMenu,
  123. vGuide,
  124. webVr,
  125. guimsg,
  126. vError,
  127. vrCon,
  128. vOther,
  129. // MiniMapDecorator,
  130. },
  131. data() {
  132. return {
  133. hotspots: "",
  134. // 控制背景音乐
  135. isMusicInitiallyPlayed: false,
  136. isShowPano: false,
  137. }
  138. },
  139. mounted() {
  140. },
  141. created() {
  142. // 移动端和pc端的切换
  143. if (
  144. window.navigator.userAgent.match(
  145. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  146. )
  147. ) {
  148. // 移动端
  149. if (window.location.href.includes("web")) {
  150. window.location.href = window.location.href.replace("web", "webM")
  151. setTimeout(() => {
  152. location.reload(true)
  153. }, 1000)
  154. }
  155. }
  156. const locationQuerySection = new URLSearchParams(location.href.split('?')[1])
  157. if (locationQuerySection.get('show-cover')) {
  158. this.isShowPano = true
  159. }
  160. },
  161. methods: {
  162. // 控制背景音乐播放
  163. musicPlay() {
  164. if (!this.isMusicInitiallyPlayed) window.manage.switchBgmState(true)
  165. this.isMusicInitiallyPlayed = true
  166. },
  167. onClickBegin() {
  168. this.isShowPano = false
  169. const locationQuerySection = new URLSearchParams(location.href.split('?')[1])
  170. locationQuerySection.delete('show-cover')
  171. const newLocation = location.href.split('?')[0] + '?' + locationQuerySection.toString()
  172. location.assign(newLocation)
  173. }
  174. },
  175. }
  176. </script>
  177. <style lang="less" scoped>
  178. .mini-map-decorator {
  179. }
  180. .parent-body {
  181. position: relative;
  182. width: 100%;
  183. height: 100%;
  184. > #gui-parent {
  185. > #gui {
  186. }
  187. }
  188. }
  189. /deep/#drawer {
  190. transition: all 0.3s;
  191. }
  192. // .mobile[view-mode='floor-plain'], .mobile[view-mode='doll-house'], .mobile[view-mode='transitioning'] {
  193. // .mini-map-decorator {
  194. // display: none;
  195. // }
  196. // }
  197. .pano-layer {
  198. position: absolute;
  199. left: 0;
  200. top: 0;
  201. width: 100%;
  202. height: 100%;
  203. z-index: 9999;
  204. iframe.pano {
  205. width: 100%;
  206. height: 100%;
  207. }
  208. button.begin {
  209. position: absolute;
  210. bottom: 85px;
  211. left:50%;
  212. transform: translateX(-50%);
  213. > img {
  214. width: 141px;
  215. }
  216. }
  217. }
  218. .hotspot-detail-open {
  219. .v-menu {
  220. display: none;
  221. }
  222. .v-guide {
  223. display: none;
  224. }
  225. }
  226. </style>