diff --git a/src/api/attachment.js b/src/api/attachment.js index 2760641c..5c1f9e23 100644 --- a/src/api/attachment.js +++ b/src/api/attachment.js @@ -19,4 +19,11 @@ attachmentApi.get = attachmentId => { }) } +attachmentApi.delete = attachmentId => { + return service({ + url: `${baseUrl}/${attachmentId}`, + method: 'delete' + }) +} + export default attachmentApi diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index b00c9f1c..42e2737f 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -56,7 +56,7 @@ > - +
@@ -64,30 +64,59 @@
- - - - 附件名: - - - - - 附件类型: - - - - - - {{ selectAttachment.path }} - - - ![{{ selectAttachment.name }}]({{ selectAttachment.path }}) - - + + + + + 附件名: + + + + + 附件类型: + + + + + 附件大小: + + + + + 图片尺寸: + + + + + + 普通链接: + + + + + + + + Markdown 格式: + + + + + +
- 删除 + + 删除 +
@@ -106,7 +135,7 @@ export default { return { uploadVisible: false, drawerVisible: false, - detailImgLoading: false, + detailLoading: false, selectAttachment: null, drawerWidth: '560', attachments: [], @@ -138,10 +167,10 @@ export default { }, showDetailDrawer(attachment) { this.drawerVisible = true - this.detailImgLoading = true + this.detailLoading = true this.selectAttachment = attachment setTimeout(() => { - this.detailImgLoading = false + this.detailLoading = false }, 500) }, showUploadModal() { @@ -158,6 +187,41 @@ export default { this.$message.error(`${info.file.name} file upload failed.`) } }, + deleteAttachment(id) { + attachmentApi.delete(id).then(response => { + this.$message.success('删除成功!') + this.drawerVisible = false + this.loadAttachments() + }) + }, + doCopyNormalLink() { + const text = ` + ${this.selectAttachment.path} + ` + this.$copyText(text) + .then(message => { + console.log('copy', message) + this.$message.success('复制完毕') + }) + .catch(err => { + console.log('copy.err', err) + this.$message.error('复制失败') + }) + }, + doCopyMarkdownLink() { + const text = ` + ![${this.selectAttachment.name}](${this.selectAttachment.path}) + ` + this.$copyText(text) + .then(message => { + console.log('copy', message) + this.$message.success('复制完毕') + }) + .catch(err => { + console.log('copy.err', err) + this.$message.error('复制失败') + }) + }, onChildClose() { this.drawerVisible = false } @@ -166,7 +230,7 @@ export default {