添加keywords字段
This commit is contained in:
parent
ea3f591eb6
commit
ae3b22b60d
|
@ -20,7 +20,7 @@ export const changeHead = async ({ key }, params) => {
|
|||
res = await getNewsDetail(params.id)
|
||||
data = res.data.data
|
||||
if (data) {
|
||||
setSeoMeta(`${data.name}`, data.name, data.summary || '', `/zone/${params.deptId}/newdetail/${ params.id }`)
|
||||
setSeoMeta(`${data.keywords || data.name}`, data.name, data.summary || '', `/zone/${params.deptId}/newdetail/${ params.id }`)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -60,14 +60,15 @@ function NewsCreate(props){
|
|||
function getNewsDetail() {
|
||||
getNewsDetailByAu(newsId).then(res=>{
|
||||
if(res && res.data){
|
||||
const {name, summary, cmsDir, content, headImg, editorType} = res.data.data;
|
||||
const {name, summary, cmsDir, content, headImg, editorType, keywords} = res.data.data;
|
||||
setType(editorType === "rich_editor" ? 'richEditor' : 'mdEditor')
|
||||
setFieldsValue({
|
||||
name,
|
||||
summary,
|
||||
dirId: cmsDir && cmsDir.id,
|
||||
content: Base64.decode(content),
|
||||
headImg
|
||||
headImg,
|
||||
keywords
|
||||
});
|
||||
setImageUrl(headImg);
|
||||
setValue(Base64.decode(content));
|
||||
|
@ -84,12 +85,15 @@ function NewsCreate(props){
|
|||
hasContent && setFields({content: {value:fieldsValue.content,errors:[new Error('请输入内容!')]}});
|
||||
return;
|
||||
}
|
||||
if (fieldsValue.keywords) {
|
||||
fieldsValue.keywords = fieldsValue.keywords.replaceAll(',', ',')
|
||||
}
|
||||
setLoading(true);
|
||||
const params = {
|
||||
...fieldsValue,
|
||||
editorType: type === "richEditor" ? "rich_editor" : "markdown_editor",
|
||||
headImg: imageUrl,
|
||||
content: Base64.encode(fieldsValue.content)
|
||||
content: Base64.encode(fieldsValue.content),
|
||||
}
|
||||
if(isEdit){
|
||||
delete params.editorType;
|
||||
|
@ -157,6 +161,13 @@ function NewsCreate(props){
|
|||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="关键词">
|
||||
{getFieldDecorator("keywords", {
|
||||
rules:[{type: 'string', max: 30, message: "请精简关键词,最大长度30"}],
|
||||
})(
|
||||
<Input placeholder="请输入关键词,使用逗号分隔" maxLength={ 30 } width="220px"/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="内容" wrapperCol={{span: 21}}>
|
||||
{getFieldDecorator("content",{
|
||||
rules:[{required:true,message:"请输入内容!"}],
|
||||
|
|
Loading…
Reference in New Issue