From 4f20d1afbe641a2f3fd49ae9460ea3630b7acf2b Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期一, 11 九月 2023 14:19:03 +0800 Subject: [PATCH] 下一步核查 --- src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html | 40 +++++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html index cc0c2f2..c8b0359 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html @@ -109,7 +109,7 @@ th:src="*{preRectifyPhoto}" onclick="showPicture(this.getAttribute('data-id'),'preRectifyPhoto')" th:data-id="${hiddenDangerCheckPoint.id}"> - <div class="image-container"></div> + <div class="image-container" style="display: flex;align-items: flex-start"></div> </div> </div> </div> @@ -154,33 +154,35 @@ var ids = imgsUrl.attr('data-id') var imageContainer = document.querySelector('.image-container'); - // 将逗号分隔的字符串拆分为URL数组 - var imageUrlArray = imageUrls.split(','); + if(imageUrls && imageUrls !== ''){ + // 将逗号分隔的字符串拆分为URL数组 + var imageUrlArray = imageUrls.split(','); - // 遍历URL数组并创建img元素 - imageUrlArray.forEach(function(url, index) { - var img = document.createElement('img'); - img.setAttribute('src', url); - img.setAttribute('style', 'width: 100px; height: 100px; cursor: pointer;margin: 10px'); - img.setAttribute('title', '查看图片'); - img.setAttribute('data-id', ids); - img.addEventListener('click', function() { - // showPicture(this.getAttribute('data-id'), 'preRectifyPhoto'); - openPicture(url) + // 遍历URL数组并创建img元素 + imageUrlArray.forEach(function(url, index) { + var img = document.createElement('img'); + img.setAttribute('src', url); + img.setAttribute('style', 'width: 100px; height: 100px; cursor: pointer;margin-right: 10px'); + img.setAttribute('title', '查看图片'); + img.setAttribute('data-id', ids); + img.addEventListener('click', function() { + // showPicture(this.getAttribute('data-id'), 'preRectifyPhoto'); + openPicture(url) + }); + imageContainer.appendChild(img); }); - imageContainer.appendChild(img); - }); + } }); + + function openPicture(url) { + window.open(url) + } /* 图片--查看 */ function showPicture(id,type) { var showPictureUrl = "/tr/hiddenDangerCheck/dangerBase/showPicture/{type}/{id}"; var urlLast = showPictureUrl.replace("{type}", type).replace("{id}", id); $.operate.openDetailInfo("查看图片", urlLast); - } - - function openPicture(url) { - window.open(url) } </script> -- Gitblit v1.9.2