image.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div v-if="!isMobile" class="images" :style="{backgroundImage:`url(${require('@/assets/images/project/hotspot_bg.jpg')})`}">
  3. <div class="title">{{hotspot.title}}</div>
  4. <div class="img-con">
  5. <span @click="active-=1" :class="{noshow:active<=0}">上一张</span>
  6. <img v-viewer :src="hotspot.images[active]" alt="">
  7. <span @click="active+=1" :class="{noshow:active>=hotspot.images.length - 1}">下一张</span>
  8. <ul class="pagna">
  9. <li v-for="(item,i) in hotspot.images" :class="{active:i==active}" :key="i"></li>
  10. </ul>
  11. </div>
  12. <div class="desc" v-html="hotspot.content">
  13. </div>
  14. </div>
  15. <div v-else class="mbimages" :style="{backgroundImage:`url(${require('@/assets/images/project/mb_hostpot.jpg')})`}">
  16. <div class="title">{{hotspot.title}}</div>
  17. <swiper class="swiper-wrapper swiper-wrapper-n" :options="swiperOption">
  18. <swiper-slide class="swiper-slide" v-for="(item,index) in hotspot.images" :key="index">
  19. <div class="sl-item">
  20. <img v-viewer :src="item">
  21. </div>
  22. </swiper-slide>
  23. </swiper>
  24. <ul class="pagna">
  25. <li v-for="(item,i) in hotspot.images" :class="{active: i == mbactive}" :key="i"></li>
  26. </ul>
  27. <div v-if="hotspot.content" class="desc">
  28. <p>简介:</p>
  29. <div v-html="hotspot.content"></div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import { Swiper, SwiperSlide } from "vue-awesome-swiper";
  35. import 'swiper/swiper-bundle.css'
  36. export default {
  37. components: {
  38. Swiper,
  39. SwiperSlide,
  40. },
  41. props:['hotspot'],
  42. data(){
  43. return {
  44. active:0,
  45. mbactive:0
  46. }
  47. },
  48. computed:{
  49. swiperOption() {
  50. let that = this
  51. return {
  52. slidesPerView: 'auto',
  53. autoplay: false,
  54. centeredSlides: true,
  55. watchSlidesProgress: true,
  56. loop: false,
  57. on:{
  58. slideChangeTransitionEnd:function () {
  59. that.mbactive = this.realIndex
  60. console.log(that.mbactive);
  61. }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="less" scoped>
  69. .noshow{
  70. opacity: 0!important;;
  71. pointer-events: none!important;;
  72. }
  73. .images{
  74. width: 100%;
  75. height: 100%;
  76. background-repeat: no-repeat;
  77. text-align: center;
  78. .title{
  79. padding: 0 80px;
  80. display: inline-block;
  81. color: #DBA761;
  82. font-weight: bold;
  83. font-size: 36px;
  84. height: 70px;
  85. line-height: 70px;
  86. background: #BC1515;
  87. border-radius: 60px;
  88. margin: 45px auto;
  89. }
  90. .img-con{
  91. display: flex;
  92. justify-content: space-around;
  93. align-items: center;
  94. position: relative;
  95. padding-bottom: 40px;
  96. >span{
  97. display: inline-block;
  98. padding: 0 30px;
  99. box-sizing: content-box;
  100. font-size: 20px;
  101. height: 50px;
  102. line-height: 50px;
  103. background: rgba(188, 21, 21, 0.9);
  104. border: 2px solid #DBA761;
  105. border-radius: 37px;
  106. cursor: pointer;
  107. &:hover,&.active{
  108. color: #DBA761;
  109. }
  110. }
  111. >img{
  112. max-width: 1000px;
  113. border: 10px solid #BC1515;
  114. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  115. max-height: 600px;
  116. }
  117. .pagna{
  118. position: absolute;
  119. bottom: 0;
  120. text-align: center;
  121. z-index: 999;
  122. >li{
  123. width: 60px;
  124. height: 6px;
  125. background: #BC1515;
  126. display: inline-block;
  127. margin: 0 4px;
  128. &.active{
  129. background: #DBA761;
  130. }
  131. }
  132. }
  133. }
  134. .desc{
  135. max-width: 1000px;
  136. margin: 20px auto 0;
  137. color: #DBA761;
  138. text-align: left;
  139. line-height: 2;
  140. max-height: 200px;
  141. overflow-y: auto;
  142. }
  143. }
  144. @position:62px;
  145. .mbimages{
  146. width: 100%;
  147. height: 100%;
  148. background-repeat: no-repeat;
  149. background-size: 100% calc(100% + @position);
  150. background-position: 0 -@position;
  151. text-align: center;
  152. .title{
  153. width: 90%;
  154. padding: 10px;
  155. display: inline-block;
  156. color: #DBA761;
  157. font-weight: bold;
  158. font-size: 18px;
  159. background: #BC1515;
  160. border-radius: 60px;
  161. margin: 20px auto;
  162. }
  163. .swiper-wrapper {
  164. height: 250px;
  165. padding: 0;
  166. .swiper-slide {
  167. width: 85%;
  168. transform-style: preserve-3d;
  169. position: relative;
  170. height: 100%;
  171. margin: 0 10px;
  172. .sl-item{
  173. position: absolute;
  174. top: 0;
  175. left: 50%;
  176. height: 100%;
  177. transform: translateX(-50%);
  178. width: 100%;
  179. overflow: hidden;
  180. border: 4px solid #BC1515;
  181. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  182. background-color: #757477;
  183. >img{
  184. height: 100%;
  185. transform: translateX(-50%);
  186. position: absolute;
  187. left: 50%;
  188. }
  189. }
  190. }
  191. }
  192. .pagna{
  193. text-align: center;
  194. z-index: 999;
  195. >li{
  196. width: 40px;
  197. height: 4px;
  198. background: #BC1515;
  199. display: inline-block;
  200. margin: 0 4px;
  201. &.active{
  202. background: #DBA761;
  203. }
  204. }
  205. }
  206. .desc{
  207. color: #DBA761;
  208. text-align: left;
  209. width: 85%;
  210. margin: 20px auto 0;
  211. p{
  212. font-size: 16px;
  213. font-weight: bold;
  214. }
  215. div{
  216. font-size: 14px;
  217. margin-top: 10px;
  218. line-height: 1.5;
  219. max-height: 50vh;
  220. overflow-y: auto;
  221. }
  222. }
  223. }
  224. </style>