$(document).ready(function () { let url = window.location.search; let id; let data; let videoSrc; 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; // 上传文件-视频 let spFilesArr = []; let spInputFile1 = document.getElementById("uploadVideo1"); let spTheFile1; spInputFile1.onchange = function () { // 获取用户上传的文件对象 spTheFile1 = spInputFile1.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile1[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile1[0]); fileReader.onprogress = updateProgress1; }; let spInputFile2 = document.getElementById("uploadVideo2"); let spTheFile2; spInputFile2.onchange = function () { // 获取用户上传的文件对象 spTheFile2 = spInputFile2.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile2[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile2[0]); fileReader.onprogress = updateProgress2; }; let spInputFile3 = document.getElementById("uploadVideo3"); let spTheFile3; spInputFile3.onchange = function () { // 获取用户上传的文件对象 spTheFile3 = spInputFile3.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile3[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile3[0]); fileReader.onprogress = updateProgress3; }; let spInputFile4 = document.getElementById("uploadVideo4"); let spTheFile4; spInputFile4.onchange = function () { // 获取用户上传的文件对象 spTheFile4 = spInputFile4.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile4[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile4[0]); fileReader.onprogress = updateProgress4; }; let spInputFile5 = document.getElementById("uploadVideo5"); let spTheFile5; spInputFile5.onchange = function () { // 获取用户上传的文件对象 spTheFile5 = spInputFile5.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile5[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile5[0]); fileReader.onprogress = updateProgress5; }; let spInputFile6 = document.getElementById("uploadVideo6"); let spTheFile6; spInputFile6.onchange = function () { // 获取用户上传的文件对象 spTheFile6 = spInputFile6.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile6[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile6[0]); fileReader.onprogress = updateProgress6; }; let spInputFile7 = document.getElementById("uploadVideo7"); let spTheFile7; spInputFile7.onchange = function () { // 获取用户上传的文件对象 spTheFile7 = spInputFile7.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile7[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile7[0]); fileReader.onprogress = updateProgress7; }; let spInputFile8 = document.getElementById("uploadVideo8"); let spTheFile8; spInputFile8.onchange = function () { // 获取用户上传的文件对象 spTheFile8 = spInputFile8.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile8[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile8[0]); fileReader.onprogress = updateProgress8; }; let spInputFile9 = document.getElementById("uploadVideo9"); let spTheFile9; spInputFile9.onchange = function () { // 获取用户上传的文件对象 spTheFile9 = spInputFile9.files; // 回显 // 实例化一个文件读取器 let fileReader = new FileReader(); fileReader.onload = function () { spFilesArr.push(spTheFile9[0]); }; //读取文件 fileReader.readAsDataURL(spTheFile9[0]); fileReader.onprogress = updateProgress9; }; // 上传文件-图片 let tpFilesArr = []; let tpInputFile1 = document.getElementById("uploadImg1"); let tpTheFile1; tpInputFile1.onchange = function () { // 获取用户上传的文件对象 tpTheFile1 = tpInputFile1.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg1").attr("src", fileReader.result); tpFilesArr.push(tpTheFile1[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile1[0]); }; let tpInputFile2 = document.getElementById("uploadImg2"); let tpTheFile2; tpInputFile2.onchange = function () { // 获取用户上传的文件对象 tpTheFile2 = tpInputFile2.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg2").attr("src", fileReader.result); tpFilesArr.push(tpTheFile2[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile2[0]); }; let tpInputFile3 = document.getElementById("uploadImg3"); let tpTheFile3; tpInputFile3.onchange = function () { // 获取用户上传的文件对象 tpTheFile3 = tpInputFile3.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg3").attr("src", fileReader.result); tpFilesArr.push(tpTheFile3[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile3[0]); }; let tpInputFile4 = document.getElementById("uploadImg4"); let tpTheFile4; tpInputFile4.onchange = function () { // 获取用户上传的文件对象 tpTheFile4 = tpInputFile4.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg4").attr("src", fileReader.result); tpFilesArr.push(tpTheFile4[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile4[0]); }; let tpInputFile5 = document.getElementById("uploadImg5"); let tpTheFile5; tpInputFile5.onchange = function () { // 获取用户上传的文件对象 tpTheFile5 = tpInputFile5.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg5").attr("src", fileReader.result); tpFilesArr.push(tpTheFile5[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile5[0]); }; let tpInputFile6 = document.getElementById("uploadImg6"); let tpTheFile6; tpInputFile6.onchange = function () { // 获取用户上传的文件对象 tpTheFile6 = tpInputFile6.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg6").attr("src", fileReader.result); tpFilesArr.push(tpTheFile6[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile6[0]); }; let tpInputFile7 = document.getElementById("uploadImg7"); let tpTheFile7; tpInputFile7.onchange = function () { // 获取用户上传的文件对象 tpTheFile7 = tpInputFile7.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg7").attr("src", fileReader.result); tpFilesArr.push(tpTheFile7[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile7[0]); }; let tpInputFile8 = document.getElementById("uploadImg8"); let tpTheFile8; tpInputFile8.onchange = function () { // 获取用户上传的文件对象 tpTheFile8 = tpInputFile8.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg8").attr("src", fileReader.result); tpFilesArr.push(tpTheFile8[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile8[0]); }; let tpInputFile9 = document.getElementById("uploadImg9"); let tpTheFile9; tpInputFile9.onchange = function () { // 获取用户上传的文件对象 tpTheFile9 = tpInputFile9.files; // 实例化一个文件读取器 let fileReader = new FileReader(); // 文件读取器方法执行完毕后调用函数 fileReader.onload = function () { $("#TPImg9").attr("src", fileReader.result); tpFilesArr.push(tpTheFile9[0]); }; // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL fileReader.readAsDataURL(tpTheFile9[0]); }; // 功能-上传视频-打开上传视频窗口 $("#SPImg1").on("click", function () { $("#uploadVideo1").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg2").on("click", function () { $("#uploadVideo2").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg3").on("click", function () { $("#uploadVideo3").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg4").on("click", function () { $("#uploadVideo4").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg5").on("click", function () { $("#uploadVideo5").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg6").on("click", function () { $("#uploadVideo6").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg7").on("click", function () { $("#uploadVideo7").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg8").on("click", function () { $("#uploadVideo8").click(); }); // 功能-上传视频-打开上传视频窗口 $("#SPImg9").on("click", function () { $("#uploadVideo9").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg1").on("click", function () { $("#uploadImg1").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg2").on("click", function () { $("#uploadImg2").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg3").on("click", function () { $("#uploadImg3").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg4").on("click", function () { $("#uploadImg4").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg5").on("click", function () { $("#uploadImg5").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg6").on("click", function () { $("#uploadImg6").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg7").on("click", function () { $("#uploadImg7").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg8").on("click", function () { $("#uploadImg8").click(); }); // 功能-上传图片-打开上传图片窗口 $("#TPImg9").on("click", function () { $("#uploadImg9").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg1").on("click", function () { $("#uploadImg1").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg2").on("click", function () { $("#uploadImg2").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg3").on("click", function () { $("#uploadImg3").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg4").on("click", function () { $("#uploadImg4").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg5").on("click", function () { $("#uploadImg5").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg6").on("click", function () { $("#uploadImg6").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg7").on("click", function () { $("#uploadImg7").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg8").on("click", function () { $("#uploadImg8").click(); }); // 功能-修改图片-修改上传图片 $("#GTPImg9").on("click", function () { $("#uploadImg9").click(); }); // 更新进度条 function updateProgress1(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum1`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum1").addClass("uploadDel"); $("#uploadNum1").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum1").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress2(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum2`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum2").addClass("uploadDel"); $("#uploadNum2").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum2").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress3(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum3`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum3").addClass("uploadDel"); $("#uploadNum3").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum3").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress4(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum4`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum4").addClass("uploadDel"); $("#uploadNum4").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum4").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress5(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum5`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum5").addClass("uploadDel"); $("#uploadNum5").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum5").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress6(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum6`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum6").addClass("uploadDel"); $("#uploadNum6").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum6").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress7(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum7`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum7").addClass("uploadDel"); $("#uploadNum7").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum7").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress8(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum8`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum8").addClass("uploadDel"); $("#uploadNum8").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum8").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } function updateProgress9(e) { // e 是一个 ProgressEvent. if (e.lengthComputable) { var percentLoaded = Math.round((e.loaded / e.total) * 100); // 更新进度条长度 if (percentLoaded <= 100) { $(`#uploadNum9`).text(`进度: ${percentLoaded}%`); } if (percentLoaded == 100) { $("#uploadNum9").addClass("uploadDel"); $("#uploadNum9").text("删除"); // 功能-添加中删除-反差内容-视频 $("#uploadNum9").on("click", function () { console.log($(this).parent().index()); spFilesArr.splice($(this).parent().index(), 1); console.log(spFilesArr); $(this).text("进度: 0%"); $(this).removeClass("uploadDel"); }); } } } // 功能-新增-反差内容-弹窗展示 $(".SLHeaderCreate").on("click", function () { $(".HoutaiContainerDialogAdd").show(); }); // 功能-新增-反差内容-弹窗隐藏 $(".HoutaiContainerDialogLine5LeftAdd").on("click", function () { $(".HoutaiContainerDialogAdd").hide(); }); // 功能-新增-反差内容-确认新增 $(".HoutaiContainerDialogLine5RightAdd").on("click", function () { if ($(this).text() == "正在上传中") { alert("正在上传中!请耐心等待!!!"); return; } $(this).text("正在上传中"); $(this).css("background", "#575f6e"); var formFile = new FormData(); formFile.append("title", $("#inputtext1").val()); formFile.append("uploader", "7"); formFile.append("token", "b8e3bb6ef8747d7"); console.log(spFilesArr); for (let i in spFilesArr) { formFile.append("mp4[]", spFilesArr[i]); console.log(spFilesArr[i]); } console.log(tpFilesArr); for (let i in tpFilesArr) { formFile.append("img[]", tpFilesArr[i]); console.log(tpFilesArr[i]); } for (let value of formFile.values()) { console.log(value); } $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/pengyouquan_add", dataType: "json", data: formFile, async: true, cache: false, contentType: false, processData: false, success: function (res) { // alert("添加成功"); console.log(res); window.location.reload(); }, }); }); // 接口调用-数据获取-反差列表 function getData() { $.ajax({ type: "post", url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/take_photo_on_street_list", dataType: "json", data: { type: "7", page: tabId, }, success: function (res) { console.log(res); data = res.data; $(".SLHeader p").text(`鉴臀( ${res.all_num} )`); let AppleListHTML = ""; $.each(data, function (index, value) { let splitImgArray = []; if (value.img_url) { splitImgArray = value.img_url.split(","); } console.log(splitImgArray); AppleListHTML += `
${value.title}
`; AppleListHTML += `${splitImgArray[0] ? `` : ""}
${splitImgArray[1] ? `` : ""}
${splitImgArray[2] ? `` : ""}
${splitImgArray[3] ? `` : ""}
${splitImgArray[4] ? `` : ""}
${splitImgArray[5] ? `` : ""}
${splitImgArray[6] ? `` : ""}
${splitImgArray[7] ? `` : ""}
${splitImgArray[8] ? `` : ""}
待处理`; } else if (value.type == "1") { AppleListHTML += `
处理中`; } else { AppleListHTML += `
完成`; } AppleListHTML += `
删除
确认