feat: 优化登录日志样式

master
绝弹 2023-10-16 22:25:48 +08:00
parent 649ca40f12
commit d18d80cd68
1 changed files with 16 additions and 12 deletions

View File

@ -12,7 +12,7 @@
<script setup lang="tsx"> <script setup lang="tsx">
import { api } from "@/api"; import { api } from "@/api";
import { Table, useTable } from "@/components"; import { Table, useTable } from "@/components";
import { dayjs } from "@/libs/dayjs"; import dayjs from "dayjs";
const table = useTable({ const table = useTable({
data: async (model, paging) => { data: async (model, paging) => {
@ -22,7 +22,17 @@ const table = useTable({
{ {
title: "登陆账号", title: "登陆账号",
dataIndex: "nickname", dataIndex: "nickname",
width: 140, width: 200,
render({ record }) {
return (
<div class="flex flex-col overflow-hidden">
<span>{record.nickname}</span>
<span class="text-gray-400 text-xs truncate">
{dayjs(record.createdAt).format()}
</span>
</div>
);
},
}, },
{ {
title: "操作描述", title: "操作描述",
@ -42,12 +52,6 @@ const table = useTable({
); );
}, },
}, },
{
title: "登陆地址",
dataIndex: "ip",
width: 200,
render: ({ record }) => `${record.addr || "未知"}(${record.ip})`,
},
{ {
title: "操作系统", title: "操作系统",
dataIndex: "os", dataIndex: "os",
@ -59,10 +63,10 @@ const table = useTable({
width: 160, width: 160,
}, },
{ {
title: "登陆时间", title: "登陆地址",
dataIndex: "createdAt", dataIndex: "ip",
width: 160, width: 200,
render: ({ record }) => dayjs(record.createdAt).fromNow(), render: ({ record }) => `${record.addr || "未知"}(${record.ip})`,
}, },
], ],
search: { search: {