diff --git a/src/components/article/block.tsx b/src/components/article/block.tsx index 92bf825..bb2c795 100644 --- a/src/components/article/block.tsx +++ b/src/components/article/block.tsx @@ -17,7 +17,7 @@ type Props = { editable?: boolean; onChange?: (blocks: BlockContent[]) => void; onRemove?: () => void; - onAdd?: (index?:number) => void; + onAdd?: (index:number,checkIndex:number) => void; errorMessage?: string; } @@ -61,7 +61,7 @@ export default function ArticleBlock( return
{editable && index == 1 &&
- onAdd?.(1)} className="article-action-add" title={t('news.edit_add_group')}> + onAdd?.(1,1)} className="article-action-add" title={t('news.edit_add_group')}>
}
@@ -99,7 +99,7 @@ export default function ArticleBlock(
{editable &&
- onAdd?.(index + 1)} className="article-action-add" title="新增分组"> + onAdd?.(index + 1,index)} className="article-action-add" title="新增分组">
}
} \ No newline at end of file diff --git a/src/components/article/edit-modal.tsx b/src/components/article/edit-modal.tsx index 710fa66..7d46000 100644 --- a/src/components/article/edit-modal.tsx +++ b/src/components/article/edit-modal.tsx @@ -119,6 +119,7 @@ export default function ArticleEditModal(props: Props) { useEffect(() => { setState({...DEFAULT_STATE}) if (typeof (props.id) != 'undefined') { + // 如果传入了id则获取数据 if (props.id > 0) { article.getById(props.id).then(res => { setGroups(rebuildGroups([[{content: res.metahuman_text, type: "text"}], ...res.content_group])) diff --git a/src/components/article/group.tsx b/src/components/article/group.tsx index ff8bd0f..987b4f1 100644 --- a/src/components/article/group.tsx +++ b/src/components/article/group.tsx @@ -21,11 +21,13 @@ export default function ArticleGroup({groups, editable, onChange, errorMessage}: * 添加一个组 * @param insertIndex 插入的位置,-1表示插入到末尾 */ - const handleAddGroup = (insertIndex: number = -1) => { - if (insertIndex !== -1 && insertIndex !== 1) { - const triggerGroup = insertIndex == -1 || insertIndex >= groups.length ? groups[groups.length - 1] : groups[insertIndex - 1]; + const handleAddGroup = (insertIndex: number,checkId:number) => { + // && insertIndex !== 1 + if (checkId > 0 && checkId < groups.length) { + //const index = insertIndex == -1 || insertIndex >= groups.length ? groups.length - 1 : insertIndex - 1 + const triggerGroup = groups[checkId]; // 判断 - if (triggerGroup.length == 0 || triggerGroup.some(s => !s.content)) { + if (!triggerGroup || triggerGroup.length == 0 || triggerGroup.some(s => !s.content)) { showToast(t('news.edit_notice_enter_text')) return; } @@ -88,8 +90,8 @@ export default function ArticleGroup({groups, editable, onChange, errorMessage}: }} errorMessage={errorMessage} index={index} - onAdd={(_index) => { - handleAddGroup?.(_index ? _index :index + 1) + onAdd={(_index,checkIndex) => { + handleAddGroup?.(_index ? _index :index + 1,checkIndex) }} onRemove={async () => { if (groups.length == 1) { diff --git a/src/i18n/translations/en-US.json b/src/i18n/translations/en-US.json index 2fb1de0..0f0f320 100644 --- a/src/i18n/translations/en-US.json +++ b/src/i18n/translations/en-US.json @@ -1,12 +1,15 @@ { "AppTitle": "AI Livesteam", "Hello": "Hello", + "cancel": "Cancel", "close": "Close", "confirm": { "push_title": "Push Notice", "push_video": "Are you sure editing selected news?", "title": "Notice" }, + "confirm_text": "Confirm", + "delete": "Delete", "delete_batch": "Delete Select", "delete_failed": "Delete failed", "delete_success": "Delete success", @@ -20,6 +23,7 @@ "search_key": "Please enter title keywords", "text": "Video history" }, + "history.pushed": "Streaming: {{count}}", "live": { "duration": "Duration", "edit_locked": "Locked", @@ -51,9 +55,24 @@ "delete_description": "This item will be deleted.
It can be recovered from the \"News\" page. ", "delete_description_count": "These item will be deleted.
It can be recovered from the \"News\" page. ", "delete_empty": "Please select the items to delete", + "delete_the_picture": "Are you sure delete the picture?", "download_empty": "Please select the news to download", "download_failed": "Download failed!", + "edit_add_group": "Add Group", + "edit_delete_group": "Delete Group", + "edit_delete_group_confirm": "Are you sure you want to delete the group?", + "edit_digital_text": "MetaHuman Material", "edit_form_search": "Please enter title keywords", + "edit_generate_again": "Regenerate", + "edit_generate_video": "Generating", + "edit_generate_video_again": "Regenerate", + "edit_notice_enter_article_content": "Please enter content", + "edit_notice_enter_article_title": "Please enter title", + "edit_notice_enter_article_title1": "Please enter news title", + "edit_notice_enter_text": "Please enter content", + "edit_notice_keep_1": "Keep at least one content block", + "edit_other_text": "Other media Material", + "edit_save_failed": "Save failed!", "editing": "Editing", "filter_all": "All", "filter_source": "News source", @@ -61,7 +80,6 @@ "get_detail": "Get news details", "get_detail_error": "Get new details failed", "image_count": "Images", - "word_count": "Words", "materials": { "title": "News Materials" }, @@ -81,30 +99,8 @@ "title_operate": "", "title_time": "Time stamp", "title_word_count": "Word count", - "edit_digital_text": "MetaHuman Material", - "edit_other_text": "Other media Material", - "edit_generate_video_again": "Regenerate", - "edit_generate_again": "Regenerate", - "edit_generate_video": "Generating", - "edit_save_failed": "Save failed!", - "edit_notice_keep_1": "Keep at least one content block", - "edit_notice_enter_text": "Please enter content", - "edit_notice_enter_article_title": "Please enter title", - "edit_notice_enter_article_title1": "Please enter news title", - "edit_notice_enter_article_content": "Please enter content", - "edit_add_group": "Add Group", - "edit_delete_group": "Delete Group", - "edit_delete_group_confirm": "Are you sure you want to delete the group?", - "delete_the_picture": "Are you sure delete the picture?" + "word_count": "Words" }, - "upload": { - "upload_failed": "Upload failed", - "delete_confirm": "Are you sure delete the picture?", - "upload_image": "Upload Image" - }, - "delete": "Delete", - "cancel": "Cancel", - "confirm_text": "Confirm", "select": { "pushed": "Pushed: {{count}}", "select_all": "Select all", @@ -121,17 +117,24 @@ "past_4_hour": "Past 4 hour", "past_hour": "Past 1 hour" }, + "upload": { + "delete_confirm": "Are you sure delete the picture?", + "upload_failed": "Upload failed", + "upload_image": "Upload Image" + }, "user": { "logout": "Logout" }, "video": { - "delete_confirm_title": "Are you sure you want to delete this video?", "delete_confirm": "The video will be deleted.
It can be recovered from the \"News\" page. ", "delete_confirm_count": "These videos will be deleted.
They can be recovered from the \"News\" page. ", + "delete_confirm_title": "Are you sure you want to delete this video?", "delete_description": "Are you sure you want to delete the video?", "delete_description_count": "Are you sure you want to delete these {{count}} videos?", "delete_empty": "Select the video you want to delete", "download": "Download", + "generating": "Generating", + "playing": "Playing", "push_confirm": "Are you sure you want to streaming these video?", "push_empty": "Select the video you want to streaming", "push_failed": "some video streaming failed!", @@ -145,9 +148,6 @@ "title": "Title", "title_generated_time": "Time stamp", "title_operation": "", - "title_thumb": "Cover", - "playing": "Playing", - "generating": "Generating" - }, - "history.pushed": "Streaming: {{count}}" -} + "title_thumb": "Cover" + } +} \ No newline at end of file diff --git a/src/i18n/translations/zh-CN.json b/src/i18n/translations/zh-CN.json index f760686..4c38ffe 100644 --- a/src/i18n/translations/zh-CN.json +++ b/src/i18n/translations/zh-CN.json @@ -1,12 +1,15 @@ { "AppTitle": "数字人直播", "Hello": "你好", + "cancel": "取消", "close": "关闭", "confirm": { "push_title": "推流提示", "push_video": "是否确定一键推流选中新闻视频?", "title": "提示" }, + "confirm_text": "确定", + "delete": "删除", "delete_batch": "批量删除", "delete_failed": "删除失败", "delete_success": "删除成功", @@ -20,6 +23,7 @@ "search_key": "请输入视频标题关键字进行信息", "text": "历史视频" }, + "history.pushed": "已推送 {{count}} 条", "live": { "duration": "时长", "edit_locked": "锁定状态不可排序", @@ -51,9 +55,24 @@ "delete_description": "删除后需从新闻素材中重新选择", "delete_description_count": "删除后需从新闻素材中重新选择", "delete_empty": "请选择要删除的新闻", + "delete_the_picture": "请确认删除此图片", "download_empty": "请选择要下载的新闻", "download_failed": "下载新闻失败,请重试!", + "edit_add_group": "新增分组", + "edit_delete_group": "删除此分组", + "edit_delete_group_confirm": "请确认删除此分组?", + "edit_digital_text": "数字人主播台编辑区", "edit_form_search": "请输入新闻标题关键词进行搜索", + "edit_generate_again": "重新生成", + "edit_generate_video": "生成视频", + "edit_generate_video_again": "重新生成", + "edit_notice_enter_article_content": "请输入正文文本内容", + "edit_notice_enter_article_title": "请输入文章标题", + "edit_notice_enter_article_title1": "请输入标题内容", + "edit_notice_enter_text": "请先填写当前组的内容", + "edit_notice_keep_1": "至少保留一个内容块", + "edit_other_text": "素材融合呈现编辑区", + "edit_save_failed": "保存失败,请重试!", "editing": "新闻编辑", "filter_all": "全部", "filter_source": "新闻来源", @@ -80,31 +99,8 @@ "title_operate": "操作", "title_time": "时间", "title_word_count": "字数", - "word_count": "字数", - "edit_digital_text": "数字人主播台编辑区", - "edit_other_text": "素材融合呈现编辑区", - "edit_generate_video_again": "重新生成", - "edit_generate_again": "重新生成", - "edit_generate_video": "生成视频", - "edit_save_failed": "保存失败,请重试!", - "edit_notice_keep_1": "至少保留一个内容块", - "edit_notice_enter_text": "请先添加内容", - "edit_notice_enter_article_title": "请输入文章标题", - "edit_notice_enter_article_title1": "请输入标题内容", - "edit_notice_enter_article_content": "请输入正文文本内容", - "edit_add_group": "新增分组", - "edit_delete_group": "删除此分组", - "edit_delete_group_confirm": "请确认删除此分组?", - "delete_the_picture": "请确认删除此图片" + "word_count": "字数" }, - "upload": { - "upload_failed": "上传图片失败,请重试", - "delete_confirm": "请确认删除此图片?", - "upload_image": "上传图片" - }, - "delete": "删除", - "cancel": "取消", - "confirm_text": "确定", "select": { "pushed": "已推送: {{count}} 条", "select_all": "全选", @@ -121,17 +117,23 @@ "past_4_hour": "四小时内", "past_hour": "一小时内" }, + "upload": { + "delete_confirm": "请确认删除此图片?", + "upload_failed": "上传图片失败,请重试", + "upload_image": "上传图片" + }, "user": { "logout": "退出登录" }, "video": { - "delete_confirm_title": "你确定要删除此视频吗 ", "delete_confirm": "删除后需重新生成视频", "delete_confirm_count": "删除后需重新生成视频", + "delete_confirm_title": "你确定要删除此视频吗 ", "delete_description": "已选择{{count}}条,确定要全部删除吗?", "delete_description_count": "已选择{{count}}条,确定要全部删除吗?", "delete_empty": "请选择要删除的视频", "download": "下载视频", + "playing": "播放中", "push_confirm": "是否确定一键推流选中新闻视频?", "push_empty": "请选择要推流的新闻视频", "push_failed": "选择视频中有部分视频还在生成中无法推送,推流成功视频前往数字人直播间页面查看!", @@ -145,8 +147,6 @@ "title": "标题", "title_generated_time": "生成时间", "title_operation": "操作", - "title_thumb": "缩略图", - "playing": "播放中" - }, - "history.pushed": "已推送 {{count}} 条" -} + "title_thumb": "缩略图" + } +} \ No newline at end of file