video.vue 3.4 KB

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