add.jsp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta charset="utf-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <%@ include file="../../common/head.jsp"%>
  9. <script>
  10. $(document).ready(function () {
  11. /* var seApId = '<select id="apId" name="apId" class="form-control" validate="{required:true}" validateMessage="{required:\'请选择对应广告位\'}"> <option value=""> --请选择 -- </option>';
  12. var jsonData = ${jsonAdvPosition};
  13. $.each(jsonData, function(i, item) {
  14. seApId += '<option value="'+item.id+'"> '+item.apName+' </option>';
  15. });
  16. seApId += "</select>"
  17. $("#divApId").append(seApId); */
  18. $("#divGoods").hide();
  19. //绑定change事件
  20. $(document).on("change", "#advType", function() {
  21. if($("#advType").val() == "goods"){
  22. $("#divGoods").show();
  23. $("#divAdvSrc").hide();
  24. }else{
  25. $("#divGoods").hide();
  26. $("#divAdvSrc").show();
  27. }
  28. });
  29. $("#buttonSubmit").bind("click",function(){
  30. if ($("#addGoodsClassForm").valid()) {
  31. if($("#advType").val() == "goods"){
  32. if($("#goodsId").val() == ""){
  33. layer.alert('请选择商品!');
  34. return;
  35. }
  36. $("#advSrc").val($("#goodsId").val());
  37. }
  38. if($("#advPic").val() == ""){
  39. layer.alert('请上传图片!');
  40. return;
  41. }
  42. $("#addGoodsClassForm").submit();
  43. }
  44. });
  45. });
  46. ///选择商品p
  47. <%-- function selectGooods_radio(){
  48. var index = parent.layer.open({
  49. type: 2,
  50. area: ['800px', '800px'],
  51. fixed: false, //不固定
  52. resize: true,
  53. maxmin: true,
  54. shade: 0.6,
  55. title:'选择商品',
  56. content: '<%=path%>/case/listGoods.cs'
  57. });
  58. } --%>
  59. </script>
  60. <cs:initFile />
  61. </head>
  62. <body>
  63. <div class="wrapper wrapper-content">
  64. <div class="row">
  65. <div class="col-sm-12">
  66. <cs:form_validate formId="addGoodsClassForm" />
  67. <form class="form-horizontal" action="add.cs" id="addGoodsClassForm"
  68. method="POST">
  69. <!-- <div class="form-group">
  70. <label class="col-sm-3 control-label">对应广告位:</label>
  71. <div class="col-sm-6" id="divApId"></div>
  72. </div> -->
  73. <div class="form-group">
  74. <label class="col-sm-3 control-label">标题:</label>
  75. <div class="col-sm-6">
  76. <input id="advTitle" name="advTitle" class="form-control"
  77. validate="{required:true}"
  78. validateMessage="{required:'请输入标题'}">
  79. </div>
  80. </div>
  81. <div class="form-group">
  82. <label class="col-sm-3 control-label">图片:</label>
  83. <div class="col-sm-6">
  84. <cs:file name="advPic" type="130" num="1"></cs:file>
  85. </div>
  86. </div>
  87. <div class="form-group">
  88. <label class="col-sm-3 control-label">权重:</label>
  89. <div class="col-sm-6">
  90. <input id="advSort" name="advSort" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" placeholder="请输入数字,正排序" class="form-control"
  91. validate="{required:true,maxlength:10}"
  92. validateMessage="{required:'请输入权重',maxlength:'请输入小于10位的数字'}">
  93. </div>
  94. </div>
  95. <!-- 广告链接类型 关键字搜索-keyword 商品-goods 链接-link-->
  96. <div class="form-group">
  97. <label class="col-sm-3 control-label">链接类型:</label>
  98. <div class="col-sm-6">
  99. <select id="advType" name="advType" class="form-control">
  100. <!-- validate="{required:true}" validateMessage="{required:'请选择广告链接类型'}" -->
  101. <option value="">--请选择 --</option>
  102. <!-- <option value="keyword">关键字搜索</option>
  103. <option value="goods">商品</option> -->
  104. <option value="link">链接</option>
  105. <option value="">无链接</option>
  106. </select>
  107. </div>
  108. </div>
  109. <div class="form-group" id="divAdvSrc">
  110. <label class="col-sm-3 control-label">链接地址:</label>
  111. <div class="col-sm-6">
  112. <input id="advSrc" name="advSrc" class="form-control">
  113. <!-- validate="{required:true}" validateMessage="{required:'请输入链接地址,不能重复'}" -->
  114. </div>
  115. </div>
  116. <!-- <div class="form-group" id="divGoods">
  117. <label class="col-sm-3 control-label">商品:</label>
  118. <div class="col-sm-6">
  119. <div class="input-group">
  120. <input type="hidden" class="form-control" value="" id="goodsId"
  121. placeholder="" name="goodsId"> <input type="text"
  122. class="form-control" value="" id="goodsName" placeholder=""
  123. readonly name="goodsName"> <span
  124. class="input-group-btn">
  125. <button onclick="selectGooods_radio()" type="button"
  126. class="btn btn-primary">选择商品</button>
  127. </span>
  128. </div>
  129. </div>
  130. </div> -->
  131. <!-- <div class="form-group">
  132. <label class="col-sm-3 control-label">排序:</label>
  133. <div class="col-sm-6">
  134. <input id="slideSort" name="slideSort" class="form-control">
  135. </div>
  136. </div> -->
  137. <div class="form-group">
  138. <div class="col-sm-4 col-sm-offset-3 pull-left">
  139. <button class="btn btn-default btn-dlg-close">取消</button>
  140. <button class="btn btn-primary" id="buttonSubmit" type="button">提交</button>
  141. </div>
  142. </div>
  143. </form>
  144. </div>
  145. </div>
  146. </div>
  147. </body>
  148. </html>