add.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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">
  10. <label class="col-sm-2 control-label">周星类型:</label>
  11. <div class="col-sm-10">
  12. <select name="weekType" id="weekType" class="form-control m-b" th:with="type=${@dict.getType('week_star_gift_type')}">
  13. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  14. </select>
  15. </div>
  16. </div>
  17. <div class="form-group">
  18. <label for="giftId" class="col-sm-2 control-label">周星礼物:</label>
  19. <div class="col-sm-10" style="margin-bottom: 20px;">
  20. <select name="giftId" id="giftId">
  21. </select>
  22. </div>
  23. </div>
  24. <div class="form-group">
  25. <label class="col-sm-2 control-label">奖项类型:</label>
  26. <div class="col-sm-10">
  27. <select name="type" id="type" class="form-control m-b" th:with="type=${@dict.getType('zxb_item_type')}">
  28. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  29. </select>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label for="giftId" class="col-sm-2 control-label">奖项:</label>
  34. <div class="col-sm-10" style="margin-bottom: 20px;">
  35. <select name="itemId" id="itemId">
  36. </select>
  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. <input id="days" name="days" class="form-control" type="number" min="1" placeholder="请输入赠送天数" 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. <input id="content" name="content" class="form-control" type="text" placeholder="请输入内容" required/>
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <label class="col-sm-2 control-label">排序:</label>
  53. <div class="col-sm-10">
  54. <input id="seq" name="seq" class="form-control" type="number" min="1" placeholder="请输入排序" required/>
  55. </div>
  56. </div>
  57. </form>
  58. </div>
  59. <th:block th:include="include :: footer" />
  60. <th:block th:include="include :: summernote-js" />
  61. <script type="text/javascript">
  62. var prefix = ctx + "activity/zxb/award";
  63. $("#form-notice-add").validate({
  64. focusCleanup: true
  65. });
  66. var weekType = $("#weekType").val();
  67. getWeekStartGiftByType(weekType);
  68. var type = $("#type").val();
  69. getWeekStartItem(type);
  70. $("#weekType").change(function(){
  71. var weekType = $("#weekType").val();
  72. getWeekStartGiftByType(weekType)
  73. });
  74. $("#type").change(function(){
  75. var type = $("#type").val();
  76. getWeekStartItem(type)
  77. });
  78. function getWeekStartItem(type){
  79. $.ajax({
  80. type: 'GET',
  81. async : false,
  82. url: prefix + '/getWeekStartItem?type=' + type,
  83. dataType:'json',
  84. success:function (data) {
  85. if (data.code == 0) {
  86. var _html = "";
  87. for(var i = 0; i < data.data.length; i ++) {
  88. _html += "<option value=" + data.data[i].itemId + ">" + data.data[i].itemName + "</option>";
  89. }
  90. $("#itemId").html(_html);
  91. }
  92. }
  93. })
  94. }
  95. function getWeekStartGiftByType(weekType){
  96. $.ajax({
  97. type: 'GET',
  98. async : false,
  99. url: ctx + 'activity/zxb/getWeekStartGiftByType?type=' + weekType,
  100. dataType:'json',
  101. success:function (data) {
  102. if (data.code == 0) {
  103. var _html = "";
  104. for(var i = 0; i < data.data.length; i ++) {
  105. _html += "<option value=" + data.data[i].giftId + ">" + data.data[i].giftName + "</option>";
  106. }
  107. $("#giftId").html(_html);
  108. }
  109. }
  110. })
  111. }
  112. function submitHandler() {
  113. if ($.validate.form()) {
  114. $.operate.save(prefix + "/add", $('#form-notice-add').serialize());
  115. }
  116. }
  117. </script>
  118. </body>
  119. </html>