Merge remote-tracking branch 'origin/dev/main' into dev/main
This commit is contained in:
commit
08e4de4a90
@ -85,7 +85,7 @@ export default function ArticleEditModal(props: Props) {
|
|||||||
}
|
}
|
||||||
const save = props.type == 'news' ? article.save : regenerate
|
const save = props.type == 'news' ? article.save : regenerate
|
||||||
setState({loading: true})
|
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)
|
props.onClose?.(true)
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
setState({error: e.data || '保存失败,请重试!'})
|
setState({error: e.data || '保存失败,请重试!'})
|
||||||
@ -111,7 +111,7 @@ export default function ArticleEditModal(props: Props) {
|
|||||||
if (typeof (props.id) != 'undefined') {
|
if (typeof (props.id) != 'undefined') {
|
||||||
if (props.id > 0) {
|
if (props.id > 0) {
|
||||||
article.getById(props.id).then(res => {
|
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)
|
setTitle(res.title)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,11 +51,11 @@ export default function VideoDetail({video, onClose,autoPlay}: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end modal-control-footer">
|
<div className="flex justify-end modal-control-footer">
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<button disabled={state.pushing} className="text-gray-400 hover:text-gray-800 " type="text" onClick={pushToRoom}>一键推流</button>
|
<button disabled={state.pushing} className="text-gray-400 hover:text-gray-800 " type="button" onClick={pushToRoom}>一键推流</button>
|
||||||
<button disabled={state.exporting} className="text-gray-400 hover:text-gray-800 " onClick={downloadVideo}
|
<button disabled={state.exporting} className="text-gray-400 hover:text-gray-800 " onClick={downloadVideo}
|
||||||
type="text">下载视频
|
type="button">下载视频
|
||||||
</button>
|
</button>
|
||||||
<button onClick={onClose} type="text" className="text-gray-800 hover:text-blue-500">关闭</button>
|
<button onClick={onClose} type="button" className="text-gray-800 hover:text-blue-500">关闭</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -71,6 +71,7 @@ export default function LibraryIndex() {
|
|||||||
autoPlay: boolean
|
autoPlay: boolean
|
||||||
}>()
|
}>()
|
||||||
const handleAllCheckedChange = (checked: boolean) => {
|
const handleAllCheckedChange = (checked: boolean) => {
|
||||||
|
if (!data) return;
|
||||||
setCheckedIdArray(checked ? data.list.map(v => v.id) : [])
|
setCheckedIdArray(checked ? data.list.map(v => v.id) : [])
|
||||||
setState({
|
setState({
|
||||||
checkedAll: !state.checkedAll
|
checkedAll: !state.checkedAll
|
||||||
@ -158,6 +159,7 @@ export default function LibraryIndex() {
|
|||||||
className='bg-gray-300 hover:bg-gray-400 text-white'
|
className='bg-gray-300 hover:bg-gray-400 text-white'
|
||||||
icon={<IconDelete className=""/>}
|
icon={<IconDelete className=""/>}
|
||||||
title={`你确定要删除选择的 ${checkedIdArray.length} 条视频吗?`}
|
title={`你确定要删除选择的 ${checkedIdArray.length} 条视频吗?`}
|
||||||
|
emptyMessage={'请选择要删除的视频'}
|
||||||
confirmMessage={'删除后需重新生成视频'}
|
confirmMessage={'删除后需重新生成视频'}
|
||||||
onProcess={deleteHistories}
|
onProcess={deleteHistories}
|
||||||
>批量删除</ButtonBatch>}
|
>批量删除</ButtonBatch>}
|
||||||
@ -167,6 +169,7 @@ export default function LibraryIndex() {
|
|||||||
className='bg-[#4096ff] hover:bg-blue-600 text-white'
|
className='bg-[#4096ff] hover:bg-blue-600 text-white'
|
||||||
icon={<IconArrowRight className={'text-white'}/>}
|
icon={<IconArrowRight className={'text-white'}/>}
|
||||||
onProcess={push2room}
|
onProcess={push2room}
|
||||||
|
emptyMessage={'请选择要推流的视频'}
|
||||||
>一键推流</ButtonBatch>}
|
>一键推流</ButtonBatch>}
|
||||||
</div>
|
</div>
|
||||||
</>)
|
</>)
|
||||||
|
@ -20,9 +20,10 @@ export function getById(id: Id) {
|
|||||||
return post<ArticleDetail>({url: '/article/detail/' + id})
|
return post<ArticleDetail>({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', {
|
return post<{ content: string }>(id && id > 0 ? '/article/modify' : '/article/create/new', {
|
||||||
title,
|
title,
|
||||||
|
metahuman_text,
|
||||||
content_group,
|
content_group,
|
||||||
id
|
id
|
||||||
})
|
})
|
||||||
|
@ -21,11 +21,12 @@ export function deleteHistories(ids: Id[]) {
|
|||||||
* @param content_group
|
* @param content_group
|
||||||
* @param article_id
|
* @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 }>({
|
return post<{ content: string }>({
|
||||||
url: '/video/regenerate',
|
url: '/video/regenerate',
|
||||||
data: {
|
data: {
|
||||||
title,
|
title,
|
||||||
|
metahuman_text,
|
||||||
content_group,
|
content_group,
|
||||||
article_id
|
article_id
|
||||||
}
|
}
|
||||||
|
1
src/types/core.d.ts
vendored
1
src/types/core.d.ts
vendored
@ -31,6 +31,7 @@ declare interface ArticleContentGroup {
|
|||||||
declare interface ArticleDetail {
|
declare interface ArticleDetail {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
|
metahuman_text: string;
|
||||||
content_group: BlockContent[][]
|
content_group: BlockContent[][]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user