video.vue 5.3 KB

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