one.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="one">
  3. <div class="comTit">{{ tit }}</div>
  4. <div class="comMani">
  5. <div class="info sroolStop" v-html="data.content"></div>
  6. <div class="conShow">
  7. <!-- 数据加载中 -->
  8. <div class="conShowLoad" v-show="conShowLoad">
  9. <img src="../assets/img/loading.gif" alt="">
  10. </div>
  11. <!--基础存放容器-->
  12. <div class="swiper-container">
  13. <!-- 需要进行轮播的部分 -->
  14. <div class="swiper-wrapper">
  15. <!-- 每个节点 -->
  16. <div
  17. class="swiper-slide"
  18. v-for="item in data.images"
  19. :key="item.id"
  20. >
  21. <img :src="baseURL + item.filePath" alt=""/>
  22. </div>
  23. <div
  24. class="swiper-slide swiperVideo"
  25. v-for="item in data.videos"
  26. :key="item.id"
  27. >
  28. <div class="videoName">{{item.name}}</div>
  29. <video controls :src="baseURL + item.filePath"></video>
  30. </div>
  31. </div>
  32. <!-- 如果需要使用分页器 -->
  33. <!-- <div class="swiper-pagination swiper-pagination-white"></div> -->
  34. <!-- 如果需要使用前进后退按钮 -->
  35. <!-- <div class="swiper-button-prev swiper-button-white"></div>
  36. <div class="swiper-button-next swiper-button-white"></div> -->
  37. </div>
  38. </div>
  39. </div>
  40. <div class="comBs" @click="$emit('pageNext')"></div>
  41. </div>
  42. </template>
  43. <script>
  44. import axios from "@/utils/request";
  45. import "swiper/dist/js/swiper";
  46. import "swiper/dist/css/swiper.css";
  47. import Swiper from "swiper";
  48. export default {
  49. name: "one",
  50. props: {
  51. tit: {
  52. type: String,
  53. },
  54. data: {
  55. type: Object,
  56. default: () => {},
  57. },
  58. },
  59. components: {},
  60. data() {
  61. //这里存放数据
  62. return {
  63. conShowLoad:true,
  64. baseURL: "",
  65. };
  66. },
  67. //监听属性 类似于data概念
  68. computed: {},
  69. //监控data中的数据变化
  70. watch: {},
  71. //方法集合
  72. methods: {},
  73. //生命周期 - 创建完成(可以访问当前this实例)
  74. created() {
  75. // 获取服务器前缀地址
  76. this.baseURL = axios.defaults.baseURL;
  77. },
  78. //生命周期 - 挂载完成(可以访问DOM元素)
  79. mounted() {
  80. this.$nextTick(() => {
  81. setTimeout(() => {
  82. new Swiper(".one .swiper-container", {
  83. slidesPerView: 3.5,
  84. spaceBetween: 20,
  85. // // 如果需要分页器
  86. // pagination: {
  87. // el: ".swiper-pagination",
  88. // clickable: true, // 分页器可以点击
  89. // },
  90. // // 如果需要前进后退按钮
  91. // navigation: {
  92. // nextEl: ".swiper-button-next",
  93. // prevEl: ".swiper-button-prev",
  94. // },
  95. });
  96. this.conShowLoad=false
  97. }, 1000);
  98. });
  99. },
  100. beforeCreate() {}, //生命周期 - 创建之前
  101. beforeMount() {}, //生命周期 - 挂载之前
  102. beforeUpdate() {}, //生命周期 - 更新之前
  103. updated() {}, //生命周期 - 更新之后
  104. beforeDestroy() {}, //生命周期 - 销毁之前
  105. destroyed() {}, //生命周期 - 销毁完成
  106. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  107. };
  108. </script>
  109. <style lang='less' scoped>
  110. @import "../../node_modules/swiper/dist/css/swiper.css";
  111. .swiper-container {
  112. width: 100%;
  113. height: 100%;
  114. }
  115. .swiper-slide img {
  116. cursor: pointer;
  117. width: 100%;
  118. height: 100%;
  119. object-fit: cover;
  120. }
  121. .swiper-slide video {
  122. cursor: pointer;
  123. width: 100%;
  124. height: 100%;
  125. }
  126. .info::-webkit-scrollbar {
  127. /*滚动条整体样式*/
  128. width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
  129. height: 1px;
  130. }
  131. .info::-webkit-scrollbar-thumb {
  132. /*滚动条里面小方块*/
  133. border-radius: 10px;
  134. -webkit-box-shadow: inset 0 0 5px transparent;
  135. background: #8a7351;
  136. }
  137. .info::-webkit-scrollbar-track {
  138. /*滚动条里面轨道*/
  139. -webkit-box-shadow: inset 0 0 5px transparent;
  140. border-radius: 10px;
  141. background: transparent;
  142. }
  143. .one {
  144. position: relative;
  145. width: 100%;
  146. height: 100%;
  147. padding-top: 50px;
  148. .comMani {
  149. width: 100%;
  150. height: calc(100% - 65px);
  151. .info {
  152. color: #8a7351;
  153. font-size: 16px;
  154. line-height: 28px;
  155. width: 100%;
  156. height: 360px;
  157. padding-right: 30px;
  158. overflow-y: auto;
  159. margin-bottom: 30px;
  160. }
  161. .conShow {
  162. position: relative;
  163. height: 240px;
  164. flex: 1;
  165. .conShowLoad{
  166. z-index: 999;
  167. position: absolute;
  168. top: 0;
  169. left: 0;
  170. width: 100%;
  171. height: 100%;
  172. display: flex;
  173. background-color: #fcfefc;
  174. justify-content: center;
  175. align-items: center;
  176. }
  177. .swiperVideo {
  178. position: relative;
  179. width: 100%;
  180. height: 100%;
  181. background-color: rgba(0,0,0,.6);
  182. .videoName{
  183. position: absolute;
  184. top: 1px;
  185. left: 5px;
  186. color: #fff;
  187. font-size: 14px;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. </style>