解决已知问题
This commit is contained in:
@@ -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())]
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user