<template>
  <div class="avator-group">
    <div v-for="(item, index) in avators" :key="index" class="avator-item" :style="widthStyle">
      <cr-image :class="{ avator: index == 0 }" width="44px" :src="item" />
      <div v-if="index == 0" class="is-leader">
        <cr-image width="48px" src="@/assets/images/leader.png" />
      </div>
      <div v-else class="is-new">
        <cr-image width="25px" src="@/assets/images/new-user.png" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    avators: {
      type: Array,
      default: () => [
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_01.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_02.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_03.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_04.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_05.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_06.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_07.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_09.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_10.png',
        'https://activitystatic.lkbang.net/mall-free-ui/img/avator_10.png'
      ]
    },
    desc: {
      type: String,
      default: ''
    },
    groupPersonNum: {
      type: Number,
      default: 100
    }
  },
  data() {
    return {
      isLeader: true // 标识是不是团长
    };
  },
  computed: {
    widthStyle() {
      // 用于单个头像不能占一排
      return this.avators.length == 6 ? { width: '25%' } : { width: '20%' };
    }
  }
};
</script>
<style lang="less" scoped>
.avator-group {
  position: relative;
  padding: 0 38 - @padding-sd;
  box-sizing: border-box;
  margin-bottom: @padding-md;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  background: @white;
  .avator-item {
    flex-shrink: 0;
    position: relative;
    width: 20%;
    height: 44px;
    margin-top: @padding-lg;
    .avator {
      border: 2px solid #ffd93d;
      // border: px solid rgba(255, 212, 0, 0.24);
      border-radius: 50%;
      box-sizing: border-box;
    }
    .is-new {
      position: absolute;
      top: 0;
      right: @padding-unit * 2;
    }
    .is-leader {
      position: absolute;
      left: 2px;
      top: -11px;
    }
  }
}
</style>
