✨ feat: 不能删除最后一组素材
This commit is contained in:
parent
d782801420
commit
0bf20343d0
@ -101,7 +101,7 @@ export default function ArticleBlock(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{editable && <div className={'divider-container after'}><Divider>
|
{editable && <div className={'divider-container after'}><Divider>
|
||||||
<span onClick={()=>onAdd?.(index + 1,index)} className="article-action-add" title="新增分组"><IconAdd style={{fontSize: 24}}/></span>
|
<span onClick={()=>onAdd?.(index + 1,index)} className="article-action-add" title={t('news.materials.add_group')}><IconAdd style={{fontSize: 24}}/></span>
|
||||||
</Divider></div> }
|
</Divider></div> }
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
@ -1,10 +1,11 @@
|
|||||||
import {Input, message} from "antd"
|
import {Divider, Input, message} from "antd"
|
||||||
import ArticleBlock from "@/components/article/block.tsx";
|
import ArticleBlock from "@/components/article/block.tsx";
|
||||||
|
|
||||||
import styles from './article.module.scss'
|
import styles from './article.module.scss'
|
||||||
import {showToast} from "@/components/message.ts";
|
import {showToast} from "@/components/message.ts";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {useTranslation} from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
|
import {IconAdd} from "@/components/icons";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
groups: BlockContent[][];
|
groups: BlockContent[][];
|
||||||
@ -79,6 +80,11 @@ export default function ArticleGroup({groups, editable, onChange, errorMessage}:
|
|||||||
|
|
||||||
<div className="panel-body py-3">
|
<div className="panel-body py-3">
|
||||||
<div className="max-h-[485px] overflow-auto py-4">
|
<div className="max-h-[485px] overflow-auto py-4">
|
||||||
|
|
||||||
|
{editable && groups.length == 1 && <div className={`${styles.blockContainer} group`}><div className={'divider-container before'}><Divider>
|
||||||
|
<span onClick={()=>handleAddGroup?.(1,1)} className="article-action-add" title={t('news.materials.add_group')}><IconAdd style={{fontSize: 24}}/></span>
|
||||||
|
</Divider></div></div> }
|
||||||
|
|
||||||
{groups.map((g, index) => (
|
{groups.map((g, index) => (
|
||||||
index == 0 ? null : <ArticleBlock
|
index == 0 ? null : <ArticleBlock
|
||||||
editable={editable}
|
editable={editable}
|
||||||
@ -93,9 +99,9 @@ export default function ArticleGroup({groups, editable, onChange, errorMessage}:
|
|||||||
onAdd={(_index,checkIndex) => {
|
onAdd={(_index,checkIndex) => {
|
||||||
handleAddGroup?.(_index ? _index :index + 1,checkIndex)
|
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 () => {
|
onRemove={async () => {
|
||||||
if (groups.length <= 2) {
|
if (groups.length <= 1) {
|
||||||
message.warning(t('news.edit_notice_keep_1'))
|
message.warning(t('news.edit_notice_keep_1'))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"Hello": "Hello",
|
"Hello": "Hello",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
|
"service_error": "Service exception, please contact customer support.",
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"push_title": "Push Notice",
|
"push_title": "Push Notice",
|
||||||
"push_video": "Are you sure editing selected news?",
|
"push_video": "Are you sure editing selected news?",
|
||||||
@ -83,7 +84,8 @@
|
|||||||
"get_detail_error": "Get new details failed",
|
"get_detail_error": "Get new details failed",
|
||||||
"image_count": "Images",
|
"image_count": "Images",
|
||||||
"materials": {
|
"materials": {
|
||||||
"title": "News Materials"
|
"title": "News Materials",
|
||||||
|
"add_group": "Add Group"
|
||||||
},
|
},
|
||||||
"news_all_source": "All",
|
"news_all_source": "All",
|
||||||
"push_empty": "please select the news to edit",
|
"push_empty": "please select the news to edit",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"Hello": "你好",
|
"Hello": "你好",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"close": "关闭",
|
"close": "关闭",
|
||||||
|
"service_error": "新闻异常,无法生成,请咨询客服",
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"push_title": "推流提示",
|
"push_title": "推流提示",
|
||||||
"push_video": "是否确定一键推流选中新闻视频?",
|
"push_video": "是否确定一键推流选中新闻视频?",
|
||||||
@ -83,7 +84,8 @@
|
|||||||
"get_detail_error": "获取新闻详情失败",
|
"get_detail_error": "获取新闻详情失败",
|
||||||
"image_count": "图片数",
|
"image_count": "图片数",
|
||||||
"materials": {
|
"materials": {
|
||||||
"title": "新闻素材"
|
"title": "新闻素材",
|
||||||
|
"add_group": "新增分组"
|
||||||
},
|
},
|
||||||
"news_all_source": "全部来源",
|
"news_all_source": "全部来源",
|
||||||
"push_empty": "请选择要推入编辑的新闻",
|
"push_empty": "请选择要推入编辑的新闻",
|
||||||
|
@ -45,7 +45,10 @@ export default function ButtonPush2Video(props: PushVideoProps) {
|
|||||||
state: 'push-success'
|
state: 'push-success'
|
||||||
})
|
})
|
||||||
// props.onSuccess?.()
|
// props.onSuccess?.()
|
||||||
}).catch(showErrorToast).finally(() => {
|
}).catch(()=>{
|
||||||
|
showToast(t('service_error'), 'error')
|
||||||
|
//showErrorToast
|
||||||
|
}).finally(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user