소스 검색

优化获取栏目id获取第一行

xierz 4 년 전
부모
커밋
9cefb64d57
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 3
      src/main/webapp/WEB-INF/manager/cms/content/form.ftl
  2. 4 1
      src/main/webapp/WEB-INF/manager/cms/content/main.ftl

+ 4 - 3
src/main/webapp/WEB-INF/manager/cms/content/form.ftl

@@ -286,7 +286,7 @@
                     // 文章标题
                     contentTitle: '',
                     // 所属栏目
-                    categoryId: '',
+                    categoryId: undefined,
                     // 文章类型
                     contentType: [],
                     // 是否显示
@@ -675,8 +675,9 @@
                 this.type = ms.util.getParameter("type");
 
                 //在指定栏目下新增或编辑文章时
-                if (ms.util.getParameter("categoryId")) {
-                    this.form.categoryId = ms.util.getParameter("categoryId");
+                var categoryId = ms.util.getParameter("categoryId");
+                if (categoryId) {
+                    this.form.categoryId = categoryId;
                     //如果是封面栏目直接跳转
                     if (this.type) {
                         this.getFromFengMian(this.form.categoryId);

+ 4 - 1
src/main/webapp/WEB-INF/manager/cms/content/main.ftl

@@ -11,7 +11,7 @@
     <el-header class="ms-header" height="50px">
         <el-col :span="12">
             <@shiro.hasPermission name="cms:content:save">
-                <el-button type="primary" icon="el-icon-plus" size="mini" @click="save()">新增</el-button>
+                <el-button type="primary" icon="el-icon-plus" size="mini" @click="save(0)">新增</el-button>
             </@shiro.hasPermission>
             <@shiro.hasPermission name="cms:content:del">
                 <el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)"  :disabled="!selectionList.length">删除</el-button>
@@ -370,6 +370,9 @@
             save: function (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;
                 }