From b19dccc6399c1934bbc225ffde62bd0e6f8b3ec8 Mon Sep 17 00:00:00 2001 From: xierz Date: Tue, 22 Dec 2020 09:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapp/WEB-INF/manager/cms/content/main.ftl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/WEB-INF/manager/cms/content/main.ftl b/src/main/webapp/WEB-INF/manager/cms/content/main.ftl index 53551b9b..fd4a357f 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/main.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/main.ftl @@ -11,7 +11,7 @@ <@shiro.hasPermission name="cms:content:save"> - 新增 + 新增 <@shiro.hasPermission name="cms:content:del"> 删除 @@ -368,13 +368,18 @@ }, //新增 save: function (id) { + //id有值时编辑 if (id) { location.href = this.manager + "/cms/content/form.do?id=" + id; - } else if (id == 0){ - //在全部栏目下新增文章 - location.href = this.manager + "/cms/content/form.do"; - } else { - location.href = this.manager + "/cms/content/form.do?categoryId=" + this.form.categoryId; + }else { + //根据当前栏目新增时自动选中栏目 + var categoryId = this.form.categoryId; + if (categoryId) { + location.href = this.manager + "/cms/content/form.do?categoryId=" + this.form.categoryId; + }else { + //如果栏目id没有值就单纯的新增,不自动选定栏目 + location.href = this.manager + "/cms/content/form.do"; + } } }, //表格数据转换