diff --git a/src/components/article/block.tsx b/src/components/article/block.tsx index ce5607f..612dbbc 100644 --- a/src/components/article/block.tsx +++ b/src/components/article/block.tsx @@ -101,7 +101,7 @@ export default function ArticleBlock( {editable &&
- onAdd?.(index + 1,index)} className="article-action-add" title="新增分组"> + onAdd?.(index + 1,index)} className="article-action-add" title={t('news.materials.add_group')}>
} } \ No newline at end of file diff --git a/src/components/article/group.tsx b/src/components/article/group.tsx index 05c7c42..ae9b7e7 100644 --- a/src/components/article/group.tsx +++ b/src/components/article/group.tsx @@ -1,10 +1,11 @@ -import {Input, message} from "antd" +import {Divider, Input, message} from "antd" import ArticleBlock from "@/components/article/block.tsx"; import styles from './article.module.scss' import {showToast} from "@/components/message.ts"; import React from "react"; import {useTranslation} from "react-i18next"; +import {IconAdd} from "@/components/icons"; type Props = { groups: BlockContent[][]; @@ -79,6 +80,11 @@ export default function ArticleGroup({groups, editable, onChange, errorMessage}:
+ + {editable && groups.length == 1 &&
+ handleAddGroup?.(1,1)} className="article-action-add" title={t('news.materials.add_group')}> +
} + {groups.map((g, index) => ( index == 0 ? null : { handleAddGroup?.(_index ? _index :index + 1,checkIndex) }} - disableRemoveMessage={groups.length <= 2?t('news.edit_notice_keep_1'):''} + disableRemoveMessage={groups.length <= 1?t('news.edit_notice_keep_1'):''} onRemove={async () => { - if (groups.length <= 2) { + if (groups.length <= 1) { message.warning(t('news.edit_notice_keep_1')) return; } diff --git a/src/i18n/translations/en-US.json b/src/i18n/translations/en-US.json index 025e8c5..eb29a4a 100644 --- a/src/i18n/translations/en-US.json +++ b/src/i18n/translations/en-US.json @@ -3,6 +3,7 @@ "Hello": "Hello", "cancel": "Cancel", "close": "Close", + "service_error": "Service exception, please contact customer support.", "confirm": { "push_title": "Push Notice", "push_video": "Are you sure editing selected news?", @@ -83,7 +84,8 @@ "get_detail_error": "Get new details failed", "image_count": "Images", "materials": { - "title": "News Materials" + "title": "News Materials", + "add_group": "Add Group" }, "news_all_source": "All", "push_empty": "please select the news to edit", diff --git a/src/i18n/translations/zh-CN.json b/src/i18n/translations/zh-CN.json index 2c171e3..f0b7562 100644 --- a/src/i18n/translations/zh-CN.json +++ b/src/i18n/translations/zh-CN.json @@ -3,6 +3,7 @@ "Hello": "你好", "cancel": "取消", "close": "关闭", + "service_error": "新闻异常,无法生成,请咨询客服", "confirm": { "push_title": "推流提示", "push_video": "是否确定一键推流选中新闻视频?", @@ -83,7 +84,8 @@ "get_detail_error": "获取新闻详情失败", "image_count": "图片数", "materials": { - "title": "新闻素材" + "title": "新闻素材", + "add_group": "新增分组" }, "news_all_source": "全部来源", "push_empty": "请选择要推入编辑的新闻", diff --git a/src/pages/news/components/button-push2video.tsx b/src/pages/news/components/button-push2video.tsx index e5b33ad..201e764 100644 --- a/src/pages/news/components/button-push2video.tsx +++ b/src/pages/news/components/button-push2video.tsx @@ -45,7 +45,10 @@ export default function ButtonPush2Video(props: PushVideoProps) { state: 'push-success' }) // props.onSuccess?.() - }).catch(showErrorToast).finally(() => { + }).catch(()=>{ + showToast(t('service_error'), 'error') + //showErrorToast + }).finally(() => { setLoading(false) }) }