Prefect attachment drawer and detail drawer

pull/3445/head
johnniang 2019-04-20 00:46:00 +08:00
parent 828c8ad624
commit f0dc466760
2 changed files with 50 additions and 16 deletions

View File

@ -143,11 +143,24 @@ export default {
} }
}, },
created() { created() {
setTimeout(() => { this.loadSkeleton()
this.detailLoading = false },
}, 300) watch: {
visiable: function(newValue, oldValue) {
this.$log.debug('old value', oldValue)
this.$log.debug('new value', newValue)
if (newValue) {
this.loadSkeleton()
}
}
}, },
methods: { methods: {
loadSkeleton() {
this.detailLoading = true
setTimeout(() => {
this.detailLoading = false
}, 500)
},
deleteAttachment() { deleteAttachment() {
attachmentApi.delete(this.attachment.id).then(response => { attachmentApi.delete(this.attachment.id).then(response => {
this.$message.success('删除成功!') this.$message.success('删除成功!')

View File

@ -17,23 +17,29 @@
enterButton enterButton
/> />
</a-row> </a-row>
<a-divider></a-divider> <a-divider />
<a-row <a-row
type="flex" type="flex"
align="middle" align="middle"
> >
<a-col :span="24"> <a-skeleton
<div active
class="attach-item" :loading="skeletonLoading"
v-for="(item, index) in attachments" :paragraph="{ rows: 8 }"
:key="index" >
@click="showDetailDrawer(item)" <a-col :span="24">
> <div
<img :src="item.thumbPath"> class="attach-item"
</div> v-for="(item, index) in attachments"
</a-col> :key="index"
@click="showDetailDrawer(item)"
>
<img :src="item.thumbPath">
</div>
</a-col>
</a-skeleton>
</a-row> </a-row>
<a-divider></a-divider> <a-divider />
<a-row <a-row
type="flex" type="flex"
justify="end" justify="end"
@ -108,9 +114,10 @@ export default {
detailVisiable: false, detailVisiable: false,
attachmentDrawerVisible: false, attachmentDrawerVisible: false,
uploadVisible: false, uploadVisible: false,
skeletonLoading: true,
pagination: { pagination: {
page: 1, page: 1,
size: 8, size: 14,
sort: '' sort: ''
}, },
attachments: [], attachments: [],
@ -119,9 +126,23 @@ export default {
} }
}, },
created() { created() {
this.loadSkeleton()
this.loadAttachments() this.loadAttachments()
}, },
watch: {
visiable: function(newValue, oldValue) {
if (newValue) {
this.loadSkeleton()
}
}
},
methods: { methods: {
loadSkeleton() {
this.skeletonLoading = true
setTimeout(() => {
this.skeletonLoading = false
}, 500)
},
showUploadModal() { showUploadModal() {
this.uploadVisible = true this.uploadVisible = true
}, },