From 863a1758e3b7e44bbc5b3d287cefafd7202b6201 Mon Sep 17 00:00:00 2001 From: dangsn <dangsn@vci-tech.com> Date: 星期一, 30 十二月 2024 16:32:22 +0800 Subject: [PATCH] 新增/更新情况下,处理图标svg内容中href的使用 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java index c6d966d..75ca637 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java @@ -109,10 +109,16 @@ public void addIcon(PLIconDTO iconDTO) { WebUtil.alertNotNull(iconDTO.getName(),"鍥炬爣鍚嶇О", iconDTO.getContent(),"鍥炬爣鍐呭"); + String iconContent = iconDTO.getContent(); + if(iconContent.contains("<use href")){ + iconContent = iconContent.replace("svg\"", "svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""); + iconContent = iconContent.replace("<use href","<use xlink:href"); + } + PLIcon plIcon = new PLIcon(); plIcon.oid = WebUtil.getPk(); plIcon.name = iconDTO.getName().toLowerCase(); - plIcon.content = iconDTO.getContent(); + plIcon.content = iconContent; plIcon.type = iconDTO.getType(); plIcon.groups = iconDTO.getGroups(); @@ -138,7 +144,14 @@ if(StringUtils.isBlank(plIcon.oid)){ throw new VciBaseException("鏈幏鍙栧埌銆�"+iconDTO.getName()+"銆戝浘鏍囦俊鎭紒"); } - plIcon.content = iconDTO.getContent(); + + String iconContent = iconDTO.getContent(); + if(iconContent.contains("<use href")){ + iconContent = iconContent.replace("svg\"", "svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""); + iconContent = iconContent.replace("<use href","<use xlink:href"); + } + + plIcon.content = iconContent; plIcon.type = iconDTO.getType(); plIcon.groups = iconDTO.getGroups(); portalServicePrx.updatePLIcon(plIcon); -- Gitblit v1.9.3