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"; + } } }, //表格数据转换