Refactor post edit.

pull/3445/head
ruibaby 2019-04-27 00:10:31 +08:00
parent 79a0cc0d0f
commit 803676557a
3 changed files with 35 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="user-wrapper"> <div class="user-wrapper">
<a href="/" target="_blank"> <a href="http://localhost:8090" target="_blank">
<span class="action"> <span class="action">
<a-icon type="link" /> <a-icon type="link" />
</span> </span>

View File

@ -79,6 +79,21 @@
v-model="selectedCategoryIds" v-model="selectedCategoryIds"
:categories="categories" :categories="categories"
/> />
<div>
<a-form layout="vertical">
<a-form-item v-if="categoryForm">
<a-input placeholder="分类名称" v-model="categoryToCreate.name"/>
</a-form-item>
<a-form-item v-if="categoryForm">
<a-input placeholder="分类路径" v-model="categoryToCreate.slugNames"/>
</a-form-item>
<a-form-item>
<a-button type="primary" style="marginRight: 8px" v-if="categoryForm" @click="handlerCreateCategory"></a-button>
<a-button type="dashed" style="marginRight: 8px" v-if="!categoryForm" @click="toggleCategoryForm"></a-button>
<a-button v-if="categoryForm" @click="toggleCategoryForm"></a-button>
</a-form-item>
</a-form>
</div>
</div> </div>
</div> </div>
<a-divider /> <a-divider />
@ -89,18 +104,6 @@
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item> <a-form-item>
<TagSelect v-model="selectedTagIds" /> <TagSelect v-model="selectedTagIds" />
<!-- <a-select
v-model="selectedTagIds"
allowClear
mode="multiple"
placeholder="选择或输入标签"
>
<a-select-option
v-for="tag in tags"
:key="tag.id"
:value="tag.id"
>{{ tag.name }}</a-select-option>
</a-select> -->
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
@ -196,11 +199,13 @@ export default {
attachmentDrawerVisible: false, attachmentDrawerVisible: false,
visible: false, visible: false,
thumDrawerVisible: false, thumDrawerVisible: false,
categoryForm: false,
tags: [], tags: [],
categories: [], categories: [],
selectedCategoryIds: [], selectedCategoryIds: [],
selectedTagIds: [], selectedTagIds: [],
postToStage: {} postToStage: {},
categoryToCreate: {}
} }
}, },
computed: { computed: {
@ -271,6 +276,9 @@ export default {
showThumbDrawer() { showThumbDrawer() {
this.thumDrawerVisible = true this.thumDrawerVisible = true
}, },
toggleCategoryForm() {
this.categoryForm = !this.categoryForm
},
handlePublishClick() { handlePublishClick() {
this.postToStage.status = 'PUBLISHED' this.postToStage.status = 'PUBLISHED'
this.createOrUpdatePost() this.createOrUpdatePost()
@ -282,6 +290,12 @@ export default {
handlerRemoveThumb() { handlerRemoveThumb() {
this.postToStage.thumbnail = null this.postToStage.thumbnail = null
}, },
handlerCreateCategory() {
categoryApi.create(this.categoryToCreate).then(response => {
this.loadCategories()
this.categoryToCreate = {}
})
},
onClose() { onClose() {
this.visible = false this.visible = false
}, },

View File

@ -15,7 +15,13 @@
<div class="aboutTitle">关于我们</div> <div class="aboutTitle">关于我们</div>
<div> <div>
<a-row> <a-row>
<a-col :xs="8" :md="6" :lg="4" :xl="4" v-for="(dev,index) in devs" :key="index"> <a-col
:xs="8"
:md="6"
:lg="4"
:xl="4"
v-for="(dev,index) in devs"
:key="index">
<div class="head-Box"> <div class="head-Box">
<a-avatar :size="60" :src="dev.src"/> <a-avatar :size="60" :src="dev.src"/>
<p>{{ dev.Name }}</p> <p>{{ dev.Name }}</p>