Skip to content

Commit febd8f1

Browse files
committed
显示相对时间
1 parent 45f88ec commit febd8f1

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

web/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import { RecoilRoot } from 'recoil';
88
import { SnackbarProvider } from 'notistack';
99
import Zoom from '@mui/material/Zoom';
1010
import dayjs from 'dayjs';
11+
import relativeTime from 'dayjs/plugin/relativeTime';
1112
import 'dayjs/locale/zh-cn';
1213
import App from './app';
1314

1415
dayjs.locale('zh-cn');
16+
dayjs.extend(relativeTime);
1517

1618
// 某些第三方模块(react-pin-input)大量打印 debug 日志
1719
if (process.env.NODE_ENV === 'production') {

web/src/route/system/event/index.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ import Typography from '@mui/material/Typography';
2020
import Chip from '@mui/material/Chip';
2121
import { useSnackbar } from 'notistack';
2222
import dayjs from 'dayjs';
23-
import relativeTime from 'dayjs/plugin/relativeTime';
2423
import SearchInput from '~/comp/search-input';
2524
import Markdown from '~/comp/markdown';
2625
import titleState from "~/state/title";
2726
import { post, put } from '~/rest';
2827

29-
dayjs.extend(relativeTime);
30-
3128
export default function Event() {
3229
const { enqueueSnackbar } = useSnackbar();
3330
const setTitle = useSetRecoilState(titleState);

web/src/route/system/user/list.jsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ export default function List() {
153153
<TableCell align='center'>姓名</TableCell>
154154
<TableCell align='center'>访问控制</TableCell>
155155
<TableCell align='center'>创建时间</TableCell>
156-
<TableCell align='center'>登录时间 / 次数</TableCell>
156+
<TableCell align='center'>最后登录时间</TableCell>
157+
<TableCell align='center'>登录次数</TableCell>
157158
<TableCell as='td' align='right' colSpan={2} padding='checkbox' />
158159
</TableRow>
159160
</TableHead>
@@ -172,12 +173,9 @@ export default function List() {
172173
<Typography variant='body2'>{u.acl_name}</Typography>
173174
}
174175
</TableCell>
175-
<TableCell align="center">
176-
{dayjs(u.create_at).format('YY-MM-DD HH:mm:ss')}
177-
</TableCell>
178-
<TableCell align="center">
179-
{dayjs(u.signin_at).format('YY-MM-DD HH:mm:ss')} / {u.n_signin}
180-
</TableCell>
176+
<TableCell align="center">{dayjs(u.create_at).fromNow()}</TableCell>
177+
<TableCell align="center">{dayjs(u.signin_at).fromNow()}</TableCell>
178+
<TableCell align="center">{u.n_signin}</TableCell>
181179
<TableCell align="right" padding='none'>
182180
{u.deleted &&
183181
<RemoveCircleOutlineIcon color='error' fontSize='small'

0 commit comments

Comments
 (0)