edit.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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-dict-edit" th:object="${banner}">
  9. <input name="bannerId" type="hidden" th:field="*{bannerId}" />
  10. <div class="form-group">
  11. <label class="col-sm-2 control-label">banner名称:</label>
  12. <div class="col-sm-10">
  13. <input name="bannerName" id="bannerName" class="form-control" type="text" placeholder="请输入banner名称" th:field="*{bannerName}" 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="picImage" style="width:250px;height:90px;" alt="" th:src="*{bannerPic}">
  20. <input type="file" id="picUploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
  21. <button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
  22. <input type="hidden" id="bannerPic" name="bannerPic" th:field="*{bannerPic}" class="form-control validate[required]"/>
  23. </div>
  24. </div>
  25. <div class="form-group" id="chargeSkipType">
  26. <label class="col-sm-2 control-label">跳转类型:</label>
  27. <div class="col-sm-10">
  28. <select name="skipType" id="skipType" class="form-control m-b" th:with="type=${@dict.getType('skip_type')}">
  29. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{skipType}"></option>
  30. </select>
  31. <input id="skipUri" name="skipUri" class="form-control" type="text" th:field="*{skipUri}"/>
  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 id="seqNo" min="1" name="seqNo" class="form-control" type="number" th:field="*{seqNo}" placeholder="请输入排序" 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. <select name="bannerStatus" id="bannerStatus" class="form-control m-b" th:with="type=${@dict.getType('activation_type')}">
  44. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{bannerStatus}"></option>
  45. </select>
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <label class="col-sm-2 control-label">平台:</label>
  50. <div class="col-sm-10">
  51. <select name="osType" id="osType" class="form-control m-b" th:with="type=${@dict.getType('system_type')}">
  52. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{osType}"></option>
  53. </select>
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <label class="col-sm-2 control-label">用户:</label>
  58. <div class="col-sm-10">
  59. <select name="isNewUser" id="isNewUser" class="form-control m-b" th:with="type=${@dict.getType('is_news_type')}">
  60. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isNewUser}"></option>
  61. </select>
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-sm-2 control-label">显示位置:</label>
  66. <div class="col-sm-10">
  67. <select name="viewType" id="viewType" class="form-control m-b" th:with="type=${@dict.getType('banner_view_position')}">
  68. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{viewType}"></option>
  69. </select>
  70. </div>
  71. </div>
  72. <div class="form-group select-time" >
  73. <label class="col-sm-2 control-label">开始时间:</label>
  74. <div class="col-sm-10">
  75. <input id="startDate" name="startTime" class="form-control time-input" type="text" th:field="*{startTime}" placeholder="请输入开始时间"/>
  76. </div>
  77. </div>
  78. <div class="form-group select-time" >
  79. <label class="col-sm-2 control-label">结束时间:</label>
  80. <div class="col-sm-10">
  81. <input id="endDate" name="endTime" class="form-control time-input" type="text" th:field="*{endTime}" placeholder="请输入结束时间"/>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. <th:block th:include="include :: footer" />
  87. <th:block th:include="include :: summernote-js" />
  88. <script type="text/javascript">
  89. var prefix = ctx + "operation/banner";
  90. $("#form-dict-edit").validate({
  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 + "/edit", $('#form-dict-edit').serialize());
  118. }
  119. }
  120. </script>
  121. </body>
  122. </html>