add.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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-notice-add">
  9. <div class="form-group" id="chargeErBanNo">
  10. <label class="col-sm-2 control-label">活动名称:</label>
  11. <div class="col-sm-10">
  12. <input name="actName" id="actName" class="form-control" type="text" placeholder="请输入活动名称" required/>
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label">状态:</label>
  17. <div class="col-sm-3">
  18. <div class="radio-box">
  19. <input type="radio" id="actStatus" name="actStatus" value="1" checked>
  20. <label for="actStatus">有效</label>
  21. </div>
  22. <div class="radio-box">
  23. <input type="radio" id="actStatus2" name="actStatus" value="2">
  24. <label for="actStatus2">无效</label>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label class="col-sm-2 control-label">是否弹窗:</label>
  30. <div class="col-sm-10">
  31. <select name="alertWin" id="alertWin" class="form-control m-b" th:with="type=${@dict.getType('alert_win')}">
  32. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  33. </select>
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-2 control-label">图片:</label>
  38. <div class="col-sm-10">
  39. <img src="" id="picImage" style="width:250px;height:90px;" alt="">
  40. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  41. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  42. <input type="hidden" id="alertWinPic" name="alertWinPic" class="form-control validate[required]"/>
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label class="col-sm-2 control-label">弹窗位置:</label>
  47. <div class="col-sm-10">
  48. <select name="alertWinLoc" id="alertWinLoc" class="form-control m-b" th:with="type=${@dict.getType('alert_win_loc')}">
  49. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  50. </select>
  51. </div>
  52. </div>
  53. <div class="form-group" id="chargeSkipType">
  54. <label class="col-sm-2 control-label">跳转类型:</label>
  55. <div class="col-sm-10">
  56. <select name="skipType" id="skipType" class="form-control m-b" th:with="type=${@dict.getType('skip_type')}">
  57. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  58. </select>
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="col-sm-2 control-label">跳转地址:</label>
  63. <div class="col-sm-10">
  64. <input id="skipUrl" name="skipUrl" class="form-control" type="text" placeholder="请输入跳转地址" required/>
  65. </div>
  66. </div>
  67. <div class="form-group">
  68. <label class="col-sm-2 control-label">版本号:</label>
  69. <div class="col-sm-10">
  70. <input id="actAlertVersion" name="actAlertVersion" class="form-control" type="text" placeholder="请输入版本号" required/>
  71. </div>
  72. </div>
  73. </form>
  74. </div>
  75. <th:block th:include="include :: footer" />
  76. <th:block th:include="include :: summernote-js" />
  77. <script type="text/javascript">
  78. var prefix = ctx + "operation/activity";
  79. $("#form-notice-add").validate({
  80. onkeyup: false,
  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 + "/add", $('#form-notice-add').serialize());
  108. }
  109. }
  110. </script>
  111. </body>
  112. </html>