edit.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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="${gift}">
  9. <input name="giftId" type="hidden" th:field="*{giftId}" />
  10. <div class="form-group" id="chargeErBanNo">
  11. <label class="col-sm-2 control-label">礼物名称:</label>
  12. <div class="col-sm-10">
  13. <input id="giftName" th:field="*{giftName}" readonly="readonly" class="form-control" type="text"/>
  14. </div>
  15. </div>
  16. <div class="form-group">
  17. <label class="col-sm-2 control-label">礼物金币:</label>
  18. <div class="col-sm-10">
  19. <input id="goldPrice" min="0" th:field="*{goldPrice}" readonly="readonly" class="form-control" type="text"/>
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="col-sm-2 control-label">礼物类型:</label>
  24. <div class="col-sm-10">
  25. <select name="giftType" id="giftType" class="form-control m-b" th:with="type=${@dict.getType('gift_type')}">
  26. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{giftType}"></option>
  27. </select>
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <label class="col-sm-2 control-label">礼物状态:</label>
  32. <div class="col-sm-3">
  33. <div class="radio-box">
  34. <input type="radio" id="giftStatus1" name="giftStatus" value="1" th:field="*{giftStatus}" checked>
  35. <label for="giftStatus1">有效</label>
  36. </div>
  37. <div class="radio-box">
  38. <input type="radio" id="giftStatus2" name="giftStatus" th:field="*{giftStatus}" value="2">
  39. <label for="giftStatus2">无效</label>
  40. </div>
  41. </div>
  42. <label class="col-sm-2 control-label">礼物特效:</label>
  43. <div class="col-sm-3">
  44. <div class="radio-box">
  45. <input type="radio" id="hasEffect" name="hasEffect" th:field="*{hasEffect}" value="0" checked>
  46. <label for="hasEffect">否</label>
  47. </div>
  48. <div class="radio-box">
  49. <input type="radio" id="hasEffect2" name="hasEffect" th:field="*{hasEffect}" value="1">
  50. <label for="hasEffect2">是</label>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="form-group">
  55. <label class="col-sm-2 control-label">vgg特效:</label>
  56. <div class="col-sm-3">
  57. <div class="radio-box">
  58. <input type="radio" id="hasVggPic" name="hasVggPic" th:field="*{hasVggPic}" value="0" checked>
  59. <label for="hasVggPic">否</label>
  60. </div>
  61. <div class="radio-box">
  62. <input type="radio" id="hasVggPic2" name="hasVggPic" th:field="*{hasVggPic}" value="1">
  63. <label for="hasVggPic2">是</label>
  64. </div>
  65. </div>
  66. <label class="col-sm-2 control-label">最新礼物:</label>
  67. <div class="col-sm-3">
  68. <div class="radio-box">
  69. <input type="radio" id="isLatest" name="isLatest" th:field="*{isLatest}" value="0" checked>
  70. <label for="isLatest">否</label>
  71. </div>
  72. <div class="radio-box">
  73. <input type="radio" id="isLatest2" name="isLatest" th:field="*{isLatest}" value="1">
  74. <label for="isLatest2">是</label>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <label class="col-sm-2 control-label">贵族礼物:</label>
  80. <div class="col-sm-3">
  81. <div class="radio-box">
  82. <input type="radio" id="isNobleGift" name="isNobleGift" th:field="*{isNobleGift}" value="0" checked>
  83. <label for="isNobleGift">否</label>
  84. </div>
  85. <div class="radio-box">
  86. <input type="radio" id="isNobleGift2" name="isNobleGift" th:field="*{isNobleGift}" value="1">
  87. <label for="isNobleGift2">是</label>
  88. </div>
  89. </div>
  90. <label class="col-sm-2 control-label">限时礼物:</label>
  91. <div class="col-sm-3">
  92. <div class="radio-box">
  93. <input type="radio" id="isTimeLimit" name="isTimeLimit" th:field="*{isTimeLimit}" value="0" checked>
  94. <label for="isTimeLimit">否</label>
  95. </div>
  96. <div class="radio-box">
  97. <input type="radio" id="isTimeLimit2" name="isTimeLimit" th:field="*{isTimeLimit}" value="1">
  98. <label for="isTimeLimit2">是</label>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="col-sm-2 control-label">是否允许赠送:</label>
  104. <div class="col-sm-3">
  105. <div class="radio-box">
  106. <input type="radio" id="isCanGive" name="isCanGive" th:field="*{isCanGive}" value="0" checked>
  107. <label for="isCanGive">否</label>
  108. </div>
  109. <div class="radio-box">
  110. <input type="radio" id="isCanGive2" name="isCanGive" th:field="*{isCanGive}" value="1">
  111. <label for="isCanGive2">是</label>
  112. </div>
  113. </div>
  114. <label class="col-sm-2 control-label">表白礼物:</label>
  115. <div class="col-sm-3">
  116. <div class="radio-box">
  117. <input type="radio" id="isExpressGift" name="isExpressGift" th:field="*{isExpressGift}" value="0" checked>
  118. <label for="isExpressGift">否</label>
  119. </div>
  120. <div class="radio-box">
  121. <input type="radio" id="isExpressGift2" name="isExpressGift" th:field="*{isExpressGift}" value="1">
  122. <label for="isExpressGift2">是</label>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="form-group">
  127. <label class="col-sm-2 control-label">礼物图片:</label>
  128. <div class="col-sm-10">
  129. <img src="" id="picImage" style="width:250px;height:90px;" alt="" th:src="*{picUrl}">
  130. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  131. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  132. <input type="hidden" id="picUrl" name="picUrl" th:field="*{picUrl}" class="form-control validate[required]"/>
  133. </div>
  134. </div>
  135. <div class="form-group">
  136. <label class="col-sm-2 control-label">vgg图片:</label>
  137. <div class="col-sm-10">
  138. <img src="" id="imgUrl" style="width:250px;height:90px;" alt="" th:src="*{vggUrl}">
  139. <input type="file" id="uploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  140. <button class="btn btn-success" type="button" id="uploadBtn">上传</button>
  141. <input type="hidden" id="vggUrl" name="vggUrl" th:field="*{vggUrl}" class="form-control validate[required]"/>
  142. </div>
  143. </div>
  144. <div class="form-group" >
  145. <label class="col-sm-2 control-label">排序:</label>
  146. <div class="col-sm-10">
  147. <input id="seqNo" name="seqNo" min="1" class="form-control" th:field="*{seqNo}" type="number" placeholder="请输入排序" required/>
  148. </div>
  149. </div>
  150. <div class="form-group select-time" >
  151. <label class="col-sm-2 control-label">开始时间:</label>
  152. <div class="col-sm-10">
  153. <input id="startTime" name="startTime" class="form-control time-input" th:field="*{startTime}" type="text" placeholder="请输入开始时间"/>
  154. </div>
  155. </div>
  156. <div class="form-group select-time" >
  157. <label class="col-sm-2 control-label">结束时间:</label>
  158. <div class="col-sm-10">
  159. <input id="endTime" name="endTime" class="form-control time-input" th:field="*{endTime}" type="text" placeholder="请输入结束时间"/>
  160. </div>
  161. </div>
  162. </form>
  163. </div>
  164. <th:block th:include="include :: footer" />
  165. <script type="text/javascript">
  166. var prefix = ctx + "mall/gift";
  167. $("#form-dict-edit").validate({
  168. focusCleanup: true
  169. });
  170. /**
  171. * 礼物图片上传
  172. */
  173. $('#picUploadBtn').on('click',function () {
  174. if($('#picUploadFile').get(0).files[0]==undefined){
  175. $.modal.alertError("请选择要上传的文件!");
  176. return;
  177. }
  178. var formData = new FormData();
  179. formData.append("file", $('#picUploadFile').get(0).files[0]);
  180. $.ajax({
  181. url: ctx + "file/upload",
  182. data: formData,
  183. type: "post",
  184. processData: false,
  185. contentType: false,
  186. success: function(result) {
  187. $('#picImage').attr('src',result.data);
  188. $("input[name='picUrl']").val(result.data);
  189. }
  190. })
  191. });
  192. /**
  193. * vgg图片上传
  194. */
  195. $('#uploadBtn').on('click',function () {
  196. if($('#uploadFile').get(0).files[0]==undefined){
  197. $.modal.alertError("请选择要上传的文件!");
  198. return;
  199. }
  200. var formData = new FormData();
  201. formData.append("file", $('#uploadFile').get(0).files[0]);
  202. $.ajax({
  203. url: ctx + "file/upload",
  204. data: formData,
  205. type: "post",
  206. processData: false,
  207. contentType: false,
  208. success: function(result) {
  209. $('#imgUrl').attr('src',result.data);
  210. $("input[name='vggUrl']").val(result.data);
  211. }
  212. })
  213. });
  214. function submitHandler() {
  215. if ($.validate.form()) {
  216. $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
  217. }
  218. }
  219. </script>
  220. </body>
  221. </html>