video.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="images">
  3. <div class="img-con">
  4. <span @click="active -= 1" :class="{ noshow: active <= 0 }">上一张</span>
  5. <video controls autoplay>
  6. <source :src="g_dealUrl(hotspot.video[active].url)" type="video/mp4" />
  7. </video>
  8. <span
  9. @click="active += 1"
  10. :class="{ noshow: active >= hotspot.video.length - 1 }"
  11. >下一张</span
  12. >
  13. <ul class="pagna" v-if="hotspot.video.length>1">
  14. <li
  15. v-for="(item, i) in hotspot.video"
  16. :class="{ active: i == active }"
  17. :key="i"
  18. ></li>
  19. </ul>
  20. </div>
  21. <div class="title">{{ hotspot.title }}</div>
  22. <div class="desc" v-if="hotspot.content" v-html="hotspot.content"></div>
  23. </div>
  24. </template>
  25. <script>
  26. import { directive } from "vue-awesome-swiper";
  27. // import style (<= Swiper 5.x)
  28. import "swiper/css/swiper.css";
  29. export default {
  30. directives: {
  31. swiper: directive,
  32. },
  33. props: ["hotspot"],
  34. data() {
  35. return {
  36. active: 0,
  37. mbactive: 0,
  38. };
  39. },
  40. computed: {
  41. swiperOption() {
  42. let that = this;
  43. return {
  44. slidesPerView: "auto",
  45. autoplay: false,
  46. centeredSlides: true,
  47. watchSlidesProgress: true,
  48. loop: false,
  49. pagination: {
  50. el: ".swiper-pagination",
  51. },
  52. on: {
  53. slideChangeTransitionEnd: function() {
  54. that.mbactive = this.realIndex;
  55. },
  56. },
  57. };
  58. },
  59. },
  60. };
  61. </script>
  62. <style lang="less" scoped>
  63. .noshow{
  64. opacity: 0!important;;
  65. pointer-events: none!important;;
  66. }
  67. .images{
  68. width: 1410px;
  69. height: 760px;
  70. text-align: center;
  71. margin: 0 auto;
  72. position: fixed;
  73. top: 50%;
  74. left: 50%;
  75. transform: translate(-50%,-50%);
  76. border-radius: 5px;
  77. text-align: left;
  78. .img-con{
  79. display: flex;
  80. justify-content: space-around;
  81. align-items: center;
  82. position: relative;
  83. padding-bottom: 40px;
  84. >span{
  85. @juli:60px;
  86. display: inline-block;
  87. padding: 0 30px;
  88. box-sizing: content-box;
  89. cursor: pointer;
  90. position: absolute;
  91. left: @juli;
  92. top: 50%;
  93. transform: translateY(-50%);
  94. >img{
  95. width: 20px;
  96. }
  97. &:last-of-type{
  98. left: unset;
  99. right: @juli;
  100. }
  101. }
  102. >video{
  103. max-width: 100%;
  104. max-height: 520px;
  105. cursor: pointer;
  106. margin-top: 50px;
  107. }
  108. .pagna{
  109. position: absolute;
  110. bottom: 0;
  111. text-align: center;
  112. z-index: 999;
  113. >li{
  114. width: 10px;
  115. border-radius: 50%;
  116. height: 10px;
  117. background: rgba(51, 143, 123, .24);
  118. display: inline-block;
  119. margin: 0 4px;
  120. &.active{
  121. background: #338F7B;
  122. }
  123. }
  124. }
  125. }
  126. .title {
  127. font-weight: bold;
  128. font-size: 30px;
  129. text-align: center;
  130. width: 100%;
  131. padding: 0 50px;
  132. margin-bottom: 10px;
  133. }
  134. .desc{
  135. margin: 0 auto;
  136. width: 70%;
  137. color: #fff;
  138. text-align: center;
  139. line-height: 1.8;
  140. max-height: 120px;
  141. overflow-y: auto;
  142. font-size: 16px;
  143. padding: 0;
  144. }
  145. }
  146. .close{
  147. position: absolute;
  148. top: 40px;
  149. right: 50px;
  150. width: 20px;
  151. height: 20px;
  152. cursor: pointer;
  153. z-index: 9999999;
  154. }
  155. </style>