edit.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('编辑座驾')" />
  5. </head>
  6. <body class="white-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  8. <form class="form-horizontal m" id="form-dict-edit" th:object="${car}">
  9. <input name="carId" type="hidden" th:field="*{carId}" />
  10. <div class="form-group">
  11. <label class="col-sm-2 control-label">座驾类型:</label>
  12. <div class="col-sm-10">
  13. <select name="allowPurse" id="allowPurse" class="form-control m-b" th:with="type=${@dict.getType('car_type')}">
  14. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{allowPurse}"></option>
  15. </select>
  16. </div>
  17. </div>
  18. <div class="form-group">
  19. <label class="col-sm-2 control-label">购买类型:</label>
  20. <div class="col-sm-10">
  21. <select name="buyType" id="buyType" class="form-control m-b" th:with="type=${@dict.getType('buy_type')}">
  22. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{buyType}"></option>
  23. </select>
  24. </div>
  25. </div>
  26. <div class="form-group" id="chargeErBanNo">
  27. <label class="col-sm-2 control-label">座驾名称:</label>
  28. <div class="col-sm-10">
  29. <input name="carName" id="carName" th:field="*{carName}" class="form-control" type="text" placeholder="请输入座驾名称" required/>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="col-sm-2 control-label">等级要求:</label>
  34. <div class="col-sm-10">
  35. <input id="leftLevel" name="leftLevel" min="0" th:field="*{leftLevel}" class="form-control" type="number" placeholder="请输入等级要求" required/>
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="col-sm-2 control-label">座驾金币:</label>
  40. <div class="col-sm-10">
  41. <input readonly="readonly" min="0" th:field="*{goldPrice}" class="form-control" type="number" placeholder="请输入礼物金币" required/>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-sm-2 control-label">座驾状态:</label>
  46. <div class="col-sm-3">
  47. <div class="radio-box">
  48. <input type="radio" id="carStatus" th:field="*{carStatus}" name="carStatus" value="1">
  49. <label for="carStatus">有效</label>
  50. </div>
  51. <div class="radio-box">
  52. <input type="radio" id="carStatus2" th:field="*{carStatus}" name="carStatus" value="2">
  53. <label for="carStatus">无效</label>
  54. </div>
  55. </div>
  56. <label class="col-sm-2 control-label">vgg特效:</label>
  57. <div class="col-sm-3">
  58. <div class="radio-box">
  59. <input type="radio" id="hasVggPic" th:field="*{hasVggPic}" name="hasVggPic" value="0">
  60. <label for="hasVggPic">否</label>
  61. </div>
  62. <div class="radio-box">
  63. <input type="radio" id="hasVggPic2" th:field="*{hasVggPic}" name="hasVggPic" value="1">
  64. <label for="hasVggPic2">是</label>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="form-group">
  69. <label class="col-sm-2 control-label">座驾图片:</label>
  70. <div class="col-sm-10">
  71. <img src="" id="picImage" style="width:250px;height:90px;" alt="" th:src="*{picUrl}">
  72. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  73. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  74. <input type="hidden" id="picUrl" name="picUrl" th:field="*{picUrl}" class="form-control validate[required]"/>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="col-sm-2 control-label">vgg图片:</label>
  79. <div class="col-sm-10">
  80. <img src="" id="imgUrl" style="width:250px;height:90px;" alt="" th:src="*{vggUrl}">
  81. <input type="file" id="uploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  82. <button class="btn btn-success" type="button" id="uploadBtn">上传</button>
  83. <input type="hidden" id="vggUrl" name="vggUrl" th:field="*{vggUrl}" class="form-control validate[required]"/>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label class="col-sm-2 control-label">角标图片:</label>
  88. <div class="col-sm-10">
  89. <img src="" id="markImage" style="width:250px;height:90px;" alt="" th:src="*{markPic}">
  90. <input type="file" id="markPicFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  91. <button class="btn btn-success" type="button" id="markPicBtn">上传</button>
  92. <input type="hidden" id="markPic" name="markPic" th:field="*{markPic}" class="form-control validate[required]"/>
  93. </div>
  94. </div>
  95. <div class="form-group" >
  96. <label class="col-sm-2 control-label">排序:</label>
  97. <div class="col-sm-10">
  98. <input id="seqNo" name="seqNo" min="1" class="form-control" th:field="*{seqNo}" type="number" placeholder="请输入排序" required/>
  99. </div>
  100. </div>
  101. <div class="form-group" >
  102. <label class="col-sm-2 control-label">有效期(天):</label>
  103. <div class="col-sm-10">
  104. <input id="effectiveTime" name="effectiveTime" min="1" class="form-control" type="number" th:field="*{effectiveTime}" placeholder="请输入有效期(天)" required/>
  105. </div>
  106. </div>
  107. </form>
  108. </div>
  109. <th:block th:include="include :: footer" />
  110. <th:block th:include="include :: summernote-js" />
  111. <script type="text/javascript">
  112. var prefix = ctx + "mall/car";
  113. $("#form-dict-edit").validate({
  114. onkeyup: false,
  115. rules:{
  116. carName:{
  117. minlength: 1,
  118. remote: {
  119. url: prefix + "/checkCarName",
  120. type: "post",
  121. dataType: "json",
  122. data: {
  123. carName : function() {
  124. return $.common.trim($("#carName").val());
  125. }
  126. },
  127. dataFilter: function(data, type) {
  128. return $.validate.unique(data);
  129. }
  130. }
  131. }
  132. },
  133. messages: {
  134. "carName": {
  135. remote: "该座驾名称已经存在!"
  136. }
  137. },
  138. focusCleanup: true
  139. });
  140. /**
  141. * 礼物上传
  142. */
  143. $('#picUploadBtn').on('click',function () {
  144. if($('#picUploadFile').get(0).files[0]==undefined){
  145. $.modal.alertError("请选择要上传的文件!");
  146. return;
  147. }
  148. var formData = new FormData();
  149. formData.append("file", $('#picUploadFile').get(0).files[0]);
  150. $.ajax({
  151. url: ctx + "file/upload",
  152. data: formData,
  153. type: "post",
  154. processData: false,
  155. contentType: false,
  156. success: function(result) {
  157. $('#picImage').attr('src',result.data);
  158. $("input[name='picUrl']").val(result.data);
  159. }
  160. })
  161. });
  162. /**
  163. * vgg图片上传
  164. */
  165. $('#uploadBtn').on('click',function () {
  166. if($('#uploadFile').get(0).files[0]==undefined){
  167. $.modal.alertError("请选择要上传的文件!");
  168. return;
  169. }
  170. var formData = new FormData();
  171. formData.append("file", $('#uploadFile').get(0).files[0]);
  172. $.ajax({
  173. url: ctx + "file/upload",
  174. data: formData,
  175. type: "post",
  176. processData: false,
  177. contentType: false,
  178. success: function(result) {
  179. $('#imgUrl').attr('src',result.data);
  180. $("input[name='vggUrl']").val(result.data);
  181. }
  182. })
  183. });
  184. /**
  185. * 角标图片上传
  186. */
  187. $('#markPicBtn').on('click',function () {
  188. if($('#markPicFile').get(0).files[0]==undefined){
  189. $.modal.alertError("请选择要上传的文件!");
  190. return;
  191. }
  192. var formData = new FormData();
  193. formData.append("file", $('#markPicFile').get(0).files[0]);
  194. $.ajax({
  195. url: ctx + "file/upload",
  196. data: formData,
  197. type: "post",
  198. processData: false,
  199. contentType: false,
  200. success: function(result) {
  201. $('#markImage').attr('src',result.data);
  202. $("input[name='markPic']").val(result.data);
  203. }
  204. })
  205. });
  206. function submitHandler() {
  207. if ($.validate.form()) {
  208. $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
  209. }
  210. }
  211. </script>
  212. </body>
  213. </html>