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>
<div class="user-wrapper">
<a href="/" target="_blank">
<a href="http://localhost:8090" target="_blank">
<span class="action">
<a-icon type="link" />
</span>

View File

@ -79,6 +79,21 @@
v-model="selectedCategoryIds"
: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>
<a-divider />
@ -89,18 +104,6 @@
<a-form layout="vertical">
<a-form-item>
<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>
</div>
@ -196,11 +199,13 @@ export default {
attachmentDrawerVisible: false,
visible: false,
thumDrawerVisible: false,
categoryForm: false,
tags: [],
categories: [],
selectedCategoryIds: [],
selectedTagIds: [],
postToStage: {}
postToStage: {},
categoryToCreate: {}
}
},
computed: {
@ -271,6 +276,9 @@ export default {
showThumbDrawer() {
this.thumDrawerVisible = true
},
toggleCategoryForm() {
this.categoryForm = !this.categoryForm
},
handlePublishClick() {
this.postToStage.status = 'PUBLISHED'
this.createOrUpdatePost()
@ -282,6 +290,12 @@ export default {
handlerRemoveThumb() {
this.postToStage.thumbnail = null
},
handlerCreateCategory() {
categoryApi.create(this.categoryToCreate).then(response => {
this.loadCategories()
this.categoryToCreate = {}
})
},
onClose() {
this.visible = false
},

View File

@ -15,7 +15,13 @@
<div class="aboutTitle">关于我们</div>
<div>
<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">
<a-avatar :size="60" :src="dev.src"/>
<p>{{ dev.Name }}</p>