edit.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('编辑点点币pk')" />
  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="${pointPk}">
  9. <input name="carId" type="hidden" th:field="*{id}" />
  10. <div class="form-group" >
  11. <label class="col-sm-2 control-label">题目:</label>
  12. <div class="col-sm-10">
  13. <input id="title" name="title" class="form-control" type="text" th:field="*{title}" required/>
  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. <img src="" id="addRedPic" style="width:250px;height:90px;" alt="" th:src="*{redPic}">
  20. <input type="file" id="addUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  21. <button class="btn btn-success" type="button" id="addUploadBtn">上传</button>
  22. <input type="hidden" id="addRedPicUrl" name="redPic" class="form-control validate[required]" th:field="*{redPic}" required/>
  23. </div>
  24. </div>
  25. <div class="form-group" >
  26. <label class="col-sm-2 control-label">蓝方图片:</label>
  27. <div class="col-sm-10">
  28. <img src="" id="addBluePic" style="width:250px;height:90px;" alt="" th:src="*{bluePic}">
  29. <input type="file" id="addUploadFile2" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  30. <button class="btn btn-success" type="button" id="addUploadBtn2">上传</button>
  31. <input type="hidden" id="addBluePicUrl" name="bluePic" class="form-control validate[required]" th:field="*{bluePic}" required/>
  32. </div>
  33. </div>
  34. <div class="form-group" >
  35. <label class="col-sm-2 control-label">红方选项:</label>
  36. <div class="col-sm-10">
  37. <input type="text" id="addRedAnswer" name="redAnswer" class="form-control validate[required]" th:field="*{redAnswer}" required>
  38. </div>
  39. </div>
  40. <div class="form-group" >
  41. <label class="col-sm-2 control-label">蓝方选项:</label>
  42. <div class="col-sm-10">
  43. <input type="text" id="addBlueAnswer" name="blueAnswer" class="form-control validate[required]" th:field="*{blueAnswer}" required>
  44. </div>
  45. </div>
  46. <div class="form-group" >
  47. <label class="col-sm-2 control-label">活动状态:</label>
  48. <div class="col-sm-10">
  49. <select name="pkStatus1" id="pkStatus" class="form-control m-b" th:with="type=${@dict.getType('point_pk_activity_status')}" disabled >
  50. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{pkStatus}" ></option>
  51. </select>
  52. <input name="carId" type="hidden" th:field="*{pkStatus}" />
  53. </div>
  54. </div>
  55. <div class="form-group select-time" >
  56. <label class="col-sm-2 control-label">开奖时间:</label>
  57. <div class="col-sm-10">
  58. <input id="time" name="lotteryTime" class="form-control time-input" type="text" th:field="*{lotteryTime}" required/>
  59. </div>
  60. </div>
  61. </form>
  62. </div>
  63. <th:block th:include="include :: footer" />
  64. <th:block th:include="include :: summernote-js" />
  65. <script type="text/javascript">
  66. var prefix = ctx + "activity/point/pk";
  67. $("#form-dict-edit").validate({
  68. focusCleanup: true
  69. });
  70. /**
  71. * 红方图片上传
  72. */
  73. $('#addUploadBtn').on('click',function () {
  74. if($('#addUploadFile').get(0).files[0]==undefined){
  75. $.modal.alertError("请选择要上传的文件!");
  76. return;
  77. }
  78. var formData = new FormData();
  79. formData.append("file", $('#addUploadFile').get(0).files[0]);
  80. $.ajax({
  81. url: ctx + "file/upload",
  82. data: formData,
  83. type: "post",
  84. processData: false,
  85. contentType: false,
  86. success: function(result) {
  87. $('#addRedPic').attr('src',result.data);
  88. $("input[name='redPic']").val(result.data);
  89. }
  90. })
  91. });
  92. /**
  93. * 蓝方图片上传
  94. */
  95. $('#addUploadBtn2').on('click',function () {
  96. if($('#addUploadFile2').get(0).files[0]==undefined){
  97. $.modal.alertError("请选择要上传的文件!");
  98. return;
  99. }
  100. var formData = new FormData();
  101. formData.append("file", $('#addUploadFile2').get(0).files[0]);
  102. $.ajax({
  103. url: ctx + "file/upload",
  104. data: formData,
  105. type: "post",
  106. processData: false,
  107. contentType: false,
  108. success: function(result) {
  109. $('#addBluePic').attr('src',result.data);
  110. $("input[name='bluePic']").val(result.data);
  111. }
  112. })
  113. });
  114. function submitHandler() {
  115. if ($.validate.form()) {
  116. $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
  117. }
  118. }
  119. </script>
  120. </body>
  121. </html>