<template>
  <div class="flexible flx-column-center-between">
    <div class="flexible-top">{{ title }}</div>
    <div class="flexible-content card">
      <div>
        <div
          v-for="(item, index) in list"
          :key="index"
          class="flexible-item"
          @click="handleChange(item)"
        >
          <span class="poliy-item-order" :class="index > 2 ? 'poliy-item-postorder' : ''">{{
            index + 1
          }}</span>
          <el-link>{{ item.FTITLE }}</el-link>
          <img v-show="index < 3" src="@/assets/img/icon-new.png" width="28" height="15" alt="" />
        </div>
      </div>
      <div v-show="isMore" class="flexible-footer" @click="seeMore">
        查看更多<el-icon><i-ep-DArrowRight /></el-icon>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps({
  title: {
    type: String,
    default: ''
  },
  list: {
    type: Array,
    default: () => []
  } as any,
  isMore: {
    type: Boolean,
    default: false
  }
})

const emits = defineEmits(['change', 'seeMore'])

const handleChange = (row: any) => {
  emits('change', row)
}

const seeMore = () => {
  emits('seeMore')
}
</script>

<style lang="scss" scoped>
.flexible {
  position: relative;
  flex: 0 0 calc((100% - 50px) / 3);
  margin: 0 25px 50px 0;
  padding-top: 16px;
  background: #ffffff;
  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  box-sizing: border-box;
  .flexible-top {
    position: absolute;
    top: -21px;
    height: 42px;
    width: 200px;
    line-height: 42px;
    background: #1887fb;
    border-radius: 8px;
    font-size: 24px;
    color: #ffffff;
  }
  .flexible-content {
    min-height: 401px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    padding: 0 20px;
    box-sizing: border-box;
    padding-bottom: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .flexible-item {
      display: flex;
      align-items: center;
      font-size: 14px;
      font-weight: 400;
      color: #222222;
      margin-top: 16px;
      .poliy-item-order {
        display: inline-block;
        width: 14px;
        height: 14px;
        line-height: 14px;
        background: linear-gradient(90deg, #177cfa 0%, #177cfa 100%);
        border-radius: 2px 2px 2px 2px;
        font-size: 12px;
        font-family: Roboto, Roboto;
        font-weight: 400;
        color: #ffffff;
        margin-right: 4px;
      }

      .poliy-item-postorder {
        background: #f8f8f8;
        color: #999999;
      }

      :deep(.el-link__inner) {
        display: inline-block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 321px;
      }
      img {
        margin-left: 4px;
      }
    }

    .flexible-footer {
      width: 100%;
      margin-top: 16px;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      font-size: 14px;
      font-weight: 400;
      color: #05a8ff;
      cursor: pointer;
    }
  }
}
</style>
