<template>
  <div class="policy flx-column-center-between">
    <div class="policy-top">{{ title }}</div>
    <div class="policy-content card" :style="{ minHeight: minHeight + 'px' }">
      <div
        v-for="(item, index) in list"
        :key="index"
        class="policy-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 v-show="isMore" class="policy-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
  },
  minHeight: {
    type: Number,
    default: 200
  }
})

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

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

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

<style lang="scss" scoped>
.policy {
  width: 645px;
  .policy-top {
    width: 100%;
    height: 42px;
    line-height: 42px;
    background: #1887fb;
    border-radius: 8px 8px 0px 0px;
    font-size: 24px;
    color: #ffffff;
  }
  .policy-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    padding: 0 23px;
    box-sizing: border-box;
    padding-bottom: 16px;

    .policy-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: 470px;
      }
      img {
        margin-left: 4px;
      }
    }

    .policy-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>
