<template>
  <div class="myNeighborInfo" v-if="userList.length">
    <div class="card-list">
      <div class="item" v-for="(item,index) in userList" :key="index" @click="$linkTo(`./familyInfo?idNumber=${item.idNumber}`)">
        <div class="userpic">
          <img :src="item.avatarUrl" v-if="item.avatarUrl" alt="">
          <img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" v-else alt="">
        </div>
        <div class="user-info">
          <p class="name">{{ item.name }}</p>
          <div class="idNumber">{{ item.idNumber.replace(/(.{6}).*(.{4})/, '$1********$2') }}</div>
        </div>
        <div class="arrowRoght">
          <u-icon name="arrow-right"></u-icon>
        </div>
      </div>
    </div>
  </div>

  <AiEmpty description="暂无数据" class="emptyWrap" v-else />
</template>

<script>
export default {
  name: 'myNeighborInfo',
  appName: '我的四邻信息',
  data() {
    return {
      partyId: '',
      userList: []
    }
  },
  onLoad() {
    this.getUserInfo()
  },
  methods: {
    // 我的四邻党员查询
    getUserInfo() {
      this.$instance.post('/app/apppartyfourresident/listFourResidentByApplet').then((res) => {
        if(res?.data) {
          this.userList = res.data
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.myNeighborInfo {

  .card-list {
    padding: 32px 32px 32px 20px;
    box-sizing: border-box;
    .item {
      display: flex;
      background: #FFF;
      padding: 32px;
      border-radius: 16px;
      box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.04);
      margin-bottom: 24px;
      .userpic {
        width: 96px;
        height: 96px;
        margin-right: 10px;
        img {
          border-radius: 50%;
          width: 100%;
          height: 100%;
        }
      }

      .user-info {
        width: calc(100% - 146px);
        .name {
          font-size: 32px;
          font-weight: 600;
        }
        .idNumber {
          margin-top: 8px;
          color: #999999;
        }
      }

      .arrowRoght {
        width: 40px;
        align-self: center;
      }
    }
  }
  
}
</style>