Complete select attachment component.

pull/9/head
ruibaby 6 years ago
parent 125faa2a43
commit e03fc86b44

@ -15,7 +15,7 @@
<a-row type="flex" align="middle"> <a-row type="flex" align="middle">
<a-skeleton active :loading="skeletonLoading" :paragraph="{ rows: 8 }"> <a-skeleton active :loading="skeletonLoading" :paragraph="{ rows: 8 }">
<a-col :span="24"> <a-col :span="24">
<div class="attach-item" v-for="(item, index) in attachments" :key="index"> <div class="attach-item" v-for="(item, index) in attachments" :key="index" @click="selectAttachment(item)">
<img :src="item.thumbPath"> <img :src="item.thumbPath">
</div> </div>
</a-col> </a-col>
@ -72,8 +72,6 @@ export default {
}, },
data() { data() {
return { return {
detailVisiable: false,
attachmentDrawerVisible: false,
uploadVisible: false, uploadVisible: false,
skeletonLoading: true, skeletonLoading: true,
pagination: { pagination: {
@ -82,7 +80,6 @@ export default {
sort: '' sort: ''
}, },
attachments: [], attachments: [],
selectedAttachment: {},
attachmentUploadHandler: attachmentApi.upload attachmentUploadHandler: attachmentApi.upload
} }
}, },
@ -115,6 +112,9 @@ export default {
this.pagination.total = response.data.data.total this.pagination.total = response.data.data.total
}) })
}, },
selectAttachment(item) {
this.$emit('listenToSelect', item)
},
handlePaginationChange(page, pageSize) { handlePaginationChange(page, pageSize) {
this.pagination.page = page this.pagination.page = page
this.pagination.size = pageSize this.pagination.size = pageSize

@ -97,7 +97,7 @@
</a-col> </a-col>
</a-row> </a-row>
<AttachmentSelectDrawer v-model="attachmentDrawerVisible"/> <AttachmentSelectDrawer v-model="attachmentDrawerVisible" @listenToSelect="selectAvatar"/>
</div> </div>
</template> </template>
@ -120,7 +120,8 @@ export default {
oldPassword: null, oldPassword: null,
newPassword: null, newPassword: null,
confirmPassword: null confirmPassword: null
} },
attachment: {}
} }
}, },
computed: { computed: {
@ -162,6 +163,9 @@ export default {
this.user = response.data.data this.user = response.data.data
this.$message.success('资料更新成功!') this.$message.success('资料更新成功!')
}) })
},
selectAvatar(data) {
this.user.avatar = data.path
} }
} }
} }

Loading…
Cancel
Save