From 7133d078db191d0053d4e9914a738bdcaca3e9fe Mon Sep 17 00:00:00 2001 From: wujj <1027418825@qq.com> Date: Thu, 13 Feb 2020 11:07:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BE=E5=BA=A6=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8F=82=E6=95=B0=E6=96=B0=E5=A2=9EappId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapp/WEB-INF/manager/cms/content/form.ftl | 2 +- .../webapp/static/plugins/ms/1.0.0/ms.util.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl index 973dfed7..04569f67 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl @@ -267,7 +267,7 @@ maximumWords: 2000, initialFrameWidth: '100%', initialFrameHeight: 400, - serverUrl: ms.base + "/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'" + ms.base + "\',fileUrlPrefix:\'" + ms.base + "\',imageUrlPrefix:\'" + ms.base + "\',imagePathFormat:\'/upload/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/cms/content/editor/%7Btime%7D\'%7D", + serverUrl: ms.base + "/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'" + ms.base + "\',fileUrlPrefix:\'" + ms.base + "\',imageUrlPrefix:\'" + ms.base + "\',imagePathFormat:\'cms/content/editor/%7Btime%7D\',filePathFormat:\'cms/content/editor/%7Btime%7D\',videoPathFormat:\'cms/content/editor/%7Btime%7D\',appId:true%7D", UEDITOR_HOME_URL: ms.base + '/static/plugins/ueditor/1.4.3.1/' }, contentCategoryIdOptions: [], diff --git a/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js b/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js index 64346f3f..137ac3cb 100644 --- a/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js +++ b/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js @@ -20,7 +20,18 @@ log(e.message); } } - //树形数据组织 + + /** + * 列表数据转化为树形结构的列表 + * @param source 数据源list + * @param id 编号 + * @param parentId 父级编号 + * @param children 树形子集变量 + * @returns {*} + * 支持父级编号为 0或null + * 原始数据[{id:1,titile:"标题",pid:0},{id:2,titile:"标题",pid:1}] + * 转化树形数据:[{id:1,titile:"标题",pid:0,children:[{id:2,titile:"标题",pid:1}]}] + */ function treeData(source, id, parentId, children) { var cloneData = JSON.parse(JSON.stringify(source)); return cloneData.filter(function (father) { @@ -28,7 +39,7 @@ return father[id] == child[parentId]; }); branchArr.length > 0 ? father[children] = branchArr : ''; - return !father[parentId] || father[parentId] == '0'; // 如果第一层不是parentId=0,请自行修改 + return !father[parentId] || father[parentId] == '0' || father[parentId] == null ; }); } //验证是否为子集