增加用户中心、用户注册登录

This commit is contained in:
jiangh277
2025-12-26 15:12:49 +08:00
parent 1eb1dafe1e
commit 07e011febd
43 changed files with 2006 additions and 611 deletions

View File

@@ -4,9 +4,23 @@ import { StoryItem } from '@/pages/story/data';
import { queryStoryItemImages } from '@/pages/story/service';
import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { useIntl, useRequest } from '@umijs/max';
import { Button, Divider, Drawer, Popconfirm, Space } from 'antd';
import { Button, Divider, Drawer, Popconfirm, Space, Tag } from 'antd';
import React, { useEffect } from 'react';
// 格式化时间数组为易读格式
const formatTimeArray = (time: string | number[] | undefined): string => {
if (!time) return '';
// 如果是数组格式 [2025, 12, 23, 8, 55, 39]
if (Array.isArray(time)) {
const [year, month, day, hour, minute, second] = time;
return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')} ${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}:${String(second).padStart(2, '0')}`;
}
// 如果已经是字符串格式,直接返回
return String(time);
};
interface Props {
storyItem: StoryItem;
open: boolean;
@@ -39,9 +53,11 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
};
// 格式化日期显示
const formatDate = (dateString: string) => {
const formatDate = (dateString: string | number[] | undefined) => {
if (!dateString) return '';
const date = new Date(dateString);
const formattedTime = formatTimeArray(dateString);
const date = new Date(formattedTime);
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
@@ -63,9 +79,23 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
zIndex={1000}
title={
<div>
<h2 style={{ margin: 0 }}>{storyItem.title}</h2>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<h2 style={{ margin: 0 }}>{storyItem.title}</h2>
<div style={{ display: 'flex', gap: '8px' }}>
{storyItem.createName && (
<Tag color="blue">
: {storyItem.createName}
</Tag>
)}
{storyItem.updateName && storyItem.updateName !== storyItem.createName && (
<Tag color="green">
: {storyItem.updateName}
</Tag>
)}
</div>
</div>
<div style={{ fontSize: '14px', color: '#888', marginTop: '4px' }}>
{storyItem.storyItemTime} {storyItem.location ? `${storyItem.location}` : ''}
{formatTimeArray(storyItem.storyItemTime)} {storyItem.location ? `${storyItem.location}` : ''}
</div>
</div>
}
@@ -158,9 +188,13 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
<div style={{ color: '#888', marginBottom: '4px' }}></div>
<div style={{ fontSize: '16px' }}>{formatDate(storyItem.updateTime)}</div>
</div>
<div style={{ flex: '1', minWidth: '200px' }}>
<div style={{ color: '#888', marginBottom: '4px' }}></div>
<div style={{ fontSize: '16px' }}>{storyItem.createName || '系统用户'}</div>
</div>
<div style={{ flex: '1', minWidth: '200px' }}>
<div style={{ color: '#888', marginBottom: '4px' }}></div>
<div style={{ fontSize: '16px' }}></div>
<div style={{ fontSize: '16px' }}>{storyItem.updateName || storyItem.createName || '系统用户'}</div>
</div>
</div>
</div>
@@ -170,4 +204,4 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
);
};
export default TimelineItemDrawer;
export default TimelineItemDrawer;