调整了管理页面的样式

This commit is contained in:
Monster
2025-07-31 18:29:47 +08:00
parent 6f7143ada7
commit 64544c109d
9 changed files with 90 additions and 57 deletions

View File

@@ -57,14 +57,6 @@ const ADMIN_MENUS = [
show: true,
disabled: false,
},
{
label: '管理员',
value: '/admin',
pathname: 'admin',
icon: 'icon-guanliyuan1',
show: true,
disabled: false,
},
{
label: '通用设置',
value: '/general-setting',

View File

@@ -1,19 +0,0 @@
import React from 'react';
import LoginHistory from './loginHistory';
import AdminTable from './adminTable';
import { Grid2 as Grid, Stack } from '@mui/material';
const Admin = () => {
return (
<Grid container spacing={2} sx={{ height: '100%' }}>
<Grid size={6}>
<AdminTable />
</Grid>
<Grid size={6}>
<LoginHistory />
</Grid>
</Grid>
);
};
export default Admin;

View File

@@ -12,7 +12,7 @@ type LoginHistory = NonNullable<
DomainListAdminLoginHistoryResp['login_histories']
>[number];
const LoginHistory = () => {
const AdminLoginHistory = () => {
const { data, loading } = useRequest(() => getAdminLoginHistory({}));
const columns: ColumnsType<LoginHistory> = [
{
@@ -55,9 +55,23 @@ const LoginHistory = () => {
direction='row'
justifyContent='space-between'
alignItems='center'
sx={{ mb: 2 }}
sx={{
mb: 2,
height: 32,
fontWeight: 'bold',
}}
>
<Box sx={{ fontWeight: 700, lineHeight: '36px' }}></Box>
<Box sx={{
'&::before': {
content: '""',
display: 'inline-block',
width: 4,
height: 12,
bgcolor: 'common.black',
borderRadius: '2px',
mr: 1,
},
}}></Box>
</Stack>
<Table
columns={columns}
@@ -71,4 +85,4 @@ const LoginHistory = () => {
);
};
export default LoginHistory;
export default AdminLoginHistory;

View File

@@ -151,7 +151,7 @@ const AddAdminModal = ({
);
};
const AdminTable = () => {
const AdminUser = () => {
const [open, setOpen] = useState(false);
const { data, loading, refresh } = useRequest(() => getListAdminUser({}));
const onDeleteAdmin = (data: DomainAdminUser) => {
@@ -187,19 +187,27 @@ const AdminTable = () => {
},
},
{
title: '最近活跃时间',
title: '加入时间',
dataIndex: 'created_at',
width: 140,
render: (text) => {
return dayjs.unix(text).fromNow();
},
},
{
title: '最近活跃',
dataIndex: 'last_active_at',
width: 140,
render: (text, record) => {
return <Stack direction='column'>
<Box sx={{ color: 'text.secondary' }}>{record.created_at ? dayjs.unix(record.created_at).fromNow() + '加入' : '加入时间未知'}</Box>
<Box sx={{ color: 'text.secondary' }}>{record.last_active_at ? dayjs.unix(record.last_active_at).fromNow() + '活跃' : '活跃时间未知'}</Box>
</Stack>
return record.last_active_at === 0
? '从未使用'
: dayjs.unix(text).fromNow();
},
},
{
title: '',
dataIndex: 'opt',
width: 200,
width: 100,
render: (_, record) => {
return (
<Button
@@ -215,14 +223,28 @@ const AdminTable = () => {
},
];
return (
<Card sx={{ height: '100%' }}>
<Card>
<Stack
direction='row'
justifyContent='space-between'
alignItems='center'
sx={{ mb: 2 }}
sx={{
mb: 2,
height: 32,
fontWeight: 'bold',
}}
>
<Box sx={{ fontWeight: 700, lineHeight: '36px' }}></Box>
<Box sx={{
'&::before': {
content: '""',
display: 'inline-block',
width: 4,
height: 12,
bgcolor: 'common.black',
borderRadius: '2px',
mr: 1,
},
}}></Box>
<Button
variant='contained'
color='primary'
@@ -249,4 +271,4 @@ const AdminTable = () => {
);
};
export default AdminTable;
export default AdminUser;

View File

@@ -0,0 +1,25 @@
import Card from '@/components/card';
import { Box, Stack } from "@mui/material"
import AdminUser from './adminUser';
import AdminLoginHistory from './adminLoginHistory';
const CardAdminUser = () => {
return <Card sx={{ p : 0, }}>
<Box sx={{
fontWeight: 'bold',
px: 2,
py: 1.5,
bgcolor: 'rgb(248, 249, 250)',
borderTopLeftRadius: '10px',
borderTopRightRadius: '10px',
}}></Box>
<Stack direction='column'>
<AdminUser />
<AdminLoginHistory />
</Stack>
</Card>
}
export default CardAdminUser;

View File

@@ -5,7 +5,7 @@ import { useEffect, useState } from "react"
import { getGetSetting, putUpdateSetting } from '@/api/Admin';
import { DomainUpdateSettingReq } from '@/api/types';
const BaseURLSettings = () => {
const CardServiceSettings = () => {
const [baseURL, setBaseURL] = useState('');
const [initialBaseURL, setInitialBaseURL] = useState('');
@@ -69,12 +69,14 @@ const BaseURLSettings = () => {
const hasValueChanged = baseURL !== initialBaseURL;
return <Card sx={{p : 0}}>
return <Card sx={{p : 0, borderBottom: '1px solid #e0e0e0'}}>
<Box sx={{
fontWeight: 'bold',
px: 2,
py: 1.5,
bgcolor: 'rgb(248, 249, 250)'
bgcolor: 'rgb(248, 249, 250)',
borderTopLeftRadius: '10px',
borderTopRightRadius: '10px',
}}>MonkeyCode </Box>
<Stack direction='column'>
<Box sx={{ width: '100%' }}>
@@ -117,4 +119,4 @@ const BaseURLSettings = () => {
</Card>
}
export default BaseURLSettings;
export default CardServiceSettings;

View File

@@ -1,14 +1,15 @@
import React from 'react';
import BaseURLSettings from './baseURLSettings';
import { Grid2 as Grid, Stack } from '@mui/material';
import CardServiceSettings from './components/cardServiceSettings';
import { Grid2 as Grid } from '@mui/material';
import CardAdminUser from './components/cardAdminUser';
const GeneralSetting = () => {
return (
<Grid container spacing={2} sx={{ height: '100%' }}>
<Grid size={6}>
<BaseURLSettings />
<CardServiceSettings />
</Grid>
<Grid size={6}>
<CardAdminUser />
</Grid>
</Grid>
);

View File

@@ -266,7 +266,7 @@ const MemberManage = () => {
{
title: '加入时间',
dataIndex: 'created_at',
width: 120,
width: 140,
render: (text) => {
return dayjs.unix(text).fromNow();
},
@@ -274,7 +274,7 @@ const MemberManage = () => {
{
title: '最近活跃',
dataIndex: 'last_active_at',
width: 120,
width: 140,
render: (text, record) => {
return record.last_active_at === 0
? '从未使用'
@@ -284,7 +284,7 @@ const MemberManage = () => {
{
title: '',
dataIndex: 'action',
width: 100,
width: 80,
render: (_, record) => {
return (
<IconButton

View File

@@ -83,10 +83,6 @@ const routerConfig = [
path: 'member-management',
element: <MemberManage />,
},
{
path: 'admin',
element: <Admin />,
},
{
path: 'general-setting',
element: <GeneralSetting />,