HomeMobile.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <div class="hotspot-home">
  3. <audio
  4. ref="bg-audio"
  5. class="bg-audio"
  6. :src="bgAudioUrl"
  7. loop
  8. autoplay
  9. />
  10. <button
  11. class="close"
  12. @click="onClickClose"
  13. >
  14. <img
  15. src="@/assets/images/close.png"
  16. alt="关闭"
  17. draggable="false"
  18. >
  19. </button>
  20. <h1
  21. :title="hotspotData.title"
  22. v-html="hotspotData.title"
  23. />
  24. <button
  25. class="download"
  26. @click="onClickDownload"
  27. >
  28. <img
  29. class=""
  30. src="@/assets/images/download.png"
  31. alt=""
  32. draggable="false"
  33. >
  34. <span>
  35. Download brochure
  36. </span>
  37. </button>
  38. <div class="content-wrapper">
  39. <div
  40. class="desc"
  41. v-html="descForShow"
  42. />
  43. <div
  44. class="swiper-wrapper-mine image-wrapper"
  45. >
  46. <div
  47. class="swiper-root"
  48. >
  49. <div
  50. v-viewer="{
  51. button: true,
  52. navbar: false,
  53. title: false,
  54. toolbar: false,
  55. tooltip: false,
  56. movable: true,
  57. zoomable: true,
  58. rotatable: true,
  59. scalable: true,
  60. transition: false,
  61. fullscreen: false,
  62. keyboard: true,
  63. loop: false,
  64. }"
  65. class="swiper-wrapper img-list-wrapper"
  66. >
  67. <img
  68. v-for="(item, index) in hotspotData.images"
  69. :key="index"
  70. v-lazy="item"
  71. class="swiper-slide"
  72. :class="{
  73. single: hotspotData.images.length === 1
  74. }"
  75. alt=""
  76. draggable="false"
  77. >
  78. </div>
  79. <!-- <div class="swiper-pagination" />
  80. <div class="swiper-button-prev" />
  81. <div class="swiper-button-next" /> -->
  82. </div>
  83. </div>
  84. <div
  85. class="swiper-wrapper-mine video-wrapper"
  86. >
  87. <div
  88. class="swiper-root"
  89. >
  90. <div
  91. class="swiper-wrapper video-list-wrapper"
  92. >
  93. <div
  94. v-for="(item, index) in hotspotData.video"
  95. :key="index"
  96. class="swiper-slide"
  97. :class="{
  98. single: hotspotData.images.length === 1
  99. }"
  100. @click="viewVideo(item)"
  101. >
  102. <video
  103. ref="video"
  104. :src="item.url"
  105. />
  106. <img
  107. class="icon"
  108. src="@/assets/images/play.png"
  109. alt=""
  110. draggable="false"
  111. >
  112. </div>
  113. </div>
  114. <!-- <div class="swiper-pagination" />
  115. <div class="swiper-button-prev" />
  116. <div class="swiper-button-next" /> -->
  117. </div>
  118. </div>
  119. </div>
  120. <!-- <menu>
  121. <button
  122. v-if="bgAudioUrl"
  123. @click="isBgAudioMuted = !isBgAudioMuted"
  124. >
  125. <img
  126. v-show="isBgAudioMuted"
  127. class="bg-audio-control"
  128. src="@/assets/images/bg-audio-mobile.png"
  129. alt=""
  130. draggable="false"
  131. >
  132. <img
  133. v-show="!isBgAudioMuted"
  134. class="bg-audio-control"
  135. src="@/assets/images/bg-audio-mobile-muted.png"
  136. alt=""
  137. draggable="false"
  138. >
  139. </button>
  140. </menu> -->
  141. <div
  142. v-if="isShowVideoForPlay"
  143. class="video-for-play-wrapper"
  144. >
  145. <button
  146. class="close"
  147. @click="isShowVideoForPlay = false"
  148. >
  149. <img
  150. src="@/assets/images/close.png"
  151. alt="关闭"
  152. draggable="false"
  153. >
  154. </button>
  155. <video
  156. ref="video-for-play"
  157. :src="videoSrcForPlay"
  158. controls
  159. controlslist="nodownload"
  160. disablePictureInPicture
  161. />
  162. </div>
  163. </div>
  164. </template>
  165. <script>
  166. import Swiper from 'swiper/swiper-bundle.esm.js'
  167. import 'swiper/swiper-bundle.css'
  168. import { deepProcess } from "@/utils/other.js"
  169. export default {
  170. data() {
  171. return {
  172. hotspotData: {}, // 热点数据
  173. isShowVideoForPlay: false,
  174. videoSrcForPlay: '',
  175. bgAudioUrl: "", //背景音频url
  176. isBgAudioMuted: false,
  177. }
  178. },
  179. computed: {
  180. descForShow() {
  181. return this.hotspotData.content
  182. },
  183. },
  184. watch: {
  185. isBgAudioMuted: {
  186. handler(vNew) {
  187. if (vNew) {
  188. this.$refs['bg-audio'].pause() // or toggle静音?
  189. } else {
  190. this.$refs['bg-audio'].play() // or toggle静音?
  191. }
  192. }
  193. }
  194. },
  195. async mounted() {
  196. await this.getData()
  197. this.$nextTick(() => {
  198. const that = this
  199. new Swiper('.swiper-wrapper-mine .swiper-root', {
  200. slidesPerView: 'auto',
  201. // pagination: {
  202. // el: '.swiper-pagination',
  203. // },
  204. // navigation: {
  205. // nextEl: '.swiper-button-next',
  206. // prevEl: '.swiper-button-prev',
  207. // },
  208. // on: {
  209. // // 自动播放
  210. // afterInit: function (e) {
  211. // if (that.isShowVideos) {
  212. // that.$nextTick(() => {
  213. // that.$refs.video[0].play()
  214. // })
  215. // }
  216. // if (that.isShowAudios) {
  217. // that.$nextTick(() => {
  218. // that.$refs.audio[0].play()
  219. // })
  220. // }
  221. // },
  222. // slideChange: function(e) {
  223. // that.currentSlideIdx = e.activeIndex
  224. // // 自动播放
  225. // if (that.isShowVideos) {
  226. // for (let index = 0; index < that.$refs.video.length; index++) {
  227. // if (index !== that.currentSlideIdx) {
  228. // that.$refs.video[index].pause()
  229. // } else {
  230. // that.$refs.video[index].play()
  231. // }
  232. // }
  233. // }
  234. // if (that.isShowAudios) {
  235. // for (let index = 0; index < that.$refs.audio.length; index++) {
  236. // if (index !== that.currentSlideIdx) {
  237. // that.$refs.audio[index].pause()
  238. // } else {
  239. // that.$refs.audio[index].play()
  240. // }
  241. // }
  242. // }
  243. // }
  244. // }
  245. })
  246. })
  247. },
  248. methods: {
  249. // changeSubStr(str) {
  250. // return str.replace('https://super.4dage.com/', process.env.VUE_APP_G_PREFIX)
  251. // },
  252. async getData() {
  253. let url = `${process.env.VUE_APP_G_PREFIX}/data/${this.$route.query.id}/hot/js/data.js?time=${Math.random()}`
  254. let result = (await this.$http.get(url)).data
  255. // deepProcess(result, this.changeSubStr) // 本地化部署时的处理
  256. this.hotspotData = result[this.$route.query.m]
  257. if (!this.hotspotData) {
  258. return alert("热点解析错误")
  259. }
  260. console.log('热点数据:', this.hotspotData)
  261. this.bgAudioUrl = this.hotspotData.backgroundMusic
  262. if (this.hotspotData.backgroundMusic) {
  263. this.isShowAudios = true
  264. this.hotspotData.audio = [{ url: this.hotspotData.backgroundMusic }]
  265. }
  266. },
  267. viewVideo(videoItem) {
  268. this.videoSrcForPlay = videoItem.url
  269. this.isShowVideoForPlay = true
  270. this.$nextTick(() => {
  271. this.$refs['video-for-play'].play()
  272. })
  273. },
  274. onClickClose() {
  275. window.parent.document.getElementById('closepop').click()
  276. },
  277. onClickDownload() {
  278. window.open(
  279. "https://www.heidelbergchina.com/app/index.php?i=136&c=official&a=article&id=303&type=0&utm_source=vr&utm_campaign=cx104"
  280. )
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="less" scoped>
  286. .hotspot-home {
  287. position: absolute;
  288. left: 50%;
  289. top: 50%;
  290. transform: translate(-50%, -50%);
  291. z-index: 0;
  292. border-top: 2.1vw solid #00A0E6;
  293. width: 81.5vw;
  294. height: 80vh;
  295. background: #fff;
  296. display: flex;
  297. flex-direction: column;
  298. align-items: flex-start;
  299. padding: 9vw 1vw 4vw 4vw;
  300. > .bg-audio {
  301. display: none;
  302. }
  303. > button.close {
  304. position: absolute;
  305. top: 4.8vw;
  306. right: 2.8vw;
  307. width: 6.2vw;
  308. height: 6.2vw;
  309. z-index: 1;
  310. > img {
  311. width: 100%;
  312. height: 100%;
  313. }
  314. }
  315. > h1 {
  316. font-size: 5vw;
  317. font-weight: bold;
  318. color: #1F3E7C;
  319. line-height: 1.5em;
  320. flex: 0 0 auto;
  321. }
  322. > button.download {
  323. margin-top: 3vw;
  324. height: 5.4vw;
  325. border: 1px solid #00A0E6;
  326. border-radius: 2.7vw;
  327. padding-left: 2.5vw;
  328. padding-right: 2.5vw;
  329. font-size: 2.8vw;
  330. color: #00A0E6;
  331. > img {
  332. vertical-align: middle;
  333. width: 2.9vw;
  334. height: 3.2vw;
  335. margin-right: 1vw;
  336. }
  337. > span {
  338. vertical-align: middle;
  339. }
  340. }
  341. > .content-wrapper {
  342. flex: 1 0 1px;
  343. overflow: auto;
  344. margin-top: 6.2vw;
  345. padding-right: 3vw;
  346. width: 100%;
  347. > .desc {
  348. font-family: Adobe Heiti Std;
  349. font-size: 3.6vw;
  350. color: #666666;
  351. line-height: 5.3vw;
  352. }
  353. .swiper-wrapper-mine {
  354. margin-top: 5vw;
  355. .swiper-root {
  356. overflow: hidden;
  357. height: 100%;
  358. width: 100%;
  359. .swiper-wrapper.img-list-wrapper {
  360. > .swiper-slide {
  361. object-fit: contain;
  362. border-radius: 4px;
  363. margin-right: 1.8vw;
  364. width: 30.2vw;
  365. height: 19.6vw;
  366. position: relative;
  367. }
  368. > .swiper-slide.single {
  369. width: 100%;
  370. height: initial;
  371. margin-right: initial;
  372. }
  373. }
  374. .swiper-wrapper.video-list-wrapper {
  375. > .swiper-slide {
  376. margin-right: 1.8vw;
  377. width: 30.2vw;
  378. height: 19.6vw;
  379. position: relative;
  380. > video {
  381. object-fit: contain;
  382. border-radius: 4px;
  383. width: 100%;
  384. height: 100%;
  385. }
  386. > img.icon {
  387. position: absolute;
  388. left: 50%;
  389. top: 50%;
  390. transform: translate(-50%, -50%);
  391. width: 6.2vw;
  392. height: 6.2vw;
  393. }
  394. }
  395. > .swiper-slide.single {
  396. width: 100%;
  397. height: initial;
  398. margin-right: initial;
  399. }
  400. }
  401. .swiper-pagination {
  402. }
  403. .swiper-button-prev {
  404. }
  405. .swiper-button-next {
  406. }
  407. }
  408. }
  409. }
  410. > .video-for-play-wrapper {
  411. position: absolute;
  412. left: 0;
  413. top: 0;
  414. width: 100%;
  415. height: 100%;
  416. background: rgba(0, 0, 0, 0.95);
  417. z-index: 2;
  418. > button.close {
  419. position: absolute;
  420. top: 4.8vw;
  421. right: 2.8vw;
  422. width: 6.2vw;
  423. height: 6.2vw;
  424. z-index: 1;
  425. > img {
  426. width: 100%;
  427. height: 100%;
  428. }
  429. }
  430. > video {
  431. position: absolute;
  432. left: 50%;
  433. top: 50%;
  434. transform: translate(-50%, -50%);
  435. width: 100%;
  436. }
  437. }
  438. }
  439. /deep/.swiper-pagination-bullet-active {
  440. background: #a10e0c;
  441. }
  442. </style>
  443. <style lang="less">
  444. h3 {
  445. font-size: 4.3vw;
  446. color: black;
  447. }
  448. </style>