<template>
  <div>
    <div class="banner">
      <div v-for="(item, index) in roadList" :key="index" class="banner_roadList">
        <el-popover
          title="我的项目"
          width="340"
          trigger="hover"
          popper-class="popover"
          :placement="item.position"
          v-model="item.isShow"
          visible-arrow="true"
        >
          <!-- <div> -->
          <div v-for="(it, indexItem) in item.projectList" :key="indexItem" class="project_name">
            <AppLink :data="it">
              {{ it.name }}
            </AppLink>
          </div>
          <div class="line"></div>
          <div class="el-popover__title">未来可选目标:</div>
          <div v-for="(itTwo, index) in item.checkList" :key="itTwo.name" class="project_name">
            <AppLink :data="itTwo">
              {{ itTwo.name }}
            </AppLink>
          </div>
          <!-- </div> -->

          <div slot="reference" class="banner_roadList_con">
            <img :src="item.icon" alt="" />
            <div class="item_title">{{ item.title }}</div>
          </div>
        </el-popover>
      </div>
      <div class="banner_homeList">
        <div v-for="(itemRoad, indexRoad) in homeList" :key="indexRoad">
          <el-popover trigger="hover" popper-class="popover" :placement="itemRoad.position" v-model="itemRoad.isShow">
            <div>
              <div v-for="(it, indexItem) in itemRoad.itemList" :key="indexItem" class="project_name">
                {{ it.name }}
              </div>
            </div>
            <div slot="reference" class="banner_homeList_con">
              <img :src="itemRoad.icon" alt="" />
              <div class="item_title">{{ itemRoad.title }}</div>
            </div>
          </el-popover>
        </div>
      </div>
    </div>
    <div class="w1200">
      <ProjectCard
        title="在线国际学位"
        :list="internationalDegreeProjectList"
        baseUrl="/internationalDegree"
      ></ProjectCard>
      <ProjectCard title="留学中学" :list="studyAbroadProjectList" baseUrl="/studyAbroad"></ProjectCard>
    </div>
  </div>
</template>

<script>
import { roadMapList, homeList } from '@/utils/roadMap.js'
import ProjectCard from '@/components/ProjectCard.vue'
import AppLink from '@/components/Link.vue'

export default {
  components: { ProjectCard, AppLink },
  computed: {},
  data() {
    return {
      roadList: [],
      homeList: [],
      // 热门专业
      internationalDegreeProjectList: [
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/internationalDegree/project_kelley.png',
          href: 'https://kelley.ezijing.com/'
        },
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/internationalDegree/project_ciis.png',
          href: 'https://ciis.ezijing.com/'
        },
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/internationalDegree/project_marywood.png',
          href: 'https://marywood.ezijing.com/'
        }
      ],
      // 热门专业
      studyAbroadProjectList: [
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/studyAbroad/project_cbu.png',
          href: 'https://cbu-plus.ezijing.com/'
        },
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/studyAbroad/project_marywood_plus_1.png',
          href: 'https://marywood-plus.ezijing.com/'
        },
        {
          imgUrl: 'https://webapp-pub.ezijing.com/www/pc/studyAbroad/project_sbu.png',
          href: 'https://sbu-plus.ezijing.com/'
        }
      ]
    }
  },
  mounted() {
    this.roadList = roadMapList
    this.homeList = homeList
    this.$nextTick(() => {
      // 获取子元素的个数
      this.roadList.map(item => {
        console.log(item.title, 'title')
        if (item.title === '职业教育') {
          item.isShow = true
        }
      })
    })
  }
}
</script>

<style lang="scss">
.el-popover.popover {
  background: rgba(255, 255, 255, 0.39);
  .el-popover__title {
    font-weight: 400;
    color: #ffffff;
    font-size: 18px;
  }
  .project_name {
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
  }
  .line {
    width: 281px;
    border: 1px dashed #ccc;
    margin: 20px 0 20px 0;
  }
}

.banner {
  width: 100%;
  min-width: 1200px;
  background: url(https://webapp-pub.oss-cn-beijing.aliyuncs.com/www/pc/lifeLearning/banner.jpg);
  background-size: 100% 100%;
  height: 650px;
  position: relative;
  .banner_roadList {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    .banner_roadList_con {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      cursor: pointer;
      .item_title {
        font-size: 20px;
        font-weight: bold;
        color: #ffffff;
      }
    }
  }
  .banner_roadList:nth-child(1) {
    position: absolute;
    top: 325px;
    left: 21.5%;
  }
  .banner_roadList:nth-child(2) {
    position: absolute;
    top: 270px;
    left: 40%;
  }
  .banner_roadList:nth-child(3) {
    position: absolute;
    top: 250px;
    left: 47%;
  }
  .banner_roadList:nth-child(4) {
    position: absolute;
    top: 140px;
    left: 58%;
  }
  .banner_roadList:nth-child(5) {
    position: absolute;
    top: 105px;
    left: 68%;
  }
  .banner_homeList {
    width: 50%;
    position: absolute;
    left: 50%;
    bottom: 52px;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: space-around;
    align-items: center;
    .banner_homeList_con {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;

      .item_title {
        font-size: 20px;
        font-weight: bold;
        color: #ffffff;
      }
    }
  }
}
.w1200 {
  width: 1200px;
  margin: 84px auto;
}
</style>
