update: 添加删除
This commit is contained in:
parent
08e4de4a90
commit
a8b672037c
@ -2,11 +2,11 @@ import {Checkbox, Empty, Space} from "antd";
|
|||||||
import React, {useEffect, useMemo, useRef, useState} from "react";
|
import React, {useEffect, useMemo, useRef, useState} from "react";
|
||||||
import {DndContext} from "@dnd-kit/core";
|
import {DndContext} from "@dnd-kit/core";
|
||||||
import {arrayMove, SortableContext} from "@dnd-kit/sortable";
|
import {arrayMove, SortableContext} from "@dnd-kit/sortable";
|
||||||
import {useSetState, useTimeout} from "ahooks";
|
import {useSetState} from "ahooks";
|
||||||
|
|
||||||
import {VideoListItem} from "@/components/video/video-list-item.tsx";
|
import {VideoListItem} from "@/components/video/video-list-item.tsx";
|
||||||
import ArticleEditModal from "@/components/article/edit-modal.tsx";
|
import ArticleEditModal from "@/components/article/edit-modal.tsx";
|
||||||
import {deleteByIds, getList, modifyOrder, VideoStatus} from "@/service/api/video.ts";
|
import {deleteFromList, getList, modifyOrder, VideoStatus} from "@/service/api/video.ts";
|
||||||
import {formatDuration} from "@/util/strings.ts";
|
import {formatDuration} from "@/util/strings.ts";
|
||||||
import ButtonBatch from "@/components/button-batch.tsx";
|
import ButtonBatch from "@/components/button-batch.tsx";
|
||||||
import {showErrorToast, showToast} from "@/components/message.ts";
|
import {showErrorToast, showToast} from "@/components/message.ts";
|
||||||
@ -131,7 +131,7 @@ export default function VideoIndex() {
|
|||||||
}
|
}
|
||||||
}, [videoData, scrollerRef])
|
}, [videoData, scrollerRef])
|
||||||
const processDeleteVideo = async (ids: Id[]) => {
|
const processDeleteVideo = async (ids: Id[]) => {
|
||||||
deleteByIds(ids).then(() => {
|
deleteFromList(ids).then(() => {
|
||||||
showToast('删除成功!', 'success')
|
showToast('删除成功!', 'success')
|
||||||
loadList()
|
loadList()
|
||||||
}).catch(showErrorToast)
|
}).catch(showErrorToast)
|
||||||
@ -256,7 +256,7 @@ export default function VideoIndex() {
|
|||||||
<div className="page-action">
|
<div className="page-action">
|
||||||
<ButtonToTop visible={state.showToTop} onClick={() => scrollerRef.current?.scrollToPosition(0)}/>
|
<ButtonToTop visible={state.showToTop} onClick={() => scrollerRef.current?.scrollToPosition(0)}/>
|
||||||
{checkedIdArray.length > 0 && <ButtonBatch
|
{checkedIdArray.length > 0 && <ButtonBatch
|
||||||
onProcess={deleteByIds}
|
onProcess={deleteFromList}
|
||||||
selected={checkedIdArray}
|
selected={checkedIdArray}
|
||||||
emptyMessage={`请选择要删除的新闻视频`}
|
emptyMessage={`请选择要删除的新闻视频`}
|
||||||
title={`已选择${checkedIdArray.length}条,确定要全部删除吗?`}
|
title={`已选择${checkedIdArray.length}条,确定要全部删除吗?`}
|
||||||
|
@ -7,12 +7,7 @@ export function search(params:VideoSearchParams) {
|
|||||||
return post<DataList<VideoInfo>>('/video/search',params)
|
return post<DataList<VideoInfo>>('/video/search',params)
|
||||||
}
|
}
|
||||||
export function deleteHistories(ids: Id[]) {
|
export function deleteHistories(ids: Id[]) {
|
||||||
console.log('deleteHistories',ids)
|
return post('/video/history/remove', {ids})
|
||||||
return new Promise<number>((resolve)=>{
|
|
||||||
setTimeout(()=>{
|
|
||||||
resolve(1)
|
|
||||||
},2000)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,8 +32,8 @@ export function getById(id: Id) {
|
|||||||
return post<VideoInfo>({url: '/video/detail/' + id})
|
return post<VideoInfo>({url: '/video/detail/' + id})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteByIds(ids: Id[]) {
|
export function deleteFromList(ids: Id[]) {
|
||||||
return post('/video/remove', {ids})
|
return post('/video/outside', {ids})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user