cmHeheFloorContentForm.jsp 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  1. <%@ page import="java.util.Date" %>
  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. margin-left: 130px !important;
  12. }
  13. .controls .conList {
  14. display: inline-block;
  15. margin-right: 15px;
  16. }
  17. .conList .btn:nth-of-type(1) {
  18. margin-left: 25px;
  19. }
  20. .upload-content {
  21. margin-top: -100px;
  22. }
  23. .upload-content .conList .btn:nth-of-type(1) {
  24. width: 90px;
  25. height: 100px;
  26. border: 2px solid #eee;
  27. background: #fff;
  28. position: relative;
  29. }
  30. .upload-content .conList .btn:nth-of-type(1) > div {
  31. position: absolute;
  32. top: 50%;
  33. left: 50%;
  34. transform: translate(-50%, -50%);
  35. color: #666;
  36. }
  37. .upload-content .conList .btn:nth-of-type(1) span {
  38. font-size: 35px;
  39. }
  40. .upload-content .conList .btn:nth-of-type(1) h5 {
  41. color: #666;
  42. }
  43. .cancel-upload {
  44. background: transparent;
  45. border: none;
  46. box-shadow: none;
  47. position: relative;
  48. top: -38px;
  49. left: -25px;
  50. cursor: pointer;
  51. z-index: 100;
  52. }
  53. .upload-content .conList ol li {
  54. width: 114px;
  55. min-height: 80px;
  56. text-align: center;
  57. background: #fff;
  58. position: relative;
  59. top: 120px;
  60. margin-left: 2px;
  61. }
  62. .hide-pic {
  63. display: none !important;
  64. }
  65. td {
  66. border: solid black;
  67. border-width: 0px 1px 1px 0px;
  68. }
  69. table {
  70. border-collapse: inherit;
  71. border: solid black;
  72. border-width: 1px 0px 0px 1px;
  73. }
  74. .table-striped {
  75. margin-right: 10px;
  76. }
  77. .table-striped td {
  78. border-collapse: inherit;
  79. border: 1px solid #ddd;
  80. border-width: 1px 0px 0px 1px;
  81. }
  82. .table-striped th, .table-striped td {
  83. text-align: center !important;
  84. }
  85. select {
  86. width: 85px;
  87. line-height: 25px;
  88. height: 25px
  89. }
  90. .tbMargin {
  91. margin: 15px 17px;
  92. }
  93. em {
  94. background: #d7d7d7;
  95. color: black;
  96. padding: 2px 8px;
  97. font-style: normal;
  98. font-size: 14px;
  99. display: inline-block;
  100. border-radius: 2px
  101. }
  102. .middleEm {
  103. position: absolute;
  104. left: 40%;
  105. margin-top: 7px;
  106. }
  107. .rightEm {
  108. float: right;
  109. margin-top: 7px;
  110. margin-right: 10px;
  111. }
  112. .templateButton {
  113. margin: 15px 0 15px 15px !important;
  114. }
  115. .displayTemplate, .mallTemplate {
  116. position: relative;
  117. }
  118. .templateImageTable {
  119. margin-left: 20px;
  120. }
  121. .templateImageDiv {
  122. padding: 5px 10px;
  123. text-align: center;
  124. }
  125. #templateTd label {
  126. font-weight: bolder;
  127. font-size: 18px;
  128. }
  129. #displayDateDiv {
  130. height: 30px;
  131. }
  132. .relative-pst {
  133. margin-top: 20px !important;
  134. }
  135. </style>
  136. <script type="text/javascript">
  137. $(document).ready(function () {
  138. //表单提交
  139. $("#inputForm").validate({
  140. submitHandler: function (form) {
  141. var templateType = $("input[name='templateType']:checked").val();
  142. if (templateType == '' || templateType == undefined) {
  143. alertx("请配置模板图片区域");
  144. return;
  145. }
  146. var displayDateNo = $("input[name='displayDateRadio']:checked").val();
  147. if (productImageList.length > 0) {
  148. var stringify = JSON.stringify(productImageList);
  149. $('#images').val(stringify);
  150. } else {
  151. alertx("至少上传一个商品");
  152. return;
  153. }
  154. var appletsIcon1 = $("#appletsIcon1").val();
  155. var appletsIcon2 = $("#appletsIcon2").val();
  156. var appletsIcon3 = $("#appletsIcon3").val();
  157. var appletsIcon4 = $("#appletsIcon4").val();
  158. var appletsIcon5 = $("#appletsIcon5").val();
  159. if (templateType == 1 || templateType == 2 || templateType == 3 || templateType == 6 || templateType == 7 || templateType == 8) {
  160. if (appletsIcon1 == '') {
  161. alertx("请上传广告图1");
  162. return;
  163. }
  164. if (templateType == 2 || templateType == 3 || templateType == 6 || templateType == 7) {
  165. if (appletsIcon2 == '') {
  166. alertx("请上传广告图2");
  167. return;
  168. }
  169. if (templateType == 2 || templateType == 6 || templateType == 7) {
  170. if (appletsIcon3 == '') {
  171. alertx("请上传广告图3");
  172. return;
  173. }
  174. if ( templateType == 7) {
  175. if (appletsIcon4 == '') {
  176. alertx("请上传广告图4");
  177. return;
  178. }
  179. if (appletsIcon5 == '') {
  180. alertx("请上传广告图5");
  181. return;
  182. }
  183. } else {
  184. $(".Image4 .cancel-upload").click();
  185. $(".Image5 .cancel-upload").click();
  186. }
  187. } else {
  188. $(".Image3 .cancel-upload").click();
  189. $(".Image4 .cancel-upload").click();
  190. $(".Image5 .cancel-upload").click();
  191. }
  192. } else {
  193. $(".Image2 .cancel-upload").click();
  194. $(".Image3 .cancel-upload").click();
  195. $(".Image4 .cancel-upload").click();
  196. $(".Image5 .cancel-upload").click();
  197. }
  198. } else {
  199. $(".Image1 .cancel-upload").click();
  200. $(".Image2 .cancel-upload").click();
  201. $(".Image3 .cancel-upload").click();
  202. $(".Image4 .cancel-upload").click();
  203. $(".Image5 .cancel-upload").click();
  204. }
  205. for (var i = 1; i <= 5; i++) {
  206. var jumpTypeName = 'jumpType' + i;
  207. var jumpType = $("input[name=" + jumpTypeName + "]:checked").val();
  208. if (3 == jumpType) {
  209. var jumpImage = $("#jumpIcon"+i).val();
  210. if (jumpImage == '') {
  211. alertx("请上传广告图" + i + "跳转图片");
  212. return false;
  213. }
  214. }
  215. }
  216. $("#formType").val(8);
  217. loading('正在提交,请稍等...');
  218. form.submit();
  219. },
  220. errorContainer: "#messageBox",
  221. errorPlacement: function (error, element) {
  222. $("#messageBox").text("输入有误,请先更正。");
  223. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  224. error.appendTo(element.parent().parent());
  225. } else {
  226. error.insertAfter(element);
  227. }
  228. }
  229. });
  230. });
  231. </script>
  232. </head>
  233. <body>
  234. <ul class="nav nav-tabs">
  235. <c:if test="${not empty floorContent.floorId}">
  236. <li><a href="${ctx}/newhome/newPageFloor/">楼层管理列表</a></li>
  237. <li class="active"><a href="${ctx}/newhome/newPageFloor/goContentPage?floorId=${floorContent.floorId}">内容</a>
  238. </li>
  239. </c:if>
  240. <c:if test="${empty floorContent.floorId}">
  241. <li><a href="${ctx}/cmpage/cmPageCentre/?pageId=${floorContent.pageId}&type=8">商品楼层列表</a></li>
  242. <li class="active"><a
  243. href="${ctx}/cmpage/cmPageCentre/goContentPage?pageId=${floorContent.pageId}&centreId=${floorContent.centreId}&type=${floorContent.type}">内容</a>
  244. </li>
  245. </c:if>
  246. </ul>
  247. <br/>
  248. <form:form id="inputForm" modelAttribute="floorContent" action="${ctx}/newhome/newPageFloor/saveFloorContent"
  249. method="post" class="form-horizontal">
  250. <form:hidden path="id"/>
  251. <form:hidden path="floorId"/>
  252. <form:hidden path="centreId"/>
  253. <form:hidden path="pageId"/>
  254. <form:hidden path="images" id="images"/>
  255. <form:hidden path="images2" id="images2"/>
  256. <form:hidden path="images3" id="images3"/>
  257. <form:hidden path="type"/>
  258. <form:hidden path="formType"/>
  259. <form:hidden path="redirectFlag"/>
  260. <sys:message content="${message}"/>
  261. <div class="control-group">
  262. 楼层名称:<a style="text-decoration:none;">${floorContent.floorTitle}</a>
  263. </div>
  264. <div class="control-group">
  265. <table style="overflow:scroll;height: 400px !important;" class="templateTable">
  266. <tr>
  267. <td id="templateTd" style="display: block;height: 580px;overflow-y:scroll;width: 380px !important;">
  268. <div>
  269. <div id="template" style="position: relative">
  270. <div id="template1" class="displayTemplate" style="position: relative;">
  271. <form:radiobutton path="templateType" name="templateType" value="1" label="模板1" id="templateType1"
  272. cssClass="templateButton"
  273. onclick="showContent()"/>
  274. <div class="templateImageDiv">
  275. <img src="/static/template/hehe/1.png">
  276. </div>
  277. </div>
  278. <div id="template2" class="displayTemplate">
  279. <form:radiobutton path="templateType" name="templateType" value="2" label="模板2" id="templateType2"
  280. cssClass="templateButton"
  281. onclick="showContent()"/>
  282. <div class="templateImageDiv">
  283. <img src="/static/template/hehe/2.png">
  284. </div>
  285. </div>
  286. <div id="template3" class="displayTemplate">
  287. <form:radiobutton path="templateType" name="templateType" value="3" label="模板3" id="templateType3"
  288. cssClass="templateButton"
  289. onclick="showContent()"/>
  290. <div class="templateImageDiv">
  291. <img src="/static/template/hehe/3.png">
  292. </div>
  293. </div>
  294. <div id="template4" class="displayTemplate">
  295. <form:radiobutton path="templateType" name="templateType" value="4" label="模板4" id="templateType4"
  296. cssClass="templateButton"
  297. onclick="showContent()"/>
  298. <div class="templateImageDiv">
  299. <img src="/static/template/hehe/4.png">
  300. </div>
  301. </div>
  302. <div id="template5" class="displayTemplate">
  303. <form:radiobutton path="templateType" name="templateType" value="5" label="模板5" id="templateType5"
  304. cssClass="templateButton"
  305. onclick="showContent()"/>
  306. <div class="templateImageDiv">
  307. <img src="/static/template/hehe/5.png">
  308. </div>
  309. </div>
  310. <div id="template6" class="displayTemplate">
  311. <form:radiobutton path="templateType" name="templateType" value="6" label="模板6" id="templateType6"
  312. cssClass="templateButton"
  313. onclick="showContent()"/>
  314. <div class="templateImageDiv">
  315. <img src="/static/template/hehe/6.png">
  316. </div>
  317. </div>
  318. <div id="template7" class="displayTemplate">
  319. <form:radiobutton path="templateType" name="templateType" value="7" label="模板7" id="templateType7"
  320. cssClass="templateButton"
  321. onclick="showContent()"/>
  322. <div class="templateImageDiv">
  323. <img src="/static/template/hehe/7.png">
  324. </div>
  325. </div>
  326. <div id="template8" class="displayTemplate">
  327. <form:radiobutton path="templateType" name="templateType" value="8" label="模板8" id="templateType8"
  328. cssClass="templateButton"
  329. onclick="showContent()"/>
  330. <div class="templateImageDiv">
  331. <img src="/static/template/hehe/8.png">
  332. </div>
  333. </div>
  334. <div id="template9" class="displayTemplate">
  335. <form:radiobutton path="templateType" name="templateType" value="9" label="模板9" id="templateType9"
  336. cssClass="templateButton"
  337. onclick="showContent()"/>
  338. <div class="templateImageDiv">
  339. <img src="/static/template/hehe/9.png">
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. </td>
  345. <td style=" width: 2800px;">
  346. <div style="height: 100%;overflow-y:scroll;">
  347. <label id="infoLabel"
  348. style="display: none; position: relative;left: 200px;top: 200px; font-weight: bolder;font-size: 30px">请先选择左边模板后,再编辑模板相关内容</label>
  349. <div class="control-group clear Image1" style="display: none">
  350. <div style="float: left">
  351. <span class="help-inline"><font color="red">*</font> </span>广告图1:
  352. <div class="controls upload-content iconBox" id="appletsAdsImage1">
  353. <div class="conList">
  354. <form:hidden id="appletsIcon1" path="appletsAdsImage1" htmlEscape="false" maxlength="255"
  355. class="input-xlarge required"/>
  356. <sys:ckfinder input="appletsIcon1" type="images" uploadPath="/photo"
  357. selectMultiple="false"
  358. maxWidth="100" maxHeight="100"/> <br>
  359. <label id="imageSize1">建议图片分辨率1184px*160px</label>
  360. </div>
  361. </div>
  362. </div>
  363. <div style="float: left">
  364. <span class="help-inline"></span>跳转方式:
  365. <div style="margin-left: 100px">
  366. <div>
  367. <input type="radio" name="jumpType1" value="1" onchange="changeJumpType(1)" ${(floorContent.jumpType1 eq null || floorContent.jumpType1 eq 1 )? "checked" : ""} />链接:
  368. <form:input path="adsLink1" htmlEscape="false" maxlength="255"
  369. class="input-xlarge"/>
  370. </div>
  371. <div style="margin-top: 20px">
  372. <input type="radio" name="jumpType1" value="2" onchange="changeJumpType(1)" ${floorContent.jumpType1 eq 2? "checked" : ""} />产品:
  373. <form:select path="productId1" class="select-ele input-xlarge">
  374. <form:option value="" label="请选择"/>
  375. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  376. htmlEscape="false"/>
  377. </form:select>
  378. </div>
  379. </div>
  380. </div>
  381. <div style="float: left;margin: 25px 0px 0px 100px">
  382. <span class="help-inline"></span>
  383. <input type="radio" name="jumpType1" value="3" onchange="changeJumpType(1)" ${floorContent.jumpType1 eq 3? "checked" : ""} />图片:
  384. <div class="controls upload-content iconBox" id="jumpImage1">
  385. <div class="conList">
  386. <form:hidden id="jumpIcon1" path="jumpImage1" htmlEscape="false" maxlength="255"
  387. class="input-xlarge required"/>
  388. <sys:ckfinder input="jumpIcon1" type="images" uploadPath="/photo"
  389. selectMultiple="false"
  390. maxWidth="100" maxHeight="100"/> <br>
  391. <label>建议图片分辨率750px*1624px</label>
  392. </div>
  393. </div>
  394. </div>
  395. </div>
  396. <div class="control-group clear Image2" style="display: none">
  397. <div style="float: left">
  398. <span class="help-inline"><font color="red">*</font> </span>广告图2:
  399. <div class="controls upload-content iconBox" id="appletsAdsImage2">
  400. <div class="conList">
  401. <form:hidden id="appletsIcon2" path="appletsAdsImage2" htmlEscape="false" maxlength="255"
  402. class="input-xlarge required"/>
  403. <sys:ckfinder input="appletsIcon2" type="images" uploadPath="/photo"
  404. selectMultiple="false"
  405. maxWidth="100" maxHeight="100"/><br>
  406. <label id="imageSize2">建议图片分辨率344px*268px</label>
  407. </div>
  408. </div>
  409. </div>
  410. <div style="float: left">
  411. <span class="help-inline"></span>跳转方式:
  412. <div style="margin-left: 100px">
  413. <div>
  414. <input type="radio" name="jumpType2" value="1" onchange="changeJumpType(2)" ${(floorContent.jumpType2 eq null || floorContent.jumpType2 eq 1 )? "checked" : ""} />链接:
  415. <form:input path="adsLink1" htmlEscape="false" maxlength="255"
  416. class="input-xlarge"/>
  417. </div>
  418. <div style="margin-top: 20px">
  419. <input type="radio" name="jumpType2" value="2" onchange="changeJumpType(2)" ${floorContent.jumpType2 eq 2? "checked" : ""} />产品:
  420. <form:select path="productId2" class="select-ele input-xlarge">
  421. <form:option value="" label="请选择"/>
  422. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  423. htmlEscape="false"/>
  424. </form:select>
  425. </div>
  426. </div>
  427. </div>
  428. <div style="float: left;margin: 25px 0px 0px 100px">
  429. <span class="help-inline"></span>
  430. <input type="radio" name="jumpType2" value="3" onchange="changeJumpType(2)" ${floorContent.jumpType2 eq 3? "checked" : ""} />图片:
  431. <div class="controls upload-content iconBox" id="jumpImage2">
  432. <div class="conList">
  433. <form:hidden id="jumpIcon2" path="jumpImage2" htmlEscape="false" maxlength="255"
  434. class="input-xlarge required"/>
  435. <sys:ckfinder input="jumpIcon2" type="images" uploadPath="/photo"
  436. selectMultiple="false"
  437. maxWidth="100" maxHeight="100"/> <br>
  438. <label>建议图片分辨率750px*1624px</label>
  439. </div>
  440. </div>
  441. </div>
  442. </div>
  443. <div class="control-group clear Image3" style="display: none">
  444. <div style="float: left">
  445. <span class="help-inline"><font color="red">*</font> </span>广告图3:
  446. <div class="controls upload-content iconBox" id="appletsAdsImage3">
  447. <div class="conList">
  448. <form:hidden id="appletsIcon3" path="appletsAdsImage3" htmlEscape="false" maxlength="255"
  449. class="input-xlarge required"/>
  450. <sys:ckfinder input="appletsIcon3" type="images" uploadPath="/photo"
  451. selectMultiple="false"
  452. maxWidth="100" maxHeight="100"/><br>
  453. <label id="imageSize3">建议图片分辨率344px*268px</label>
  454. </div>
  455. </div>
  456. </div>
  457. <div style="float: left">
  458. <span class="help-inline"></span>跳转方式:
  459. <div style="margin-left: 100px">
  460. <div>
  461. <input type="radio" name="jumpType3" value="1" onchange="changeJumpType(3)" ${(floorContent.jumpType3 eq null || floorContent.jumpType3 eq 1 )? "checked" : ""} />链接:
  462. <form:input path="adsLink3" htmlEscape="false" maxlength="255"
  463. class="input-xlarge"/>
  464. </div>
  465. <div style="margin-top: 20px">
  466. <input type="radio" name="jumpType3" value="2" onchange="changeJumpType(3)" ${floorContent.jumpType3 eq 2? "checked" : ""} />产品:
  467. <form:select path="productId3" class="select-ele input-xlarge">
  468. <form:option value="" label="请选择"/>
  469. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  470. htmlEscape="false"/>
  471. </form:select>
  472. </div>
  473. </div>
  474. </div>
  475. <div style="float: left;margin: 25px 0px 0px 100px">
  476. <span class="help-inline"></span>
  477. <input type="radio" name="jumpType3" value="3" onchange="changeJumpType(3)" ${floorContent.jumpType3 eq 3? "checked" : ""} />图片:
  478. <div class="controls upload-content iconBox" id="jumpImage3">
  479. <div class="conList">
  480. <form:hidden id="jumpIcon3" path="jumpImage3" htmlEscape="false" maxlength="255"
  481. class="input-xlarge required"/>
  482. <sys:ckfinder input="jumpIcon3" type="images" uploadPath="/photo"
  483. selectMultiple="false"
  484. maxWidth="100" maxHeight="100"/> <br>
  485. <label>建议图片分辨率750px*1624px</label>
  486. </div>
  487. </div>
  488. </div>
  489. </div>
  490. <div class="control-group clear Image4" style="display: none">
  491. <div style="float: left">
  492. <span class="help-inline"><font color="red">*</font> </span>广告图4:
  493. <div class="controls upload-content iconBox" id="appletsAdsImage4">
  494. <div class="conList">
  495. <form:hidden id="appletsIcon4" path="appletsAdsImage4" htmlEscape="false" maxlength="255"
  496. class="input-xlarge required"/>
  497. <sys:ckfinder input="appletsIcon4" type="images" uploadPath="/photo"
  498. selectMultiple="false"
  499. maxWidth="100" maxHeight="100"/><br>
  500. <label id="imageSize4">建议图片分辨率344px*268px</label>
  501. </div>
  502. </div>
  503. </div>
  504. <div style="float: left">
  505. <span class="help-inline"></span>跳转方式:
  506. <div style="margin-left: 100px">
  507. <div>
  508. <input type="radio" name="jumpType4" value="1" onchange="changeJumpType(4)" ${(floorContent.jumpType4 eq null || floorContent.jumpType4 eq 1 )? "checked" : ""} />链接:
  509. <form:input path="adsLink4" htmlEscape="false" maxlength="255"
  510. class="input-xlarge"/>
  511. </div>
  512. <div style="margin-top: 20px">
  513. <input type="radio" name="jumpType4" value="2" onchange="changeJumpType(4)" ${floorContent.jumpType4 eq 2? "checked" : ""} />产品:
  514. <form:select path="productId4" class="select-ele input-xlarge">
  515. <form:option value="" label="请选择"/>
  516. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  517. htmlEscape="false"/>
  518. </form:select>
  519. </div>
  520. </div>
  521. </div>
  522. <div style="float: left;margin: 25px 0px 0px 100px">
  523. <span class="help-inline"></span>
  524. <input type="radio" name="jumpType4" value="3" onchange="changeJumpType(4)" ${floorContent.jumpType4 eq 3? "checked" : ""} />图片:
  525. <div class="controls upload-content iconBox" id="jumpImage4">
  526. <div class="conList">
  527. <form:hidden id="jumpIcon4" path="jumpImage4" htmlEscape="false" maxlength="255"
  528. class="input-xlarge required"/>
  529. <sys:ckfinder input="jumpIcon4" type="images" uploadPath="/photo"
  530. selectMultiple="false"
  531. maxWidth="100" maxHeight="100"/> <br>
  532. <label>建议图片分辨率750px*1624px</label>
  533. </div>
  534. </div>
  535. </div>
  536. </div>
  537. <div class="control-group clear Image5" style="display: none">
  538. <div style="float: left">
  539. <span class="help-inline"><font color="red">*</font> </span>广告图5:
  540. <div class="controls upload-content iconBox" id="appletsAdsImage5">
  541. <div class="conList">
  542. <form:hidden id="appletsIcon5" path="appletsAdsImage5" htmlEscape="false" maxlength="255"
  543. class="input-xlarge required"/>
  544. <sys:ckfinder input="appletsIcon5" type="images" uploadPath="/photo"
  545. selectMultiple="false"
  546. maxWidth="100" maxHeight="100"/><br>
  547. <label id="imageSize5">建议图片分辨率344px*268px</label>
  548. </div>
  549. </div>
  550. </div>
  551. <div style="float: left">
  552. <span class="help-inline"></span>跳转方式:
  553. <div style="margin-left: 100px">
  554. <div>
  555. <input type="radio" name="jumpType5" value="1" onchange="changeJumpType(5)" ${(floorContent.jumpType5 eq null || floorContent.jumpType5 eq 1 )? "checked" : ""} />链接:
  556. <form:input path="adsLink5" htmlEscape="false" maxlength="255"
  557. class="input-xlarge"/>
  558. </div>
  559. <div style="margin-top: 20px">
  560. <input type="radio" name="jumpType5" value="2" onchange="changeJumpType(5)" ${floorContent.jumpType5 eq 2? "checked" : ""} />产品:
  561. <form:select path="productId5" class="select-ele input-xlarge">
  562. <form:option value="" label="请选择"/>
  563. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  564. htmlEscape="false"/>
  565. </form:select>
  566. </div>
  567. </div>
  568. </div>
  569. <div style="float: left;margin: 25px 0px 0px 100px">
  570. <span class="help-inline"></span>
  571. <input type="radio" name="jumpType5" value="3" onchange="changeJumpType(5)" ${floorContent.jumpType5 eq 3? "checked" : ""} />图片:
  572. <div class="controls upload-content iconBox" id="jumpImage5">
  573. <div class="conList">
  574. <form:hidden id="jumpIcon5" path="jumpImage5" htmlEscape="false" maxlength="255"
  575. class="input-xlarge required"/>
  576. <sys:ckfinder input="jumpIcon5" type="images" uploadPath="/photo"
  577. selectMultiple="false"
  578. maxWidth="100" maxHeight="100"/> <br>
  579. <label>建议图片分辨率750px*1624px</label>
  580. </div>
  581. </div>
  582. </div>
  583. </div>
  584. <br>
  585. <div class="control-group templateImageTable">
  586. <br><br>
  587. <input class="btn" id="del" style="width: 50px" onclick="batchDeletion()" value="删除"/>&nbsp;&nbsp;&nbsp;&nbsp;
  588. <input class="btn btn-primary" id="sortBtn" style="width: 70px" onclick="batchSaveSort()"
  589. value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
  590. <input class="btn btn-primary" id="showSelectBtn" style="width: 70px"
  591. onclick="showSelect('${ctx}/newhome/newPageFloor/addHeheImage')" value="上线商品"/>&nbsp;&nbsp;&nbsp;&nbsp;
  592. <br><br>
  593. <table id="productImageTable" class="table table-striped table-bordered table-condensed"
  594. style="display: none">
  595. <thead>
  596. <tr>
  597. <th style="width:20px;"><input class="check-all" type="checkbox"
  598. onclick="clickAllSelect(this)"/> 全选
  599. </th>
  600. <th>商品ID</th>
  601. <th>商品图片</th>
  602. <th>商品名称</th>
  603. <th>供应商名称</th>
  604. <th>商品状态</th>
  605. <th>排序</th>
  606. <th>推荐状态</th>
  607. <th>添加时间</th>
  608. <th>操作</th>
  609. </tr>
  610. </thead>
  611. <tbody id="productImageTbody"></tbody>
  612. </table>
  613. </div>
  614. </div>
  615. </td>
  616. </tr>
  617. </table>
  618. </div>
  619. <div class="form-actions">
  620. <shiro:hasPermission name="newhome:newPageFloor:edit"><input id="btnSubmit" class="btn btn-primary"
  621. type="submit" onclick="changeRedirectFlag(1)"
  622. value="保 存"/>&nbsp;</shiro:hasPermission>
  623. <input id="btnSubmit" class="btn btn-primary"
  624. type="submit" onclick="changeRedirectFlag(0)"
  625. value="保存并继续"/>&nbsp;
  626. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  627. </div>
  628. </form:form>
  629. <script>
  630. var productImageList = [];
  631. var productIds = '';
  632. $(function () {
  633. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  634. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  635. $('.upload-content .conList').find('.cancel-upload').hide();
  636. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  637. var MutationObserverConfig = {
  638. childList: true,
  639. subtree: true,
  640. characterData: true
  641. };
  642. var observer = new MutationObserver(function (mutations) {
  643. $.each(mutations, function (index, item) {
  644. if (item.type === 'childList') {
  645. // 在创建新的 element 时调用
  646. var target = $(item.target),
  647. thisWrapper = target.closest('.conList'),
  648. nextEle = thisWrapper.next();
  649. thisWrapper.find('li').css('z-index', 99);
  650. thisWrapper.find('.cancel-upload').show();
  651. if (nextEle.hasClass('hide-pic')) {
  652. nextEle.removeClass('hide-pic');
  653. }
  654. }
  655. })
  656. });
  657. for (var i = 0; i < 10; i++) {
  658. var observeEle = document.getElementsByClassName('upload-content')[i];
  659. observer.observe(observeEle, MutationObserverConfig)
  660. }
  661. $('body').on('click', '.cancel-upload', function () {
  662. var wrapper = $(this).closest('.conList');
  663. wrapper.find('li').css('z-index', '-1');
  664. wrapper.find('input').val('');
  665. $(this).hide();
  666. wrapper.removeClass("hide-pic");
  667. wrapper.parent().append(wrapper.clone());
  668. wrapper.remove();
  669. $(".conList").each(function (i, ele) {
  670. if ($(ele).find("input.input-xlarge").val()) {
  671. $(ele).next().removeClass("hide-pic")
  672. }
  673. })
  674. });
  675. $(window).on("load", function () {
  676. setTimeout(showImage(), 100);
  677. });
  678. var templateType = $("input[name='templateType']:checked").val();
  679. if (templateType != undefined) {
  680. //数据填充
  681. <c:forEach items="${floorContent.floorImageList}" var="floorImage" varStatus="index">
  682. productImageList.push({
  683. id: "${floorImage.id}",
  684. productId: "${empty floorImage.productId ? "":floorImage.productId}",
  685. image: "${floorImage.image}",
  686. name: "${floorImage.name}",
  687. shopName: "${floorImage.shopName}",
  688. link: "${floorImage.link}",
  689. sort: "${floorImage.sort}",
  690. pcStatus: "${floorImage.pcStatus}",
  691. appletsStatus: "${floorImage.appletsStatus}",
  692. recommend: "${floorImage.recommend}",
  693. label: "${floorImage.label}",
  694. createDate: "${floorImage.createDate}"
  695. });
  696. </c:forEach>
  697. }
  698. showContent();
  699. });
  700. //展示选中模板对应的表单
  701. function showContent() {
  702. var list = [];
  703. var type;
  704. for (var i = 1; i <= 9; i++) {
  705. list.push('#template' + i);
  706. }
  707. var templateType = parseInt($("input[name='templateType']:checked").val());
  708. $('.Image1').hide();
  709. $('.Image2').hide();
  710. $('.Image3').hide();
  711. $('.Image4').hide();
  712. $('.Image5').hide();
  713. if (!isNaN(templateType)) {
  714. toTop(list, '#template', $("#template" + templateType))
  715. //滚动条滚动到最上方
  716. document.getElementById("templateTd").scrollTop = 0;
  717. //展示模板内容表单
  718. $("#infoLabel").hide();
  719. $(".templateImageTable").show();
  720. $("#displayDateDiv").css('display', 'none');
  721. $("#productImageTable").hide();
  722. //广告图
  723. if (templateType === 1 || templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7 || templateType == 8) {
  724. $('.Image1').show();
  725. }
  726. if (templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7) {
  727. $('.Image2').show();
  728. }
  729. if (templateType === 2 || templateType === 6 || templateType === 7) {
  730. $('.Image3').show();
  731. }
  732. if ( templateType === 7) {
  733. $('.Image4').show();
  734. $('.Image5').show();
  735. }
  736. //删除按钮和表格展示
  737. //图片表格
  738. if (productImageList.length == 0) {
  739. $("#del").attr("disabled", "disabled");
  740. } else {
  741. $("#productImageTable").show();
  742. $("#del").removeAttr("disabled");
  743. }
  744. //广告图建议尺寸
  745. if (templateType == 1 || templateType == 8) {
  746. $("#imageSize1").text("建议图片分辨率702px*240px");
  747. } else if (templateType == 2) {
  748. $("#imageSize1").text("建议图片分辨率702px*240px");
  749. $("#imageSize2").text("建议图片分辨率343px*524px");
  750. $("#imageSize3").text("建议图片分辨率343px*524px");
  751. } else if (templateType == 3) {
  752. $("#imageSize1").text("建议图片分辨率343px*524px");
  753. $("#imageSize2").text("建议图片分辨率343px*524px");
  754. } else if (templateType == 6) {
  755. $("#imageSize1").text("建议图片分辨率343px*524px");
  756. $("#imageSize2").text("建议图片分辨率343px*254px");
  757. $("#imageSize3").text("建议图片分辨率343px*254px");
  758. } else if (templateType == 7) {
  759. $("#imageSize1").text("建议图片分辨率343px*524px");
  760. $("#imageSize2").text("建议图片分辨率343px*254px");
  761. $("#imageSize3").text("建议图片分辨率343px*254px");
  762. $("#imageSize4").text("建议图片分辨率343px*254px");
  763. $("#imageSize5").text("建议图片分辨率343px*254px");
  764. }
  765. showImage();
  766. batchSaveSort();
  767. } else {
  768. $("#infoLabel").show();
  769. $(".templateImageTable").hide();
  770. }
  771. }
  772. //被选中的模板置顶
  773. function toTop(list = [], parent, children) {
  774. list.forEach(function (item, index) {
  775. $(parent).append($(item))
  776. })
  777. $(parent).prepend($(children))
  778. }
  779. //展示图片
  780. function showImage() {
  781. for (var i = 0; i <= 5; i++) {
  782. $("#appletsAdsImage" + i).find("input.input-xlarge").each(function (j, ele) {
  783. if ($(ele).val() && $(ele).val() != '') {
  784. $(ele).next().find("li").css("z-index", "99");
  785. $(ele).parents(".conList").find(".cancel-upload").show();
  786. $(ele).parents(".conList").next().removeClass("hide-pic");
  787. } else {
  788. $("#appletsAdsImage" + i + " .cancel-upload").click();
  789. }
  790. });
  791. $("#jumpImage" + i).find("input.input-xlarge").each(function (j, ele) {
  792. if ($(ele).val() && $(ele).val() != '') {
  793. $(ele).next().find("li").css("z-index", "99");
  794. $(ele).parents(".conList").find(".cancel-upload").show();
  795. $(ele).parents(".conList").next().removeClass("hide-pic");
  796. } else {
  797. $("#jumpImage" + i + " .cancel-upload").click();
  798. }
  799. });
  800. }
  801. }
  802. //点击添加
  803. function showSelect(url) {
  804. var title = '添加';
  805. var width = $(top.document).width() - 800;
  806. var height = $(top.document).height() - 160;
  807. var templateType = $("input[name='templateType']:checked").val();
  808. url = url + "?type=productImage&productCategory=1&productIds=" + productIds + "&templateType=" + templateType;
  809. title = '商品图片';
  810. width = $(top.document).width() - 400;
  811. height = $(top.document).height() - 160;
  812. top.$.jBox("iframe:" + url, {
  813. iframeScrolling: 'yes',
  814. width: width,
  815. height: height,
  816. persistent: true,
  817. title: title,
  818. buttons: {"确定": '1', "取消": '-1'},
  819. submit: function (v, h, f) {
  820. //确定
  821. var $jboxFrame = top.$('#jbox-iframe');
  822. var $mainFrame = top.$('#mainFrame');
  823. if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
  824. var items = $jboxFrame[0].contentWindow.getCheckedItems();
  825. items.createDate = '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>';
  826. console.log(items);
  827. //商品图片活动
  828. if (items.productId == "") {
  829. if (items.image == '') {
  830. alertx("请上传图片");
  831. return false;
  832. }
  833. if (items.name == '') {
  834. alertx("请输入名称");
  835. return false;
  836. }
  837. if (items.link == '') {
  838. alertx("请输入跳转链接");
  839. return false;
  840. }
  841. if (items.sort == '') {
  842. alertx("请输入排序值");
  843. return false;
  844. }
  845. if (items.label == '') {
  846. alertx("请输入标签");
  847. return false;
  848. }
  849. }
  850. productImageList.push(items);
  851. $('#productImageTable').show();
  852. $("#del").removeAttr("disabled");
  853. batchSaveSort();
  854. }
  855. return true;
  856. }
  857. });
  858. }
  859. //相关图片列表数据
  860. function appendShopOrderHead(data, index) {
  861. var type = 'productImage';
  862. var html = '<tr id ="ads' + index + '">' +
  863. '<td>' +
  864. '<input class="check-item" type="checkbox" name="info" value="' + index + '"/>' + (index + 1) +
  865. '</td>' +
  866. '<td>' + data.productId + '</td>' +
  867. '<td>' +
  868. '<img src="' + data.image + '" width="60px" border="none" title="启用">' +
  869. '</td>' +
  870. '<td>' + data.name +'</td>' +
  871. '<td>' + data.shopName +'</td>' +
  872. '<td>' +
  873. (data.appletsStatus == 1 ?
  874. '<font color="green">已上架</font>':'<font color="red">已下架</font>'
  875. ) +
  876. '</td>' +
  877. '<td>' +
  878. '<input name="sort" style="width:50px;" value="' + data.sort + '" onkeyup="onlynum(this)" onchange="changeSort(' + index + ',this)"></td>' +
  879. '</td>' +
  880. '<td>' +
  881. '<img src="'+(data.recommend == 1?'/static/images/yes.gif':'/static/images/no.gif')+'" width="15px" border="none"/>' +
  882. '</td>' +
  883. '<td>' +
  884. (data.createDate == '' ? (
  885. '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>'
  886. ) : (
  887. data.createDate
  888. )) +
  889. '</td>' +
  890. '<td>' +
  891. '<a href="javascript:;" onclick="updateAppletsStatus('+(data.appletsStatus == 1?0:1)+',' + index + ');"">'+(data.appletsStatus == 1?"下架":"上架")+'</a>'+
  892. ' <a href="javascript:;" onclick="updateRecommend('+(data.recommend == 1?0:1)+',' + index + ');"">'+(data.recommend == 1?"取消推荐":"设为推荐")+'</a>'+
  893. ' <a href="javascript:;" onclick="delect(' + index + ')">删除</a>' +
  894. '</td>' +
  895. '</tr>';
  896. return html;
  897. }
  898. function insertHtml(list) {
  899. var html = '';
  900. productIds = '';
  901. list.forEach(function (item, index) {
  902. html += appendShopOrderHead(item, index);
  903. productIds += "," + item.productId;
  904. });
  905. $("#productImageTbody").html(html);
  906. }
  907. /**
  908. * 一键排序
  909. */
  910. function batchSaveSort() {
  911. productImageList.sort(sort);
  912. insertHtml(productImageList);
  913. }
  914. //根据sort值 从小到大排序
  915. function sort(a, b) {
  916. return ((a.sort - b.sort) == 0 ? (a.createDate > b.createDate ? -1 : 1) : (a.sort - b.sort));
  917. }
  918. /**
  919. * @param obj
  920. * jquery控制input只能输入数字
  921. */
  922. function onlynum(obj) {
  923. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  924. }
  925. function changeSort(index, sortThis) {
  926. var sort = sortThis.value;
  927. var image = getImage(index);
  928. image.sort = sort;
  929. }
  930. function changeName(index, nameThis) {
  931. var name = nameThis.value;
  932. var image = getImage(index);
  933. image.name = name;
  934. }
  935. function changeContent(index, nameThis) {
  936. var content = nameThis.value;
  937. var image = infoImageList[index];
  938. image.content = content;
  939. }
  940. function changeLink(index, linkThis) {
  941. var link = linkThis.value;
  942. var image = getImage(index);
  943. image.link = link;
  944. }
  945. function changeLabel(index, labelThis) {
  946. var label = labelThis.value;
  947. var image = productImageList[index];
  948. image.label = label;
  949. }
  950. /**
  951. * 删除操作
  952. */
  953. function delect(index) {
  954. var displayDateNo = $("input[name='displayDateRadio']:checked").val();
  955. return confirmx("确定删除该数据吗?", function () {
  956. var image = getImage(index);
  957. if (image.productId != '') {
  958. productIds = productIds.replace(image.productId, "");
  959. }
  960. productImageList.splice(index, 1);
  961. insertHtml(productImageList);
  962. if (productImageList.length == 0) {
  963. $("#del").attr("disabled", "disabled");
  964. $('#productImageTable').hide();
  965. }
  966. });
  967. }
  968. /**
  969. * 批量删除
  970. */
  971. function batchDeletion() {
  972. var index = -1;
  973. var i = 1;
  974. var length = $('input[name="info"]:checked').length;
  975. if (length > 0) {
  976. return confirmx("确定删除吗?", function () {
  977. var displayDateNo = $("input[name='displayDateRadio']:checked").val();
  978. $('input[name="info"]:checked').each(function () {
  979. var thisIndex = $(this).val();
  980. if (index >= 0 && index < thisIndex) {
  981. thisIndex = thisIndex - i;
  982. i++;
  983. } else {
  984. index = thisIndex;
  985. }
  986. var image = getImage(thisIndex);
  987. if (image.productId != '') {
  988. productIds = productIds.replace(image.productId, "");
  989. }
  990. productImageList.splice(thisIndex, 1);
  991. });
  992. insertHtml(productImageList);
  993. if (productImageList.length == 0) {
  994. $('#productImageTable').hide();
  995. $("#del").attr("disabled", "disabled");
  996. } else {
  997. $("#del").removeAttr("disabled");
  998. }
  999. });
  1000. } else {
  1001. alertx("请先选中要删除的数据")
  1002. }
  1003. }
  1004. function getImage(index) {
  1005. var image = productImageList[index];
  1006. return image;
  1007. }
  1008. function updatePcStatus(status, index) {
  1009. var image = getImage(index);
  1010. confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
  1011. image.pcStatus = status;
  1012. batchSaveSort();
  1013. })
  1014. }
  1015. function updateAppletsStatus(status, index) {
  1016. var image = getImage(index);
  1017. confirmx(status == 0 ? '确定下架该商品吗?' : '确定上架该商品吗?', function () {
  1018. image.appletsStatus = status;
  1019. batchSaveSort();
  1020. })
  1021. }
  1022. function updateRecommend(status, index) {
  1023. var image = getImage(index);
  1024. confirmx(status == 0 ? '确定取消推荐吗?' : '确定将该商品设为推荐商品吗?', function () {
  1025. image.recommend = status;
  1026. batchSaveSort();
  1027. })
  1028. }
  1029. function clickAllSelect(ckb) {
  1030. var isChecked = ckb.checked;
  1031. $(".check-item").attr('checked', isChecked);
  1032. }
  1033. // 保存完是否重定向到楼层列表
  1034. function changeRedirectFlag(redirectFlag) {
  1035. $("#redirectFlag").val(redirectFlag);
  1036. }
  1037. function changeJumpType(index){
  1038. var jumpTypeName = 'jumpType' + index;
  1039. var jumpType = $("input[name=" + jumpTypeName + "]:checked").val();
  1040. var jumpLink = $("#adsLink"+index);
  1041. var jumpProductId = $("#productId"+index);
  1042. if (1 == jumpType) {
  1043. jumpLink.addClass("required");
  1044. jumpProductId.removeClass("required");
  1045. }else if (2 == jumpType) {
  1046. jumpProductId.addClass("required");
  1047. jumpLink.removeClass("required");
  1048. } else {
  1049. jumpProductId.removeClass("required");
  1050. jumpLink.removeClass("required");
  1051. }
  1052. }
  1053. </script>
  1054. </body>
  1055. </html>