<template>
  <a-card title="项目成员" style="margin-bottom: 20px">
    <template #extra>
      <a-space>
        <a-button>编辑</a-button>
        <a-button type="primary">添加</a-button>
      </a-space>
    </template>
    <template v-for="(item,_) in list" class="bg-gray-50 rounded-lg w-80 p-4 flex justify-between items-center">
      <a-space>
        <a-avatar size="large" :src="item.avatar"/>
        <div class="text-gray-400 flex flex-col">
          <span>{{ item.nickname }}</span>
          <span>{{ item.createTime }}</span>
        </div>
      </a-space>
    </template>
  </a-card>
</template>

<script lang="ts" setup>
import {ref, onMounted} from 'vue';
import {
  listUsers
} from '@/api/system/user';
import {User} from "@/api/system/user/model";

const list = ref<User[]>([]);

const reload = async () => {
  const data = await listUsers({
    isAdmin: 1
  });
  if (data.length > 0) {
    list.value = data;
  }
}

onMounted(() => {
  reload();
})
</script>
