内容管理支持所属专题

This commit is contained in:
shuzheng 2017-03-18 22:01:43 +08:00
parent 7d37595db3
commit 79205f7493
4 changed files with 37 additions and 19 deletions

View File

@ -7,7 +7,10 @@ import com.zheng.cms.common.constant.CmsResult;
import com.zheng.cms.common.constant.CmsResultConstant;
import com.zheng.cms.dao.model.CmsArticle;
import com.zheng.cms.dao.model.CmsArticleExample;
import com.zheng.cms.dao.model.CmsTopic;
import com.zheng.cms.dao.model.CmsTopicExample;
import com.zheng.cms.rpc.api.CmsArticleService;
import com.zheng.cms.rpc.api.CmsTopicService;
import com.zheng.common.base.BaseController;
import com.zheng.common.validator.LengthValidator;
import com.zheng.common.validator.NotNullValidator;
@ -19,6 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@ -40,6 +44,9 @@ public class CmsArticleController extends BaseController {
@Autowired
private CmsArticleService cmsArticleService;
@Autowired
private CmsTopicService cmsTopicService;
@ApiOperation(value = "文章首页")
@RequiresPermissions("cms:article:read")
@RequestMapping(value = "/index", method = RequestMethod.GET)
@ -73,7 +80,11 @@ public class CmsArticleController extends BaseController {
@ApiOperation(value = "新增文章")
@RequiresPermissions("cms:article:create")
@RequestMapping(value = "/create", method = RequestMethod.GET)
public String create() {
public String create(ModelMap modelMap) {
CmsTopicExample cmsTopicExample = new CmsTopicExample();
cmsTopicExample.setOrderByClause("ctime desc");
List<CmsTopic> cmsTopics = cmsTopicService.selectByExample(cmsTopicExample);
modelMap.put("cmsTopics", cmsTopics);
return "/manage/article/create";
}

View File

@ -50,11 +50,23 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
<select id="topicId" name="topicId" style="width: 100%">
<option value="0">所属专题</option>
<c:forEach var="cmsTopic" items="${cmsTopics}">
<option value="${cmsTopic.topicId}">${cmsTopic.title}</option>
</c:forEach>
</select>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
<label for="image">封面图</label>
<input id="image" type="text" class="form-control" name="image" maxlength="300" value="http://">
<input id="image" type="text" class="form-control" name="image" maxlength="300">
</div>
</div>
</div>
@ -62,15 +74,7 @@
<div class="form-group">
<div class="fg-line">
<label for="readnumber">阅读数量</label>
<input id="readnumber" type="text" class="form-control" name="readnumber" value="0">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
<label for="ctime">创建时间</label>
<input id="ctime" type="text" class="form-control" name="ctime">
<input id="readnumber" type="text" class="form-control" name="readnumber">
</div>
</div>
</div>

View File

@ -54,6 +54,7 @@ $(function() {
columns: [
{field: 'ck', checkbox: true},
{field: 'articleId', title: '编号', sortable: true, align: 'center'},
{field: 'topicId', title: '所属专题'},
{field: 'title', title: '标题'},
{field: 'author', title: '作者'},
{field: 'description', title: '描述'},
@ -107,6 +108,7 @@ function createAction() {
content: 'url:${basePath}/manage/article/create',
onContentReady: function () {
initMaterialInput();
$('select').select2();
}
});
}
@ -135,6 +137,7 @@ function updateAction() {
content: 'url:${basePath}/manage/article/update/' + rows[0].articleId,
onContentReady: function () {
initMaterialInput();
$('select').select2();
}
});
}

View File

@ -50,6 +50,14 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
<label for="topicId">所属专题</label>
<input id="topicId" type="text" class="form-control" name="topicId" value="${article.topicId}">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
@ -66,14 +74,6 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<div class="fg-line">
<label for="ctime">创建时间</label>
<input id="ctime" type="text" class="form-control" name="ctime" value="${article.ctime}">
</div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<div class="fg-line">