newPageFirstNavigationForm.jsp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. loading('正在提交,请稍等...');
  75. form.submit();
  76. },
  77. errorContainer: "#messageBox",
  78. errorPlacement: function(error, element) {
  79. $("#messageBox").text("输入有误,请先更正。");
  80. if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
  81. error.appendTo(element.parent().parent());
  82. } else {
  83. error.insertAfter(element);
  84. }
  85. }
  86. });
  87. });
  88. /**
  89. * @param obj
  90. * jquery控制input只能输入数字
  91. */
  92. function onlynum(obj) {
  93. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  94. }
  95. $(function () {
  96. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  97. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  98. $('.upload-content .conList').find('.cancel-upload').hide();
  99. var observeEle = document.getElementsByClassName('upload-content')[0];
  100. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  101. var MutationObserverConfig = {
  102. childList: true,
  103. subtree: true,
  104. characterData: true
  105. };
  106. var observer = new MutationObserver(function (mutations) {
  107. $.each(mutations, function (index, item) {
  108. if (item.type === 'childList') {
  109. // 在创建新的 element 时调用
  110. var target = $(item.target),
  111. thisWrapper = target.closest('.conList'),
  112. nextEle = thisWrapper.next();
  113. thisWrapper.find('li').css('z-index', 99);
  114. thisWrapper.find('.cancel-upload').show();
  115. if (nextEle.hasClass('hide-pic')) {
  116. nextEle.removeClass('hide-pic');
  117. }
  118. }
  119. })
  120. });
  121. observer.observe(observeEle, MutationObserverConfig);
  122. $('body').on('click', '.cancel-upload', function () {
  123. var wrapper = $(this).closest('.conList');
  124. wrapper.find('li').css('z-index', '-1');
  125. wrapper.find('input').val('');
  126. $(this).hide();
  127. wrapper.removeClass("hide-pic");
  128. wrapper.parent().append(wrapper.clone());
  129. wrapper.remove();
  130. $(".conList").each(function (i, ele) {
  131. if ($(ele).find("input.input-xlarge").val()) {
  132. $(ele).next().removeClass("hide-pic")
  133. }
  134. })
  135. });
  136. $(window).on("load", function () {
  137. setTimeout(function () {
  138. $("#iconBox").find("input.input-xlarge").each(function (i, ele) {
  139. if ($(ele).val()) {
  140. $(ele).next().find("li").css("z-index", "99");
  141. $(ele).parents(".conList").find(".cancel-upload").show();
  142. $(ele).parents(".conList").next().removeClass("hide-pic")
  143. }
  144. })
  145. }, 500);
  146. });
  147. });
  148. </script>
  149. </head>
  150. <body>
  151. <ul class="nav nav-tabs">
  152. <li class=${newPageFirstNavigation.type==0?"active":""}><a href="${ctx}/newhome/newPageFirstNavigation?type=${newPageFirstNavigation.type}">主菜单列表</a></li>
  153. <li class=${newPageFirstNavigation.type==2?"active":""}><a href="${ctx}/newhome/newPageFirstNavigation?type=${newPageFirstNavigation.type}">快捷运营菜单</a></li>
  154. <li class="active"><a href="${ctx}/newhome/newPageFirstNavigation/form?id=${newPageFirstNavigation.id}">${not empty newPageFirstNavigation.id?'编辑':'添加'}</a></li>
  155. </ul><br/>
  156. <form:form id="inputForm" modelAttribute="newPageFirstNavigation" action="${ctx}/newhome/newPageFirstNavigation/save" method="post" class="form-horizontal">
  157. <form:hidden path="id"/>
  158. <form:hidden path="type"/>
  159. <sys:message content="${message}"/>
  160. <div class="control-group">
  161. <label class="control-label"><font color="red">*</font><c:if test="${newPageFirstNavigation.type==0}">主</c:if>菜单名称:</label>
  162. <div class="controls">
  163. <form:input path="navigationName" htmlEscape="false" cssStyle="position: relative" maxlength="5" class="required input-xlarge "/>
  164. </div>
  165. </div>
  166. <c:if test="${newPageFirstNavigation.type!=0}">
  167. <div class="control-group">
  168. <label class="control-label"><c:if test="${newPageFirstNavigation.type==0}">主</c:if>菜单备注:</label>
  169. <div class="controls">
  170. <form:input path="remark" htmlEscape="false" cssStyle="position: relative" maxlength="8" class=" input-xlarge "/>
  171. </div>
  172. </div>
  173. </c:if>
  174. <div class="control-group iconBox">
  175. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>图标:</label>
  176. <div class="controls upload-content" id="iconBox">
  177. <div class="conList">
  178. <form:hidden id="icon" path="icon" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
  179. <sys:ckfinder input="icon" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  180. <br><label>建议图片分辨率110px*110px</label>
  181. </div>
  182. </div>
  183. </div>
  184. <div class="control-group">
  185. <label class="control-label"><font color="red">*</font>跳转链接:</label>
  186. <div class="controls">
  187. <form:input path="link" htmlEscape="false" maxlength="255" class="required input-xlarge"/>
  188. </div>
  189. </div>
  190. <div class="control-group">
  191. <label class="control-label"><font color="red">*</font>排序:</label>
  192. <div class="controls">
  193. <form:input path="sort" htmlEscape="false" maxlength="11" class="required input-xlarge " onkeyup="onlynum(this)"/>
  194. </div>
  195. </div>
  196. <div class="control-group">
  197. <label class="control-label"><font color="red">*</font>网站状态:</label>
  198. <div class="controls">
  199. <form:select path="wwwEnabledStatus" class="input-xlarge ">
  200. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
  201. </form:select>
  202. </div>
  203. </div>
  204. <div class="control-group">
  205. <label class="control-label"><font color="red">*</font>小程序状态:</label>
  206. <div class="controls">
  207. <form:select path="crmEnabledStatus" class="input-xlarge ">
  208. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/><%--label="${fns:getDictList('enabled_status')[0]}"--%>
  209. </form:select>
  210. </div>
  211. </div>
  212. <div class="form-actions">
  213. <shiro:hasPermission name="newhome:newPageFirstNavigation:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
  214. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  215. </div>
  216. </form:form>
  217. </body>
  218. </html>