fixed: 不可以删除正在直播的视频;素材正文内容和图片都必须填写

This commit is contained in:
LittleBoy 2025-02-06 00:16:29 +08:00 committed by Coding
parent ac7e4b1b27
commit 829a135ef3
4 changed files with 30 additions and 7 deletions

View File

@ -100,9 +100,21 @@ export default function ArticleEditModal(props: Props) {
return; return;
} }
if (groups.length == 0 || groups[0].length == 0 || !groups[0][0].content) { if (groups.length == 0 || groups[0].length == 0 || !groups[0][0].content) {
// setState({msgGroup: '请输入正文文本内容'}); setState({msgGroup: t('news.edit_empty_human_content')});
return; return;
} }
// 验证图文都存在时,文图是否匹配
if(groups.length > 1) {
// 获取图文设置不正确的数据
const group = groups.filter((it,idx)=>{
return idx > 0 && (it.length < 2 || it.some(s=>s.content.trim().length == 0))
})
console.log('xxx',group)
if(group.length > 0){
setState({msgGroup: t('news.edit_empty_group_content')});
return;
}
}
if(!props.id || state.generating) return; if(!props.id || state.generating) return;
setState({generating:true}) setState({generating:true})
await article.save(title, groups[0][0].content, groups.slice(1), props.id) await article.save(title, groups[0][0].content, groups.slice(1), props.id)
@ -164,6 +176,7 @@ export default function ArticleEditModal(props: Props) {
setState({msgGroup: (list.length == 0 || list[0].length == 0 || !list[0][0].content) ? t('news.edit_notice_enter_article_content') : ''}); setState({msgGroup: (list.length == 0 || list[0].length == 0 || !list[0][0].content) ? t('news.edit_notice_enter_article_content') : ''});
}} }}
/> />
<div className="text-red-500">{state.msgGroup}</div>
</div> </div>
{state.error && <div className="text-red-500">{state.error}</div>} {state.error && <div className="text-red-500">{state.error}</div>}
</div> </div>

View File

@ -73,6 +73,8 @@
"edit_notice_keep_1": "Keep at least one content block", "edit_notice_keep_1": "Keep at least one content block",
"edit_other_text": "Other media Material", "edit_other_text": "Other media Material",
"edit_save_failed": "Save failed!", "edit_save_failed": "Save failed!",
"edit_empty_human_content": "Please enter meta human material",
"edit_empty_group_content": "Please other media material",
"editing": "Editing", "editing": "Editing",
"filter_all": "All", "filter_all": "All",
"filter_source": "News source", "filter_source": "News source",

View File

@ -69,10 +69,12 @@
"edit_notice_enter_article_content": "请输入正文文本内容", "edit_notice_enter_article_content": "请输入正文文本内容",
"edit_notice_enter_article_title": "请输入文章标题", "edit_notice_enter_article_title": "请输入文章标题",
"edit_notice_enter_article_title1": "请输入标题内容", "edit_notice_enter_article_title1": "请输入标题内容",
"edit_notice_enter_text": "请先填写当前组的内容", "edit_notice_enter_text": "请先填写文本内容",
"edit_notice_keep_1": "至少保留一个内容块", "edit_notice_keep_1": "至少保留一个内容块",
"edit_other_text": "素材融合呈现编辑区", "edit_other_text": "素材融合呈现编辑区",
"edit_save_failed": "保存失败,请重试!", "edit_save_failed": "保存失败,请重试!",
"edit_empty_human_content": "请先填写数字人播报内容",
"edit_empty_group_content": "正文文本和图片均不为空",
"editing": "新闻编辑", "editing": "新闻编辑",
"filter_all": "全部", "filter_all": "全部",
"filter_source": "新闻来源", "filter_source": "新闻来源",
@ -133,6 +135,7 @@
"delete_description_count": "已选择{{count}}条,确定要全部删除吗?", "delete_description_count": "已选择{{count}}条,确定要全部删除吗?",
"delete_empty": "请选择要删除的视频", "delete_empty": "请选择要删除的视频",
"download": "下载视频", "download": "下载视频",
"generating": "生成中",
"playing": "播放中", "playing": "播放中",
"push_confirm": "是否确定一键推流选中新闻视频?", "push_confirm": "是否确定一键推流选中新闻视频?",
"push_empty": "请选择要推流的新闻视频", "push_empty": "请选择要推流的新闻视频",

View File

@ -206,6 +206,11 @@ export default function LiveIndex() {
return checkedIdArray.filter(id => currentId.id != id) return checkedIdArray.filter(id => currentId.id != id)
}, [checkedIdArray, state.activeIndex]) }, [checkedIdArray, state.activeIndex])
const currentSelectedVideoIds = useMemo(()=>{
const activeId = videoData[state.activeIndex].id;
return checkedIdArray.length == 0 ? [] : checkedIdArray.filter(id => id != activeId)
},[checkedIdArray,state.activeIndex])
return (<div className="container py-5 page-live"> return (<div className="container py-5 page-live">
<div className="h-[36px]"></div> <div className="h-[36px]"></div>
<div className="flex"> <div className="flex">
@ -320,14 +325,14 @@ export default function LiveIndex() {
</div> </div>
<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 {currentSelectedVideoIds.length > 0 && <ButtonBatch
className='bg-gray-300 hover:bg-gray-400 text-white' className='bg-gray-300 hover:bg-gray-400 text-white'
selected={checkedIdArray} selected={currentSelectedVideoIds}
emptyMessage={t('video.delete_empty')} emptyMessage={t('video.delete_empty')}
confirmMessage={checkedIdArray.length > 1? confirmMessage={currentSelectedVideoIds.length > 1?
t('video.delete_description_count',{count:checkedIdArray.length}) t('video.delete_description_count',{count:currentSelectedVideoIds.length})
: :
t('video.delete_description',{count:checkedIdArray.length})} t('video.delete_description',{count:currentSelectedVideoIds.length})}
onSuccess={loadList} onSuccess={loadList}
onProcess={processDeleteVideo} onProcess={processDeleteVideo}
> >