newPageFirstNavigationForm.jsp 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <%@ page import="com.caimei.modules.newhome.entity.NewPageFirstNavigation" %>
  2. <%@ page contentType="text/html;charset=UTF-8" %>
  3. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  4. <html>
  5. <head>
  6. <title>新首页一级导航栏管理</title>
  7. <meta name="decorator" content="default"/>
  8. <style>
  9. .iconBox {
  10. font-size: 0;
  11. }
  12. .controls .conList {
  13. display: inline-block;
  14. margin-right: 15px;
  15. }
  16. .conList .btn:nth-of-type(1) {
  17. margin-left: 25px;
  18. }
  19. .upload-content {
  20. margin-top: -70px;
  21. }
  22. .upload-content .conList .btn:nth-of-type(1) {
  23. width: 90px;
  24. height: 100px;
  25. border: 2px solid #eee;
  26. background: #fff;
  27. position: relative;
  28. }
  29. .upload-content .conList .btn:nth-of-type(1) > div {
  30. position: absolute;
  31. top: 50%;
  32. left: 50%;
  33. transform: translate(-50%, -50%);
  34. color: #666;
  35. }
  36. .upload-content .conList .btn:nth-of-type(1) span {
  37. font-size: 35px;
  38. }
  39. .upload-content .conList .btn:nth-of-type(1) h5 {
  40. color: #666;
  41. }
  42. .cancel-upload {
  43. background: transparent;
  44. border: none;
  45. box-shadow: none;
  46. position: relative;
  47. top: -38px;
  48. left: -25px;
  49. cursor: pointer;
  50. z-index: 100;
  51. }
  52. .upload-content .conList ol li {
  53. width: 114px;
  54. min-height: 80px;
  55. text-align: center;
  56. background: #fff;
  57. position: relative;
  58. top: 120px;
  59. margin-left: 2px;
  60. }
  61. .hide-pic {
  62. display: none !important;
  63. }
  64. </style>
  65. <script type="text/javascript">
  66. $(document).ready(function() {
  67. //$("#name").focus();
  68. $("#inputForm").validate({
  69. submitHandler: function(form){
  70. if ($('#icon').val() == ""){
  71. alertx("请上传图标");
  72. return;
  73. }
  74. const type = $('#type').val()
  75. const number = $('#number').val()
  76. const status = $('.wwwEnabledStatus').val()
  77. if (type != 2 && '1' == status && number >= 8) {
  78. top.$.jBox.confirm("网站端最多只能启用8个菜单,请停用其他菜单后再重新启用本菜单。", "提示");
  79. return;
  80. }
  81. loading('正在提交,请稍等...');
  82. form.submit();
  83. },
  84. errorContainer: "#messageBox",
  85. errorPlacement: function(error, element) {
  86. $("#messageBox").text("输入有误,请先更正。");
  87. if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
  88. error.appendTo(element.parent().parent());
  89. } else {
  90. error.insertAfter(element);
  91. }
  92. }
  93. });
  94. });
  95. /**
  96. * @param obj
  97. * jquery控制input只能输入数字
  98. */
  99. function onlynum(obj) {
  100. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  101. }
  102. $(function () {
  103. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  104. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  105. $('.upload-content .conList').find('.cancel-upload').hide();
  106. var observeEle = document.getElementsByClassName('upload-content')[0];
  107. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  108. var MutationObserverConfig = {
  109. childList: true,
  110. subtree: true,
  111. characterData: true
  112. };
  113. var observer = new MutationObserver(function (mutations) {
  114. $.each(mutations, function (index, item) {
  115. if (item.type === 'childList') {
  116. // 在创建新的 element 时调用
  117. var target = $(item.target),
  118. thisWrapper = target.closest('.conList'),
  119. nextEle = thisWrapper.next();
  120. thisWrapper.find('li').css('z-index', 99);
  121. thisWrapper.find('.cancel-upload').show();
  122. if (nextEle.hasClass('hide-pic')) {
  123. nextEle.removeClass('hide-pic');
  124. }
  125. }
  126. })
  127. });
  128. observer.observe(observeEle, MutationObserverConfig);
  129. $('body').on('click', '.cancel-upload', function () {
  130. var wrapper = $(this).closest('.conList');
  131. wrapper.find('li').css('z-index', '-1');
  132. wrapper.find('input').val('');
  133. $(this).hide();
  134. wrapper.removeClass("hide-pic");
  135. wrapper.parent().append(wrapper.clone());
  136. wrapper.remove();
  137. $(".conList").each(function (i, ele) {
  138. if ($(ele).find("input.input-xlarge").val()) {
  139. $(ele).next().removeClass("hide-pic")
  140. }
  141. })
  142. });
  143. $(window).on("load", function () {
  144. setTimeout(function () {
  145. $("#iconBox").find("input.input-xlarge").each(function (i, ele) {
  146. if ($(ele).val()) {
  147. $(ele).next().find("li").css("z-index", "99");
  148. $(ele).parents(".conList").find(".cancel-upload").show();
  149. $(ele).parents(".conList").next().removeClass("hide-pic")
  150. }
  151. })
  152. }, 500);
  153. });
  154. });
  155. </script>
  156. </head>
  157. <body>
  158. <ul class="nav nav-tabs">
  159. <li class=${newPageFirstNavigation.type==0?"active":""}><a href="${ctx}/newhome/newPageFirstNavigation?type=0">主菜单列表</a></li>
  160. <li class=${newPageFirstNavigation.type==2?"active":""}><a href="${ctx}/newhome/newPageFirstNavigation?type=2">快捷运营菜单</a></li>
  161. <li class="active"><a href="${ctx}/newhome/newPageFirstNavigation/form?id=${newPageFirstNavigation.id}">${not empty newPageFirstNavigation.id?'编辑':'添加'}</a></li>
  162. </ul><br/>
  163. <form:form id="inputForm" modelAttribute="newPageFirstNavigation" action="${ctx}/newhome/newPageFirstNavigation/save" method="post" class="form-horizontal">
  164. <form:hidden path="id"/>
  165. <input id="number" name="number" type="hidden" value="${number}"/>
  166. <form:hidden path="type"/>
  167. <sys:message content="${message}"/>
  168. <div class="control-group">
  169. <label class="control-label"><font color="red">*</font><c:if test="${newPageFirstNavigation.type==0}">主</c:if>菜单名称:</label>
  170. <div class="controls">
  171. <form:input path="navigationName" htmlEscape="false" cssStyle="position: relative" maxlength="5" class="required input-xlarge "/>
  172. </div>
  173. </div>
  174. <c:if test="${newPageFirstNavigation.type!=0}">
  175. <div class="control-group">
  176. <label class="control-label"><c:if test="${newPageFirstNavigation.type==0}">主</c:if>菜单备注:</label>
  177. <div class="controls">
  178. <form:input path="remark" htmlEscape="false" cssStyle="position: relative" maxlength="8" class=" input-xlarge "/>
  179. </div>
  180. </div>
  181. </c:if>
  182. <c:if test="${newPageFirstNavigation.type != 0}">
  183. <div class="control-group iconBox">
  184. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>图标:</label>
  185. <div class="controls upload-content" id="iconBox">
  186. <div class="conList">
  187. <form:hidden id="icon" path="icon" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
  188. <sys:ckfinder input="icon" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  189. <br><label>建议图片分辨率110px*110px</label>
  190. </div>
  191. </div>
  192. </div>
  193. </c:if>
  194. <div class="control-group">
  195. <label class="control-label"><font color="red">*</font>跳转链接:</label>
  196. <div class="controls">
  197. <form:input path="link" htmlEscape="false" maxlength="255" class="required input-xlarge"/>
  198. </div>
  199. </div>
  200. <div class="control-group">
  201. <label class="control-label"><font color="red">*</font>排序:</label>
  202. <div class="controls">
  203. <form:input path="sort" htmlEscape="false" maxlength="11" class="required input-xlarge " onkeyup="onlynum(this)"/>
  204. </div>
  205. </div>
  206. <div class="control-group">
  207. <label class="control-label"><font color="red">*</font>网站状态:</label>
  208. <div class="controls">
  209. <form:select path="wwwEnabledStatus" class="input-xlarge wwwEnabledStatus">
  210. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
  211. </form:select>
  212. </div>
  213. </div>
  214. <div class="control-group">
  215. <label class="control-label"><font color="red">*</font>小程序状态:</label>
  216. <div class="controls">
  217. <form:select path="crmEnabledStatus" class="input-xlarge ">
  218. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/><%--label="${fns:getDictList('enabled_status')[0]}"--%>
  219. </form:select>
  220. </div>
  221. </div>
  222. <div class="form-actions">
  223. <shiro:hasPermission name="newhome:newPageFirstNavigation:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
  224. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  225. </div>
  226. </form:form>
  227. </body>
  228. </html>