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

This commit is contained in:
xierz 2020-12-18 17:43:46 +08:00
parent c1d15d6836
commit 9cefb64d57
2 changed files with 8 additions and 4 deletions

View File

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

View File

@ -11,7 +11,7 @@
<el-header class="ms-header" height="50px"> <el-header class="ms-header" height="50px">
<el-col :span="12"> <el-col :span="12">
<@shiro.hasPermission name="cms:content:save"> <@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>
<@shiro.hasPermission name="cms:content:del"> <@shiro.hasPermission name="cms:content:del">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)" :disabled="!selectionList.length">删除</el-button> <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) { save: function (id) {
if (id) { if (id) {
location.href = this.manager + "/cms/content/form.do?id=" + id; location.href = this.manager + "/cms/content/form.do?id=" + id;
} else if (id == 0){
//在全部栏目下新增文章
location.href = this.manager + "/cms/content/form.do";
} else { } else {
location.href = this.manager + "/cms/content/form.do?categoryId=" + this.form.categoryId; location.href = this.manager + "/cms/content/form.do?categoryId=" + this.form.categoryId;
} }