Skip to content

Commit 3437a78

Browse files
authored
Merge pull request #44 from safe1ine/main
修改了用户管理页面的样式
2 parents e3cf805 + 82d5042 commit 3437a78

5 files changed

Lines changed: 115 additions & 119 deletions

File tree

ui/src/components/header/Bread.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const OtherBread = {
99
chat: { title: '对话记录', to: '/chat' },
1010
completion: { title: '补全记录', to: '/completion' },
1111
model: { title: '模型管理', to: '/model' },
12-
user: { title: '用户管理', to: '/user' },
12+
user: { title: '成员管理', to: '/user' },
1313
admin: { title: '管理员', to: '/admin' },
1414
};
1515

ui/src/components/sidebar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const menus = [
4545
show: true,
4646
},
4747
{
48-
label: '用户管理',
48+
label: '成员管理',
4949
value: '/user',
5050
pathname: 'user',
5151
icon: 'icon-yonghuguanli1',

ui/src/pages/model/components/modelCard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ const ModelItem = ({
7878
overflow: 'hidden',
7979
position: 'relative',
8080
transition: 'all 0.3s ease',
81+
borderStyle: 'solid',
82+
borderWidth: '1px',
83+
borderColor: data.is_active ? 'success.main' : 'transparent',
8184
boxShadow:
8285
'0px 0px 10px 0px rgba(68, 80, 91, 0.1), 0px 0px 2px 0px rgba(68, 80, 91, 0.1)',
8386
'&:hover': {

ui/src/pages/user/index.tsx

Lines changed: 81 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -72,98 +72,90 @@ const User = () => {
7272
};
7373

7474
return (
75-
<Stack gap={2}>
76-
<Grid container spacing={2}>
77-
<Grid size={6} container>
78-
<Grid size={12}>
79-
<StyledCard>
80-
<StyledLabel>强制成员启用两步认证</StyledLabel>
81-
<Switch
82-
checked={data?.force_two_factor_auth}
83-
onChange={(e) => {
84-
updateSetting({ force_two_factor_auth: e.target.checked });
85-
}}
86-
/>
87-
</StyledCard>
88-
</Grid>
89-
<Grid size={12}>
90-
<StyledCard>
91-
<StyledLabel>禁止成员使用密码登录</StyledLabel>
92-
<Switch
93-
checked={data?.disable_password_login}
94-
onChange={(e) =>
95-
updateSetting({ disable_password_login: e.target.checked })
75+
<Stack gap={2} direction={'row'}>
76+
<Stack gap={2} direction={'column'}>
77+
<MemberManage />
78+
</Stack>
79+
<Stack gap={2} direction={'column'}>
80+
<Card >
81+
<StyledLabel>第三方登录</StyledLabel>
82+
<Stack
83+
direction='row'
84+
alignItems='center'
85+
spacing={2}
86+
sx={{ mt: 2 }}
87+
>
88+
<Button
89+
variant='outlined'
90+
color='primary'
91+
sx={{ gap: 3 }}
92+
onClick={() => {
93+
if (dingdingCheck) {
94+
onDisabledDingdingLogin();
95+
} else {
96+
setDingdingLoginSettingModalOpen(true);
9697
}
97-
/>
98-
</StyledCard>
99-
</Grid>
100-
</Grid>
101-
<Grid size={6} container>
102-
<Grid size={12}>
103-
<Card sx={{ height: '100%' }}>
104-
<StyledLabel>第三方登录</StyledLabel>
105-
<Stack
106-
direction='row'
107-
alignItems='center'
108-
spacing={2}
109-
sx={{ mt: 2, height: 'calc(100% - 40px)' }}
110-
>
111-
<Button
112-
variant='outlined'
113-
color='primary'
114-
sx={{ gap: 3 }}
115-
onClick={() => {
116-
if (dingdingCheck) {
117-
onDisabledDingdingLogin();
118-
} else {
119-
setDingdingLoginSettingModalOpen(true);
120-
}
121-
}}
122-
>
123-
<Radio size='small' sx={{ p: 0.5 }} checked={dingdingCheck} />
124-
<Stack direction='row' alignItems='center' gap={2}>
125-
<Stack direction='row' alignItems='center' gap={1}>
126-
<Icon type='icon-dingding' sx={{ fontSize: 18 }}></Icon>
127-
钉钉
128-
</Stack>
129-
</Stack>
130-
</Button>
131-
<Button
132-
variant='outlined'
133-
color='primary'
134-
sx={{ gap: 3 }}
135-
disabled
136-
>
137-
<Radio size='small' sx={{ p: 0.5 }} disabled />
138-
<Stack direction='row' alignItems='center' gap={2}>
139-
<Stack direction='row' alignItems='center' gap={1}>
140-
<Icon type='icon-weixin' sx={{ fontSize: 18 }}></Icon>
141-
微信
142-
</Stack>
143-
</Stack>
144-
</Button>
145-
<Button
146-
variant='outlined'
147-
color='primary'
148-
sx={{ gap: 3 }}
149-
disabled
150-
>
151-
<Radio size='small' sx={{ p: 0.5 }} disabled />
152-
<Stack direction='row' alignItems='center' gap={2}>
153-
<Stack direction='row' alignItems='center' gap={1}>
154-
<Icon type='icon-github' sx={{ fontSize: 18 }}></Icon>
155-
GitHub
156-
</Stack>
157-
</Stack>
158-
</Button>
98+
}}
99+
>
100+
<Radio size='small' sx={{ p: 0.5 }} checked={dingdingCheck} />
101+
<Stack direction='row' alignItems='center' gap={2}>
102+
<Stack direction='row' alignItems='center' gap={1}>
103+
<Icon type='icon-dingding' sx={{ fontSize: 18 }}></Icon>
104+
钉钉
105+
</Stack>
159106
</Stack>
160-
</Card>
161-
</Grid>
162-
</Grid>
163-
</Grid>
107+
</Button>
108+
<Button
109+
variant='outlined'
110+
color='primary'
111+
sx={{ gap: 3 }}
112+
disabled
113+
>
114+
<Radio size='small' sx={{ p: 0.5 }} disabled />
115+
<Stack direction='row' alignItems='center' gap={2}>
116+
<Stack direction='row' alignItems='center' gap={1}>
117+
<Icon type='icon-weixin' sx={{ fontSize: 18 }}></Icon>
118+
微信
119+
</Stack>
120+
</Stack>
121+
</Button>
122+
<Button
123+
variant='outlined'
124+
color='primary'
125+
sx={{ gap: 3 }}
126+
disabled
127+
>
128+
<Radio size='small' sx={{ p: 0.5 }} disabled />
129+
<Stack direction='row' alignItems='center' gap={2}>
130+
<Stack direction='row' alignItems='center' gap={1}>
131+
<Icon type='icon-github' sx={{ fontSize: 18 }}></Icon>
132+
GitHub
133+
</Stack>
134+
</Stack>
135+
</Button>
136+
</Stack>
137+
</Card>
138+
<StyledCard>
139+
<StyledLabel>禁止成员使用密码登录</StyledLabel>
140+
<Switch
141+
checked={data?.disable_password_login}
142+
onChange={(e) =>
143+
updateSetting({ disable_password_login: e.target.checked })
144+
}
145+
/>
146+
</StyledCard>
147+
<StyledCard>
148+
<StyledLabel>强制成员启用两步认证</StyledLabel>
149+
<Switch
150+
checked={data?.force_two_factor_auth}
151+
onChange={(e) => {
152+
updateSetting({ force_two_factor_auth: e.target.checked });
153+
}}
154+
/>
155+
</StyledCard>
156+
<LoginHistory />
157+
</Stack>
164158

165-
<MemberManage />
166-
<LoginHistory />
167159
<DingingLoginSettingModal
168160
open={dingdingLoginSettingModalOpen}
169161
onClose={() => setDingdingLoginSettingModalOpen(false)}

ui/src/pages/user/memberManage.tsx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import {
1111
TextField,
1212
Chip,
1313
Paper,
14-
ButtonBase,
14+
Link,
1515
IconButton,
1616
Menu,
1717
MenuItem,
18+
Typography,
1819
} from '@mui/material';
1920
import { Table, MenuSelect, Modal, message } from '@c-x/ui';
2021
import InviteUserModal from './inviteUserModal';
@@ -23,6 +24,7 @@ import { ConstsUserStatus, DomainUser } from '@/api/types';
2324
import dayjs from 'dayjs';
2425
import { CopyToClipboard } from 'react-copy-to-clipboard';
2526
import ErrorRoundedIcon from '@mui/icons-material/ErrorRounded';
27+
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
2628

2729
const ResetPasswordModal = ({
2830
open,
@@ -248,40 +250,39 @@ const MemberManage = () => {
248250
{
249251
title: '账号',
250252
dataIndex: 'username',
251-
},
252-
{
253-
title: '两步认证',
254-
dataIndex: 'two_step_auth',
255-
render: (text) => {
256-
return text ? (
257-
<Chip label='启动' color='success' size='small' />
258-
) : (
259-
<Chip label='未启用' size='small' />
260-
);
253+
render: (text, record) => {
254+
return <>
255+
<Stack>
256+
<Link onClick={() => navigate(`/dashboard/member/${record.id}`)} sx={{
257+
'&:hover': {
258+
color: 'info.main',
259+
},
260+
cursor: 'pointer'
261+
}}>
262+
<Stack direction={'row'}>
263+
<AccountCircleIcon fontSize='small' sx={{ mr: 1, lineHeight: 24 }}/>
264+
<Typography>{text}</Typography>
265+
</Stack>
266+
</Link>
267+
<Typography color='text.auxiliary'>{record.email}</Typography>
268+
</Stack>
269+
</>;
261270
},
262271
},
263272
{
264-
title: '最近活跃时间',
265-
dataIndex: 'last_active_at',
273+
title: '加入时间',
274+
dataIndex: 'created_at',
275+
width: 120,
266276
render: (text) => {
267-
return dayjs.unix(text).format('YYYY-MM-DD HH:mm:ss');
277+
return dayjs.unix(text).fromNow();
268278
},
269279
},
270280
{
271-
title: '统计使用情况',
272-
dataIndex: 'status',
273-
render: (_, record) => {
274-
return (
275-
<ButtonBase
276-
disableRipple
277-
onClick={() => navigate(`/dashboard/member/${record.id}`)}
278-
sx={{
279-
color: 'info.main',
280-
}}
281-
>
282-
点击查看
283-
</ButtonBase>
284-
);
281+
title: '最近活跃',
282+
dataIndex: 'last_active_at',
283+
width: 120,
284+
render: (text, record) => {
285+
return record.last_active_at === 0 ? '从未使用' : dayjs.unix(text).fromNow();
285286
},
286287
},
287288
{

0 commit comments

Comments
 (0)