<template>
  <div class="hot-project">
    <div class="header">
      <text class="title">热门项目</text>
      <text class="more">查看更多</text>
    </div>
    <div class="content">
      <div class="wrap" v-for="item in data" :key="item.id" @click="handleToTravel(item)">
        <image :src="item.homeHotPicturesAfterConvert[0]" mode="aspectFill" />
        <div class="text-wrap">
          {{ item.projectTitle }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  data: {
    type: Array,
    default: () => [],
  },
});
function handleToTravel(item) {
  uni.navigateTo({
    url: `/pages/travel/detail?id=${item.id}`,
  });
}
</script>

<style lang="scss" scoped>
.hot-project {
  padding: 0 30rpx;
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .title {
      font-size: 18px;
      font-weight: bold;
    }
    .more {
      font-size: 12px;
      color: #adb5bd;
    }
  }
  .content {
    margin-top: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 380rpx 380rpx;
    row-gap: 20rpx;
    column-gap: 20rpx;
    .wrap {
      border-radius: 8px;
      overflow: hidden;
      position: relative;
      image {
        width: 100%;
        height: 100%;
      }
      .text-wrap {
        height: 47rpx;
        padding-left: 20rpx;
        padding-bottom: 20rpx;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #020202 100%);
        color: #fff;
        font-size: 14px;
        font-weight: bold;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
}
</style>
