From ed933a88f6317141094aebcf1f165bdb5b9f6842 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 25 八月 2023 10:58:05 +0800 Subject: [PATCH] 图片预览 --- src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html | 30 ++++--- src/main/resources/templates/tr/hiddenDangerCheck/dangerRectify/editDangerRectify.html | 30 ++++--- src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailYesDanger.html | 30 ++++--- src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotJudge.html | 31 ++++--- src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/editDangerExamine.html | 30 ++++--- src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/detailDangerExamine.html | 31 ++++--- 6 files changed, 96 insertions(+), 86 deletions(-) diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/detailDangerExamine.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/detailDangerExamine.html index 73775fe..e8488b0 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/detailDangerExamine.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/detailDangerExamine.html @@ -302,23 +302,24 @@ var imageUrls = imgsUrl.attr('src') var ids = imgsUrl.attr('data-id') var imageContainer = document.querySelector('.image-container'); + if(imageUrls && imageUrls !== '') { + // 将逗号分隔的字符串拆分为URL数组 + var imageUrlArray = imageUrls.split(','); - // 将逗号分隔的字符串拆分为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-right: 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) { diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/editDangerExamine.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/editDangerExamine.html index d02b036..70f2265 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/editDangerExamine.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerExamine/editDangerExamine.html @@ -350,22 +350,24 @@ 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-right: 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) { diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerRectify/editDangerRectify.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerRectify/editDangerRectify.html index 0e57f53..bacfd08 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerRectify/editDangerRectify.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerRectify/editDangerRectify.html @@ -415,22 +415,24 @@ 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-right: 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) { diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html index 145d2c0..c8b0359 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotDanger.html @@ -154,22 +154,24 @@ 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-right: 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) { diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotJudge.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotJudge.html index 393bda5..19eff42 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotJudge.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailNotJudge.html @@ -152,23 +152,24 @@ var imageUrls = imgsUrl.attr('src') var ids = imgsUrl.attr('data-id') var imageContainer = document.querySelector('.image-container'); + if(imageUrls && imageUrls !== '') { + // 将逗号分隔的字符串拆分为URL数组 + var imageUrlArray = imageUrls.split(','); - // 将逗号分隔的字符串拆分为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-right: 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 showPicture(id,type) { diff --git a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailYesDanger.html b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailYesDanger.html index 4e7b271..b0b1c25 100644 --- a/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailYesDanger.html +++ b/src/main/resources/templates/tr/hiddenDangerCheck/dangerReport/detailYesDanger.html @@ -207,22 +207,24 @@ 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-right: 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 showPicture(id,type) { -- Gitblit v1.9.2