dangsn
2024-12-30 863a1758e3b7e44bbc5b3d287cefafd7202b6201
新增/更新情况下,处理图标svg内容中href的使用
已修改1个文件
17 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);