2022-12-23 07:21:55 +01:00
|
|
|
<template>
|
|
|
|
<div :class="$style.root">
|
|
|
|
<MkLoading v-if="fetching"/>
|
2022-12-23 08:46:38 +01:00
|
|
|
<div v-else class="users">
|
2022-12-23 07:21:55 +01:00
|
|
|
<MkA v-for="(user, i) in newUsers" :key="user.id" :to="`/user-info/${user.id}`" class="user">
|
|
|
|
<MkUserCardMini :user="user"/>
|
|
|
|
</MkA>
|
2022-12-23 08:46:38 +01:00
|
|
|
</div>
|
2022-12-23 07:21:55 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, onUnmounted, ref } from 'vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { useInterval } from '@/scripts/use-interval';
|
|
|
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
|
|
|
|
|
|
|
let newUsers = $ref(null);
|
|
|
|
let fetching = $ref(true);
|
|
|
|
|
|
|
|
const fetch = async () => {
|
|
|
|
const _newUsers = await os.api('admin/show-users', {
|
|
|
|
limit: 5,
|
|
|
|
sort: '+createdAt',
|
|
|
|
origin: 'local',
|
|
|
|
});
|
|
|
|
newUsers = _newUsers;
|
|
|
|
fetching = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
useInterval(fetch, 1000 * 60, {
|
|
|
|
immediate: true,
|
|
|
|
afterMounted: true,
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
|
|
|
&:global {
|
|
|
|
> .users {
|
|
|
|
.chart-move {
|
|
|
|
transition: transform 1s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
display: grid;
|
2022-12-24 00:46:30 +01:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
2022-12-23 07:21:55 +01:00
|
|
|
grid-gap: 12px;
|
|
|
|
|
|
|
|
> .user:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|