$(document).ready(function () { let url = window.location.search; let id; let data; var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape( decodeURI(strs[i].split("=")[1]) ); } } let tabId = theRequest.TabId || 1; // 接口调用-数据获取-反差列表 function getData() { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/show_gonggao_list", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7", page: tabId, size: 50, }, success: function (res) { console.log(res); data = res.data; let AppleListHTML = ""; $.each(data, function (index, value) { AppleListHTML += `

${value.content }

修改

删除

`; }); $("#AppleList").html(AppleListHTML); }, complete: function (res, status) { console.log(res); $("#page").paging({ pageNo: tabId, totalPage: Math.ceil(res.responseJSON.all_count / 50), callback: function (num) { window.location.href = "https://api.9169kkxstzsjkdd222.app/announcement?TabId=" + num; }, }); $(".HoutaiContainerBottomAppleListHeaderCZxg").on( "click", function () { id = $(this).attr("id"); let index = $(this).parent().parent().index(); console.log(index); $(".HoutaiContainerDialoggai").show(); $("#feedbackContent2").val(data[index].content); } ); $(".HoutaiContainerBottomAppleListHeaderCZhf").on( "click", function () { id = $(this).attr("id"); var formFile = new FormData(); formFile.append("id", id); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/open_gonggao", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("添加成功"); console.log(res); window.location.reload(); }, }); } ); // 功能-删除-反差内容-弹窗展示 $(".HoutaiContainerBottomAppleListHeaderCZsc").on( "click", function () { console.log(123123); id = $(this).parent().parent().attr("id"); $(".HoutaiContainerDialogSC").show(); } ); }, }); } getData(); // 功能-新增-反差内容-弹窗展示 $(".SLHeaderCreate").on("click", function () { $(".HoutaiContainerDialogAdd").show(); }); // 功能-新增-反差内容-弹窗隐藏 $(".HoutaiContainerDialogLine5LeftAdd").on("click", function () { $(".HoutaiContainerDialogAdd").hide(); $(".HoutaiContainerDialoggai").hide(); }); // 功能-新增-反差内容-确认新增 $(".HoutaiContainerDialogLine5RightAdd").on("click", function () { var formFile = new FormData(); formFile.append("content", $("#feedbackContent").val()); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/add_gonggao", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("添加成功"); console.log(res); window.location.reload(); }, }); }); // 功能-新增-反差内容-修改 $(".HoutaiContainerDialogLine5Rightgai").on("click", function () { var formFile = new FormData(); formFile.append("id", id); formFile.append("content", $("#feedbackContent2").val()); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/save_gonggao_content", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("添加成功"); console.log(res); window.location.reload(); }, }); }); // 功能-删除-反差内容-取消删除 $(".HoutaiContainerDialogASCdvertLeft").on("click", function () { $(".HoutaiContainerDialogSC").hide(); }); // 功能-删除-反差内容-确定删除 $(".HoutaiContainerDialogSCAdvertRight").on("click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackoneeight/delete_gonggao", dataType: "json", data: { id: id, }, success: function (res) { console.log(res); window.location.reload(); }, }); }); });