edit.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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="${appActivity}">
  9. <input name="actId" type="hidden" th:field="*{actId}" />
  10. <div class="form-group" id="chargeErBanNo">
  11. <label class="col-sm-2 control-label">活动名称:</label>
  12. <div class="col-sm-10">
  13. <input name="actName" id="actName" class="form-control" type="text" th:field="*{actName}" placeholder="请输入活动名称" required/>
  14. </div>
  15. </div>
  16. <div class="form-group">
  17. <label class="col-sm-2 control-label">状态:</label>
  18. <div class="col-sm-3">
  19. <div class="radio-box">
  20. <input type="radio" id="actStatus" name="actStatus" value="1" th:field="*{actStatus}">
  21. <label for="actStatus">有效</label>
  22. </div>
  23. <div class="radio-box">
  24. <input type="radio" id="actStatus2" name="actStatus" value="2" th:field="*{actStatus}">
  25. <label for="actStatus2">无效</label>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label">是否弹窗:</label>
  31. <div class="col-sm-10">
  32. <select name="alertWin" id="alertWin" class="form-control m-b" th:with="type=${@dict.getType('alert_win')}">
  33. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{alertWin}"></option>
  34. </select>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="col-sm-2 control-label">图片:</label>
  39. <div class="col-sm-10">
  40. <img src="" id="picImage" style="width:250px;height:90px;" alt="" th:src="*{alertWinPic}">
  41. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  42. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  43. <input type="hidden" id="alertWinPic" th:field="*{alertWinPic}" name="alertWinPic" class="form-control validate[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="alertWinLoc" id="alertWinLoc" class="form-control m-b" th:with="type=${@dict.getType('alert_win_loc')}">
  50. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{alertWinLoc}"></option>
  51. </select>
  52. </div>
  53. </div>
  54. <div class="form-group" id="chargeSkipType">
  55. <label class="col-sm-2 control-label">跳转类型:</label>
  56. <div class="col-sm-10">
  57. <select name="skipType" id="skipType" class="form-control m-b" th:with="type=${@dict.getType('skip_type')}">
  58. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{skipType}"></option>
  59. </select>
  60. </div>
  61. </div>
  62. <div class="form-group">
  63. <label class="col-sm-2 control-label">跳转地址:</label>
  64. <div class="col-sm-10">
  65. <input id="skipUrl" name="skipUrl" class="form-control" type="text" placeholder="请输入跳转地址" th:field="*{skipUrl}" required/>
  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. <input id="actAlertVersion" name="actAlertVersion" class="form-control" type="text" th:field="*{actAlertVersion}" placeholder="请输入版本号" required/>
  72. </div>
  73. </div>
  74. </form>
  75. </div>
  76. <th:block th:include="include :: footer" />
  77. <th:block th:include="include :: summernote-js" />
  78. <script type="text/javascript">
  79. var prefix = ctx + "operation/activity";
  80. $("#form-dict-edit").validate({
  81. focusCleanup: true
  82. });
  83. /**
  84. * 图片上传
  85. */
  86. $('#picUploadBtn').on('click',function () {
  87. if($('#picUploadFile').get(0).files[0]==undefined){
  88. $.modal.alertError("请选择要上传的文件!");
  89. return;
  90. }
  91. var formData = new FormData();
  92. formData.append("file", $('#picUploadFile').get(0).files[0]);
  93. $.ajax({
  94. url: ctx + "file/upload",
  95. data: formData,
  96. type: "post",
  97. processData: false,
  98. contentType: false,
  99. success: function(result) {
  100. $('#picImage').attr('src',result.data);
  101. $("input[name='alertWinPic']").val(result.data);
  102. }
  103. })
  104. });
  105. function submitHandler() {
  106. if ($.validate.form()) {
  107. $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
  108. }
  109. }
  110. </script>
  111. </body>
  112. </html>