登录日志

This commit is contained in:
zhx 2026-05-06 21:11:05 +08:00
parent 34a84375e3
commit 2647354e41

View File

@ -47,13 +47,15 @@ const columns = [
{ dataIndex: 'user', key: 'user', title: '用户', width: 240 },
{ dataIndex: 'deviceId', key: 'deviceId', title: '设备ID', width: 220 },
{ dataIndex: 'ip', key: 'ip', title: 'IP', width: 160 },
{ dataIndex: 'ipLocation', key: 'ipLocation', title: 'IP地区', width: 220 },
{ dataIndex: 'loginBlocked', key: 'loginBlocked', title: '是否屏蔽', width: 120 },
{ dataIndex: 'loginTypeName', key: 'loginTypeName', title: '登录方式', width: 120 },
{ dataIndex: 'appVersion', key: 'appVersion', title: 'App版本', width: 120 },
{ dataIndex: 'createTime', key: 'createTime', title: '登录时间', width: 180 },
{ dataIndex: 'actions', key: 'actions', title: '操作', width: 220 },
];
const tableScroll = computed(() => ({ x: 1480 }));
const tableScroll = computed(() => ({ x: 1820 }));
function getUserId(record: Record<string, any>) {
return String(record.userProfile?.id || record.id || record.userId || '');
@ -75,6 +77,14 @@ function getVipStatusName(record: Record<string, any>) {
return record.userProfile?.vipStatusName || record.vipStatusName || '';
}
function getIpLocation(record: Record<string, any>) {
const parts = [
record.ipCountryName || record.ipCountryCode,
record.ipRegion,
].filter(Boolean);
return parts.length > 0 ? parts.join(' / ') : '-';
}
async function loadData(reset = false) {
if (reset) {
query.cursor = 1;
@ -179,6 +189,20 @@ loadData(true);
{{ record.ip || '-' }}
</a>
</template>
<template v-else-if="column.key === 'ipLocation'">
{{ getIpLocation(record) }}
</template>
<template v-else-if="column.key === 'loginBlocked'">
<Tag v-if="record.loginBlocked" color="red">
已屏蔽
</Tag>
<Tag v-else color="green">
未屏蔽
</Tag>
<div v-if="record.blockReason" class="block-reason">
{{ record.blockReason }}
</div>
</template>
<template v-else-if="column.key === 'createTime'">
{{ formatDate(record.createTime) }}
</template>
@ -272,6 +296,12 @@ loadData(true);
font-size: 12px;
}
.block-reason {
color: rgb(100 116 139);
font-size: 12px;
margin-top: 4px;
}
.pager {
display: flex;
justify-content: flex-end;