From 9c90ffda265792cb20211026af3264fc50e46ae3 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Mon, 23 Dec 2024 23:20:21 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=A7=86=E9=A2=91=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/video/video-list-item.tsx | 50 +++++++++++++------- src/pages/live/index.tsx | 2 +- src/pages/news/edit.tsx | 4 +- src/pages/news/index.tsx | 1 - src/pages/video/index.tsx | 60 ++++++++++++------------ src/routes/layout/dashboard-layout.tsx | 12 ++--- 6 files changed, 73 insertions(+), 56 deletions(-) diff --git a/src/components/video/video-list-item.tsx b/src/components/video/video-list-item.tsx index 4c56ea1..c5d8ab7 100644 --- a/src/components/video/video-list-item.tsx +++ b/src/components/video/video-list-item.tsx @@ -6,7 +6,7 @@ import {Checkbox, Popconfirm} from "antd"; import {CheckCircleFilled, MenuOutlined, MinusCircleFilled, LoadingOutlined} from "@ant-design/icons"; import ImageCover from '@/assets/images/cover.png' -import {IconEdit, IconPlay, IconPlaying} from "@/components/icons"; +import {IconDelete, IconEdit, IconPlay, IconPlaying} from "@/components/icons"; import {VideoStatus} from "@/service/api/video.ts"; import {formatTime} from "@/util/strings.ts"; @@ -52,8 +52,16 @@ export const VideoListItem = ( onClick={onItemClick} >
-
{index}
-
+
{index}
+
{generating && @@ -70,17 +78,25 @@ export const VideoListItem = (
}
-
+
{video.title || video.video_title}
-
{video.publish_time ? formatTime(video.publish_time) : ''}
+
{video.publish_time ? formatTime(video.publish_time) : ''}
- {sortable && !generating && (!active ? - : )} + {/*{sortable && !generating && (!active ?*/} + {/* : )}*/} {editable && !generating && <> {onEdit && @@ -91,13 +107,6 @@ export const VideoListItem = ( }} style={{fontSize: '1.1em'}}> } - { - if (onCheckedChange) { - onCheckedChange(!state.checked) - } else { - setState({checked: !state.checked}) - } - }} /> {onRemove && 请确认删除此视频?
} @@ -105,8 +114,15 @@ export const VideoListItem = ( okText="删除" cancelText="取消" > - + } + { + if (onCheckedChange) { + onCheckedChange(!state.checked) + } else { + setState({checked: !state.checked}) + } + }} /> }
diff --git a/src/pages/live/index.tsx b/src/pages/live/index.tsx index 1858b65..4d2f85c 100644 --- a/src/pages/live/index.tsx +++ b/src/pages/live/index.tsx @@ -145,7 +145,7 @@ export default function LiveIndex() { }) }, onCancel: () => { - showToast('退出并清除移动视频位置操作!', 'info'); + showToast('退出并恢复之前的直播队列!', 'info'); loadList() setEditable(false) } diff --git a/src/pages/news/edit.tsx b/src/pages/news/edit.tsx index b03b57c..c7c08c1 100644 --- a/src/pages/news/edit.tsx +++ b/src/pages/news/edit.tsx @@ -107,7 +107,7 @@ export default function NewEdit() { {data?.list?.map((item, i) => { const checked = selectedRowKeys.includes(item.id) return
-
+
setEditId(item.id)}>
{item.title}
{formatTime(item.publish_time, 'YYYY-MM-DD HH:mm')}
- setEditId(item.id)}> + {/**/} { handleDelete(item.id) }}> diff --git a/src/pages/news/index.tsx b/src/pages/news/index.tsx index be3e924..0a05b22 100644 --- a/src/pages/news/index.tsx +++ b/src/pages/news/index.tsx @@ -82,7 +82,6 @@ export default function NewsIndex() { {activeNews && setActiveNews(undefined)} >
diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx index 08fcabe..28e951b 100644 --- a/src/pages/video/index.tsx +++ b/src/pages/video/index.tsx @@ -65,12 +65,13 @@ export default function VideoIndex() { checkedAll: !state.checkedAll }) } - const handleModifySort = () => { - setVideoData((items) => { - modifyOrder(items.map(s => s.id)).catch(() => { - showToast('调整视频顺序失败,请重试!') - }).finally(loadList) - return items; + const handleModifySort = (items:VideoInfo[]) => { + // .then(() => { + // showToast('调整视频顺序成功!','success') + // }) + modifyOrder(items.map(s => s.id)).catch(()=>{ + loadList(); + showToast('调整视频顺序失败,请重试!','warning') }) } // @@ -94,8 +95,6 @@ export default function VideoIndex() { } },[videoData,scrollerRef]) - - return (
{contextHolder}
@@ -148,16 +147,18 @@ export default function VideoIndex() { setVideoData((items) => { oldIndex = items.findIndex(s => s.id == active.id); newIndex = items.findIndex(s => s.id == over.id); - return arrayMove(items, oldIndex, newIndex); + const newSorts = arrayMove(items, oldIndex, newIndex); + handleModifySort(newSorts) + return newSorts; }); - modal.confirm({ - title: '提示', - content: '是否要移动到指定位置', - onOk: handleModifySort, - onCancel: () => { - setVideoData(originArr); - } - }) + // modal.confirm({ + // title: '提示', + // content: '是否要移动到指定位置', + // onOk: handleModifySort, + // onCancel: () => { + // setVideoData(originArr); + // } + // }) } }}> @@ -179,6 +180,7 @@ export default function VideoIndex() { }) }} onItemClick={ () => playVideo(v, index)} + onRemove={()=>{}} onEdit={v.status == VideoStatus.Generating ? undefined : () => { setEditId(v.article_id) }} @@ -195,21 +197,21 @@ export default function VideoIndex() {
scrollerRef.current?.scrollToPosition(0)}/> - { + {checkedIdArray.length > 0 && { showToast('删除成功!', 'success') loadList() }} - > - 批量删除 - - + > + 批量删除 + + }
diff --git a/src/routes/layout/dashboard-layout.tsx b/src/routes/layout/dashboard-layout.tsx index 3fbf55a..5db3593 100644 --- a/src/routes/layout/dashboard-layout.tsx +++ b/src/routes/layout/dashboard-layout.tsx @@ -20,12 +20,12 @@ const NavigationUserContainer = () => { const {logout, user} = useAuth() const navigate = useNavigate() const items: MenuProps['items'] = [ - { - key: 'profile', - label:
{ - navigate('/history') - }}>视频库
, - }, + // { + // key: 'profile', + // label:
{ + // navigate('/history') + // }}>视频库
, + // }, { key: 'logout', label:
{