edit.html 4.1 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-dict-edit" th:object="${weekStarItemReward}">
  9. <input name="id" type="hidden" th:field="*{id}" />
  10. <div class="form-group">
  11. <label class="col-sm-2 control-label">周星类型:</label>
  12. <div class="col-sm-10">
  13. <select name="weekType" id="weekType" disabled="disabled" class="form-control m-b" th:with="type=${@dict.getType('week_star_gift_type')}">
  14. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{weekStarType}"></option>
  15. </select>
  16. </div>
  17. </div>
  18. <div class="form-group">
  19. <label for="giftId" class="col-sm-2 control-label">周星礼物:</label>
  20. <div class="col-sm-10" style="margin-bottom: 20px;">
  21. <select name="giftId" id="giftId" disabled="disabled">
  22. </select>
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <label class="col-sm-2 control-label">奖项类型:</label>
  27. <div class="col-sm-10">
  28. <select name="type" id="type" class="form-control m-b" th:with="type=${@dict.getType('zxb_item_type')}">
  29. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}"></option>
  30. </select>
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label for="giftId" class="col-sm-2 control-label">奖项:</label>
  35. <div class="col-sm-10" style="margin-bottom: 20px;">
  36. <select name="itemId" id="itemId">
  37. </select>
  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. <input id="days" name="days" class="form-control" type="number" min="1" th:field="*{days}" placeholder="请输入赠送天数" required/>
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label class="col-sm-2 control-label">内容:</label>
  48. <div class="col-sm-10">
  49. <input id="content" name="content" class="form-control" type="text" th:field="*{content}" placeholder="请输入内容" required/>
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <label class="col-sm-2 control-label">排序:</label>
  54. <div class="col-sm-10">
  55. <input id="seq" name="seq" class="form-control" type="number" min="1" th:field="*{seq}" placeholder="请输入排序" required/>
  56. </div>
  57. </div>
  58. </form>
  59. </div>
  60. <th:block th:include="include :: footer" />
  61. <script type="text/javascript">
  62. var prefix = ctx + "activity/zxb/award";
  63. $("#form-dict-edit").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 + "/edit", $('#form-dict-edit').serialize());
  115. }
  116. }
  117. </script>
  118. </body>
  119. </html>