-
+
+
+
{editable ? <>
@@ -140,48 +185,66 @@ export default function LiveIndex() {
> :
}
-
+
+
+
+
-
{
- const {active, over} = e;
- if (over && active.id !== over.id) {
- let oldIndex = -1, newIndex = -1;
- const originArr = [...videoData]
- setVideoData((items) => {
- oldIndex = items.findIndex(s => s.id == active.id);
- newIndex = items.findIndex(s => s.id == over.id);
- return arrayMove(items, oldIndex, newIndex);
- });
- modal.confirm({
- title: '提示',
- content: '是否要移动到指定位置',
- onCancel: () => {
- setVideoData(originArr);
- },
- onOk: () => {
- setVideoData([...videoData])
- }
- })
- }
- }}>
-
- {videoData.map((v, index) => (
- {
- setCheckedIdArray(idArray => {
- return checked ? idArray.concat(v.id) : idArray.filter(id => id != v.id);
+
+
+
+ {videoData.map((v, index) => (
+
+ ))}
+
+
+ {
+ const {active, over} = e;
+ if (over && active.id !== over.id) {
+ let oldIndex = -1, newIndex = -1;
+ const originArr = [...videoData]
+ setVideoData((items) => {
+ oldIndex = items.findIndex(s => s.id == active.id);
+ newIndex = items.findIndex(s => s.id == over.id);
+ return arrayMove(items, oldIndex, newIndex);
+ });
+ modal.confirm({
+ title: '提示',
+ content: '是否要移动到指定位置',
+ onCancel: () => {
+ setVideoData(originArr);
+ },
+ onOk: () => {
+ setVideoData([...videoData])
+ }
})
- }}
- onRemove={() => processDeleteVideo([v.id])}
- editable={editable}
- />))}
-
-
+ }
+ }}>
+
+ {videoData.map((v, index) => (
+ {
+ setCheckedIdArray(idArray => {
+ return checked ? idArray.concat(v.id) : idArray.filter(id => id != v.id);
+ })
+ }}
+ onRemove={() => processDeleteVideo([v.id])}
+ editable={editable}
+ />))}
+
+
+
+
+
diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx
index 3c749f2..0ba080a 100644
--- a/src/pages/video/index.tsx
+++ b/src/pages/video/index.tsx
@@ -1,4 +1,4 @@
-import {message, Modal} from "antd";
+import {Empty, message, Modal} from "antd";
import React, {useEffect, useMemo, useRef, useState} from "react";
import {DndContext} from "@dnd-kit/core";
import {arrayMove, SortableContext} from "@dnd-kit/sortable";
@@ -43,7 +43,7 @@ export default function VideoIndex() {
})
}
- const playVideo = (video: VideoInfo,playingIndex:number) => {
+ const playVideo = (video: VideoInfo, playingIndex: number) => {
setState({
playingIndex
})
@@ -88,58 +88,61 @@ export default function VideoIndex() {
-
- {videoData.map((v, index) => (
-
- ))}
-
-
- {
- const {active, over} = e;
- if (over && active.id !== over.id) {
- let oldIndex = -1, newIndex = -1;
- const originArr = [...videoData]
- setVideoData((items) => {
- oldIndex = items.findIndex(s => s.id == active.id);
- newIndex = items.findIndex(s => s.id == over.id);
- return arrayMove(items, oldIndex, newIndex);
- });
- modal.confirm({
- title: '提示',
- content: '是否要移动到指定位置',
- onCancel: () => {
- setVideoData(originArr);
- }
- })
- }
- }}>
-
- {videoData.map((v, index) => (
- {
- setCheckedIdArray(idArray => {
- const newArr = checked ? idArray.concat(v.id) : idArray.filter(id => id != v.id);
- setState({checkedAll: newArr.length == videoData.length})
- return newArr;
- })
- }}
- onPlay={() => playVideo(v,index)}
- onEdit={() => {
- setEditId(v.article_id)
- }}
- editable
- />))}
-
-
-
+ {videoData.length == 0 ?
: <>
+
+ {videoData.map((v, index) => (
+
+ ))}
+
+
+ {
+ const {active, over} = e;
+ if (over && active.id !== over.id) {
+ let oldIndex = -1, newIndex = -1;
+ const originArr = [...videoData]
+ setVideoData((items) => {
+ oldIndex = items.findIndex(s => s.id == active.id);
+ newIndex = items.findIndex(s => s.id == over.id);
+ return arrayMove(items, oldIndex, newIndex);
+ });
+ modal.confirm({
+ title: '提示',
+ content: '是否要移动到指定位置',
+ onCancel: () => {
+ setVideoData(originArr);
+ }
+ })
+ }
+ }}>
+
+ {videoData.map((v, index) => (
+ {
+ setCheckedIdArray(idArray => {
+ const newArr = checked ? idArray.concat(v.id) : idArray.filter(id => id != v.id);
+ setState({checkedAll: newArr.length == videoData.length})
+ return newArr;
+ })
+ }}
+ onPlay={() => playVideo(v, index)}
+ onEdit={() => {
+ setEditId(v.article_id)
+ }}
+ editable
+ />))}
+
+
+
+ >}