<template>
  <div>
    <el-carousel >
      <el-carousel-item class="lunbo" v-for="(item, index) in carouselList" :key="index" :style="{ backgroundImage: `url(${item.src})` }">
        <div id="txt">
          <a class="title">{{ item.title }}</a>
          <a class="subtitle">{{ item.subtitle }}</a>
        </div>
      </el-carousel-item>
    </el-carousel>
    <div id="hot">
      <div class="content">
        <div class="top">
          <div id="imgtxt">
            <img :src="hotnews.img">
            <a class="newsTitle">{{ hotnews.title }}</a>
          </div>
          <div id="hottxt">
            <div id="htitle">
              <a class="tle">热点新闻</a>
              <el-button type="text">MORE+</el-button>
            </div>
            <div id="hotList">
              <div class="list" v-for="(item, index) in hotnewsList" :key="index">
                <img :src="item.img">
                <a>{{ item.title }}</a>
              </div>
            </div>
          </div>
        </div>
        <div class="bottom"  :style="{ backgroundImage: `url(${gg1})` }"/>
      </div>
    </div>
    <div id="daliay">
      <div class="content">
        <div class="top">
          <div class="htitle">
            <a class="tle">资讯</a>
            <div class="item">
              <a v-for="item in information" :key="item" @click="changenews(item)" :class="{ clk: informationitem === item }">{{ item }}</a>
            </div>
            <el-button type="text">MORE+</el-button>
          </div>
          <div id="hotList">
            <div class="list" v-for="(item, index) in carList" :key="index">
              <img :src="item.img">
              <div class="txt">
                <a class="title">{{ item.title }}</a>
                <a class="subtitle">{{ item.subtitle }}</a>
              </div>
              <!-- <a>{{ item.title }}</a> -->
            </div>
          </div>
        </div>
        <div class="bottom"  :style="{ backgroundImage: `url(${gg2})` }"/>
      </div>
    </div>
    <div id="wk">
      <div class="content">
        <div class="htitle">
          <a class="tle">深度</a>
          <div class="item">
            <a v-for="item in depth" :key="item" @click="changedepth(item)" :class="{ clk: depthitem === item }">{{ item }}</a>
          </div>
          <el-button type="text">MORE+</el-button>
        </div>
        <div id="hotList">
          <div class="list" v-for="(item, index) in carList" :key="index">
            <img :src="item.img">
            <div class="txt">
              <a class="title">{{ item.title }}</a>
              <a class="subtitle">{{ item.subtitle }}</a>
            </div>
            <!-- <a>{{ item.title }}</a> -->
          </div>
        </div>
      </div>
      <!-- <el-button type="primary" class="wkbtn" size="medium">点击进入</el-button> -->
    </div>
  </div>
</template>
<script>
import { guanggao, lunboList } from '@/api/metadaily.js'
export default {
  name: 'metadaily',
  data () {
    return {
      information: ['XR', 'Web3', 'Ai'],
      informationitem: 'XR',
      depth: ['XR', 'Web3', 'Ai'],
      depthitem: 'XR',
      carouselList: [
        // { src: '/car1.png', title: '吉利11月销量再刷新纪录，新能源转型成效凸显', subtitle: '国际汽车企业如果现在一旦脱离了中国市场，再想回来就不可能了。必须了解这个发展的趋势，只有参与才有机会。' },
        // { src: '/car2.png', title: '吉利11月销量再刷新纪录，新能源转型成效凸显', subtitle: '国际汽车企业如果现在一旦脱离了中国市场，再想回来就不可能了。必须了解这个发展的趋势，只有参与才有机会。' }
      ],
      hotnews: {
        title: '这两款产品也将采用“CHN”的模式进行研发',
        img: '/aigc.png'
      },
      hotnewsList: [
        {
          title: '广汽本田插混旗舰双子',
          img: '/aigclist.png'
        },
        {
          title: '强不强？吉利银河E8全景',
          img: '/aigclist.png'
        },
        {
          title: '智己汽车正式获准L3级',
          img: '/aigclist.png'
        },
        {
          title: '广汽本田插混旗舰双子',
          img: '/aigclist.png'
        },
        {
          title: '强不强？吉利银河E8全景',
          img: '/aigclist.png'
        },
        {
          title: '智己汽车正式获准L3级',
          img: '/aigclist.png'
        }
      ],
      carList: [
        {
          img: '/cattxt.png',
          title: '广汽本田插混旗舰双子',
          subtitle: '阿维塔科技计划三年推出四款新车，明年则将陆续推出第三款和第四款车型。目前，有2款新车在研发中，代号分别是“15”、“16”，这'
        }, {
          img: '/cattxt.png',
          title: '首款高端纯电MPV翼真Xspace',
          subtitle: '阿维塔科技计划三年推出四款新车，明年则将陆续推出第三款和第四款车型。目前，有2款新车在研发中，代号分别是“15”、“16”，这'
        }, {
          img: '/cattxt.png',
          title: '广汽本田插混旗舰双子',
          subtitle: '阿维塔科技计划三年推出四款新车，明年则将陆续推出第三款和第四款车型。目前，有2款新车在研发中，代号分别是“15”、“16”，这'
        }, {
          img: '/cattxt.png',
          title: '首款高端纯电MPV翼真Xspace',
          subtitle: '阿维塔科技计划三年推出四款新车，明年则将陆续推出第三款和第四款车型。目前，有2款新车在研发中，代号分别是“15”、“16”，这'
        }
      ],
      gg1: '',
      gg2: ''
    }
  },
  components: {
  },
  mounted () {
    this.getguanggao()
    this.getlunboList()
  },
  methods: {
    changenews (item) {
      this.informationitem = item
    },
    changedepth (item) {
      this.depthitem = item
    },
    async getguanggao () {
      const { data: { message: ggm1, data: gg1 } } = await guanggao(1)
      const { data: { message: ggm2, data: gg2 } } = await guanggao(2)

      if (ggm1 === 'success' && ggm2 === 'success') {
        this.gg1 = gg1.image
        this.gg2 = gg2.image
      }
    },
    async getlunboList () {
      const { data: { message, data } } = await lunboList()
      if (message === 'success') {
        for (const iter of data.list) {
          this.carouselList.push({
            src: iter.image,
            title: iter.link,
            subtitle: iter.link
          })
        }
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.el-carousel__item{
  background-size: 100%;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  #txt {
    display: flex;
    flex-direction: column;
    margin-bottom: 50px;
    color: #FFFFFF;
    .title {
      font-size: 36px;
      font-weight: bold;
      text-align: center;
      margin-bottom: 15px;

    }
    .subtitle {
      font-size: 16px;
      font-weight: 400;
      opacity: 0.5;
      text-align: center;
    }
  }
}
.lunbo {
  background-size: auto;
  background-position: center;
}
#hot, #daliay, #wk {
  width: 100%;
  background: #E3E5EA;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding-top: 30px;;
  .content {
    width: 1200px;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .top, .bottom {
      width: 100%;
    }
    .top {
      margin-bottom: 30px;
      background-color: #FFFFFF;
      display: flex;
      #imgtxt {
        width: 55%;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        img {
          width: 90%;
          height: 90%;
        }
        .newsTitle{
          position: absolute;
          bottom: 5%;
          left: 5%;
          display: inline-block;
          font-size: 18px;
          font-weight: bold;
          color: #FFFFFF;
          line-height: 48px;
          width: 90%;
          background-color: #0000007e;
        }
      }

      #hottxt {
        display: flex;
        justify-content: space-around;
        flex-direction: column;
        align-items: center;
        flex: 1;
        #htitle {
          display: flex;
          justify-content: space-between;
          align-items: center;
          width: 95%;
          .tle {
            z-index: 9;
            font-size: 26px;
            font-weight: bold;
            color: #00161C;
            line-height: 48px;
            display: inline-block;
            position: relative;
            text-decoration: none; /* 移除默认的下划线 */
          }
          .tle::after {
            content: '';
            position: absolute;
            left: -15px;
            bottom: 10px;
            width: 65%;
            height: 6px; /* 横线高度为文字高度的一半 */
            background-color: #07CAAF;; /* 横线颜色与文字颜色相同 */
            z-index: -1;
          }
          .el-button {
            font-size: 16px;
            font-weight: bold;
            color: #07CAAF;
            line-height: 48px;
          }
        }
      }
      #hotList {
        height: 90%;
        width: 90%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        .list {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          img {
            width: 140px;
            height: 110px;
          }
          a {
            font-size: 14px;
            font-weight: 400;
            color: #010101;
            line-height: 48px;
          }
        }
      }
    }
    .bottom {
      min-height: 120px;
      background-image: url('../../assets/bottom.png');
      background-size: 100% 100%;
    }
  }
}
#hot {
  .content {
    .top {
      margin-bottom: 30px;
      background-color: #FFFFFF;
      display: flex;
      background-image: url('../../assets/hotTopLeft.png');
      background-position: 101% 0; /* 调整这些值来改变显示的部分 */
      background-size: 30% 50%; /* 使用 'cover' 或 'contain'，或者设置具体尺寸 */
      background-repeat: no-repeat;
      #imgtxt {
        width: 55%;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        img {
          width: 90%;
          height: 90%;
        }
        .newsTitle{
          position: absolute;
          bottom: 5%;
          left: 5%;
          display: inline-block;
          font-size: 18px;
          font-weight: bold;
          color: #FFFFFF;
          line-height: 48px;
          width: 90%;
          background-color: #0000007e;
        }
      }
    }
  }
}
#wk {
  .content {
    background-color: #FFFFFF;
  }
}
#wk, #daliay {
 .content, .top {
  display: flex;
  align-items: center;
  position: relative;
  flex-direction: column;

  .htitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 93%;
    .item {
      width: 15%;
      display: flex;
      justify-content: space-between;
      a {
        font-size: 18px;
        line-height: 48px;
        cursor: pointer;
        z-index: 99;
      }
      .clk {
        font-weight: bold;
        color: #07CAAF;
      }
    }
    .tle {
      z-index: 9;
      font-size: 26px;
      font-weight: bold;
      color: #00161C;
      line-height: 48px;
      display: inline-block;
      position: relative;
      text-decoration: none; /* 移除默认的下划线 */
    }
    .tle::after {
      content: '';
      position: absolute;
      left: -5px;
      bottom: 10px;
      width: 110%;
      height: 6px; /* 横线高度为文字高度的一半 */
      background-color: #07CAAF;; /* 横线颜色与文字颜色相同 */
      z-index: -1;
    }
    .el-button {
      font-size: 16px;
      font-weight: bold;
      color: #07CAAF;
      line-height: 48px;
    }
  }
  #hotList {
    height: 90%;
    width: 95%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    .list {
      display: flex;
      width: 50%;
      height: 50%;
      flex-direction: row !important;
      align-items: center;
      justify-content: center;
      margin-bottom: 30px;

      .txt {
        display: flex;
        flex-direction: column;
        margin-left: 10px;
        align-items: center;
        justify-content: space-between;
        width: 60%;
        .title {
          text-align: left;
          width: 100%;
          font-size: 18px;
          font-weight: bold;
          color: #010101;
          line-height: 48px;
        }
        .subtitle{
          height: 90%;
          display: inline-block;
          text-align: left;
          width: 100%;
          font-size: 14px;
          font-weight: 400;
          color: #000000;
          line-height: 24px;
        }
      }
      img {
        width: 200px !important;
        height: 150px !important;
      }
    }
  }
 }
 .content::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    background-image: url('../../assets/cartxt.png');
    background-position: 100% 0; /* 调整这些值来改变显示的部分 */
    background-size: 10% 50%; /* 使用 'cover' 或 'contain'，或者设置具体尺寸 */
    background-repeat: no-repeat;
  }
}
</style>
