| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div class="three2">
- <div class="comTit">
- <img src="../assets/img/comBs1.png" alt="" />
- <span>{{ tit }}</span>
- <img src="../assets/img/comBs2.png" alt="" />
- </div>
- <div class="swBox" :class="{ opcBase: conShowLoad }">
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div
- class="swiper-slide swiperVideo"
- v-for="item in data.videos"
- :key="item.id"
- @click="$emit('openLook', baseURL + item.filePath, 'video')"
- >
- <!-- 视频 -->
- <div class="videoName">
- <p>{{ item.name }}</p>
- <div class="videoPlay">
- <img src="../assets/img/videoPlay.png" alt="" />
- </div>
- </div>
- <video :src="baseURL + item.filePath"></video>
- </div>
- <!-- 图片 -->
- <div
- class="swiper-slide"
- @click="$emit('openLook', baseURL + item.filePath, 'img')"
- v-for="item in data.images"
- :key="item.id"
- >
- <img v-lazy="baseURL + item.filePath" alt="" />
- </div>
- </div>
- </div>
- </div>
- <div
- class="main"
- v-html="data.content"
- :class="{ opcBase: conShowLoad }"
- ></div>
- <!-- 数据加载中 -->
- <div class="conShowLoad" v-show="conShowLoad">
- <img src="../assets/img/loading.gif" alt="" />
- </div>
- </div>
- </template>
- <script>
- import Swiper from "@/assets/swiper/swiper.js";
- import axios from "@/utils/request";
- export default {
- name: "three2",
- props: {
- tit: {
- type: String,
- },
- data: {
- type: Object,
- default: () => {},
- },
- },
- components: {},
- data() {
- //这里存放数据
- return {
- conShowLoad: true,
- baseURL: "",
- };
- },
- //监听属性 类似于data概念
- computed: {},
- //监控data中的数据变化
- watch: {},
- //方法集合
- methods: {},
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- // 获取服务器前缀地址
- this.baseURL = axios.defaults.baseURL;
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- this.$nextTick(() => {
- setTimeout(() => {
- new Swiper(".three2 .swiper-container", {
- slidesPerView: 1.2,
- spaceBetween: 10,
- });
- this.conShowLoad = false;
- }, 1000);
- });
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='less' scoped>
- @import "../assets/swiper/swiper.css";
- .three2 {
- position: relative;
- width: 100%;
- height: 100%;
- .main {
- letter-spacing: 1px;
- color: #8a7351;
- line-height: 24px;
- font-size: 14px;
- padding: 0 12px 0 20px;
- width: 100%;
- height: calc(100% - 320px);
- overflow-y: auto;
- margin-top: 20px;
- }
- .swBox {
- width: 100%;
- height: 170px;
- .swiper-container {
- width: calc(100% - 40px);
- margin: 0 auto;
- height: 170px;
- }
- .swiper-slide {
- width: 100%;
- height: 100%;
- img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- video {
- z-index: -1;
- // width: 100%;
- height: 100%;
- }
- }
- .swiperVideo {
- overflow: hidden;
- position: relative;
- width: 100%;
- height: 100%;
- .videoName {
- position: absolute;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.3);
- top: 0px;
- left: 0px;
- color: #fff;
- font-size: 14px;
- }
- }
- }
- }
- </style>
|