فهرست منبع

内容管理支持所属专题

shuzheng 9 سال پیش
والد
کامیت
79205f7493

+ 12 - 1
zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsArticleController.java

@@ -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";
 	}
 

+ 10 - 6
zheng-cms/zheng-cms-admin/src/main/webapp/WEB-INF/jsp/manage/article/create.jsp

@@ -53,24 +53,28 @@
 			<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://">
+						<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="readnumber">阅读数量</label>
-						<input id="readnumber" type="text" class="form-control" name="readnumber" value="0">
+						<label for="image">封面图</label>
+						<input id="image" type="text" class="form-control" name="image" maxlength="300">
 					</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">
+						<label for="readnumber">阅读数量</label>
+						<input id="readnumber" type="text" class="form-control" name="readnumber">
 					</div>
 				</div>
 			</div>

+ 3 - 0
zheng-cms/zheng-cms-admin/src/main/webapp/WEB-INF/jsp/manage/article/index.jsp

@@ -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();
 			}
 		});
 	}

+ 6 - 6
zheng-cms/zheng-cms-admin/src/main/webapp/WEB-INF/jsp/manage/article/update.jsp

@@ -53,24 +53,24 @@
 			<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="${article.image}">
+						<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">
-						<label for="readnumber">阅读数量</label>
-						<input id="readnumber" type="text" class="form-control" name="readnumber" value="0" value="${article.readnumber}">
+						<label for="image">封面图</label>
+						<input id="image" type="text" class="form-control" name="image" maxlength="300" value="${article.image}">
 					</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}">
+						<label for="readnumber">阅读数量</label>
+						<input id="readnumber" type="text" class="form-control" name="readnumber" value="0" value="${article.readnumber}">
 					</div>
 				</div>
 			</div>