announcement.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. $(document).ready(function () {
  2. let url = window.location.search;
  3. let id;
  4. let data;
  5. var theRequest = new Object();
  6. if (url.indexOf("?") != -1) {
  7. var str = url.substr(1);
  8. strs = str.split("&");
  9. for (var i = 0; i < strs.length; i++) {
  10. theRequest[strs[i].split("=")[0]] = unescape(
  11. decodeURI(strs[i].split("=")[1])
  12. );
  13. }
  14. }
  15. let tabId = theRequest.TabId || 1;
  16. // 接口调用-数据获取-反差列表
  17. function getData() {
  18. $.ajax({
  19. type: "post",
  20. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/show_gonggao_list",
  21. dataType: "json",
  22. data: {
  23. //async: false,
  24. token: "b8e3bb6ef8747d7",
  25. page: tabId,
  26. size: 50,
  27. },
  28. success: function (res) {
  29. console.log(res);
  30. data = res.data;
  31. let AppleListHTML = "";
  32. $.each(data, function (index, value) {
  33. AppleListHTML += `
  34. <div id="${value.id
  35. }" class="HoutaiContainerBottomAppleListHeaders">
  36. <p class="HoutaiContainerBottomAppleListHeaderNR">${value.content
  37. }</p>
  38. <div class="HoutaiContainerBottomAppleListHeaderCZ">
  39. <p class="HoutaiContainerBottomAppleListHeaderCZxg" id = "${value.id}">修改</p>
  40. <p class="HoutaiContainerBottomAppleListHeaderCZsc">删除</p>
  41. </div>
  42. </div>`;
  43. });
  44. $("#AppleList").html(AppleListHTML);
  45. },
  46. complete: function (res, status) {
  47. console.log(res);
  48. $("#page").paging({
  49. pageNo: tabId,
  50. totalPage: Math.ceil(res.responseJSON.all_count / 50),
  51. callback: function (num) {
  52. window.location.href =
  53. "https://api.9169kkxstzsjkdd222.app/announcement?TabId=" + num;
  54. },
  55. });
  56. $(".HoutaiContainerBottomAppleListHeaderCZxg").on(
  57. "click",
  58. function () {
  59. id = $(this).attr("id");
  60. let index = $(this).parent().parent().index();
  61. console.log(index);
  62. $(".HoutaiContainerDialoggai").show();
  63. $("#feedbackContent2").val(data[index].content);
  64. }
  65. );
  66. $(".HoutaiContainerBottomAppleListHeaderCZhf").on(
  67. "click",
  68. function () {
  69. id = $(this).attr("id");
  70. var formFile = new FormData();
  71. formFile.append("id", id);
  72. $.ajax({
  73. type: "post",
  74. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/open_gonggao",
  75. dataType: "json",
  76. data: formFile,
  77. async: true,
  78. cache: false,
  79. contentType: false,
  80. processData: false,
  81. success: function (res) {
  82. // alert("添加成功");
  83. console.log(res);
  84. window.location.reload();
  85. },
  86. });
  87. }
  88. );
  89. // 功能-删除-反差内容-弹窗展示
  90. $(".HoutaiContainerBottomAppleListHeaderCZsc").on(
  91. "click",
  92. function () {
  93. console.log(123123);
  94. id = $(this).parent().parent().attr("id");
  95. $(".HoutaiContainerDialogSC").show();
  96. }
  97. );
  98. },
  99. });
  100. }
  101. getData();
  102. // 功能-新增-反差内容-弹窗展示
  103. $(".SLHeaderCreate").on("click", function () {
  104. $(".HoutaiContainerDialogAdd").show();
  105. });
  106. // 功能-新增-反差内容-弹窗隐藏
  107. $(".HoutaiContainerDialogLine5LeftAdd").on("click", function () {
  108. $(".HoutaiContainerDialogAdd").hide();
  109. $(".HoutaiContainerDialoggai").hide();
  110. });
  111. // 功能-新增-反差内容-确认新增
  112. $(".HoutaiContainerDialogLine5RightAdd").on("click", function () {
  113. var formFile = new FormData();
  114. formFile.append("content", $("#feedbackContent").val());
  115. $.ajax({
  116. type: "post",
  117. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/add_gonggao",
  118. dataType: "json",
  119. data: formFile,
  120. async: true,
  121. cache: false,
  122. contentType: false,
  123. processData: false,
  124. success: function (res) {
  125. // alert("添加成功");
  126. console.log(res);
  127. window.location.reload();
  128. },
  129. });
  130. });
  131. // 功能-新增-反差内容-修改
  132. $(".HoutaiContainerDialogLine5Rightgai").on("click", function () {
  133. var formFile = new FormData();
  134. formFile.append("id", id);
  135. formFile.append("content", $("#feedbackContent2").val());
  136. $.ajax({
  137. type: "post",
  138. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/save_gonggao_content",
  139. dataType: "json",
  140. data: formFile,
  141. async: true,
  142. cache: false,
  143. contentType: false,
  144. processData: false,
  145. success: function (res) {
  146. // alert("添加成功");
  147. console.log(res);
  148. window.location.reload();
  149. },
  150. });
  151. });
  152. // 功能-删除-反差内容-取消删除
  153. $(".HoutaiContainerDialogASCdvertLeft").on("click", function () {
  154. $(".HoutaiContainerDialogSC").hide();
  155. });
  156. // 功能-删除-反差内容-确定删除
  157. $(".HoutaiContainerDialogSCAdvertRight").on("click", function () {
  158. $.ajax({
  159. type: "post",
  160. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/delete_gonggao",
  161. dataType: "json",
  162. data: {
  163. id: id,
  164. },
  165. success: function (res) {
  166. console.log(res);
  167. window.location.reload();
  168. },
  169. });
  170. });
  171. });