$(document).ready(function () { let url = window.location.search; 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; if (theRequest.labelcurrenttype == "视频列表广告") { $(".SLHeaderChild").removeClass("SLHeaderChildActive"); $(".SLHeaderChild").eq(0).addClass("SLHeaderChildActive"); $('#my-img').css('width', '271px'); $('#my-img').css('height', '200px'); $('#my-img img').attr('src', '/Public/Admin/img/tttp.png'); $('#my-img1').css('width', '271px'); $('#my-img1').css('height', '200px'); } else if (theRequest.labelcurrenttype == "片头广告") { $(".SLHeaderChild").removeClass("SLHeaderChildActive"); $(".SLHeaderChild").eq(1).addClass("SLHeaderChildActive"); $('#my-img').css('width', '375px'); $('#my-img').css('height', '200px'); $('#my-img img').attr('src', '/Public/Admin/img/tttps.png'); $('#my-img1').css('width', '375px'); $('#my-img1').css('height', '200px'); } else if (theRequest.labelcurrenttype == "游戏广告") { $(".SLHeaderChild").removeClass("SLHeaderChildActive"); $(".SLHeaderChild").eq(2).addClass("SLHeaderChildActive"); $('#my-img').css('width', '271px'); $('#my-img').css('height', '200px'); $('#my-img img').attr('src', '/Public/Admin/img/tttp.png'); $('#my-img2').css('width', '271px'); $('#my-img2').css('height', '200px'); } // 切换视频列表广告与片头广告 $(".SLHeaderChild").on("click", function () { // window.scrollTo(0, 0); var _this = $(this); $(".SLHeaderChild").removeClass("SLHeaderChildActive"); $(this).addClass("SLHeaderChildActive"); if (_this.attr("tabText") != theRequest.labelcurrenttype) { // window.location.href = "sl_adv?labelcurrenttype=" + _this.attr("tabText"); window.location.href = "./banner.html?labelcurrenttype=" + _this.attr("tabText"); } console.log($(this).index()); }); // 上传图片功能-取消上传图片并关闭弹弹窗 $(".HoutaiContainerDialogAdvert5Left").on("click", function () { $(".HoutaiContainerDialog").hide(); }); // 上传图片功能-显示创建广告弹窗 $(".SLHeaderCreate").on("click", function () { $(".HoutaiContainerDialog").show(); }); // 上传图片功能-打开上传图片窗口 $(".HoutaiContainerDialogAdvert4Right").on("click", function () { $("#img-upload").click(); }); // 上传图片功能-打开上传图片窗口 $(".HoutaiContainerDialogBJAdvertRight2").on("click", function () { $("#img-upload1").click(); }); // 上传图片功能-打开上传图片窗口 // $(".HoutaiContainerDialogBJAdvertRight2").on("click", function () { // $("#img-upload1").click(); // }); var input = document.getElementById("img-upload"); var theFile; var aa; input.onchange = function () { //获取用户上传的文件对象 theFile = input.files[0]; //实例化一个文件读取器 var fileReader = new FileReader(); //将用户上传的文件对象作为参数,传入文件读取器的方法readAsDataURL fileReader.readAsDataURL(theFile); //文件读取器方法执行完毕后调用函数 fileReader.onload = function () { //文件读取器的result属性即fileReader.result,就是上传文件的dataURL //document.getElementsByTagName("img")[0].src = fileReader.result; // $("#HoutaiContainerDialogDeputyXImg").attr("src", fileReader.result); console.log(fileReader.result); aa = fileReader.result; $("#my-img img").attr("src", fileReader.result); }; }; var input1 = document.getElementById("img-upload1"); var theFile1; var aa; input1.onchange = function () { //获取用户上传的文件对象 theFile1 = input1.files[0]; //实例化一个文件读取器 var fileReader = new FileReader(); //将用户上传的文件对象作为参数,传入文件读取器的方法readAsDataURL fileReader.readAsDataURL(theFile1); //文件读取器方法执行完毕后调用函数 fileReader.onload = function () { //文件读取器的result属性即fileReader.result,就是上传文件的dataURL //document.getElementsByTagName("img")[0].src = fileReader.result; // $("#HoutaiContainerDialogDeputyXImg").attr("src", fileReader.result); console.log(fileReader.result); aa = fileReader.result; $("#my-img1 img").attr("src", fileReader.result); }; }; $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/adv_count_show", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7" }, success: function (res) { console.log(res); $("#listBanner").text(`视频列表广告 ( ${res.data.videolist_adv} ) `); $("#videoBanner").text(`片头广告 ( ${res.data.start_adv} ) `); $("#gameBanner").text(`游戏广告 ( ${res.data.gamelist_adv} ) `); } }) if ( theRequest.labelcurrenttype == "视频列表广告" || theRequest.labelcurrenttype == undefined ) { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowList", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7", page: tabId, size: 50, }, success: function (res) { console.log(res); var AppleList = ""; $.each(res.data, function (index, value) { AppleList += '
'; AppleList += '

' + value.number + "

"; AppleList += '

'; AppleList += '

' + value.jump_link + "

"; AppleList += '
'; AppleList += '

' + "修改" + "

"; AppleList += '

' + "删除" + "

"; AppleList += "
"; AppleList += "
"; }); $("#AppleList").html(AppleList); }, complete: function (res, status) { console.log(res.responseJSON.total); $("#page").paging({ pageNo: tabId, totalPage: Math.ceil(res.responseJSON.total / 50), callback: function (num) { window.location.href = "https://api.9169kkxstzsjkdd222.app/sl_adv?TabId=" + num + "&labelcurrenttype=视频列表广告"; }, }); var id; $(".HoutaiContainerBottomAppleListHeaderTP").on("click", function () { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); }); $(".HoutaiContainerBottomAppleListHeaderCZxg").on( "click", function () { $(".HoutaiContainerDialogBJ").show(); id = $(this).attr("id"); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowDetailOne", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: $(this).attr("id"), }, success: function (res) { console.log(res); $(".HoutaiContainerDialogBJAdvertRight").val( res.data.jump_link ); $(".HoutaiContainerDialogBJAdvertRight1").val( res.data.content ); $("#my-img1 img").attr("src", res.data.img); }, }); } ); $(".HoutaiContainerBottomAppleListHeaderCZsc").on( "click", function () { $(".HoutaiContainerDialogSC").show(); id = $(this).attr("id"); } ); $(".HoutaiContainerDialogABJdvertLeft3").on( "click", function () { $(".HoutaiContainerDialogBJ").hide(); } ); $(".HoutaiContainerDialogBJAdvertRight3").on( "click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("advert_id", id); formFile.append( "jump_link", $(".HoutaiContainerDialogBJAdvertRight").val() ); formFile.append( "content", '' ); formFile.append("img", theFile1); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDetail", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); if (res.code == "200") { alert("修改成功"); window.location.reload(); } else { alert("请求失败,请修改后重试!"); } }, }); } ); $(".HoutaiContainerDialogASCdvertLeft").on( "click", function () { $(".HoutaiContainerDialogSC").hide(); } ); $(".HoutaiContainerDialogSCAdvertRight").on( "click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDelete", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: id, }, success: function (res) { console.log(res); window.location.reload(); }, }); } ); }, }); $(".HoutaiContainerDialogAdvert5Right").on("click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("type", theRequest.labelcurrenttype); formFile.append( "jump_link", $(".HoutaiContainerDialogAdvert2Right").val() ); formFile.append("img", theFile); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertAdd", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); window.location.reload(); }, }); }); } else if ( theRequest.labelcurrenttype == "片头广告" ) { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowStart", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7", page: tabId, size: 50, }, success: function (res) { console.log(res); var AppleList = ""; $.each(res.data, function (index, value) { AppleList += '
'; AppleList += '

' + value.number + "

"; AppleList += '

'; AppleList += '

' + value.jump_link + "

"; AppleList += '
'; AppleList += '

' + "修改" + "

"; AppleList += '

' + "删除" + "

"; AppleList += "
"; AppleList += "
"; }); $("#AppleList").html(AppleList); }, complete: function (res, status) { console.log(res.responseJSON.total); $("#page").paging({ pageNo: tabId, totalPage: Math.ceil(res.responseJSON.total / 50), callback: function (num) { window.location.href = "https://api.9169kkxstzsjkdd222.app/sl_adv?TabId=" + num + "&labelcurrenttype=片头广告"; }, }); var id; $(".HoutaiContainerBottomAppleListHeaderTP").on("click", function () { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); }); $(".HoutaiContainerBottomAppleListHeaderCZxg").on( "click", function () { $(".HoutaiContainerDialogBJ").show(); id = $(this).attr("id"); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowDetailOne", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: $(this).attr("id"), }, success: function (res) { console.log(res); $(".HoutaiContainerDialogBJAdvertRight").val( res.data.jump_link ); $(".HoutaiContainerDialogBJAdvertRight1").val( res.data.content ); $("#my-img1 img").attr("src", res.data.img); }, }); } ); $(".HoutaiContainerBottomAppleListHeaderCZsc").on( "click", function () { $(".HoutaiContainerDialogSC").show(); id = $(this).attr("id"); } ); $(".HoutaiContainerDialogABJdvertLeft3").on( "click", function () { $(".HoutaiContainerDialogBJ").hide(); } ); $(".HoutaiContainerDialogBJAdvertRight3").on( "click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("advert_id", id); formFile.append( "jump_link", $(".HoutaiContainerDialogBJAdvertRight").val() ); formFile.append( "content", '' ); formFile.append("img", theFile1); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDetail", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); if (res.code == "200") { alert("修改成功"); window.location.reload(); } else { alert("请求失败,请修改后重试!"); } }, }); } ); $(".HoutaiContainerDialogASCdvertLeft").on( "click", function () { $(".HoutaiContainerDialogSC").hide(); } ); $(".HoutaiContainerDialogSCAdvertRight").on( "click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDelete", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: id, }, success: function (res) { console.log(res); window.location.reload(); }, }); } ); }, }); $(".HoutaiContainerDialogAdvert5Right").on("click", function () { console.log(11); var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("type", theRequest.labelcurrenttype); formFile.append( "jump_link", $(".HoutaiContainerDialogAdvert2Right").val() ); formFile.append("img", theFile); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertAdd", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); window.location.reload(); }, }); }); } else if (theRequest.labelcurrenttype == "游戏广告") { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/gameOnlineShowList", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7", page: tabId, size: 50, }, success: function (res) { console.log(res); var AppleList = ""; $.each(res.data, function (index, value) { AppleList += '
'; AppleList += '

' + value.number + "

"; AppleList += '

'; AppleList += '

' + value.jump_link + "

"; AppleList += '
'; AppleList += '

' + "修改" + "

"; AppleList += '

' + "删除" + "

"; AppleList += "
"; AppleList += "
"; }); $("#AppleList").html(AppleList); }, complete: function (res, status) { $("#page").paging({ pageNo: tabId, totalPage: Math.ceil(res.responseJSON.total / 50), callback: function (num) { window.location.href = "https://api.9169kkxstzsjkdd222.app/sl_adv?TabId=" + num + "&labelcurrenttype=片头广告"; }, }); var id; $(".HoutaiContainerBottomAppleListHeaderTP").on("click", function () { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); console.log("names"); }); $(".HoutaiContainerBottomAppleListHeaderCZxg").on( "click", function () { $(".HoutaiContainerDialogBJ").show(); id = $(this).attr("id"); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowDetailOne", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: $(this).attr("id"), }, success: function (res) { console.log(res); $(".HoutaiContainerDialogBJAdvertRight").val( res.data.jump_link ); $(".HoutaiContainerDialogBJAdvertRight1").val( res.data.content ); $("#my-img1 img").attr("src", res.data.img); }, }); } ); $(".HoutaiContainerBottomAppleListHeaderCZsc").on( "click", function () { $(".HoutaiContainerDialogSC").show(); id = $(this).attr("id"); } ); $(".HoutaiContainerDialogABJdvertLeft3").on( "click", function () { $(".HoutaiContainerDialogBJ").hide(); } ); $(".HoutaiContainerDialogBJAdvertRight3").on("click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("advert_id", id); formFile.append( "jump_link", $(".HoutaiContainerDialogBJAdvertRight").val() ); formFile.append( "content", '' ); formFile.append("img", theFile1); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDetail", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") // console.log(res); if (res.code == "200") { alert("修改成功"); window.location.reload(); } else { alert("请求失败,请修改后重试!"); } }, }); } ); $(".HoutaiContainerDialogASCdvertLeft").on( "click", function () { $(".HoutaiContainerDialogSC").hide(); } ); $(".HoutaiContainerDialogSCAdvertRight").on( "click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDelete", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: id, }, success: function (res) { console.log(res); window.location.reload(); }, }); } ); } }) $(".HoutaiContainerDialogAdvert5Right").on("click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("type", theRequest.labelcurrenttype); formFile.append( "jump_link", $(".HoutaiContainerDialogAdvert2Right").val() ); formFile.append("img", theFile); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertAdd", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); window.location.reload(); }, }); }); } else { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowList", dataType: "json", data: { //async: false, token: "b8e3bb6ef8747d7", page: tabId, size: 50, }, success: function (res) { console.log(res); var AppleList = ""; $.each(res.data, function (index, value) { AppleList += '
'; AppleList += '

' + value.number + "

"; AppleList += '

'; AppleList += '

' + value.jump_link + "

"; AppleList += '
'; AppleList += '

' + "修改" + "

"; AppleList += '

' + "删除" + "

"; AppleList += "
"; AppleList += "
"; }); $("#AppleList").html(AppleList); }, complete: function (res, status) { console.log(res.responseJSON.total); $("#page").paging({ pageNo: tabId, totalPage: Math.ceil(res.responseJSON.total / 50), callback: function (num) { window.location.href = "https://api.9169kkxstzsjkdd222.app/sl_adv?TabId=" + num + "&labelcurrenttype=视频列表广告"; }, }); var id; $(".HoutaiContainerBottomAppleListHeaderTP").on("click", function () { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); }); $(".HoutaiContainerBottomAppleListHeaderCZxg").on( "click", function () { $(".HoutaiContainerDialogBJ").show(); id = $(this).attr("id"); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/advertShowDetailOne", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: $(this).attr("id"), }, success: function (res) { console.log(res); $(".HoutaiContainerDialogBJAdvertRight").val( res.data.jump_link ); $(".HoutaiContainerDialogBJAdvertRight1").val( res.data.content ); $("#my-img1 img").attr("src", res.data.img); }, }); } ); $(".HoutaiContainerBottomAppleListHeaderCZsc").on( "click", function () { $(".HoutaiContainerDialogSC").show(); id = $(this).attr("id"); } ); $(".HoutaiContainerDialogABJdvertLeft3").on( "click", function () { $(".HoutaiContainerDialogBJ").hide(); } ); $(".HoutaiContainerDialogBJAdvertRight3").on( "click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("advert_id", id); formFile.append( "jump_link", $(".HoutaiContainerDialogBJAdvertRight").val() ); formFile.append( "content", '' ); formFile.append("img", theFile1); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDetail", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); if (res.code == "200") { alert("修改成功"); window.location.reload(); } else { alert("请求失败,请修改后重试!"); } }, }); } ); $(".HoutaiContainerDialogASCdvertLeft").on( "click", function () { $(".HoutaiContainerDialogSC").hide(); } ); $(".HoutaiContainerDialogSCAdvertRight").on( "click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertDelete", dataType: "json", data: { token: "b8e3bb6ef8747d7", advert_id: id, }, success: function (res) { console.log(res); window.location.reload(); }, }); } ); }, }); $(".HoutaiContainerDialogAdvert5Right").on("click", function () { var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("type", theRequest.labelcurrenttype); formFile.append( "jump_link", $(".HoutaiContainerDialogAdvert2Right").val() ); formFile.append("img", theFile); $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/videoAdvertAdd", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("修改成功") console.log(res); window.location.reload(); }, }); }); } $(".HoutaiContainerTitleLogout").on("click", function () { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Login/loginOut", dataType: "json", success: function (res) { // alert("修改成功") console.log(res); window.location.href = "dlogin"; }, }); }); $(".bannerImgBJ").on("click", function () { $(this).fadeOut(300); }) });