cmHeheFloorContentForm.jsp 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  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 style="margin-top: 20px">
  380. <input type="radio" name="jumpType1" value="4" onchange="changeJumpType(1)" ${floorContent.jumpType1 eq 4? "checked" : ""} />无
  381. </div>
  382. </div>
  383. </div>
  384. <div style="float: left;margin: 25px 0px 0px 100px">
  385. <span class="help-inline"></span>
  386. <input type="radio" name="jumpType1" value="3" onchange="changeJumpType(1)" ${floorContent.jumpType1 eq 3? "checked" : ""} />图片:
  387. <div class="controls upload-content iconBox" id="jumpImage1">
  388. <div class="conList">
  389. <form:hidden id="jumpIcon1" path="jumpImage1" htmlEscape="false" maxlength="255"
  390. class="input-xlarge required"/>
  391. <sys:ckfinder input="jumpIcon1" type="images" uploadPath="/photo"
  392. selectMultiple="false"
  393. maxWidth="100" maxHeight="100"/> <br>
  394. <label>建议图片分辨率750px*1624px</label>
  395. </div>
  396. </div>
  397. </div>
  398. </div>
  399. <div class="control-group clear Image2" style="display: none">
  400. <div style="float: left">
  401. <span class="help-inline"><font color="red">*</font> </span>广告图2:
  402. <div class="controls upload-content iconBox" id="appletsAdsImage2">
  403. <div class="conList">
  404. <form:hidden id="appletsIcon2" path="appletsAdsImage2" htmlEscape="false" maxlength="255"
  405. class="input-xlarge required"/>
  406. <sys:ckfinder input="appletsIcon2" type="images" uploadPath="/photo"
  407. selectMultiple="false"
  408. maxWidth="100" maxHeight="100"/><br>
  409. <label id="imageSize2">建议图片分辨率344px*268px</label>
  410. </div>
  411. </div>
  412. </div>
  413. <div style="float: left">
  414. <span class="help-inline"></span>跳转方式:
  415. <div style="margin-left: 100px">
  416. <div>
  417. <input type="radio" name="jumpType2" value="1" onchange="changeJumpType(2)" ${(floorContent.jumpType2 eq null || floorContent.jumpType2 eq 1 )? "checked" : ""} />链接:
  418. <form:input path="adsLink2" htmlEscape="false" maxlength="255"
  419. class="input-xlarge"/>
  420. </div>
  421. <div style="margin-top: 20px">
  422. <input type="radio" name="jumpType2" value="2" onchange="changeJumpType(2)" ${floorContent.jumpType2 eq 2? "checked" : ""} />产品:
  423. <form:select path="productId2" class="select-ele input-xlarge">
  424. <form:option value="" label="请选择"/>
  425. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  426. htmlEscape="false"/>
  427. </form:select>
  428. </div>
  429. <div style="margin-top: 20px">
  430. <input type="radio" name="jumpType2" value="4" onchange="changeJumpType(2)" ${floorContent.jumpType2 eq 4? "checked" : ""} />无
  431. </div>
  432. </div>
  433. </div>
  434. <div style="float: left;margin: 25px 0px 0px 100px">
  435. <span class="help-inline"></span>
  436. <input type="radio" name="jumpType2" value="3" onchange="changeJumpType(2)" ${floorContent.jumpType2 eq 3? "checked" : ""} />图片:
  437. <div class="controls upload-content iconBox" id="jumpImage2">
  438. <div class="conList">
  439. <form:hidden id="jumpIcon2" path="jumpImage2" htmlEscape="false" maxlength="255"
  440. class="input-xlarge required"/>
  441. <sys:ckfinder input="jumpIcon2" type="images" uploadPath="/photo"
  442. selectMultiple="false"
  443. maxWidth="100" maxHeight="100"/> <br>
  444. <label>建议图片分辨率750px*1624px</label>
  445. </div>
  446. </div>
  447. </div>
  448. </div>
  449. <div class="control-group clear Image3" style="display: none">
  450. <div style="float: left">
  451. <span class="help-inline"><font color="red">*</font> </span>广告图3:
  452. <div class="controls upload-content iconBox" id="appletsAdsImage3">
  453. <div class="conList">
  454. <form:hidden id="appletsIcon3" path="appletsAdsImage3" htmlEscape="false" maxlength="255"
  455. class="input-xlarge required"/>
  456. <sys:ckfinder input="appletsIcon3" type="images" uploadPath="/photo"
  457. selectMultiple="false"
  458. maxWidth="100" maxHeight="100"/><br>
  459. <label id="imageSize3">建议图片分辨率344px*268px</label>
  460. </div>
  461. </div>
  462. </div>
  463. <div style="float: left">
  464. <span class="help-inline"></span>跳转方式:
  465. <div style="margin-left: 100px">
  466. <div>
  467. <input type="radio" name="jumpType3" value="1" onchange="changeJumpType(3)" ${(floorContent.jumpType3 eq null || floorContent.jumpType3 eq 1 )? "checked" : ""} />链接:
  468. <form:input path="adsLink3" htmlEscape="false" maxlength="255"
  469. class="input-xlarge"/>
  470. </div>
  471. <div style="margin-top: 20px">
  472. <input type="radio" name="jumpType3" value="2" onchange="changeJumpType(3)" ${floorContent.jumpType3 eq 2? "checked" : ""} />产品:
  473. <form:select path="productId3" class="select-ele input-xlarge">
  474. <form:option value="" label="请选择"/>
  475. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  476. htmlEscape="false"/>
  477. </form:select>
  478. </div>
  479. <div style="margin-top: 20px">
  480. <input type="radio" name="jumpType3" value="4" onchange="changeJumpType(3)" ${floorContent.jumpType3 eq 4? "checked" : ""} />无
  481. </div>
  482. </div>
  483. </div>
  484. <div style="float: left;margin: 25px 0px 0px 100px">
  485. <span class="help-inline"></span>
  486. <input type="radio" name="jumpType3" value="3" onchange="changeJumpType(3)" ${floorContent.jumpType3 eq 3? "checked" : ""} />图片:
  487. <div class="controls upload-content iconBox" id="jumpImage3">
  488. <div class="conList">
  489. <form:hidden id="jumpIcon3" path="jumpImage3" htmlEscape="false" maxlength="255"
  490. class="input-xlarge required"/>
  491. <sys:ckfinder input="jumpIcon3" type="images" uploadPath="/photo"
  492. selectMultiple="false"
  493. maxWidth="100" maxHeight="100"/> <br>
  494. <label>建议图片分辨率750px*1624px</label>
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. <div class="control-group clear Image4" style="display: none">
  500. <div style="float: left">
  501. <span class="help-inline"><font color="red">*</font> </span>广告图4:
  502. <div class="controls upload-content iconBox" id="appletsAdsImage4">
  503. <div class="conList">
  504. <form:hidden id="appletsIcon4" path="appletsAdsImage4" htmlEscape="false" maxlength="255"
  505. class="input-xlarge required"/>
  506. <sys:ckfinder input="appletsIcon4" type="images" uploadPath="/photo"
  507. selectMultiple="false"
  508. maxWidth="100" maxHeight="100"/><br>
  509. <label id="imageSize4">建议图片分辨率344px*268px</label>
  510. </div>
  511. </div>
  512. </div>
  513. <div style="float: left">
  514. <span class="help-inline"></span>跳转方式:
  515. <div style="margin-left: 100px">
  516. <div>
  517. <input type="radio" name="jumpType4" value="1" onchange="changeJumpType(4)" ${(floorContent.jumpType4 eq null || floorContent.jumpType4 eq 1 )? "checked" : ""} />链接:
  518. <form:input path="adsLink4" htmlEscape="false" maxlength="255"
  519. class="input-xlarge"/>
  520. </div>
  521. <div style="margin-top: 20px">
  522. <input type="radio" name="jumpType4" value="2" onchange="changeJumpType(4)" ${floorContent.jumpType4 eq 2? "checked" : ""} />产品:
  523. <form:select path="productId4" class="select-ele input-xlarge">
  524. <form:option value="" label="请选择"/>
  525. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  526. htmlEscape="false"/>
  527. </form:select>
  528. </div>
  529. <div style="margin-top: 20px">
  530. <input type="radio" name="jumpType4" value="4" onchange="changeJumpType(4)" ${floorContent.jumpType4 eq 4? "checked" : ""} />无
  531. </div>
  532. </div>
  533. </div>
  534. <div style="float: left;margin: 25px 0px 0px 100px">
  535. <span class="help-inline"></span>
  536. <input type="radio" name="jumpType4" value="3" onchange="changeJumpType(4)" ${floorContent.jumpType4 eq 3? "checked" : ""} />图片:
  537. <div class="controls upload-content iconBox" id="jumpImage4">
  538. <div class="conList">
  539. <form:hidden id="jumpIcon4" path="jumpImage4" htmlEscape="false" maxlength="255"
  540. class="input-xlarge required"/>
  541. <sys:ckfinder input="jumpIcon4" type="images" uploadPath="/photo"
  542. selectMultiple="false"
  543. maxWidth="100" maxHeight="100"/> <br>
  544. <label>建议图片分辨率750px*1624px</label>
  545. </div>
  546. </div>
  547. </div>
  548. </div>
  549. <div class="control-group clear Image5" style="display: none">
  550. <div style="float: left">
  551. <span class="help-inline"><font color="red">*</font> </span>广告图5:
  552. <div class="controls upload-content iconBox" id="appletsAdsImage5">
  553. <div class="conList">
  554. <form:hidden id="appletsIcon5" path="appletsAdsImage5" htmlEscape="false" maxlength="255"
  555. class="input-xlarge required"/>
  556. <sys:ckfinder input="appletsIcon5" type="images" uploadPath="/photo"
  557. selectMultiple="false"
  558. maxWidth="100" maxHeight="100"/><br>
  559. <label id="imageSize5">建议图片分辨率344px*268px</label>
  560. </div>
  561. </div>
  562. </div>
  563. <div style="float: left">
  564. <span class="help-inline"></span>跳转方式:
  565. <div style="margin-left: 100px">
  566. <div>
  567. <input type="radio" name="jumpType5" value="1" onchange="changeJumpType(5)" ${(floorContent.jumpType5 eq null || floorContent.jumpType5 eq 1 )? "checked" : ""} />链接:
  568. <form:input path="adsLink5" htmlEscape="false" maxlength="255"
  569. class="input-xlarge"/>
  570. </div>
  571. <div style="margin-top: 20px">
  572. <input type="radio" name="jumpType5" value="2" onchange="changeJumpType(5)" ${floorContent.jumpType5 eq 2? "checked" : ""} />产品:
  573. <form:select path="productId5" class="select-ele input-xlarge">
  574. <form:option value="" label="请选择"/>
  575. <form:options items="${productList}" itemLabel="name" itemValue="productId"
  576. htmlEscape="false"/>
  577. </form:select>
  578. </div>
  579. <div style="margin-top: 20px">
  580. <input type="radio" name="jumpType5" value="4" onchange="changeJumpType(5)" ${floorContent.jumpType5 eq 4? "checked" : ""} />无
  581. </div>
  582. </div>
  583. </div>
  584. <div style="float: left;margin: 25px 0px 0px 100px">
  585. <span class="help-inline"></span>
  586. <input type="radio" name="jumpType5" value="3" onchange="changeJumpType(5)" ${floorContent.jumpType5 eq 3? "checked" : ""} />图片:
  587. <div class="controls upload-content iconBox" id="jumpImage5">
  588. <div class="conList">
  589. <form:hidden id="jumpIcon5" path="jumpImage5" htmlEscape="false" maxlength="255"
  590. class="input-xlarge required"/>
  591. <sys:ckfinder input="jumpIcon5" type="images" uploadPath="/photo"
  592. selectMultiple="false"
  593. maxWidth="100" maxHeight="100"/> <br>
  594. <label>建议图片分辨率750px*1624px</label>
  595. </div>
  596. </div>
  597. </div>
  598. </div>
  599. <br>
  600. <div class="control-group templateImageTable">
  601. <br><br>
  602. <input class="btn" id="del" style="width: 50px" onclick="batchDeletion()" value="删除"/>&nbsp;&nbsp;&nbsp;&nbsp;
  603. <input class="btn btn-primary" id="sortBtn" style="width: 70px" onclick="batchSaveSort()"
  604. value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
  605. <input class="btn btn-primary" id="showSelectBtn" style="width: 70px"
  606. onclick="showSelect('${ctx}/newhome/newPageFloor/addHeheImage')" value="上线商品"/>&nbsp;&nbsp;&nbsp;&nbsp;
  607. <br><br>
  608. <table id="productImageTable" class="table table-striped table-bordered table-condensed"
  609. style="display: none">
  610. <thead>
  611. <tr>
  612. <th style="width:20px;"><input class="check-all" type="checkbox"
  613. onclick="clickAllSelect(this)"/> 全选
  614. </th>
  615. <th>商品ID</th>
  616. <th>商品图片</th>
  617. <th>商品名称</th>
  618. <th>供应商名称</th>
  619. <th>商品状态</th>
  620. <th>排序</th>
  621. <th>推荐状态</th>
  622. <th>添加时间</th>
  623. <th>操作</th>
  624. </tr>
  625. </thead>
  626. <tbody id="productImageTbody"></tbody>
  627. </table>
  628. </div>
  629. </div>
  630. </td>
  631. </tr>
  632. </table>
  633. </div>
  634. <div class="form-actions">
  635. <shiro:hasPermission name="newhome:newPageFloor:edit"><input id="btnSubmit" class="btn btn-primary"
  636. type="submit" onclick="changeRedirectFlag(1)"
  637. value="保 存"/>&nbsp;</shiro:hasPermission>
  638. <input id="btnSubmit" class="btn btn-primary"
  639. type="submit" onclick="changeRedirectFlag(0)"
  640. value="保存并继续"/>&nbsp;
  641. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  642. </div>
  643. </form:form>
  644. <script>
  645. var productImageList = [];
  646. var productIds = '';
  647. $(function () {
  648. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  649. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  650. $('.upload-content .conList').find('.cancel-upload').hide();
  651. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  652. var MutationObserverConfig = {
  653. childList: true,
  654. subtree: true,
  655. characterData: true
  656. };
  657. var observer = new MutationObserver(function (mutations) {
  658. $.each(mutations, function (index, item) {
  659. if (item.type === 'childList') {
  660. // 在创建新的 element 时调用
  661. var target = $(item.target),
  662. thisWrapper = target.closest('.conList'),
  663. nextEle = thisWrapper.next();
  664. thisWrapper.find('li').css('z-index', 99);
  665. thisWrapper.find('.cancel-upload').show();
  666. if (nextEle.hasClass('hide-pic')) {
  667. nextEle.removeClass('hide-pic');
  668. }
  669. }
  670. })
  671. });
  672. for (var i = 0; i < 10; i++) {
  673. var observeEle = document.getElementsByClassName('upload-content')[i];
  674. observer.observe(observeEle, MutationObserverConfig)
  675. }
  676. $('body').on('click', '.cancel-upload', function () {
  677. var wrapper = $(this).closest('.conList');
  678. wrapper.find('li').css('z-index', '-1');
  679. wrapper.find('input').val('');
  680. $(this).hide();
  681. wrapper.removeClass("hide-pic");
  682. wrapper.parent().append(wrapper.clone());
  683. wrapper.remove();
  684. $(".conList").each(function (i, ele) {
  685. if ($(ele).find("input.input-xlarge").val()) {
  686. $(ele).next().removeClass("hide-pic")
  687. }
  688. })
  689. });
  690. $(window).on("load", function () {
  691. setTimeout(showImage(), 100);
  692. });
  693. var templateType = $("input[name='templateType']:checked").val();
  694. if (templateType != undefined) {
  695. //数据填充
  696. <c:forEach items="${floorContent.floorImageList}" var="floorImage" varStatus="index">
  697. productImageList.push({
  698. id: "${floorImage.id}",
  699. productId: "${empty floorImage.productId ? "":floorImage.productId}",
  700. image: "${floorImage.image}",
  701. name: "${floorImage.name}",
  702. shopName: "${floorImage.shopName}",
  703. link: "${floorImage.link}",
  704. sort: "${floorImage.sort}",
  705. pcStatus: "${floorImage.pcStatus}",
  706. appletsStatus: "${floorImage.appletsStatus}",
  707. recommend: "${floorImage.recommend}",
  708. label: "${floorImage.label}",
  709. createDate: "${floorImage.createDate}"
  710. });
  711. </c:forEach>
  712. }
  713. showContent();
  714. });
  715. //展示选中模板对应的表单
  716. function showContent() {
  717. var list = [];
  718. var type;
  719. for (var i = 1; i <= 9; i++) {
  720. list.push('#template' + i);
  721. }
  722. var templateType = parseInt($("input[name='templateType']:checked").val());
  723. $('.Image1').hide();
  724. $('.Image2').hide();
  725. $('.Image3').hide();
  726. $('.Image4').hide();
  727. $('.Image5').hide();
  728. if (!isNaN(templateType)) {
  729. toTop(list, '#template', $("#template" + templateType))
  730. //滚动条滚动到最上方
  731. document.getElementById("templateTd").scrollTop = 0;
  732. //展示模板内容表单
  733. $("#infoLabel").hide();
  734. $(".templateImageTable").show();
  735. $("#displayDateDiv").css('display', 'none');
  736. $("#productImageTable").hide();
  737. //广告图
  738. if (templateType === 1 || templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7 || templateType == 8) {
  739. $('.Image1').show();
  740. }
  741. if (templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7) {
  742. $('.Image2').show();
  743. }
  744. if (templateType === 2 || templateType === 6 || templateType === 7) {
  745. $('.Image3').show();
  746. }
  747. if ( templateType === 7) {
  748. $('.Image4').show();
  749. $('.Image5').show();
  750. }
  751. //删除按钮和表格展示
  752. //图片表格
  753. if (productImageList.length == 0) {
  754. $("#del").attr("disabled", "disabled");
  755. } else {
  756. $("#productImageTable").show();
  757. $("#del").removeAttr("disabled");
  758. }
  759. //广告图建议尺寸
  760. if (templateType == 1 || templateType == 8) {
  761. $("#imageSize1").text("建议图片分辨率702px*240px");
  762. } else if (templateType == 2) {
  763. $("#imageSize1").text("建议图片分辨率702px*240px");
  764. $("#imageSize2").text("建议图片分辨率343px*524px");
  765. $("#imageSize3").text("建议图片分辨率343px*524px");
  766. } else if (templateType == 3) {
  767. $("#imageSize1").text("建议图片分辨率343px*524px");
  768. $("#imageSize2").text("建议图片分辨率343px*524px");
  769. } else if (templateType == 6) {
  770. $("#imageSize1").text("建议图片分辨率343px*524px");
  771. $("#imageSize2").text("建议图片分辨率343px*254px");
  772. $("#imageSize3").text("建议图片分辨率343px*254px");
  773. } else if (templateType == 7) {
  774. $("#imageSize1").text("建议图片分辨率343px*524px");
  775. $("#imageSize2").text("建议图片分辨率343px*254px");
  776. $("#imageSize3").text("建议图片分辨率343px*254px");
  777. $("#imageSize4").text("建议图片分辨率343px*254px");
  778. $("#imageSize5").text("建议图片分辨率343px*254px");
  779. }
  780. showImage();
  781. batchSaveSort();
  782. } else {
  783. $("#infoLabel").show();
  784. $(".templateImageTable").hide();
  785. }
  786. }
  787. //被选中的模板置顶
  788. function toTop(list = [], parent, children) {
  789. list.forEach(function (item, index) {
  790. $(parent).append($(item))
  791. })
  792. $(parent).prepend($(children))
  793. }
  794. //展示图片
  795. function showImage() {
  796. for (var i = 0; i <= 5; i++) {
  797. $("#appletsAdsImage" + i).find("input.input-xlarge").each(function (j, ele) {
  798. if ($(ele).val() && $(ele).val() != '') {
  799. $(ele).next().find("li").css("z-index", "99");
  800. $(ele).parents(".conList").find(".cancel-upload").show();
  801. $(ele).parents(".conList").next().removeClass("hide-pic");
  802. } else {
  803. $("#appletsAdsImage" + i + " .cancel-upload").click();
  804. }
  805. });
  806. $("#jumpImage" + i).find("input.input-xlarge").each(function (j, ele) {
  807. if ($(ele).val() && $(ele).val() != '') {
  808. $(ele).next().find("li").css("z-index", "99");
  809. $(ele).parents(".conList").find(".cancel-upload").show();
  810. $(ele).parents(".conList").next().removeClass("hide-pic");
  811. } else {
  812. $("#jumpImage" + i + " .cancel-upload").click();
  813. }
  814. });
  815. }
  816. }
  817. //点击添加
  818. function showSelect(url) {
  819. var title = '添加';
  820. var width = $(top.document).width() - 800;
  821. var height = $(top.document).height() - 160;
  822. var templateType = $("input[name='templateType']:checked").val();
  823. url = url + "?type=productImage&productCategory=1&productIds=" + productIds + "&templateType=" + templateType;
  824. title = '商品图片';
  825. width = $(top.document).width() - 400;
  826. height = $(top.document).height() - 160;
  827. top.$.jBox("iframe:" + url, {
  828. iframeScrolling: 'yes',
  829. width: width,
  830. height: height,
  831. persistent: true,
  832. title: title,
  833. buttons: {"确定": '1', "取消": '-1'},
  834. submit: function (v, h, f) {
  835. //确定
  836. var $jboxFrame = top.$('#jbox-iframe');
  837. var $mainFrame = top.$('#mainFrame');
  838. if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
  839. var items = $jboxFrame[0].contentWindow.getCheckedItems();
  840. items.createDate = '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>';
  841. console.log(items);
  842. //商品图片活动
  843. if (items.productId == "") {
  844. if (items.image == '') {
  845. alertx("请上传图片");
  846. return false;
  847. }
  848. if (items.name == '') {
  849. alertx("请输入名称");
  850. return false;
  851. }
  852. if (items.link == '') {
  853. alertx("请输入跳转链接");
  854. return false;
  855. }
  856. if (items.sort == '') {
  857. alertx("请输入排序值");
  858. return false;
  859. }
  860. if (items.label == '') {
  861. alertx("请输入标签");
  862. return false;
  863. }
  864. }
  865. productImageList.push(items);
  866. $('#productImageTable').show();
  867. $("#del").removeAttr("disabled");
  868. batchSaveSort();
  869. }
  870. return true;
  871. }
  872. });
  873. }
  874. //相关图片列表数据
  875. function appendShopOrderHead(data, index) {
  876. var type = 'productImage';
  877. var html = '<tr id ="ads' + index + '">' +
  878. '<td>' +
  879. '<input class="check-item" type="checkbox" name="info" value="' + index + '"/>' + (index + 1) +
  880. '</td>' +
  881. '<td>' + data.productId + '</td>' +
  882. '<td>' +
  883. '<img src="' + data.image + '" width="60px" border="none" title="启用">' +
  884. '</td>' +
  885. '<td>' + data.name +'</td>' +
  886. '<td>' + data.shopName +'</td>' +
  887. '<td>' +
  888. (data.appletsStatus == 1 ?
  889. '<font color="green">已上架</font>':'<font color="red">已下架</font>'
  890. ) +
  891. '</td>' +
  892. '<td>' +
  893. '<input name="sort" style="width:50px;" value="' + data.sort + '" onkeyup="onlynum(this)" onchange="changeSort(' + index + ',this)"></td>' +
  894. '</td>' +
  895. '<td>' +
  896. '<img src="'+(data.recommend == 1?'/static/images/yes.gif':'/static/images/no.gif')+'" width="15px" border="none"/>' +
  897. '</td>' +
  898. '<td>' +
  899. (data.createDate == '' ? (
  900. '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>'
  901. ) : (
  902. data.createDate
  903. )) +
  904. '</td>' +
  905. '<td>' +
  906. '<a href="javascript:;" onclick="updateAppletsStatus('+(data.appletsStatus == 1?0:1)+',' + index + ');"">'+(data.appletsStatus == 1?"下架":"上架")+'</a>'+
  907. ' <a href="javascript:;" onclick="updateRecommend('+(data.recommend == 1?0:1)+',' + index + ');"">'+(data.recommend == 1?"取消推荐":"设为推荐")+'</a>'+
  908. ' <a href="javascript:;" onclick="delect(' + index + ')">删除</a>' +
  909. '</td>' +
  910. '</tr>';
  911. return html;
  912. }
  913. function insertHtml(list) {
  914. var html = '';
  915. productIds = '';
  916. list.forEach(function (item, index) {
  917. html += appendShopOrderHead(item, index);
  918. productIds += "," + item.productId;
  919. });
  920. $("#productImageTbody").html(html);
  921. }
  922. /**
  923. * 一键排序
  924. */
  925. function batchSaveSort() {
  926. productImageList.sort(sort);
  927. insertHtml(productImageList);
  928. }
  929. //根据sort值 从小到大排序
  930. function sort(a, b) {
  931. return ((a.sort - b.sort) == 0 ? (a.createDate > b.createDate ? -1 : 1) : (a.sort - b.sort));
  932. }
  933. /**
  934. * @param obj
  935. * jquery控制input只能输入数字
  936. */
  937. function onlynum(obj) {
  938. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  939. }
  940. function changeSort(index, sortThis) {
  941. var sort = sortThis.value;
  942. var image = getImage(index);
  943. image.sort = sort;
  944. }
  945. function changeName(index, nameThis) {
  946. var name = nameThis.value;
  947. var image = getImage(index);
  948. image.name = name;
  949. }
  950. function changeContent(index, nameThis) {
  951. var content = nameThis.value;
  952. var image = infoImageList[index];
  953. image.content = content;
  954. }
  955. function changeLink(index, linkThis) {
  956. var link = linkThis.value;
  957. var image = getImage(index);
  958. image.link = link;
  959. }
  960. function changeLabel(index, labelThis) {
  961. var label = labelThis.value;
  962. var image = productImageList[index];
  963. image.label = label;
  964. }
  965. /**
  966. * 删除操作
  967. */
  968. function delect(index) {
  969. var displayDateNo = $("input[name='displayDateRadio']:checked").val();
  970. return confirmx("确定删除该数据吗?", function () {
  971. var image = getImage(index);
  972. if (image.productId != '') {
  973. productIds = productIds.replace(image.productId, "");
  974. }
  975. productImageList.splice(index, 1);
  976. insertHtml(productImageList);
  977. if (productImageList.length == 0) {
  978. $("#del").attr("disabled", "disabled");
  979. $('#productImageTable').hide();
  980. }
  981. });
  982. }
  983. /**
  984. * 批量删除
  985. */
  986. function batchDeletion() {
  987. var index = -1;
  988. var i = 1;
  989. var length = $('input[name="info"]:checked').length;
  990. if (length > 0) {
  991. return confirmx("确定删除吗?", function () {
  992. var displayDateNo = $("input[name='displayDateRadio']:checked").val();
  993. $('input[name="info"]:checked').each(function () {
  994. var thisIndex = $(this).val();
  995. if (index >= 0 && index < thisIndex) {
  996. thisIndex = thisIndex - i;
  997. i++;
  998. } else {
  999. index = thisIndex;
  1000. }
  1001. var image = getImage(thisIndex);
  1002. if (image.productId != '') {
  1003. productIds = productIds.replace(image.productId, "");
  1004. }
  1005. productImageList.splice(thisIndex, 1);
  1006. });
  1007. insertHtml(productImageList);
  1008. if (productImageList.length == 0) {
  1009. $('#productImageTable').hide();
  1010. $("#del").attr("disabled", "disabled");
  1011. } else {
  1012. $("#del").removeAttr("disabled");
  1013. }
  1014. });
  1015. } else {
  1016. alertx("请先选中要删除的数据")
  1017. }
  1018. }
  1019. function getImage(index) {
  1020. var image = productImageList[index];
  1021. return image;
  1022. }
  1023. function updatePcStatus(status, index) {
  1024. var image = getImage(index);
  1025. confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
  1026. image.pcStatus = status;
  1027. batchSaveSort();
  1028. })
  1029. }
  1030. function updateAppletsStatus(status, index) {
  1031. var image = getImage(index);
  1032. confirmx(status == 0 ? '确定下架该商品吗?' : '确定上架该商品吗?', function () {
  1033. image.appletsStatus = status;
  1034. batchSaveSort();
  1035. })
  1036. }
  1037. function updateRecommend(status, index) {
  1038. var image = getImage(index);
  1039. confirmx(status == 0 ? '确定取消推荐吗?' : '确定将该商品设为推荐商品吗?', function () {
  1040. image.recommend = status;
  1041. batchSaveSort();
  1042. })
  1043. }
  1044. function clickAllSelect(ckb) {
  1045. var isChecked = ckb.checked;
  1046. $(".check-item").attr('checked', isChecked);
  1047. }
  1048. // 保存完是否重定向到楼层列表
  1049. function changeRedirectFlag(redirectFlag) {
  1050. $("#redirectFlag").val(redirectFlag);
  1051. }
  1052. function changeJumpType(index){
  1053. var jumpTypeName = 'jumpType' + index;
  1054. var jumpType = $("input[name=" + jumpTypeName + "]:checked").val();
  1055. var jumpLink = $("#adsLink"+index);
  1056. var jumpProductId = $("#productId"+index);
  1057. if (1 == jumpType) {
  1058. jumpLink.addClass("required");
  1059. jumpProductId.removeClass("required");
  1060. }else if (2 == jumpType) {
  1061. jumpProductId.addClass("required");
  1062. jumpLink.removeClass("required");
  1063. } else {
  1064. jumpProductId.removeClass("required");
  1065. jumpLink.removeClass("required");
  1066. }
  1067. }
  1068. </script>
  1069. </body>
  1070. </html>