From 829a135ef358e1e866ae0deea84904e0b9efb49e Mon Sep 17 00:00:00 2001 From: callmeyan Date: Thu, 6 Feb 2025 00:16:29 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E4=B8=8D=E5=8F=AF=E4=BB=A5=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=AD=A3=E5=9C=A8=E7=9B=B4=E6=92=AD=E7=9A=84=E8=A7=86?= =?UTF-8?q?=E9=A2=91=EF=BC=9B=E7=B4=A0=E6=9D=90=E6=AD=A3=E6=96=87=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=92=8C=E5=9B=BE=E7=89=87=E9=83=BD=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/article/edit-modal.tsx | 15 ++++++++++++++- src/i18n/translations/en-US.json | 2 ++ src/i18n/translations/zh-CN.json | 5 ++++- src/pages/live/index.tsx | 15 ++++++++++----- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/components/article/edit-modal.tsx b/src/components/article/edit-modal.tsx index 7d46000..6b24778 100644 --- a/src/components/article/edit-modal.tsx +++ b/src/components/article/edit-modal.tsx @@ -100,9 +100,21 @@ export default function ArticleEditModal(props: Props) { return; } if (groups.length == 0 || groups[0].length == 0 || !groups[0][0].content) { - // setState({msgGroup: '请输入正文文本内容'}); + setState({msgGroup: t('news.edit_empty_human_content')}); 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; setState({generating:true}) 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') : ''}); }} /> +
{state.msgGroup}
{state.error &&
{state.error}
} diff --git a/src/i18n/translations/en-US.json b/src/i18n/translations/en-US.json index 0f0f320..881c784 100644 --- a/src/i18n/translations/en-US.json +++ b/src/i18n/translations/en-US.json @@ -73,6 +73,8 @@ "edit_notice_keep_1": "Keep at least one content block", "edit_other_text": "Other media Material", "edit_save_failed": "Save failed!", + "edit_empty_human_content": "Please enter meta human material", + "edit_empty_group_content": "Please other media material", "editing": "Editing", "filter_all": "All", "filter_source": "News source", diff --git a/src/i18n/translations/zh-CN.json b/src/i18n/translations/zh-CN.json index 4c38ffe..8417c01 100644 --- a/src/i18n/translations/zh-CN.json +++ b/src/i18n/translations/zh-CN.json @@ -69,10 +69,12 @@ "edit_notice_enter_article_content": "请输入正文文本内容", "edit_notice_enter_article_title": "请输入文章标题", "edit_notice_enter_article_title1": "请输入标题内容", - "edit_notice_enter_text": "请先填写当前组的内容", + "edit_notice_enter_text": "请先填写文本内容", "edit_notice_keep_1": "至少保留一个内容块", "edit_other_text": "素材融合呈现编辑区", "edit_save_failed": "保存失败,请重试!", + "edit_empty_human_content": "请先填写数字人播报内容", + "edit_empty_group_content": "正文文本和图片均不为空", "editing": "新闻编辑", "filter_all": "全部", "filter_source": "新闻来源", @@ -133,6 +135,7 @@ "delete_description_count": "已选择{{count}}条,确定要全部删除吗?", "delete_empty": "请选择要删除的视频", "download": "下载视频", + "generating": "生成中", "playing": "播放中", "push_confirm": "是否确定一键推流选中新闻视频?", "push_empty": "请选择要推流的新闻视频", diff --git a/src/pages/live/index.tsx b/src/pages/live/index.tsx index 2b95cc2..19a3042 100644 --- a/src/pages/live/index.tsx +++ b/src/pages/live/index.tsx @@ -206,6 +206,11 @@ export default function LiveIndex() { return checkedIdArray.filter(id => currentId.id != id) }, [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 (
@@ -320,14 +325,14 @@ export default function LiveIndex() {
scrollerRef.current?.scrollToPosition(0)}/> - {checkedIdArray.length > 0 && 0 && 1? - t('video.delete_description_count',{count:checkedIdArray.length}) + confirmMessage={currentSelectedVideoIds.length > 1? + t('video.delete_description_count',{count:currentSelectedVideoIds.length}) : - t('video.delete_description',{count:checkedIdArray.length})} + t('video.delete_description',{count:currentSelectedVideoIds.length})} onSuccess={loadList} onProcess={processDeleteVideo} >