add.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 id="erbanNo" name="erbanNo" class="form-control" type="text" placeholder="请输入封禁卿卿号"/>
  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. <input id="blockDesc" name="blockDesc" class="form-control" type="text" placeholder="请输入封禁原因" required/>
  19. </div>
  20. </div>
  21. <div class="form-group" id="chargeBlockIp">
  22. <label class="col-sm-2 control-label">封禁IP:</label>
  23. <div class="col-sm-10">
  24. <input id="blockIp" name="blockIp" class="form-control" type="text" placeholder="请输入封禁IP"/>
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label class="col-sm-2 control-label">封禁类型:</label>
  29. <div class="col-sm-10">
  30. <select name="blockType" id="blockType" class="form-control m-b" th:with="type=${@dict.getType('block_type')}">
  31. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  32. </select>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label class="col-sm-2 control-label">封禁时间:</label>
  37. <div class="col-sm-10">
  38. <select name="blockTime" id="blockTime" class="form-control m-b" th:with="type=${@dict.getType('banned_time')}">
  39. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  40. </select>
  41. </div>
  42. </div>
  43. </form>
  44. </div>
  45. <th:block th:include="include :: footer" />
  46. <th:block th:include="include :: summernote-js" />
  47. <script type="text/javascript">
  48. var prefix = ctx + "users/block";
  49. $("#form-notice-add").validate({
  50. focusCleanup: true
  51. });
  52. $(function(){
  53. $("#chargeBlockIp").hide();
  54. $("#chargeErBanNo").show();
  55. $('input[name="erbanNo"]').attr("required", "true");
  56. $('input[name="blockIp"]').attr("required", "false");
  57. });
  58. $("#blockType").on("change", function (){
  59. var val = $(this).val();
  60. if(val == 3){
  61. $("#chargeBlockIp").show();
  62. $("#chargeErBanNo").hide();
  63. $('input[name="erbanNo"]').attr("required", "false");
  64. $('input[name="blockIp"]').attr("required", "true");
  65. }else{
  66. $("#chargeBlockIp").hide();
  67. $("#chargeErBanNo").show();
  68. $('input[name="erbanNo"]').attr("required", "true");
  69. $('input[name="blockIp"]').attr("required", "false");
  70. }
  71. });
  72. function submitHandler() {
  73. if ($.validate.form()) {
  74. $.operate.save(prefix + "/add", $('#form-notice-add').serialize());
  75. }
  76. }
  77. </script>
  78. </body>
  79. </html>