解决已知问题

This commit is contained in:
Liu 宇阳
2024-11-05 15:20:00 +08:00
parent a51369005b
commit 4b5f77f164
2 changed files with 22 additions and 23 deletions

View File

@@ -87,6 +87,7 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo
// 如果是文章标签,则先判断是否存在,如果不存在则添加
let tagIds: number[] = []
if (values.tagIds) {
for (const item of values.tagIds) {
if (typeof item === "string") {
// 如果已经有这个标签了,就没必要再创建一个了
@@ -106,6 +107,7 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo
tagIds.push(item);
}
}
}
values.createTime = values.createTime.valueOf()
values.cateIds = [...new Set(values.cateIds?.flat())]

View File

@@ -10,7 +10,7 @@ import { Article } from '@/types/app/article';
import { getArticleDataAPI } from '@/api/Article'
import { BiSave } from "react-icons/bi";
import { GrFormNext } from "react-icons/gr";
import { AiOutlineEdit, AiOutlineSend } from 'react-icons/ai';
const CreatePage = () => {
const [params] = useSearchParams()
@@ -20,11 +20,6 @@ const CreatePage = () => {
const [content, setContent] = useState('');
const [publishOpen, setPublishOpen] = useState(false)
// 获取编辑器的内容
const getVditorData = (value: string) => {
setContent(value)
}
// 保存文章
const saveBtn = () => {
if (content.trim().length >= 1) {
@@ -152,14 +147,16 @@ const CreatePage = () => {
<>
<Title value="创作">
<div className='flex items-center space-x-4'>
<Dropdown.Button menu={{ items }}></Dropdown.Button>
<Dropdown.Button menu={{ items }}>
<AiOutlineEdit className='text-base' />
</Dropdown.Button>
<Button className='w-full flex justify-between' onClick={saveBtn} >
<BiSave className='text-base' />
</Button>
<Button size='large' type="primary" className='w-full flex justify-between' onClick={nextBtn} >
<GrFormNext className='text-2xl' />
<AiOutlineSend className='text-2xl' />
</Button>
</div>
</Title>