<template>
  <div class="my-group-item" @click="onClick">
    <div class="my-group-item-bd">
      <div class="my-group-item-pic">
        <img :src="data.logo" v-if="data.logo" />
      </div>
      <div class="my-group-item-main">
        <div class="my-group-item-title line-clamp">{{ data.org_name }}</div>
        <div class="my-group-item-content">
          <p>{{ data.num }}人</p>
        </div>
      </div>
      <div class="hot">{{data.hot}}</div>
    </div>
    <!-- <div class="my-group-item-ft">
      <ul>
        <li v-if="data.is_mine && data.approve_status === '-1'">
          <div
            class="button default-button"
            @click.stop="
              $router.push({ name: 'groupUpdate', params: { id: data.id } })
            "
          >编辑</div>
        </li>
        <li v-else>
          <div class="button default-button">详情</div>
        </li>
        <li>
          <div
            class="button default-button"
            @click.stop="$router.push({ name: 'groupMember', params: { id: data.id }, query: { is_mine: `${data.is_mine}` } })"
          >成员列表</div>
        </li>
        <li>
          <div
            class="button primary-button"
            @click.stop="
              $router.push({ name: 'groupActivity', params: { id: data.id } })
            "
          >活动</div>
        </li>
      </ul>
    </div>-->
  </div>
</template>

<script>
export default {
  name: 'MyGroupItem',
  props: { data: Object },
  computed: {
    statusClass() {
      const status = this.data.approve_status
      return {
        'status-default': status === '-1',
        'status-success': status === '1',
        'status-warning': status === '0'
      }
    }
  },
  methods: {
    onClick() {
      this.$router.push({ name: 'groupItem', params: { id: this.data.id } })
    }
  }
}
</script>
<style lang="scss" scoped>
.my-group-item {
  position: relative;
  display: flex;
  margin-bottom: 15px;
}
.my-group-item-bd {
  display: flex;
  overflow: hidden;
}

.my-group-item-pic {
  width: 120px;
  height: 75px;
  margin-right: 15px;
  background-color: #f3f4f5;
  border-radius: 4px;
  overflow: hidden;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
.my-group-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 10px 0;
}
.my-group-item-title {
  font-size: 15px;
  color: #1b1b1b;
  line-height: 1;
}
.my-group-item-content {
  font-size: 12px;
  color: #a0a0a0;
  line-height: 1;
}

.my-group-item-ft {
  margin-top: 20px;
  ul {
    display: flex;
    justify-content: space-between;
  }
  .button {
    width: 64px;
    height: 30px;
    text-align: center;
    border-radius: 5px;
  }
  .default-button {
    font-size: 12px;
    color: #999;
    line-height: 30px;
    border: 1px solid #999;
  }
  .primary-button {
    font-size: 12px;
    color: #fff;
    line-height: 30px;
    background: linear-gradient(180deg, rgba(255, 201, 44, 1) 0%, rgba(255, 116, 42, 1) 100%);
  }
}
.hot {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 15px;
  padding: 0 4px;
  font-size: 12px;
  line-height: 15px;
  border-radius: 2px;
  color: #ce0022;
  background: #ffedf0;
}
</style>
