Add loading for post settings.

pull/3445/head
ruibaby 2019-08-27 11:10:22 +08:00
parent dc52f30ade
commit 66fd2dc9c0
2 changed files with 172 additions and 153 deletions

View File

@ -490,11 +490,11 @@ export default {
} }
}, },
handleShowPostSettings(post) { handleShowPostSettings(post) {
this.postSettingVisible = true
postApi.get(post.id).then(response => { postApi.get(post.id).then(response => {
this.selectedPost = response.data.data this.selectedPost = response.data.data
this.selectedTagIds = this.selectedPost.tagIds this.selectedTagIds = this.selectedPost.tagIds
this.selectedCategoryIds = this.selectedPost.categoryIds this.selectedCategoryIds = this.selectedPost.categoryIds
this.postSettingVisible = true
}) })
}, },
// //

View File

@ -7,6 +7,11 @@
@close="onClose" @close="onClose"
destroyOnClose destroyOnClose
:visible="visiable" :visible="visiable"
>
<a-skeleton
active
:loading="settingLoading"
:paragraph="{ rows: 24 }"
> >
<div class="post-setting-drawer-content"> <div class="post-setting-drawer-content">
<div :style="{ marginBottom: '16px' }"> <div :style="{ marginBottom: '16px' }">
@ -171,6 +176,7 @@
v-if="saveButton" v-if="saveButton"
>保存</a-button> >保存</a-button>
</div> </div>
</a-skeleton>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
@ -196,6 +202,7 @@ export default {
return { return {
thumDrawerVisible: false, thumDrawerVisible: false,
categoryFormVisible: false, categoryFormVisible: false,
settingLoading: true,
options: [], options: [],
keys: ['blog_url'], keys: ['blog_url'],
selectedPost: this.post, selectedPost: this.post,
@ -249,6 +256,7 @@ export default {
} }
}, },
created() { created() {
this.loadSkeleton()
this.loadOptions() this.loadOptions()
this.loadCategories() this.loadCategories()
}, },
@ -270,6 +278,11 @@ export default {
}, },
selectedCategoryIds(val) { selectedCategoryIds(val) {
this.$emit('onRefreshCategoryIds', val) this.$emit('onRefreshCategoryIds', val)
},
visiable: function(newValue, oldValue) {
if (newValue) {
this.loadSkeleton()
}
} }
}, },
computed: { computed: {
@ -282,6 +295,12 @@ export default {
} }
}, },
methods: { methods: {
loadSkeleton() {
this.settingLoading = true
setTimeout(() => {
this.settingLoading = false
}, 500)
},
loadOptions() { loadOptions() {
optionApi.listAll(this.keys).then(response => { optionApi.listAll(this.keys).then(response => {
this.options = response.data.data this.options = response.data.data