diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue
index 941a3b05..20457c41 100644
--- a/src/views/post/PostEdit.vue
+++ b/src/views/post/PostEdit.vue
@@ -45,10 +45,12 @@
保存草稿
预览
{
this.$log.debug('Updated post', response.data.data)
this.$message.success('保存草稿成功!')
+ this.saving = false
})
} else {
// Create the post
@@ -189,6 +194,7 @@ export default {
this.$log.debug('Created post', response.data.data)
this.$message.success('保存草稿成功!')
this.postToStage = response.data.data
+ this.saving = false
})
}
},
@@ -215,12 +221,14 @@ export default {
if (!this.postToStage.title) {
this.postToStage.title = moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')
}
+ this.saving = true
if (this.postToStage.id) {
// Update the post
postApi.update(this.postToStage.id, this.postToStage, false).then(response => {
this.$log.debug('Updated post', response.data.data)
postApi.preview(this.postToStage.id).then(response => {
window.open(response.data, '_blank')
+ this.saving = false
})
})
} else {
@@ -230,6 +238,7 @@ export default {
this.postToStage = response.data.data
postApi.preview(this.postToStage.id).then(response => {
window.open(response.data, '_blank')
+ this.saving = false
})
})
}
diff --git a/src/views/post/components/PostSettingDrawer.vue b/src/views/post/components/PostSettingDrawer.vue
index 020141ef..45aeb5fc 100644
--- a/src/views/post/components/PostSettingDrawer.vue
+++ b/src/views/post/components/PostSettingDrawer.vue
@@ -228,16 +228,19 @@
style="marginRight: 8px"
@click="handleDraftClick"
v-if="saveDraftButton"
+ :disabled="saving"
>保存草稿
发布
保存
@@ -272,7 +275,8 @@ export default {
selectedCategoryIds: this.categoryIds,
categories: [],
categoryToCreate: {},
- customTpls: []
+ customTpls: [],
+ saving: false
}
},
props: {
@@ -449,13 +453,14 @@ export default {
this.selectedPost.tagIds = this.selectedTagIds
// Set post metas
this.selectedPost.postMetas = this.selectedPostMetas
-
+ this.saving = true
if (this.selectedPost.id) {
// Update the post
postApi.update(this.selectedPost.id, this.selectedPost, autoSave).then(response => {
this.$log.debug('Updated post', response.data.data)
if (updateSuccess) {
updateSuccess()
+ this.saving = false
this.$emit('onSaved', true)
this.$router.push({ name: 'PostList' })
}
@@ -466,6 +471,7 @@ export default {
this.$log.debug('Created post', response.data.data)
if (createSuccess) {
createSuccess()
+ this.saving = false
this.$emit('onSaved', true)
this.$router.push({ name: 'PostList' })
}
diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue
index 80330b4a..42fa3631 100644
--- a/src/views/sheet/SheetEdit.vue
+++ b/src/views/sheet/SheetEdit.vue
@@ -39,10 +39,12 @@
保存草稿
预览
{
this.$log.debug('Updated sheet', response.data.data)
this.$message.success('保存草稿成功!')
+ this.saving = false
})
} else {
sheetApi.create(this.sheetToStage, false).then(response => {
this.$log.debug('Created sheet', response.data.data)
this.$message.success('保存草稿成功!')
this.sheetToStage = response.data.data
+ this.saving = false
})
}
},
@@ -202,14 +208,13 @@ export default {
if (!this.sheetToStage.title) {
this.sheetToStage.title = moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')
}
- if (!this.sheetToStage.originalContent) {
- this.sheetToStage.originalContent = '开始编辑...'
- }
+ this.saving = true
if (this.sheetToStage.id) {
sheetApi.update(this.sheetToStage.id, this.sheetToStage, false).then(response => {
this.$log.debug('Updated sheet', response.data.data)
sheetApi.preview(this.sheetToStage.id).then(response => {
window.open(response.data, '_blank')
+ this.saving = false
})
})
} else {
@@ -218,6 +223,7 @@ export default {
this.sheetToStage = response.data.data
sheetApi.preview(this.sheetToStage.id).then(response => {
window.open(response.data, '_blank')
+ this.saving = false
})
})
}
diff --git a/src/views/sheet/components/SheetSettingDrawer.vue b/src/views/sheet/components/SheetSettingDrawer.vue
index bf0cda08..62db48eb 100644
--- a/src/views/sheet/components/SheetSettingDrawer.vue
+++ b/src/views/sheet/components/SheetSettingDrawer.vue
@@ -131,10 +131,12 @@
保存草稿
发布
@@ -157,7 +159,8 @@ export default {
thumbDrawerVisible: false,
settingLoading: true,
selectedSheet: this.sheet,
- customTpls: []
+ customTpls: [],
+ saving: false
}
},
props: {
@@ -272,11 +275,13 @@ export default {
return
}
this.selectedSheet.sheetMetas = this.selectedSheetMetas
+ this.saving = true
if (this.selectedSheet.id) {
sheetApi.update(this.selectedSheet.id, this.selectedSheet, autoSave).then(response => {
this.$log.debug('Updated sheet', response.data.data)
if (updateSuccess) {
updateSuccess()
+ this.saving = false
this.$emit('onSaved', true)
this.$router.push({ name: 'SheetList' })
}
@@ -286,6 +291,7 @@ export default {
this.$log.debug('Created sheet', response.data.data)
if (createSuccess) {
createSuccess()
+ this.saving = false
this.$emit('onSaved', true)
this.$router.push({ name: 'SheetList' })
}