<template>
  <div v-if="item" class="logic-user-item">
    <div class="logic-user-info">
      <div>
        <div class="name">{{ item.name }}</div>
        <div class="flex-center-v">
          <div class="flex-center-v tag">
            <img
              :src="
                require(`@/assets/icon-gender-${
                  item.gender == '男' ? 1 : 2
                }.png`)
              "
              alt=""
            />
            <span>{{ item.gender }}</span>
          </div>
          <div class="flex-center-v tag">
            <img :src="iconAge" alt="" />
            <span>{{ item.age }}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="logic-user-tips">
      {{ item.tips }}
    </div>
  </div>
</template>
<script>
import iconAge from "@/assets/icon-age.png";
export default {
  data() {
    return {
      iconAge
    };
  },
  props: {
    item: {
      type: Object,
      default: () => ({
        gender: "",
        age: 0
      })
    }
  }
};
// import { computed, defineProps, PropType } from 'vue'
// import { msToDate } from '@/utils/index'
// interface userInfo {
//   age: number
//   gender: string
//   name: string
//   photo: string
//   tips: string
// }
// const props = defineProps({
//   item: {
//     type: Object as PropType<userInfo>
//   }
// })
// const gender = computed(() => (props.item?.gender == '男' ? 1 : 2))
// const birthday = computed(() => {
//   let d = new Date()
//   d.setFullYear(d.getFullYear() - (props.item?.age || 0))
//   return msToDate(d, '')
// })
</script>
<style lang="scss" scoped>
.logic-user-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  padding: 10px;
  .logic-user-info {
    // padding: 20px 10px 0;
    padding-top: 10px;
    color: #333;
    // background: #3e70fb;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    .avatar {
      width: 52px;
      height: 52px;
      margin-right: 15px;
      margin-left: 15px;
    }
    .name {
      font-size: 16px;
      font-weight: bold;
      margin-bottom: 8px;
    }
    .age {
      color: #4d4d4d;
      // margin-left: 10px;
      font-size: 14px;
    }
    .tag {
      display: inline-block;
      color: #3e70fb;
      background: #eef1fc;
      border-radius: 4px;
      padding: 0 12px;
      margin-right: 10px;
      height: 26px;
      line-height: 26px;
      img {
        height: 0.8em;
        margin-right: 6px;
      }
    }
  }
  .logic-user-tips {
    color: #333;
    background: #f5f7ff;
    padding: 10px;
    font-size: 15px;
    word-wrap: break-all;
    margin: 10px 0;
    line-height: 26px;
  }
}
</style>
