fix: 限制最长新闻标签最多为4个字符

This commit is contained in:
LittleBoy 2025-04-24 21:42:18 +08:00
parent 6fc064fbc8
commit 0a4bb5426e
3 changed files with 13 additions and 1 deletions

View File

@ -140,6 +140,11 @@ export default function ArticleEditModal(props: Props) {
// setState({msgTitle: '请输入标题内容'});
return;
}
if(i18n.language == 'zh-CN' && tag.length > 4 ){
// 获取图文设置不正确的数据
setState({ msgGroup: t('news.edit.tag_length_error') });
return;
}
if (groups.length == 0 || groups[0].length == 0 || !groups[0][0].content) {
setState({ msgGroup: t('news.edit_empty_human_content') });
return;
@ -180,6 +185,11 @@ export default function ArticleEditModal(props: Props) {
// setState({msgTitle: '请输入标题内容'});
return;
}
if(i18n.language == 'zh-CN' && tag.length > 4 ){
// 获取图文设置不正确的数据
setState({ msgGroup: t('news.edit.tag_length_error') });
return;
}
if (groups.length == 0 || groups[0].length == 0 || !groups[0][0].content) {
setState({ msgGroup: t('news.edit_empty_human_content') });
return;
@ -307,7 +317,7 @@ export default function ArticleEditModal(props: Props) {
key={idx} placement="bottomLeft" arrow={false}
content={<img className="w-[150px] rounded" src={opt.background} />}
>
<Radio value={opt.template_id}>{idx + 1}</Radio></Popover>
<Radio value={opt.template_id}>{t('news.edit.bg')}{idx + 1}</Radio></Popover>
))}
</Radio.Group>
</div>

View File

@ -96,6 +96,7 @@
"edit": {
"bg": "Background",
"tag": "Tag",
"tag_length_error": "Video tag only limit 4 words ",
"tag_placeholder": "Example: Enterprise dynamics"
},
"edit_add_group": "Add Group",

View File

@ -96,6 +96,7 @@
"edit": {
"bg": "背景",
"tag": "标签",
"tag_length_error": "标签长度不能超过4个字",
"tag_placeholder": "例:企业动态"
},
"edit_add_group": "新增分组",