$(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]) ); } } // var TypeArr = ["抖音视频发布", "快手视频发布", "抖音评论", "快手评论"]; var Ptid = theRequest.id; // var TypeArr = [ // { // "name": "视频号发布50元", // "price": 50 // }, // { // "name": "视频号发布50元", // "price": 100 // } // ] // console.log(Ptid); var TypeName = "", TypePrice = 15, ScBolean = false, jd_huati = "X话题"; // $(".HoutaiContainerBoxChildFabu").on("click", function () { // if (Ptid == undefined) { // $(".HoutaiContainerBoxChildFabu").removeClass("HoutaiContainerBoxChildFabuActive"); // $(this).addClass("HoutaiContainerBoxChildFabuActive"); // TypeName = TypeArr[$(this).index() - 1].name; // TypePrice = TypeArr[$(this).index() - 1].price; // } // }) const img = new Image(); var TypeImgArr1 = [], TypeImgArr2 = []; if (Ptid != undefined) { ScBolean = true; var ListHtml1 = "", ListHtml2 = "", ListHtml3 = "", ListHtml5 = "", TypeImgArr3 = [], TypeImgArr5 = []; $.ajax({ type: "post", url: window.baseUrl.requestApi + "/Admin/Taskorder/detail_video_wxqun_account", dataType: "json", data: { token: "b8e3bb6ef8747d7", t_id: Ptid }, success: function (res) { if (res.code == "200") { var Data = res.data; // $(".HoutaiContainerBoxChildFabu:eq(1)").addClass("HoutaiContainerBoxChildFabuActive"); TypePrice = 15; $("#ShipinRenwuYaoqiu").val(Data.task_require); TypeImgArr1.push(Data.task_require_img); TypeImgArr2 = Data.task_img_material; $.each(TypeImgArr1, function (index, value) { ListHtml2 += '
'; ListHtml2 += ''; ListHtml2 += '
删除
'; ListHtml2 += '
'; }) $("#uploaderImgContent2").before(ListHtml2); $.each(TypeImgArr2, function (index, value) { ListHtml3 += '
'; ListHtml3 += ''; ListHtml3 += '
删除
'; ListHtml3 += '
'; }) $("#uploaderImgContent3").before(ListHtml3); } } }) } $("#TPImg2").on("click", function () { $("#uploadImg2").click(); }); $("#GTPImg2").on("click", function () { $("#uploadImg2").click(); }); let tpFilesNum1 = 0; let tpallUploaderNum1 = 0; let tpInputFile1 = document.getElementById("uploadImg2"); let tpTheFile1; let tpFilesArr1 = []; let TpFilesArrChild1 = []; tpInputFile1.addEventListener('change', function () { tpTheFile1 = []; TpFilesArrChild1 = []; tpTheFile1 = tpInputFile1.files; TpFilesArrChild1.push(tpTheFile1[0]); tpFilesArr1 = TpFilesArrChild1; $(".HoutaiContainerDialogLine3ImgFile2").remove(); async function processFiles(files) { for (let i = 0; i < files.length; i++) { const reader = new FileReader(); const result = await new Promise((resolve, reject) => { reader.onload = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(files[i]); }); let imgDataHtml = `
删除
`; $("#uploaderImgContent2").before(imgDataHtml); } } processFiles(tpFilesArr1); $("#uploadImg2").val(""); }); $(".HoutaiContainerDialogLineAddRight").on("click", ".del2Imgs", function (e) { e.stopPropagation(); TypeImgArr1.splice($(this).attr("ids"), 1) $(this).parent().remove(); $('div.del2Imgs').each(function (index) { $(this).attr('ids', index); }); }) $(".HoutaiContainerDialogLineAddRight").on("click", ".del2Img", function (e) { e.stopPropagation(); var _this = $(this); tpFilesArr1.splice($(this).attr("ids"), 1) $(this).parent().remove(); $('div.del2Img').each(function (index) { $(this).attr('ids', index); }); }); $(".HoutaiContainerDialogLineAddRight").on("click", ".HoutaiContainerDialogLine3ImgFile2", function (e) { img.src = $(this).attr("imgurl"); if (!$(e.target).closest('.del1Img').length) { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); } }); $(".bannerImgBJ").on("click", function () { $(this).fadeOut(300); }) // tupian 2 $("#TPImg3").on("click", function () { $("#uploadImg3").click(); }); $("#GTPImg3").on("click", function () { $("#uploadImg3").click(); }); let tpFilesNum3 = 0; let tpallUploaderNum3 = 0; let tpInputFile3 = document.getElementById("uploadImg3"); let tpTheFile3; let tpFilesArr3 = []; let TpFilesArrChild3 = []; console.log(tpFilesArr3) tpInputFile3.addEventListener('change', function () { if (TypeImgArr2.length > 0) { TypeImgArr2.forEach(item => { tpFilesArr3.push(item) }) } tpTheFile3 = []; // 获取用户上传的文件对象 tpTheFile3 = Array.from(tpInputFile3.files); //获取选择图片的个数 let length = tpTheFile3.length; tpallUploaderNum3 += length; if (tpFilesArr3.length >= 2) { alert("超过图片上传最大数量"); return } else { for (let j = 0; j < tpTheFile3.length; j++) { const file = tpTheFile3[j]; TpFilesArrChild3.push(file); }; if (TpFilesArrChild3.length > 2) { tpFilesArr3 = TpFilesArrChild3.slice(-2); } else { tpFilesArr3 = TpFilesArrChild3; } // } $(".HoutaiContainerDialogLine3ImgFile3").remove(); if (Ptid != undefined) { ListHtml3 = "" if (tpFilesArr3.length == 1) { if (TypeImgArr2.length == 2) { TypeImgArr2.splice(0, 1) } } else if (tpFilesArr3.length == 2) { TypeImgArr2 = [] } $.each(TypeImgArr2, function (index, value) { ListHtml3 += '
'; ListHtml3 += ''; ListHtml3 += '
删除
'; ListHtml3 += '
'; }) $("#uploaderImgContent3").before(ListHtml3); } async function processFiles(files) { for (let i = 0; i < files.length; i++) { const reader = new FileReader(); const result = await new Promise((resolve, reject) => { reader.onload = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(files[i]); }); let imgDataHtml = `
删除
`; $("#uploaderImgContent3").before(imgDataHtml); } } processFiles(tpFilesArr3); $("#uploadImg3").val(""); } }); $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Imgs", function (e) { e.stopPropagation(); TypeImgArr2.splice($(this).attr("ids"), 1) $(this).parent().remove(); $('div.del3Imgs').each(function (index) { $(this).attr('ids', index); }); }) $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Img", function (e) { e.stopPropagation(); var _this = $(this); tpFilesArr3.splice($(this).attr("ids"), 1) $(this).parent().remove(); $('div.del3Img').each(function (index) { $(this).attr('ids', index); }); }); $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Img", function (e) { e.stopPropagation(); var _this = $(this); tpFilesArr3.splice($(this).attr("ids"), 1) $(this).parent().remove(); $('div.del3Img').each(function (index) { $(this).attr('ids', index); }); }); $(".HoutaiContainerDialogLineAddRight").on("click", ".HoutaiContainerDialogLine3ImgFile3", function (e) { img.src = $(this).attr("imgurl"); img.onload = function () { }; if (!$(e.target).closest('.del1Img').length) { $(".bannerImgBJ").show(); let imgurl = $(this).attr("imgurl"); $(".bannerImg").attr("src", imgurl); } }); $(".bannerImgBJ").on("click", function () { $(this).fadeOut(300); }) if (Ptid != undefined) { $(".HoutaiContainerBoxChildYaoqiuBtnSure").on("click", function () { if (!$("#ShipinRenwuYaoqiu").val()) { alert("请输入任务要求") } else { if ($(this).text() == "正在上传中") { alert("正在上传中!请耐心等待!!!"); return; } $(this).text("正在上传中"); $(this).css("background", "#575f6e"); var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("task_require", $("#ShipinRenwuYaoqiu").val()); formFile.append("t_id", Ptid); formFile.append("task_img_material_two", TypeImgArr2.join(",")); if (tpFilesArr1.length != 0) { for (let i in tpFilesArr1) { formFile.append("task_require_img[]", tpFilesArr1[i]); } } if (tpFilesArr3.length != 0) { for (let i in tpFilesArr3) { formFile.append("task_img_material[]", tpFilesArr3[i]); } } $.ajax({ type: "post", url: window.baseUrl.uploadApi + "/Admin/Taskorder/savetask_wxshare_account", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { if (res.code == "200") { window.history.back(); } else { alert("上传失败,请重新上传"); } }, }); } }) } else { // 功能-新增-反差内容-确认新增 $(".HoutaiContainerBoxChildYaoqiuBtnSure").on("click", function () { if (!$("#ShipinRenwuYaoqiu").val()) { alert("请输入任务要求") } else { if ($(this).text() == "正在上传中") { alert("正在上传中!请耐心等待!!!"); return; } $(this).text("正在上传中"); $(this).css("background", "#575f6e"); var formFile = new FormData(); formFile.append("token", "b8e3bb6ef8747d7"); formFile.append("amount", TypePrice); formFile.append("task_require", $("#ShipinRenwuYaoqiu").val()); if (tpFilesArr1.length != 0) { for (let i in tpFilesArr1) { formFile.append("task_require_img[]", tpFilesArr1[i]); } } if (tpFilesArr3.length != 0) { for (let i in tpFilesArr3) { formFile.append("task_img_material[]", tpFilesArr3[i]); } } $.ajax({ type: "post", url: window.baseUrl.uploadApi + "/Admin/Taskorder/addtask_wxshare_account", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { if (res.code == "200") { window.history.back(); } else { alert("上传失败,请重新上传"); } }, }); } }); } $(".HoutaiContainerBoxChildYaoqiuBtnCancel").on("click", function () { window.history.back(); }) // $("#SucaiKuID") $('#SucaiKuID').blur(function () { if ($('#SucaiKuID').val() != "") { $.ajax({ type: "post", url: window.baseUrl.requestApi + "/Admin/Taskorder/find_douyin_sucaiid_name", dataType: "json", data: { token: "b8e3bb6ef8747d7", sc_id: $('#SucaiKuID').val() }, success: function (res) { console.log(res); if (res.code == "200") { $("#SucaiKuIDShibie").val(res.sc_name); ScBolean = true; } else { alert(res.msg); ScBolean = false; } } }) } }); })