diff --git a/src/components/article/edit-modal.tsx b/src/components/article/edit-modal.tsx index b9be0c2..9c8ee7c 100644 --- a/src/components/article/edit-modal.tsx +++ b/src/components/article/edit-modal.tsx @@ -85,7 +85,7 @@ export default function ArticleEditModal(props: Props) { } const save = props.type == 'news' ? article.save : regenerate setState({loading: true}) - save(title, groups, props.id && props.id > 0 ? props.id : undefined).then(() => { + save(title, groups[0][0].content, groups.slice(1), props.id && props.id > 0 ? props.id : undefined).then(() => { props.onClose?.(true) }).catch(e => { setState({error: e.data || '保存失败,请重试!'}) @@ -111,7 +111,7 @@ export default function ArticleEditModal(props: Props) { if (typeof (props.id) != 'undefined') { if (props.id > 0) { article.getById(props.id).then(res => { - setGroups(rebuildGroups(res.content_group)) + setGroups(rebuildGroups([[{content: res.metahuman_text, type: "text"}], ...res.content_group])) setTitle(res.title) }) } else { diff --git a/src/pages/library/components/video-detail.tsx b/src/pages/library/components/video-detail.tsx index c62ab83..b51a1ef 100644 --- a/src/pages/library/components/video-detail.tsx +++ b/src/pages/library/components/video-detail.tsx @@ -51,11 +51,11 @@ export default function VideoDetail({video, onClose,autoPlay}: Props) {
- + - +
diff --git a/src/pages/library/index.tsx b/src/pages/library/index.tsx index 3b65e21..a6c75ae 100644 --- a/src/pages/library/index.tsx +++ b/src/pages/library/index.tsx @@ -71,6 +71,7 @@ export default function LibraryIndex() { autoPlay: boolean }>() const handleAllCheckedChange = (checked: boolean) => { + if (!data) return; setCheckedIdArray(checked ? data.list.map(v => v.id) : []) setState({ checkedAll: !state.checkedAll @@ -158,6 +159,7 @@ export default function LibraryIndex() { className='bg-gray-300 hover:bg-gray-400 text-white' icon={} title={`你确定要删除选择的 ${checkedIdArray.length} 条视频吗?`} + emptyMessage={'请选择要删除的视频'} confirmMessage={'删除后需重新生成视频'} onProcess={deleteHistories} >批量删除} @@ -167,6 +169,7 @@ export default function LibraryIndex() { className='bg-[#4096ff] hover:bg-blue-600 text-white' icon={} onProcess={push2room} + emptyMessage={'请选择要推流的视频'} >一键推流} ) diff --git a/src/service/api/article.ts b/src/service/api/article.ts index ec5e76b..1e3118f 100644 --- a/src/service/api/article.ts +++ b/src/service/api/article.ts @@ -20,9 +20,10 @@ export function getById(id: Id) { return post({url: '/article/detail/' + id}) } -export function save(title: string, content_group: BlockContent[][], id?: number) { +export function save(title: string, metahuman_text: string, content_group: BlockContent[][], id?: number) { return post<{ content: string }>(id && id > 0 ? '/article/modify' : '/article/create/new', { title, + metahuman_text, content_group, id }) diff --git a/src/service/api/video.ts b/src/service/api/video.ts index 694f09f..1d34001 100644 --- a/src/service/api/video.ts +++ b/src/service/api/video.ts @@ -21,11 +21,12 @@ export function deleteHistories(ids: Id[]) { * @param content_group * @param article_id */ -export function regenerate(title: string, content_group: BlockContent[][], article_id?: Id) { +export function regenerate(title: string, metahuman_text: string, content_group: BlockContent[][], article_id?: Id) { return post<{ content: string }>({ url: '/video/regenerate', data: { title, + metahuman_text, content_group, article_id } diff --git a/src/types/core.d.ts b/src/types/core.d.ts index 9022610..dc8f558 100644 --- a/src/types/core.d.ts +++ b/src/types/core.d.ts @@ -31,6 +31,7 @@ declare interface ArticleContentGroup { declare interface ArticleDetail { id: number; title: string; + metahuman_text: string; content_group: BlockContent[][] }