From b1f087c99c24fe2d902687d9c51767dca9582ff6 Mon Sep 17 00:00:00 2001 From: "SWX\\10484" <1048449493@qq.com> Date: Tue, 16 Jun 2026 15:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=97=85=E4=BE=8B=E5=BA=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/cases/detail.vue | 92 +++++++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 17 deletions(-) diff --git a/src/views/cases/detail.vue b/src/views/cases/detail.vue index f2c3b34..73dab52 100644 --- a/src/views/cases/detail.vue +++ b/src/views/cases/detail.vue @@ -25,22 +25,22 @@ > @@ -872,6 +885,10 @@ export default { { required: true, message: "请输入片语内容", trigger: "blur" }, ], }, + // ====================== 图片预览 ====================== + imagePreviewVisible: false, + imagePreviewUrl: "", + imageClickTimer: null, }; }, created() { @@ -1000,15 +1017,35 @@ export default { } }, handleAttachmentClick(row) { + // 双击时取消单击预览定时器 + if (this.imageClickTimer) { + clearTimeout(this.imageClickTimer); + this.imageClickTimer = null; + } row.showInDoc = 1; }, + // 图片单击预览(300ms 内无双击则触发) + handleImageClick(row) { + if (this.imageClickTimer) { + clearTimeout(this.imageClickTimer); + this.imageClickTimer = null; + return; + } + this.imageClickTimer = setTimeout(() => { + this.imageClickTimer = null; + this.imagePreviewUrl = + this.$store.state.user.netConfig.MINIO_ENDPOINT_HTTPS + + row.bucket_compress + + "/" + + row.object_compress; + this.imagePreviewVisible = true; + }, 300); + }, handleDeleteImg(row, index) { this.$modal .confirm("确定删除该影像?") - .then(function () { - return this.form.attachment.splice(index, 1); - }) .then(() => { + this.form.attachment.splice(index, 1); this.$modal.msgSuccess("删除成功"); }) .catch(() => {}); @@ -1527,4 +1564,25 @@ export default { align-self: center; flex-shrink: 0; } + +// 图片预览 +.image-preview-body { + background: #000; + display: flex; + align-items: center; + justify-content: center; + min-height: 400px; + + img { + max-width: 100%; + max-height: 75vh; + object-fit: contain; + } +} + +// 图片卡片 +.img-wrapper { + display: inline-block; + cursor: pointer; +} \ No newline at end of file