Browse Source

信息中心V1.3.9

kaick 1 year ago
parent
commit
0bdb0499d8

+ 10 - 3
src/main/java/com/caimei/modules/info/service/InfoTypeService.java

@@ -3,6 +3,7 @@ package com.caimei.modules.info.service;
 import java.util.Date;
 import java.util.List;
 
+import com.caimei.modules.hehe.util.UploadPicUtils;
 import com.caimei.modules.landing.mapper.CmBrandLandingMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,6 +53,8 @@ public class InfoTypeService extends CrudService<InfoTypeDao, InfoType> {
 		cmBrandLandingMapper.delCmBrandLandingByAuthorId(infoType.getId());
 		//封装数据
 		infoType.getCmBrandLandingList().forEach(cmBrandLanding -> {
+			cmBrandLanding.setHeadPcBanner(UploadPicUtils.saveImageToServer(cmBrandLanding.getHeadPcBanner()));
+			cmBrandLanding.setHeadAppBanner(UploadPicUtils.saveImageToServer(cmBrandLanding.getHeadAppBanner()));
 			cmBrandLanding.setType(4);
 			cmBrandLanding.setAuthorId(infoType.getId());
 			cmBrandLanding.setAddTime(new Date());
@@ -66,16 +69,20 @@ public class InfoTypeService extends CrudService<InfoTypeDao, InfoType> {
 		cmBrandLandingMapper.delCmBrandLandingByAuthorId(infoType.getId());
 		InfoType infoType1 = new InfoType();
 		infoType1.setParentIds(infoType.getId());
-		List<InfoType> byInfoTypeIdList = infoTypedao.getByInfoTypeList(infoType1);
-		byInfoTypeIdList.forEach(byInfoTypeId->{
+		List<InfoType> byInfoTypeIdList = getByInfoTypeList(infoType1);
+		byInfoTypeIdList.forEach(byInfoTypeId -> {
 			super.delete(byInfoTypeId);
 			cmBrandLandingMapper.delCmBrandLandingByAuthorId(byInfoTypeId.getId());
 		});
 	}
 
+	public List<InfoType> getByInfoTypeList(InfoType infoType) {
+		return infoTypedao.getByInfoTypeList(infoType);
+	}
+
 	@Transactional(readOnly = false)
 	public void updateEnabledStatusByIds(String enabledStatus, String[] ids) {
-		infoTypedao.updateEnabledStatusByIds(enabledStatus,ids);
+		infoTypedao.updateEnabledStatusByIds(enabledStatus, ids);
 	}
 
 	public int countEnabledStatus(String enabledStatus) {

+ 1 - 1
src/main/java/com/caimei/modules/info/web/InfoController.java

@@ -197,7 +197,7 @@ public class InfoController extends BaseController {
      */
     @RequestMapping(value = "findInfoPage")
     public String findInfoPage(Info info, Model model, HttpServletRequest request, HttpServletResponse response) {
-        info.setEnabledStatus("1");
+        info.setOnlineStatus(2);
         Page<Info> page = infoService.findPage(new Page<Info>(request, response), info);
         InfoType infoType = new InfoType();
         infoType.setType("1");

+ 21 - 6
src/main/java/com/caimei/modules/info/web/InfoTypeController.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.caimei.modules.hehe.util.UploadPicUtils;
 import com.caimei.modules.landing.domain.CmBrandLanding;
 import com.caimei.modules.landing.service.CmBrandLandingService;
 import com.caimei.modules.opensearch.CoreServiceUitls;
@@ -83,32 +84,46 @@ public class InfoTypeController extends BaseController {
 	@RequiresPermissions("info:infoType:edit")
 	@RequestMapping(value = "save")
 	public String save(InfoType infoType, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, infoType)){
+		if (!beanValidator(model, infoType)) {
 			return form(infoType, model);
 		}
 		infoTypeService.save(infoType);
 		addMessage(redirectAttributes, "保存信息分类成功");
 		// 更新全部文章索引
 		coreServiceUitls.updateAllArticleIndex();
-		return "redirect:"+Global.getAdminPath()+"/info/infoType/?repage&type="+infoType.getType()+"&parentId="+infoType.getParentId();
+		return "redirect:" + Global.getAdminPath() + "/info/infoType/?repage&type=" + infoType.getType() + "&parentId=" + infoType.getParentId();
 	}
 
 	@RequiresPermissions("info:infoType:delete")
 	@RequestMapping(value = "delete")
 	public String delete(InfoType infoType, RedirectAttributes redirectAttributes) {
-		Info info=new Info();
+		Info info = new Info();
 		info.setInfoType(infoType);
 		List<Info> list = infoService.findList(info);
-		if(CollectionUtils.isNotEmpty(list)){
+		//子级菜单
+		InfoType infoType1 = new InfoType();
+		infoType1.setParentIds(infoType.getId());
+		List<InfoType> byInfoTypeIdList = infoTypeService.getByInfoTypeList(infoType1);
+		if (CollectionUtils.isNotEmpty(byInfoTypeIdList)) {
+			for (InfoType byInfoType : byInfoTypeIdList) {
+				Info byInfo = new Info();
+				info.setInfoType(byInfoType);
+				List<Info> byList = infoService.findList(byInfo);
+				if (CollectionUtils.isNotEmpty(byList)) {
+					addMessage(redirectAttributes, "删除信息分类失败,请先把该分类的所有子级信息删除");
+					return "redirect:" + Global.getAdminPath() + "/info/infoType/?repage&type=" + infoType.getType() + "&parentId=" + infoType.getParentId();
+				}
+			}
+		} else if (CollectionUtils.isNotEmpty(list)) {
 			addMessage(redirectAttributes, "删除信息分类失败,请先把该分类的所有信息删除");
-		}else{
+		} else {
 			infoService.deleteByTypeId(infoType.getId());
 			infoTypeService.delete(infoType);
 			addMessage(redirectAttributes, "删除信息分类成功");
 			// 更新全部文章索引
 			coreServiceUitls.updateAllArticleIndex();
 		}
-		return "redirect:"+Global.getAdminPath()+"/info/infoType/?repage&type="+infoType.getType()+"&parentId="+infoType.getParentId();
+		return "redirect:" + Global.getAdminPath() + "/info/infoType/?repage&type=" + infoType.getType() + "&parentId=" + infoType.getParentId();
 	}
 
 	/**

+ 2 - 1
src/main/resources/mappings/modules/info/InfoMapper.xml

@@ -6,6 +6,7 @@
         a.id AS "id",
 		a.shopId AS "shopId",
 		a.typeId AS "infoType.id",
+		a.typeId ,
         b.name as typeName,
 		a.title AS "title",
 		a.label AS "label",
@@ -299,7 +300,7 @@
             </if>
             <if test="null !=infoType">
                 <if test="infoType.id != null and infoType.id != ''">
-                    AND a.typeId = #{infoType.id}
+                    AND (a.typeId = #{infoType.id}  or b.parentId=#{infoType.id})
                 </if>
             </if>
             <if test="null !=cmRelatedType and cmRelatedType != ''">

+ 52 - 2
src/main/webapp/WEB-INF/views/modules/info/addInfoForm.jsp

@@ -71,7 +71,44 @@
 			obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
 			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
 		}
+		var ontypeId = null;
+		var typeId = null;
+		function ischangeType() {
+			if (null != typeId) {
+				$("#typeListId option[value=" + typeId + "]").val(ontypeId);
+			}
+			$("#optionType").find("option").eq(0).prop("selected", true)
+			optionTypeParent()
+		}
+
+		function optionTypeParent() {
+			$("#optionType [parent]").each(function (item) {
+				if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+					$(this).show()
+				} else {
+					$(this).hide()
+				}
+			})
+		}
 
+		function isoptionType() {
+			if ("" != $("#optionType option:selected").val()) {
+			ontypeId =  $("#optionType option:selected").attr("parent")
+			typeId = $("#optionType option:selected").val()
+			$("#typeListId option:selected").val($("#optionType option:selected").val())
+			}else {
+				ischangeType()
+			}
+		}
+
+		$(document).ready(function () {
+			$("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+			optionTypeParent()
+			isoptionType()
+		})
+		$("input[name=publishSource]").change(function () {
+			$("#searchForm").submit();
+		})
 	</script>
 </head>
 <body>
@@ -103,9 +140,22 @@
 					onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
 		<br> <br>
 		<label>文章分类:</label>
-		<form:select path="infoType.id" class="input-small">
+		<form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
+			<form:option value="" label=" "/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId eq 0}">
+					<form:option value="${type.id}" label="${type.name}"/>
+				</c:if>
+			</c:forEach>
+		</form:select>
+		<form:select id="optionType" path="" class="input-small" onchange="isoptionType()">
 			<form:option value="" label=" "/>
-			<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId ne 0}">
+					<form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+								 cssStyle="display: none"/>
+				</c:if>
+			</c:forEach>
 		</form:select>
 		&nbsp;&nbsp<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
 		<div class="clearfix"></div>

+ 52 - 2
src/main/webapp/WEB-INF/views/modules/info/auditInfoPage.jsp

@@ -15,6 +15,43 @@
 		#inputForm td input[type="text"]{width:320px;height:16px;line-height:16px}
 		.init-label label{margin:5px 10px;color:gray}
 	</style>
+	<script type="text/javascript">
+		var ontypeId = null;
+		var typeId = null;
+		function ischangeType() {
+			if (null != typeId) {
+				$("#typeListId option[value=" + typeId + "]").val(ontypeId);
+			}
+			$("#optionType").find("option").eq(0).prop("selected", true)
+			optionTypeParent()
+		}
+
+		function optionTypeParent() {
+			$("#optionType [parent]").each(function (item) {
+				if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+					$(this).show()
+				} else {
+					$(this).hide()
+				}
+			})
+		}
+
+		function isoptionType() {
+			if ("" != $("#optionType option:selected").val()) {
+				ontypeId = $("#optionType option:selected").attr("parent")
+				typeId = $("#optionType option:selected").val()
+				$("#typeListId option:selected").val($("#optionType option:selected").val())
+			}else {
+				ischangeType()
+			}
+		}
+
+		$(document).ready(function () {
+			$("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+			optionTypeParent()
+			isoptionType()
+		})
+	</script>
 </head>
 <body>
 <ul class="nav nav-tabs">
@@ -86,8 +123,21 @@
 		<tr>
 			<th><span class="red">*</span>文章分类:</th>
 			<td colspan="3">
-				<form:select path="infoType.id" class="input-small required">
-					<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+				<form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
+					<c:forEach items="${typeList}" var="type" varStatus="index">
+						<c:if test="${type.parentId eq 0}">
+							<form:option value="${type.id}" label="${type.name}"/>
+						</c:if>
+					</c:forEach>
+				</form:select>
+				<form:select id="optionType" path="typeId" class="input-small" onchange="isoptionType()">
+					<form:option value="" label=" "/>
+					<c:forEach items="${typeList}" var="type" varStatus="index">
+						<c:if test="${type.parentId ne 0}">
+							<form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+										 cssStyle="display: none"/>
+						</c:if>
+					</c:forEach>
 				</form:select>
 			</td>
 		</tr>

+ 53 - 2
src/main/webapp/WEB-INF/views/modules/info/infoForm.jsp

@@ -48,8 +48,45 @@
             color: gray
         }
     </style>
+    <script type="text/javascript">
+        var ontypeId = null;
+        var typeId = null;
+        function ischangeType() {
+            if (null != typeId) {
+                $("#typeListId option[value=" + typeId + "]").val(ontypeId);
+            }
+            $("#optionType").find("option").eq(0).prop("selected", true)
+            optionTypeParent()
+        }
+
+        function optionTypeParent() {
+            $("#optionType [parent]").each(function (item) {
+                if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+                    $(this).show()
+                } else {
+                    $(this).hide()
+                }
+            })
+        }
+
+        function isoptionType() {
+            if ("" != $("#optionType option:selected").val()) {
+                ontypeId = $("#optionType option:selected").attr("parent")
+                typeId = $("#optionType option:selected").val()
+                $("#typeListId option:selected").val($("#optionType option:selected").val())
+            }else {
+                ischangeType()
+            }
+        }
 
+        $(document).ready(function () {
+            $("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+            optionTypeParent()
+            isoptionType()
+        })
+    </script>
 </head>
+
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/info/info/">文章列表</a></li>
@@ -133,9 +170,23 @@
         <tr>
             <th><span class="red">*</span>文章分类:</th>
             <td colspan="3">
-                <form:select path="infoType.id" class="input-small required">
-                    <form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+                <form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
+                    <c:forEach items="${typeList}" var="type" varStatus="index">
+                        <c:if test="${type.parentId eq 0}">
+                            <form:option value="${type.id}" label="${type.name}"/>
+                        </c:if>
+                    </c:forEach>
                 </form:select>
+                <form:select id="optionType" path="typeId" class="input-small" onchange="isoptionType()">
+                    <form:option value="" label=" "/>
+                    <c:forEach items="${typeList}" var="type" varStatus="index">
+                        <c:if test="${type.parentId ne 0}">
+                            <form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+                                         cssStyle="display: none"/>
+                        </c:if>
+                    </c:forEach>
+                </form:select>
+
             </td>
         </tr>
         <tr>

+ 107 - 51
src/main/webapp/WEB-INF/views/modules/info/infoList.jsp

@@ -150,7 +150,7 @@
 					$.post("${ctx}/info/info/updateTopPosition", {
 						'topPosition': topPosition,
 						'id': id,
-						'type':type
+						'type': type
 					}, function (data) {
 						if (true == data.success) {
 							$.jBox.tip(data.msg, 'info');
@@ -159,65 +159,121 @@
 						}
 						setTimeout(function () {
 							$("#searchForm").submit();
-						},800)
+						}, 800)
 					}, "JSON");//这里返回的类型有:json,html,xml,text
 				}
 				return;
 			}, {buttonsFocus: 1, persistent: true});
 		}
+
+		var ontypeId = null;
+		var typeId = null;
+		function ischangeType() {
+			if (null != typeId) {
+				$("#typeListId option[value=" + typeId + "]").val(ontypeId);
+			}
+			$("#optionType").find("option").eq(0).prop("selected", true)
+			optionTypeParent()
+		}
+
+		function optionTypeParent() {
+			$("#optionType [parent]").each(function (item) {
+				if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+					$(this).show()
+				} else {
+					$(this).hide()
+				}
+			})
+		}
+
+		function isoptionType() {
+			if ("" != $("#optionType option:selected").val()) {
+			ontypeId = $("#optionType option:selected").attr("parent")
+			typeId = $("#optionType option:selected").val()
+			$("#typeListId option:selected").val($("#optionType option:selected").val())
+			}else {
+				ischangeType()
+			}
+		}
+
+		$(document).ready(function () {
+			$("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+			optionTypeParent()
+			isoptionType()
+		})
 	</script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/info/info/">文章列表</a></li>
-		<shiro:hasPermission name="info:info:edit"><li><a href="${ctx}/info/info/form">文章添加</a></li></shiro:hasPermission>
-		<shiro:hasPermission name="info:infoType:edit"><li><a href="javascript:void(0);" onclick="updateType();">修改分类项</a></li></shiro:hasPermission>
-	</ul>
-	<input type="button" class="btn btn-primary" value="更新全部搜索索引" onclick="updateAllIndex()" />
-	<form:form id="searchForm" modelAttribute="info" action="${ctx}/info/info/" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<form:hidden path="label"/>
-		<div class="ul-form">
-			 <label>ID:</label>
-				<form:input path="id" htmlEscape="false" maxlength="11" class="input-mini"/>
-			 <label>标题:</label>
-				<form:input path="title" htmlEscape="false" maxlength="100" class="input-medium"/>
-			 <label>发布人:</label>
-				<form:input path="publisher" htmlEscape="false" maxlength="50" class="input-medium"/>
-			 <label>发布时间:</label>
-				<form:input path="startPubDate" type="text" maxlength="10" class="input-medium Wdate"
-							value="${startPubDate}"
-							onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
-				至
-				<form:input path="endPubDate" type="text" maxlength="10" class="input-medium Wdate"
-							value="${startPubDate}"
-							onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
-				<br> <br>
-			  <label>文章分类:</label>
-				<form:select path="infoType.id" class="input-small">
-					<form:option value="" label=" "/>
-					<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
-				</form:select>
+<ul class="nav nav-tabs">
+	<li class="active"><a href="${ctx}/info/info/">文章列表</a></li>
+	<shiro:hasPermission name="info:info:edit">
+		<li><a href="${ctx}/info/info/form">文章添加</a></li>
+	</shiro:hasPermission>
+	<shiro:hasPermission name="info:infoType:edit">
+		<li><a href="javascript:void(0);" onclick="updateType();">修改分类项</a></li>
+	</shiro:hasPermission>
+</ul>
+<input type="button" class="btn btn-primary" value="更新全部搜索索引" onclick="updateAllIndex()"/>
+<form:form id="searchForm" modelAttribute="info" action="${ctx}/info/info/" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<form:hidden path="label"/>
+	<div class="ul-form">
+		<label>ID:</label>
+		<form:input path="id" htmlEscape="false" maxlength="11" class="input-mini"/>
+		<label>标题:</label>
+		<form:input path="title" htmlEscape="false" maxlength="100" class="input-medium"/>
+		<label>发布人:</label>
+		<form:input path="publisher" htmlEscape="false" maxlength="50" class="input-medium"/>
+		<label>发布时间:</label>
+		<form:input path="startPubDate" type="text" maxlength="10" class="input-medium Wdate"
+					value="${startPubDate}"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
+		至
+		<form:input path="endPubDate" type="text" maxlength="10" class="input-medium Wdate"
+					value="${startPubDate}"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
+		<br> <br>
+		<label>文章分类:</label>
+		<form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
+			<form:option value="" label=" "/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId eq 0}">
+					<form:option value="${type.id}" label="${type.name}"/>
+				</c:if>
+			</c:forEach>
+		</form:select>
+		<form:select id="optionType" path="" class="input-small" onchange="isoptionType()">
+			<form:option value="" label=" "/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId ne 0}">
+					<form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+								 cssStyle="display: none"/>
+				</c:if>
+			</c:forEach>
+		</form:select>
 
-			 <label>推荐状态:</label>
-			 	<form:select path="recommendStatus" class="input-mini">
-					<form:option value="" label=" "/>
-					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
-				</form:select>
-			 <label>状态:</label>
-			 	<form:select path="enabledStatus" class="input-mini">
-					<form:option value="" label=" "/>
-					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
-				</form:select>
-			<label>关联标签库:</label>
-				<form:select path="isRelevance" class="input-medium">
-					<form:option value="" label="请选择"/>
-					<form:option value="1" label="已关联"/>
-					<form:option value="2" label="未关联"/>
-				</form:select>
-			<label>首页置顶:</label>
-			<form:select path="topFlag" class="input-mini">
+		<label>推荐状态:</label>
+		<form:select path="recommendStatus" class="input-mini">
+			<form:option value="" label=" "/>
+			<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+						  htmlEscape="false"/>
+		</form:select>
+		<label>状态:</label>
+		<form:select path="enabledStatus" class="input-mini">
+			<form:option value="" label=" "/>
+			<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+						  htmlEscape="false"/>
+		</form:select>
+		<label>关联标签库:</label>
+		<form:select path="isRelevance" class="input-medium">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="已关联"/>
+			<form:option value="2" label="未关联"/>
+		</form:select>
+		<label>首页置顶:</label>
+		<form:select path="topFlag" class="input-mini">
 				<form:option value="" label="全部"/>
 				<form:option value="1" label="是"/>
 				<form:option value="0" label="否"/>

+ 50 - 3
src/main/webapp/WEB-INF/views/modules/info/infoSelectedList.jsp

@@ -38,7 +38,41 @@
 		function batchSaveSort() {
 			$("#searchTable").submit();
 		}
+		var ontypeId = null;
+		var typeId = null;
+		function ischangeType() {
+			if (null != typeId) {
+				$("#typeListId option[value=" + typeId + "]").val(ontypeId);
+			}
+			$("#optionType").find("option").eq(0).prop("selected", true)
+			optionTypeParent()
+		}
 
+		function optionTypeParent() {
+			$("#optionType [parent]").each(function (item) {
+				if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+					$(this).show()
+				} else {
+					$(this).hide()
+				}
+			})
+		}
+
+		function isoptionType() {
+			if ("" != $("#optionType option:selected").val()) {
+				ontypeId =  $("#optionType option:selected").attr("parent")
+				typeId = $("#optionType option:selected").val()
+				$("#typeListId option:selected").val($("#optionType option:selected").val())
+			}else {
+				ischangeType()
+			}
+		}
+
+		$(document).ready(function () {
+			$("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+			optionTypeParent()
+			isoptionType()
+		})
 		function showSelect() {
 			var url = '';
 			var title = '';
@@ -106,9 +140,22 @@
 					onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
 		<br> <br>
 		<label>文章分类:</label>
-		<form:select path="info.typeId" class="input-small">
+		<form:select id="typeListId" path="info.typeId" class="input-small" onchange="ischangeType()">
+			<form:option value="" label=" "/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId eq 0}">
+					<form:option value="${type.id}" label="${type.name}"/>
+				</c:if>
+			</c:forEach>
+		</form:select>
+		<form:select id="optionType" path="" class="input-small" onchange="isoptionType()">
 			<form:option value="" label=" "/>
-			<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+			<c:forEach items="${typeList}" var="type" varStatus="index">
+				<c:if test="${type.parentId ne 0}">
+					<form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+								 cssStyle="display: none"/>
+				</c:if>
+			</c:forEach>
 		</form:select>
 		&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
 		<input type="button" class="btn btn-primary" onclick="batchSaveSort()" value="一键排序"/>
@@ -151,7 +198,7 @@
 				<td><fmt:formatDate value="${cmRelated.info.pubdate}" pattern="yyyy-MM-dd HH:mm"/></td>
 				<td><fmt:formatDate value="${cmRelated.info.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
 				<td style="width: 150px">
-					<a href="https://www.caimei365.com/info/detail-${cmRelated.info.id}-1.html" target="_blank">查看</a>
+					<a href="${fns:getConfig('wwwServer')}info/detail-${cmRelated.info.id}-1.html" target="_blank">查看</a>
 					<a href="${ctx}/info/info/delInfoSelected?id=${cmRelated.id}"
 					   onclick="return confirmx('确认要删除该文章列表吗?', this.href)">删除</a></td>
 			</tr>

+ 18 - 18
src/main/webapp/WEB-INF/views/modules/info/infoTypeForm.jsp

@@ -23,10 +23,10 @@
 				if (str == 0) {
 					$("input[name='cmBrandLandingList["+index+"].jumpLink']").val("")
 					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("disabled", true)
-					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("class", "input-xlarge  digits")
+					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("class", "input-xlarge  ")
 				} else if (str == 2) {
 					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("disabled", false)
-					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("class", "input-xlarge required digits")
+					$("input[name='cmBrandLandingList["+index+"].jumpLink']").attr("class", "input-xlarge required ")
 				}
 			});
 			//$("#name").focus();
@@ -76,7 +76,7 @@
 	<div class="control-group">
 		<label class="control-label">分类名称:</label>
 		<div class="controls">
-			<form:input path="name" htmlEscape="false" maxlength="10" class="input-xlarge required"/>
+			<form:input path="name" htmlEscape="false" maxlength="8" class="input-xlarge required"/>
 			<span class="help-inline"><font color="red">*</font> </span>
 		</div>
 	</div>
@@ -106,10 +106,10 @@
 				<span style="float: left">
 				<label class="control-label">PC端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[0].headPcBanner" path="cmBrandLandingList[0].headPcBanner"
+					<form:hidden id="cmBrandLandingList0headPcBanner" path="cmBrandLandingList[0].headPcBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[0].headPcBanner}"
 								 maxlength="255" class="input-xlarge required"/>
-					<sys:ckfinder input="cmBrandLandingList[0].headPcBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList0headPcBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -121,10 +121,10 @@
 				<span style="float: left">
 				<label class="control-label">小程序端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[0].headAppBanner" path="cmBrandLandingList[0].headAppBanner"
+					<form:hidden id="cmBrandLandingList0headAppBanner" path="cmBrandLandingList[0].headAppBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[0].headAppBanner}"
 								 maxlength="255" class="input-xlarge"/>
-					<sys:ckfinder input="cmBrandLandingList[0].headAppBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList0headAppBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -143,7 +143,7 @@
 				<input type="radio" name="cmBrandLandingList[0].jumpStatus"
 					   value="2" ${infoType.cmBrandLandingList[0].jumpStatus eq 2?'checked=checked':''}>
 				跳转链接:
-				<form:input path="cmBrandLandingList[0].jumpLink" htmlEscape="false" class="input-xlarge digits"
+				<form:input path="cmBrandLandingList[0].jumpLink" htmlEscape="false" class="input-xlarge "
 							value="${cmBrandLandingList[0].jumpLink}" disabled="${infoType.cmBrandLandingList[0].jumpStatus eq 2?'false':'true'}"/>
 			</div>
 			<br>
@@ -163,10 +163,10 @@
 				<span style="float: left">
 				<label class="control-label">PC端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[1].headPcBanner" path="cmBrandLandingList[1].headPcBanner"
+					<form:hidden id="cmBrandLandingList1headPcBanner" path="cmBrandLandingList[1].headPcBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[1].headPcBanner}"
 								 maxlength="255" class="input-xlarge required"/>
-					<sys:ckfinder input="cmBrandLandingList[1].headPcBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList1headPcBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -178,10 +178,10 @@
 				<span style="float: left">
 				<label class="control-label">小程序端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[1].headAppBanner" path="cmBrandLandingList[1].headAppBanner"
+					<form:hidden id="cmBrandLandingList1headAppBanner" path="cmBrandLandingList[1].headAppBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[1].headAppBanner}"
 								 maxlength="255" class="input-xlarge"/>
-					<sys:ckfinder input="cmBrandLandingList[1].headAppBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList1headAppBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -200,7 +200,7 @@
 				<input type="radio" name="cmBrandLandingList[1].jumpStatus"
 					   value="2" ${infoType.cmBrandLandingList[1].jumpStatus eq 2?'checked=checked':''}>
 				跳转链接:
-				<form:input path="cmBrandLandingList[1].jumpLink" htmlEscape="false" class="input-xlarge digits"
+				<form:input path="cmBrandLandingList[1].jumpLink" htmlEscape="false" class="input-xlarge "
 							value="${cmBrandLandingList[1].jumpLink}" disabled="${infoType.cmBrandLandingList[1].jumpStatus eq 2?'false':'true'}"/>
 			</div>
 			<br>
@@ -220,10 +220,10 @@
 				<span style="float: left">
 				<label class="control-label">PC端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[2].headPcBanner" path="cmBrandLandingList[2].headPcBanner"
+					<form:hidden id="cmBrandLandingList2headPcBanner" path="cmBrandLandingList[2].headPcBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[2].headPcBanner}"
 								 maxlength="255" class="input-xlarge required"/>
-					<sys:ckfinder input="cmBrandLandingList[2].headPcBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList2headPcBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -235,10 +235,10 @@
 				<span style="float: left">
 				<label class="control-label">小程序端图:</label>
 				<div class="controls">
-					<form:hidden id="cmBrandLandingList[2].headAppBanner" path="cmBrandLandingList[2].headAppBanner"
+					<form:hidden id="cmBrandLandingList2headAppBanner" path="cmBrandLandingList[2].headAppBanner"
 								 htmlEscape="false" value="${cmBrandLandingList[2].headAppBanner}"
 								 maxlength="255" class="input-xlarge"/>
-					<sys:ckfinder input="cmBrandLandingList[2].headAppBanner" type="images" uploadPath="/photo"
+					<sys:ckfinder input="cmBrandLandingList2headAppBanner" type="images" uploadPath="/photo"
 								  selectMultiple="false"
 								  maxWidth="100"
 								  maxHeight="100"/>
@@ -257,7 +257,7 @@
 				<input type="radio" name="cmBrandLandingList[2].jumpStatus"
 					   value="2" ${infoType.cmBrandLandingList[2].jumpStatus eq 2?'checked=checked':''}>
 				跳转链接:
-				<form:input path="cmBrandLandingList[2].jumpLink" htmlEscape="false" class="input-xlarge digits"
+				<form:input path="cmBrandLandingList[2].jumpLink" htmlEscape="false" class="input-xlarge "
 							value="${cmBrandLandingList[2].jumpLink}" disabled="${infoType.cmBrandLandingList[2].jumpStatus eq 2?'false':'true'}"/>
 			</div>
 			<br>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/info/infoTypeList.jsp

@@ -18,12 +18,12 @@
 			$("#searchForm").submit();
         	return false;
         }
-        var limit=7;  //启用限制数量
+        var limit=10;  //启用限制数量
 		//状态修改
 		function updateEnabledStatus(status,ids){
 			if('1'==status){
 				$.post("${ctx}/info/infoType/countEnabledStatus",{'enabledStatus':'1'}, function(data) {
-					if(data.count>=limit){
+					if(${infoType.parentId eq 0}&&data.count>=limit){
 						alertx("您的启用分类已达到上限,请先停用");
 					}else{
 						update(status,ids)

+ 54 - 6
src/main/webapp/WEB-INF/views/modules/info/shopInfoList.jsp

@@ -85,7 +85,41 @@
 			// 自定义按钮
 			$.jBox.confirm("该操作将更新所有商品索引,约耗时10分钟!!请谨慎操作", "更新索引", submit, { buttons: { '确定': true, '取消': false} });
 		}
+		var ontypeId = null;
+		var typeId = null;
+		function ischangeType() {
+			if (null != typeId) {
+				$("#typeListId option[value=" + typeId + "]").val(ontypeId);
+			}
+			$("#optionType").find("option").eq(0).prop("selected", true)
+			optionTypeParent()
+		}
+
+		function optionTypeParent() {
+			$("#optionType [parent]").each(function (item) {
+				if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
+					$(this).show()
+				} else {
+					$(this).hide()
+				}
+			})
+		}
+
+		function isoptionType() {
+			if ("" != $("#optionType option:selected").val()) {
+				ontypeId = $("#optionType option:selected").attr("parent")
+				typeId = $("#optionType option:selected").val()
+				$("#typeListId option:selected").val($("#optionType option:selected").val())
+			}else {
+				ischangeType()
+			}
+		}
 
+		$(document).ready(function () {
+			$("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
+			optionTypeParent()
+			isoptionType()
+		})
 	</script>
 </head>
 <body>
@@ -108,12 +142,26 @@
 			 <label>供应商:</label>
 				<form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
 				<br> <br>
-			  <label>文章分类:</label>
-				<form:select path="infoType.id" class="input-small">
-					<form:option value="" label=" "/>
-					<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
-				</form:select>
-			 <label>审核状态:</label>
+			<label>文章分类:</label>
+			<form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
+				<form:option value="" label=" "/>
+				<c:forEach items="${typeList}" var="type" varStatus="index">
+					<c:if test="${type.parentId eq 0}">
+						<form:option value="${type.id}" label="${type.name}"/>
+					</c:if>
+				</c:forEach>
+			</form:select>
+			<form:select id="optionType" path="" class="input-small" onchange="isoptionType()">
+				<form:option value="" label=" "/>
+				<c:forEach items="${typeList}" var="type" varStatus="index">
+					<c:if test="${type.parentId ne 0}">
+						<form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
+									 cssStyle="display: none"/>
+					</c:if>
+				</c:forEach>
+			</form:select>
+
+			<label>审核状态:</label>
 			 	<form:select path="auditStatus" class="input-mini">
 					<form:option value="" label="全部"/>
 					<form:option value="1" label="待审核"/>