123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- $(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 += '<div class="HoutaiContainerDialogLine3ImgFile2" houchuan="' + 1 + '" imgurl=' + value + '>';
- ListHtml2 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
- ListHtml2 += '<div class="del2Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
- ListHtml2 += '</div>';
- })
- $("#uploaderImgContent2").before(ListHtml2);
- $.each(TypeImgArr2, function (index, value) {
- ListHtml3 += '<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="' + 1 + '" imgurl=' + value + '>';
- ListHtml3 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
- ListHtml3 += '<div class="del3Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
- ListHtml3 += '</div>';
- })
- $("#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 = `<div class="HoutaiContainerDialogLine3ImgFile2" houchuan="2" imgurl = ${result}>
- <img id="HoutaiContainerDialog3TPImg${i}" class="HoutaiContainerDialogTPImg" src="${result}" alt="">
- <div class="del2Img btn" ids="${i}" id="del3Img${i}">删除</div>
- </div>`;
- $("#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 += '<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="' + 1 + '" imgurl=' + value + '>';
- ListHtml3 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
- ListHtml3 += '<div class="del3Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
- ListHtml3 += '</div>';
- })
- $("#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 = `<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="2" imgurl = ${result}>
- <img id="HoutaiContainerDialog3TPImg${i}" class="HoutaiContainerDialogTPImg" src="${result}" alt="">
- <div class="del3Img btn" ids="${i}" id="del3Img${i}">删除</div>
- </div>`;
- $("#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;
- }
- }
- })
- }
- });
- })
|