three2.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div class="three2">
  3. <div class="comTit">
  4. <img src="../assets/img/comBs1.png" alt="" />
  5. <span>{{ tit }}</span>
  6. <img src="../assets/img/comBs2.png" alt="" />
  7. </div>
  8. <div class="swBox" :class="{ opcBase: conShowLoad }">
  9. <div class="swiper-container">
  10. <div class="swiper-wrapper">
  11. <div
  12. class="swiper-slide swiperVideo"
  13. v-for="item in data.videos"
  14. :key="item.id"
  15. @click="$emit('openLook', baseURL + item.filePath, 'video')"
  16. >
  17. <!-- 视频 -->
  18. <div class="videoName">
  19. <p>{{ item.name }}</p>
  20. <div class="videoPlay">
  21. <img src="../assets/img/videoPlay.png" alt="" />
  22. </div>
  23. </div>
  24. <video :src="baseURL + item.filePath"></video>
  25. </div>
  26. <!-- 图片 -->
  27. <div
  28. class="swiper-slide"
  29. @click="$emit('openLook', baseURL + item.filePath, 'img')"
  30. v-for="item in data.images"
  31. :key="item.id"
  32. >
  33. <img v-lazy="baseURL + item.filePath" alt="" />
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div
  39. class="main"
  40. v-html="data.content"
  41. :class="{ opcBase: conShowLoad }"
  42. ></div>
  43. <!-- 数据加载中 -->
  44. <div class="conShowLoad" v-show="conShowLoad">
  45. <img src="../assets/img/loading.gif" alt="" />
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import Swiper from "@/assets/swiper/swiper.js";
  51. import axios from "@/utils/request";
  52. export default {
  53. name: "three2",
  54. props: {
  55. tit: {
  56. type: String,
  57. },
  58. data: {
  59. type: Object,
  60. default: () => {},
  61. },
  62. },
  63. components: {},
  64. data() {
  65. //这里存放数据
  66. return {
  67. conShowLoad: true,
  68. baseURL: "",
  69. };
  70. },
  71. //监听属性 类似于data概念
  72. computed: {},
  73. //监控data中的数据变化
  74. watch: {},
  75. //方法集合
  76. methods: {},
  77. //生命周期 - 创建完成(可以访问当前this实例)
  78. created() {
  79. // 获取服务器前缀地址
  80. this.baseURL = axios.defaults.baseURL;
  81. },
  82. //生命周期 - 挂载完成(可以访问DOM元素)
  83. mounted() {
  84. this.$nextTick(() => {
  85. setTimeout(() => {
  86. new Swiper(".three2 .swiper-container", {
  87. slidesPerView: 1.2,
  88. spaceBetween: 10,
  89. });
  90. this.conShowLoad = false;
  91. }, 1000);
  92. });
  93. },
  94. beforeCreate() {}, //生命周期 - 创建之前
  95. beforeMount() {}, //生命周期 - 挂载之前
  96. beforeUpdate() {}, //生命周期 - 更新之前
  97. updated() {}, //生命周期 - 更新之后
  98. beforeDestroy() {}, //生命周期 - 销毁之前
  99. destroyed() {}, //生命周期 - 销毁完成
  100. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  101. };
  102. </script>
  103. <style lang='less' scoped>
  104. @import "../assets/swiper/swiper.css";
  105. .three2 {
  106. position: relative;
  107. width: 100%;
  108. height: 100%;
  109. .main {
  110. letter-spacing: 1px;
  111. color: #8a7351;
  112. line-height: 24px;
  113. font-size: 14px;
  114. padding: 0 12px 0 20px;
  115. width: 100%;
  116. height: calc(100% - 320px);
  117. overflow-y: auto;
  118. margin-top: 20px;
  119. }
  120. .swBox {
  121. width: 100%;
  122. height: 170px;
  123. .swiper-container {
  124. width: calc(100% - 40px);
  125. margin: 0 auto;
  126. height: 170px;
  127. }
  128. .swiper-slide {
  129. width: 100%;
  130. height: 100%;
  131. img {
  132. width: 100%;
  133. height: 100%;
  134. object-fit: cover;
  135. }
  136. video {
  137. z-index: -1;
  138. // width: 100%;
  139. height: 100%;
  140. }
  141. }
  142. .swiperVideo {
  143. overflow: hidden;
  144. position: relative;
  145. width: 100%;
  146. height: 100%;
  147. .videoName {
  148. position: absolute;
  149. width: 100%;
  150. height: 100%;
  151. background-color: rgba(0, 0, 0, 0.3);
  152. top: 0px;
  153. left: 0px;
  154. color: #fff;
  155. font-size: 14px;
  156. }
  157. }
  158. }
  159. }
  160. </style>