model.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="hotspot" :class="{ isfullcon: isfull }" v-if="!isMobile">
  3. <img class="aa" v-if="hotspot.model.length > 1" :src="require('@/assets/images/proj2022/pc/left_1.png')" alt=""
  4. @click="handlePage('prev')" />
  5. <div class="vhotspotcon">
  6. <div class="vtitle" v-html="hotspot.title"></div>
  7. <div class="hotspotcon">
  8. <div class="img-con">
  9. <div class="imgmain">
  10. <iframe :key="active" allowfullscreen frameborder="0" :src="hotspot.model[active]"></iframe>
  11. <img class="screen" @click="isfull = !isfull"
  12. :src="require(`@/assets/images/proj2022/${isfull ? 'fullscreen_exit' : 'fullscreen'}.png`)" alt="" />
  13. </div>
  14. </div>
  15. <div class="pagna" v-if="hotspot.model.length > 1">
  16. <span>{{ active + 1 }}</span>
  17. /
  18. <span>{{ hotspot.model.length }}</span>
  19. </div>
  20. <div class="desc" v-html="handleContent(hotspot.contents[active])"></div>
  21. </div>
  22. </div>
  23. <img class="aa" v-if="hotspot.model.length > 1" :src="require('@/assets/images/proj2022/pc/right_1.png')" alt=""
  24. @click="handlePage('next')" />
  25. </div>
  26. <div v-else class="mbhotspot">
  27. <div class="mbhcon">
  28. <div class="img-con">
  29. <img class="aa" v-if="hotspot.model.length > 1" :src="require('@/assets/images/project/icon/hotspot_l.png')"
  30. alt="" @click="handlePage('prev')" />
  31. <div class="imgmain" :class="{ bigImg: !hotspot.content }">
  32. <iframe :key="active" allowfullscreen frameborder="0" :src="hotspot.model[active]"></iframe>
  33. </div>
  34. <img class="aa" v-if="hotspot.model.length > 1" :src="require('@/assets/images/project/icon/hotspot_r.png')"
  35. alt="" @click="handlePage('next')" />
  36. </div>
  37. <div class="desc" v-if="hotspot.title || hotspot.contents[active]">
  38. <div class="title" v-html="hotspot.title"></div>
  39. <div v-html="handleContent(hotspot.contents[active], 14)"></div>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. props: ["hotspot", "type"],
  47. data() {
  48. return {
  49. active: 0,
  50. isfull: false
  51. };
  52. },
  53. methods: {
  54. handlePage(type) {
  55. if (type === "next") {
  56. if (this.active >= this.hotspot.model.length - 1) {
  57. this.active = 0;
  58. return;
  59. }
  60. this.active += 1;
  61. } else {
  62. if (this.active == 0) {
  63. this.active = this.hotspot.model.length - 1;
  64. return;
  65. }
  66. this.active -= 1;
  67. }
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="less" scoped>
  73. .noshow {
  74. opacity: 0 !important;
  75. pointer-events: none !important;
  76. }
  77. @w: 82%;
  78. @fixw: 8px;
  79. .hotspot {
  80. .vhotspotcon {
  81. .hotspotcon {
  82. .img-con {
  83. .imgmain {
  84. width: 80% !important;
  85. position: relative;
  86. >iframe {
  87. width: 100% !important;
  88. }
  89. .screen {
  90. position: absolute;
  91. bottom: 10px;
  92. right: 10px;
  93. z-index: 999;
  94. width: 30px !important;
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. .isfullcon {
  102. .vhotspotcon {
  103. .hotspotcon {
  104. height: 100% !important;
  105. position: fixed;
  106. top: 0;
  107. left: 0;
  108. right: 0;
  109. bottom: 0;
  110. .img-con {
  111. height: 100vh !important;
  112. .imgmain {
  113. width: 100% !important;
  114. position: relative;
  115. >iframe {
  116. width: 100% !important;
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. .mbhotspot {
  124. width: 100%;
  125. height: 100%;
  126. position: fixed;
  127. background: rgba(0, 0, 0, 0.5);
  128. left: 0;
  129. top: 0;
  130. backdrop-filter: blur(20px);
  131. z-index: 9999;
  132. .close {
  133. position: absolute;
  134. top: 26px;
  135. right: 16px;
  136. width: 20px;
  137. z-index: 1000;
  138. }
  139. .mbhcon {
  140. position: absolute;
  141. top: 50%;
  142. width: 100%;
  143. left: 50%;
  144. transform: translate(-50%, -50%);
  145. height: 100%;
  146. .img-con {
  147. display: flex;
  148. height: 100%;
  149. align-items: center;
  150. justify-content: space-between;
  151. position: relative;
  152. overflow: hidden;
  153. .imgmain {
  154. width: 100%;
  155. height: auto;
  156. min-height: 100%;
  157. display: flex;
  158. align-items: center;
  159. iframe {
  160. cursor: pointer;
  161. height: 60vh;
  162. width: 100%;
  163. }
  164. }
  165. @h: 100%;
  166. .bigImg {
  167. max-height: @h;
  168. margin: 0;
  169. >img {
  170. max-height: @h;
  171. }
  172. }
  173. @pos: 14px;
  174. .aa {
  175. position: absolute;
  176. width: 10px;
  177. height: auto;
  178. cursor: pointer;
  179. top: 50%;
  180. transform: translateY(-50%);
  181. left: @pos;
  182. &:last-of-type {
  183. right: @pos;
  184. left: unset;
  185. }
  186. }
  187. }
  188. .desc {
  189. position: absolute;
  190. z-index: 99999;
  191. bottom: 0;
  192. left: 50%;
  193. width: 100%;
  194. padding: 2% 5%;
  195. transform: translateX(-50%);
  196. margin: 0;
  197. min-height: 10vh;
  198. max-height: 34vh;
  199. background: rgba(0, 0, 0, 0.5);
  200. text-align: left;
  201. word-break: break-all;
  202. .title {
  203. width: 100%;
  204. display: inline-block;
  205. font-size: 16px;
  206. margin-bottom: 10px;
  207. }
  208. }
  209. }
  210. .fullcon {
  211. width: 100%;
  212. height: 100%;
  213. .img-con {
  214. height: 100%;
  215. .imgmain {
  216. width: 100%;
  217. height: auto;
  218. min-height: 100%;
  219. display: flex;
  220. align-items: center;
  221. }
  222. }
  223. }
  224. }
  225. </style>