diff --git a/pages/editor/series.tsx b/pages/editor/series.tsx index 6376e406..397372dd 100644 --- a/pages/editor/series.tsx +++ b/pages/editor/series.tsx @@ -18,7 +18,7 @@ import Empty from "components/empty" import { IDType } from "src/types/id" var validator = require('validator'); -const newSeries: Story = { title: '', brief: '', cover: '',type: IDType.Series } +const newSeries: Story = { title: '', brief: '', cover: '', type: IDType.Series } const PostsPage = () => { const [currentSeries, setCurrentSeries] = useState(null) const [posts, setPosts] = useState([]) @@ -75,11 +75,8 @@ const PostsPage = () => { } const editPost = (post: Story) => { - if (post.url.trim() === "") { - router.push(`/editor/post/${post.id}`) - } else { - setCurrentSeries(post) - } + console.log(post) + setCurrentSeries(post) } const onDeletePost = async (id) => { @@ -100,55 +97,71 @@ const PostsPage = () => { {currentSeries ? - - {(props) => ( -
- - - {({ field, form }) => ( - - 标题 - - {form.errors.title} - - )} - - - {({ field, form }) => ( - - 封面图片 - - {form.errors.cover} - - )} - - - {({ field, form }) => ( - - 简介 - - {form.errors.brief} - - )} - - - - + + + + )} + + + + + + - - - - )} -
: + + + + )} + + + : <> 系列({posts.length}) @@ -161,7 +174,7 @@ const PostsPage = () => { {posts.map(post => - editPost(post)} onDelete={() => onDeletePost(post.id)} showSource={false}/> + editPost(post)} onDelete={() => onDeletePost(post.id)} showSource={false} /> )} diff --git a/server/internal/story/post.go b/server/internal/story/post.go index 957c4369..6558ad22 100644 --- a/server/internal/story/post.go +++ b/server/internal/story/post.go @@ -60,10 +60,13 @@ func SubmitStory(c *gin.Context) (map[string]string, *e.Error) { if !user.Role.IsCreator() { return nil, e.New(http.StatusForbidden, e.NoEditorPermission) } - if len(post.Md) <= config.Data.Posts.BriefMaxLen { - post.Brief = post.Md - } else { - post.Brief = string([]rune(post.Md)[:config.Data.Posts.BriefMaxLen]) + + if post.Type == models.IDTypePost { + if len(post.Md) <= config.Data.Posts.BriefMaxLen { + post.Brief = post.Md + } else { + post.Brief = string([]rune(post.Md)[:config.Data.Posts.BriefMaxLen]) + } } } diff --git a/src/components/story/text-story-card.tsx b/src/components/story/text-story-card.tsx index 651dacc7..234e9090 100644 --- a/src/components/story/text-story-card.tsx +++ b/src/components/story/text-story-card.tsx @@ -24,7 +24,7 @@ export const TextStoryCard= (props:Props) =>{ return ( //@ts-ignore - + {showSource && <> {story.url ? 外部 : 原创}} {story.title ?story.title : 'No Title'}