add.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('新增banner')" />
  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">banner名称:</label>
  11. <div class="col-sm-10">
  12. <input name="bannerName" id="bannerName" class="form-control" type="text" placeholder="请输入banner名称" required/>
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label">图片:</label>
  17. <div class="col-sm-10">
  18. <img src="" id="picImage" style="width:250px;height:90px;" alt="">
  19. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  20. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  21. <input type="hidden" id="bannerPic" name="bannerPic" class="form-control validate[required]"/>
  22. </div>
  23. </div>
  24. <div class="form-group" id="chargeSkipType">
  25. <label class="col-sm-2 control-label">跳转类型:</label>
  26. <div class="col-sm-10">
  27. <select name="skipType" id="skipType" class="form-control m-b" th:with="type=${@dict.getType('skip_type')}">
  28. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  29. </select>
  30. <input id="skipUri" name="skipUri" class="form-control" type="text"/>
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="col-sm-2 control-label">排序:</label>
  35. <div class="col-sm-10">
  36. <input id="seqNo" min="1" name="seqNo" class="form-control" type="number" placeholder="请输入排序" required/>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="col-sm-2 control-label">激活设置:</label>
  41. <div class="col-sm-10">
  42. <select name="bannerStatus" id="bannerStatus" class="form-control m-b" th:with="type=${@dict.getType('activation_type')}">
  43. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  44. </select>
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <label class="col-sm-2 control-label">平台:</label>
  49. <div class="col-sm-10">
  50. <select name="osType" id="osType" class="form-control m-b" th:with="type=${@dict.getType('system_type')}">
  51. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  52. </select>
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="col-sm-2 control-label">用户:</label>
  57. <div class="col-sm-10">
  58. <select name="isNewUser" id="isNewUser" class="form-control m-b" th:with="type=${@dict.getType('is_news_type')}">
  59. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  60. </select>
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. <label class="col-sm-2 control-label">显示位置:</label>
  65. <div class="col-sm-10">
  66. <select name="viewType" id="viewType" class="form-control m-b" th:with="type=${@dict.getType('banner_view_position')}">
  67. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  68. </select>
  69. </div>
  70. </div>
  71. <div class="form-group select-time" >
  72. <label class="col-sm-2 control-label">开始时间:</label>
  73. <div class="col-sm-10">
  74. <input id="startDate" name="startTime" class="form-control time-input" type="text" placeholder="请输入开始时间"/>
  75. </div>
  76. </div>
  77. <div class="form-group select-time" >
  78. <label class="col-sm-2 control-label">结束时间:</label>
  79. <div class="col-sm-10">
  80. <input id="endDate" name="endTime" class="form-control time-input" type="text" placeholder="请输入结束时间"/>
  81. </div>
  82. </div>
  83. </form>
  84. </div>
  85. <th:block th:include="include :: footer" />
  86. <th:block th:include="include :: summernote-js" />
  87. <script type="text/javascript">
  88. var prefix = ctx + "operation/banner";
  89. $("#form-notice-add").validate({
  90. onkeyup: false,
  91. focusCleanup: true
  92. });
  93. /**
  94. * 图片上传
  95. */
  96. $('#picUploadBtn').on('click',function () {
  97. if($('#picUploadFile').get(0).files[0]==undefined){
  98. $.modal.alertError("请选择要上传的文件!");
  99. return;
  100. }
  101. var formData = new FormData();
  102. formData.append("file", $('#picUploadFile').get(0).files[0]);
  103. $.ajax({
  104. url: ctx + "file/upload",
  105. data: formData,
  106. type: "post",
  107. processData: false,
  108. contentType: false,
  109. success: function(result) {
  110. $('#picImage').attr('src',result.data);
  111. $("input[name='bannerPic']").val(result.data);
  112. }
  113. })
  114. });
  115. function submitHandler() {
  116. if ($.validate.form()) {
  117. $.operate.save(prefix + "/add", $('#form-notice-add').serialize());
  118. }
  119. }
  120. </script>
  121. </body>
  122. </html>