<template>
  <div class="bannar" v-if="basicSet.pc_temp2_set && basicSet.pc_temp2_set.banner && basicSet.pc_temp2_set.banner.length > 0">
    <!--首页显示-->
    <div class="swiper m-auto" v-if=" basicSet.pc_temp2_set.banner.length > 0">
      <el-carousel trigger="click" arrow="never" :autoplay="true">
        <el-carousel-item v-for="(item, index) in basicSet.pc_temp2_set.banner" :key="index">
          <img :class="[item.url? 'hoverClass':'']" :src="item.img_src" @click="toLink(item)">
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>

<script>
  import {mapState} from 'vuex'

  export default {
    data() {
      return {};
    },
    computed: {
      ...mapState(['basicSet', 'basic_info'])
    },
    mounted() {},
    methods: {
      toLink(item) {
        if(item.url) {
          window.open(item.url, "_blank");
        }else if(item.pc_link) {
          window.open(item.pc_link, "_blank");
        }else if(item.pc_adv_url) {
          window.open(item.pc_adv_url, "_blank");
        }
      }
    }
  };
</script>
<style lang="scss" scoped>
  .bannar {
    width: 690px;
    height: 350px;
    background-color: #0090ff;
    border-radius: 5px;
    overflow: hidden;
    .swiper {
      width: 690px;
      cursor: pointer;
      :deep(.el-carousel__container) {
        height: 350px;
      }
      :deep(.el-carousel__button) {
        width: 16px;
        height: 6px;
        background-color: #fff;
        border-radius: 3px;
        opacity: 1;
      }
      :deep(.el-carousel__indicator.is-active) button {
        background-color: var(--color);
      }
      img {
        width:100%;
        height:100%;
        /*border-radius: 10px;*/
      }
    }
    .swiper.fill-swiper {
      padding-top: 0;
      width: 100%;
      :deep(.el-carousel__container) {
        height: 350px;
      }
    }

    .hoverClass {
      cursor: pointer;
    }
  }
</style>
