<template>
  <section class="homeRTGT">
    <div class="htaTitle">
      <span class="TitleName"><strong>决策看板</strong></span>
      <!-- <span class="TitleTab"><em v-for='(item,index) in titleArr' :key='index' @click='titleClick(item,index)' :class='inx==index?"active":""'>{{item.name}}</em></span> -->
      <!-- <span class="more" @click='more'>更多</span> -->
    </div>
    <div class="htaBoxGT">
      <div class="homeAdvertLeaderbanner">
        <el-carousel :interval="500000" type="card" arrow="always" height="200" @change="handleBannerChange">
          <el-carousel-item v-for="(item, index) in bannerList" :key="index" :class="getBannerClass(index)">
            <img :src="item.imgUrl" @click='leaderli(`/ojt/0${index + 1}`)' /><em>{{ item.title }}</em>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
  </section>
</template>
<script>
import zhiliImg from "@/assets/images/RTImgs/治理体系2X.png";
import projectImg from "@/assets/images/RTImgs/项目管理2X.png";
import baseImg from "@/assets/images/RTImgs/基础设施2X.png";
import applicationImg from "@/assets/images/RTImgs/应用系统2X.png";
import networkSafeImg from "@/assets/images/RTImgs/网络安全2X.png";
import smartImg from "@/assets/images/RTImgs/智能指数2X.png";
export default {
  computed: {},
  data() {
    return {
      params: {
        //搜索条件
        pageIndex: 1,
        pageSize: 3,
        total: 0,
      },
      tableData: [],
      currentBannerIdx: 0,
      bannerList: [
        {
          imgUrl: zhiliImg,
          title: "治理体系",
        },
        {
          imgUrl: projectImg,
          title: "项目管理",
        },
        {
          imgUrl: baseImg,
          title: "基础设施",
        },
        {
          imgUrl: applicationImg,
          title: "应用系统",
        },
        {
          imgUrl: networkSafeImg,
          title: "网络安全",
        },
        {
          imgUrl: smartImg,
          title: "智能指数",
        },
      ],
    };
  },
  mounted() {},
  methods: {
    leaderli(url) {
      console.log(url);
      window.open("//" + location.hostname + ":8002" + url);
    },
    handleBannerChange(idx) {
      this.currentBannerIdx = idx;
    },
    getBannerClass(index) {
      if (this.currentBannerIdx === 0) {
        if (index === this.bannerList.length - 1) {
          return "before_banner";
        }
        if (index === 1) {
          return "after_banner";
        }
        if (index === 0) {
          return "current_banner";
        }
        return "normal_banner";
      } else if (this.currentBannerIdx === this.bannerList.length - 1) {
        if (index === this.bannerList.length - 2) {
          return "before_banner";
        }
        if (index === 0) {
          return "after_banner";
        }
        if (index === this.bannerList.length - 1) {
          return "current_banner";
        }
        return "normal_banner";
      } else {
        if (index === this.currentBannerIdx - 1) {
          return "before_banner";
        }
        if (index === this.currentBannerIdx + 1) {
          return "after_banner";
        }
        if (index === this.currentBannerIdx) {
          return "current_banner";
        }
        return "normal_banner";
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.before_banner em {
  margin-left: -35%;
}
.after_banner em {
  margin-left: 35%;
}
.homeRTGT {
  display: flex;
  flex-direction: column;
  background: #fff;
  // box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
  //   0px 3px 6px -4px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  margin-bottom: 24px;
  height: 301px;
  .htaTitle {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
    color: rgba(0, 0, 0, 0.85);
    padding: 10px;
    padding-left: 16px;
    display: flex;
    align-items: center;
    .TitleName {
      display: flex;
      align-items: center;
      margin-right: 40px;
      i {
        width: 2px;
        height: 18px;
        background: #0e71ff;
        margin-right: 4px;
      }
      strong {
        color: rgba(0, 0, 0, 0.85);
        font-size: 16px;
      }
    }
    .TitleTab {
      flex: 1;
      em {
        margin-right: 15px;
        font-size: 16px;
        padding-bottom: 16px;
        cursor: pointer;
        &.active {
          border-bottom: 2px solid #0076f6;
          color: #0076f6;
        }
      }
    }
    .more {
      flex-wrap: 150px;
      font-size: 14px;
      cursor: pointer;
      color: rgba(0, 0, 0, 0.45);
      display: flex;
      align-items: center;
    }
  }
  .htaBoxGT {
    padding: 16px;
    ul {
      display: flex;
      flex-wrap: wrap;
      align-content: flex-start;

      li {
        background: #fff;
        width: 140px;
        height: 100px;
        border-radius: 4px;
        display: flex;
        flex-direction: column;
        padding: 16px;
        margin-right: 16px;
        margin-bottom: 16px;
        align-items: center;
        text-align: center;

        span {
          margin-bottom: 8px;
          img {
            width: 48px;
            height: 48px;
          }
          strong {
            color: rgba(0, 0, 0, 0.85);
            font-size: 14px;
            font-weight: normal;
          }
        }
      }
    }
  }
  .scrollbarClass {
    .el-scrollbar__wrap {
      overflow: scroll !important;
      height: calc(100% + 20px) !important; //多出来的20px是横向滚动条默认的样式
    }
    .el-table--scrollable-x .el-table__body-wrapper {
      overflow-x: hidden !important;
    }
  }
}
</style>
<style lang="scss">
.homeAdvertLeaderbanner {
  img {
    height: 185px;
    width: 100%;
    cursor: pointer;
    border-radius: 8px;
  }
  .el-carousel__container {
    height: 216px !important;
    .el-carousel__item {
      display: flex;
      flex-direction: column;
      color: #000;
      text-align: center;
      em {
        margin-top: 5px;
      }
    }
  }
}
</style>