story操作权限限制
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit

This commit is contained in:
2025-12-31 14:30:03 +08:00
parent 5f433ab231
commit 1e93920162
6 changed files with 49 additions and 20 deletions

View File

@@ -10,13 +10,13 @@ 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);
};
@@ -27,6 +27,7 @@ interface Props {
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
handleDelete: () => void;
handOption: (item: StoryItem, option: 'add' | 'edit' | 'addSubItem' | 'editSubItem') => void;
disableEdit?: boolean;
}
const TimelineItemDrawer: React.FC<Props> = (props) => {
@@ -55,7 +56,7 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
// 格式化日期显示
const formatDate = (dateString: string | number[] | undefined) => {
if (!dateString) return '';
const formattedTime = formatTimeArray(dateString);
const date = new Date(formattedTime);
return date.toLocaleString('zh-CN', {
@@ -99,7 +100,7 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
</div>
</div>
}
footer={
footer={ {disableEdit ??
<div style={{ textAlign: 'right' }}>
<Space>
<Button
@@ -132,8 +133,7 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
<Button onClick={closeDrawer}></Button>
</Space>
</div>
}
>
>}}
<div style={{ padding: '0 24px' }}>
<div style={{ marginBottom: '24px' }}>
<h3>描述</h3>
@@ -204,4 +204,4 @@ const TimelineItemDrawer: React.FC<Props> = (props) => {
);
};
export default TimelineItemDrawer;
export default TimelineItemDrawer;