pull/51/head
sunface 4 years ago
parent 8c2bf9f379
commit 001609b801

@ -75,12 +75,9 @@ const PostsPage = () => {
}
const editPost = (post: Story) => {
if (post.url.trim() === "") {
router.push(`/editor/post/${post.id}`)
} else {
console.log(post)
setCurrentSeries(post)
}
}
const onDeletePost = async (id) => {
await requestApi.delete(`/story/post/${id}`)
@ -100,6 +97,7 @@ const PostsPage = () => {
<Sidebar routes={editorLinks} title="创作中心" />
<Card ml="4" p="6" width="100%">
{currentSeries ?
<>
<Formik
initialValues={currentSeries}
onSubmit={submitPost}
@ -134,6 +132,19 @@ const PostsPage = () => {
</FormControl>
)}
</Field>
<Field>
{({ field, form }) => (
<FormControl isInvalid={form.errors.brief && form.touched.brief}>
<Divider mt="0" mb="6" />
<FormLabel></FormLabel>
<Button variant="ghost"></Button>
<Divider mt="6" mb="6" />
</FormControl>
)}
</Field>
</VStack>
<Box mt={6}>
<Button
@ -148,7 +159,9 @@ const PostsPage = () => {
</Box>
</Form>
)}
</Formik> :
</Formik>
</>
:
<>
<Flex alignItems="center" justify="space-between">
<Heading size="md">({posts.length})</Heading>

@ -60,12 +60,15 @@ func SubmitStory(c *gin.Context) (map[string]string, *e.Error) {
if !user.Role.IsCreator() {
return nil, e.New(http.StatusForbidden, e.NoEditorPermission)
}
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])
}
}
}
now := time.Now()

@ -24,7 +24,7 @@ export const TextStoryCard= (props:Props) =>{
return (
//@ts-ignore
<Lay justifyContent="space-between" alignItems={isSmallScreen? "left" : "center"} {...rest}>
<VStack alignItems="left" as="a" href={story.url ?? getStoryUrl(story)} spacing={{base: 4, md: 2}}>
<VStack alignItems="left" as="a" href={getStoryUrl(story)} spacing={{base: 4, md: 2}}>
<Heading size="sm" display="flex" alignItems="center">
{showSource && <> {story.url ? <Tag size="sm" mr="2"></Tag> : <Tag size="sm" mr="2"></Tag>}</>}
{story.title ?story.title : 'No Title'}

Loading…
Cancel
Save