iframe.vue 4.3 KB

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