<template>
  <view class="grid-item" @click="handleClick">
    <view class="item-image-wrapper">
      <image :src="item.imageUrl" class="item-image"></image>
    </view>
    <view class="line-box"></view>
    <view class="item-info-area">
      <view class="item-title two-omit">{{ item.title }}</view>
      <view class="item-info">
        <text class="item-price">已筹 ￥{{ item.raisedAmount }}万</text>
        <text class="item-supporters">支持者 {{ item.supporters }}</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'CrowdFundingItem',
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  methods: {
    handleClick() {
      this.$emit('click', this.item.id);
    }
  }
}
</script>

<style scoped lang="scss">
.grid-item {
  background: #fff;
  border-radius: 12rpx;
  overflow: hidden; 
  display: flex;
  flex-direction: column;
  .line-box{
      width: 100%;
      height: 6rpx;
      background: linear-gradient(to right, #ACF934, transparent);
    }
  .item-image-wrapper {
    width: 100%;
    position: relative;
    padding-bottom: 100%; // 1:1
    overflow: hidden;
    // border-top-left-radius: 18px;
    // border-top-right-radius: 18px;
  }
  .item-image {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 100%;
    object-fit: cover;
    // border-top-left-radius: 18px;
    // border-top-right-radius: 18px;
    display: block;
  }
  .item-info-area {
    background: #fff; 
    padding: 12rpx 20rpx;    
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    .item-title {
      font-size: 26rpx;
      color: #1f1f1f;
      font-weight: 500;  
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .item-info {
      display: flex;
      justify-content: space-between;
      align-items: center;
      // padding: 0 12px 0 12px;
      font-size: 20rpx;
      margin-top: 12rpx;
      .item-price {
        color: #bdbdbd;
        font-weight: 400;
      }
      .item-supporters {
        color: #bdbdbd;
        font-weight: 400;
      }
    }
  }
}
</style> 