Skip to content

Commit

Permalink
显示相对时间
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyxhu committed Apr 1, 2022
1 parent 45f88ec commit febd8f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 2 additions & 0 deletions web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { RecoilRoot } from 'recoil';
import { SnackbarProvider } from 'notistack';
import Zoom from '@mui/material/Zoom';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import 'dayjs/locale/zh-cn';
import App from './app';

dayjs.locale('zh-cn');
dayjs.extend(relativeTime);

// 某些第三方模块(react-pin-input)大量打印 debug 日志
if (process.env.NODE_ENV === 'production') {
Expand Down
3 changes: 0 additions & 3 deletions web/src/route/system/event/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ import Typography from '@mui/material/Typography';
import Chip from '@mui/material/Chip';
import { useSnackbar } from 'notistack';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import SearchInput from '~/comp/search-input';
import Markdown from '~/comp/markdown';
import titleState from "~/state/title";
import { post, put } from '~/rest';

dayjs.extend(relativeTime);

export default function Event() {
const { enqueueSnackbar } = useSnackbar();
const setTitle = useSetRecoilState(titleState);
Expand Down
12 changes: 5 additions & 7 deletions web/src/route/system/user/list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export default function List() {
<TableCell align='center'>姓名</TableCell>
<TableCell align='center'>访问控制</TableCell>
<TableCell align='center'>创建时间</TableCell>
<TableCell align='center'>登录时间 / 次数</TableCell>
<TableCell align='center'>最后登录时间</TableCell>
<TableCell align='center'>登录次数</TableCell>
<TableCell as='td' align='right' colSpan={2} padding='checkbox' />
</TableRow>
</TableHead>
Expand All @@ -172,12 +173,9 @@ export default function List() {
<Typography variant='body2'>{u.acl_name}</Typography>
}
</TableCell>
<TableCell align="center">
{dayjs(u.create_at).format('YY-MM-DD HH:mm:ss')}
</TableCell>
<TableCell align="center">
{dayjs(u.signin_at).format('YY-MM-DD HH:mm:ss')} / {u.n_signin}
</TableCell>
<TableCell align="center">{dayjs(u.create_at).fromNow()}</TableCell>
<TableCell align="center">{dayjs(u.signin_at).fromNow()}</TableCell>
<TableCell align="center">{u.n_signin}</TableCell>
<TableCell align="right" padding='none'>
{u.deleted &&
<RemoveCircleOutlineIcon color='error' fontSize='small'
Expand Down

0 comments on commit febd8f1

Please sign in to comment.