cmHeheActivityForm.jsp 7.8 KB

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