|
|
@ -288,7 +288,7 @@ export default {
|
|
|
|
this.options = response.data.data
|
|
|
|
this.options = response.data.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
createOrUpdatePost(createSuccess, updateSuccess) {
|
|
|
|
createOrUpdatePost(createSuccess, updateSuccess, autoSave) {
|
|
|
|
// Set category ids
|
|
|
|
// Set category ids
|
|
|
|
this.postToStage.categoryIds = this.selectedCategoryIds
|
|
|
|
this.postToStage.categoryIds = this.selectedCategoryIds
|
|
|
|
// Set tag ids
|
|
|
|
// Set tag ids
|
|
|
@ -296,7 +296,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.postToStage.id) {
|
|
|
|
if (this.postToStage.id) {
|
|
|
|
// Update the post
|
|
|
|
// Update the post
|
|
|
|
postApi.update(this.postToStage.id, this.postToStage).then(response => {
|
|
|
|
postApi.update(this.postToStage.id, this.postToStage, autoSave).then(response => {
|
|
|
|
this.$log.debug('Updated post', response.data.data)
|
|
|
|
this.$log.debug('Updated post', response.data.data)
|
|
|
|
if (updateSuccess) {
|
|
|
|
if (updateSuccess) {
|
|
|
|
updateSuccess()
|
|
|
|
updateSuccess()
|
|
|
@ -304,7 +304,7 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Create the post
|
|
|
|
// Create the post
|
|
|
|
postApi.create(this.postToStage).then(response => {
|
|
|
|
postApi.create(this.postToStage, autoSave).then(response => {
|
|
|
|
this.$log.debug('Created post', response.data.data)
|
|
|
|
this.$log.debug('Created post', response.data.data)
|
|
|
|
if (createSuccess) {
|
|
|
|
if (createSuccess) {
|
|
|
|
createSuccess()
|
|
|
|
createSuccess()
|
|
|
@ -314,11 +314,15 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
savePost() {
|
|
|
|
savePost() {
|
|
|
|
this.createOrUpdatePost(() => this.$message.success('文章创建成功'), () => this.$message.success('文章更新成功'))
|
|
|
|
this.createOrUpdatePost(
|
|
|
|
|
|
|
|
() => this.$message.success('文章创建成功'),
|
|
|
|
|
|
|
|
() => this.$message.success('文章更新成功'),
|
|
|
|
|
|
|
|
false
|
|
|
|
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
autoSavePost() {
|
|
|
|
autoSavePost() {
|
|
|
|
if (this.postToStage.title != null && this.postToStage.originalContent != null) {
|
|
|
|
if (this.postToStage.title != null && this.postToStage.originalContent != null) {
|
|
|
|
this.createOrUpdatePost()
|
|
|
|
this.createOrUpdatePost(null, null, true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
toggleCategoryForm() {
|
|
|
|
toggleCategoryForm() {
|
|
|
|