tabBtn13.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. $(document).ready(function () {
  2. let url = window.location.search;
  3. let id;
  4. let data;
  5. let videoSrc;
  6. var theRequest = new Object();
  7. if (url.indexOf("?") != -1) {
  8. var str = url.substr(1);
  9. strs = str.split("&");
  10. for (var i = 0; i < strs.length; i++) {
  11. theRequest[strs[i].split("=")[0]] = unescape(
  12. decodeURI(strs[i].split("=")[1])
  13. );
  14. }
  15. }
  16. let tabId = theRequest.TabId || 1;
  17. // 上传文件-视频
  18. let spFilesArr = [];
  19. let spInputFile1 = document.getElementById("uploadAddSP1");
  20. let spTheFile1;
  21. spInputFile1.onchange = function () {
  22. // 获取用户上传的文件对象
  23. spTheFile1 = spInputFile1.files;
  24. // 回显
  25. // 实例化一个文件读取器
  26. let fileReader = new FileReader();
  27. fileReader.onload = function () {
  28. let videoLineDataHtml = `<div class="HoutaiContainerDialogLine4VideoFile btn" id="HoutaiContainerDialogLine4VideoFile1">
  29. <div class="videoFileName">视频文件 ${spTheFile1[0].name}</div>
  30. <div class="delVideo">删除</div>
  31. </div>`;
  32. $("#HoutaiContainerDialogLine4RightAdd1").append(videoLineDataHtml);
  33. $("#HoutaiContainerDialogLine4AddSP1").hide();
  34. spFilesArr.push(spTheFile1[0]);
  35. // 功能-添加中删除-反差内容-视频
  36. $("#HoutaiContainerDialogLine4VideoFile1").on("click", function () {
  37. console.log($(this).index());
  38. spFilesArr.splice($(this).index(), 1);
  39. console.log(spFilesArr);
  40. this.remove();
  41. $("#HoutaiContainerDialogLine4AddSP1").show();
  42. $("#uploadNum1").text("进度: 0%");
  43. });
  44. };
  45. //读取文件
  46. fileReader.readAsDataURL(spTheFile1[0]);
  47. fileReader.onprogress = updateProgress1;
  48. };
  49. // 上传文件-视频
  50. let spInputFile2 = document.getElementById("uploadAddSP2");
  51. let spTheFile2;
  52. spInputFile2.onchange = function () {
  53. // 获取用户上传的文件对象
  54. spTheFile2 = spInputFile2.files;
  55. // 回显
  56. // 实例化一个文件读取器
  57. let fileReader = new FileReader();
  58. fileReader.onload = function () {
  59. let videoLineDataHtml = `<div class="HoutaiContainerDialogLine4VideoFile btn" id="HoutaiContainerDialogLine4VideoFile2">
  60. <div class="videoFileName">视频文件 ${spTheFile2[0].name}</div>
  61. <div class="delVideo">删除</div>
  62. </div>`;
  63. $("#HoutaiContainerDialogLine4RightAdd2").append(videoLineDataHtml);
  64. $("#HoutaiContainerDialogLine4AddSP2").hide();
  65. spFilesArr.push(spTheFile2[0]);
  66. // 功能-添加中删除-反差内容-视频
  67. $("#HoutaiContainerDialogLine4VideoFile2").on("click", function () {
  68. // console.log($(this).index());
  69. spFilesArr.splice($(this).index() - 1, 1);
  70. console.log(spFilesArr);
  71. this.remove();
  72. $("#HoutaiContainerDialogLine4AddSP2").show();
  73. $("#uploadNum2").text("进度: 0%");
  74. });
  75. };
  76. //读取文件
  77. fileReader.readAsDataURL(spTheFile2[0]);
  78. fileReader.onprogress = updateProgress2;
  79. // console.log(fileReader.onprogress);
  80. // $(".uploadNum").text(`进度: ${percentLoaded}%`)
  81. };
  82. // 上传文件-视频
  83. let spInputFile3 = document.getElementById("uploadAddSP3");
  84. let spTheFile3;
  85. spInputFile3.onchange = function () {
  86. // 获取用户上传的文件对象
  87. spTheFile3 = spInputFile3.files;
  88. // 回显
  89. // 实例化一个文件读取器
  90. let fileReader = new FileReader();
  91. fileReader.onload = function () {
  92. let videoLineDataHtml = `<div class="HoutaiContainerDialogLine4VideoFile btn" id="HoutaiContainerDialogLine4VideoFile3">
  93. <div class="videoFileName">视频文件 ${spTheFile3[0].name}</div>
  94. <div class="delVideo">删除</div>
  95. </div>`;
  96. $("#HoutaiContainerDialogLine4RightAdd3").append(videoLineDataHtml);
  97. $("#HoutaiContainerDialogLine4AddSP3").hide();
  98. spFilesArr.push(spTheFile3[0]);
  99. // 功能-添加中删除-反差内容-视频
  100. $("#HoutaiContainerDialogLine4VideoFile3").on("click", function () {
  101. console.log($(this).index());
  102. spFilesArr.splice($(this).index() - 1, 1);
  103. console.log(spFilesArr);
  104. this.remove();
  105. $("#HoutaiContainerDialogLine4AddSP3").show();
  106. $("#uploadNum3").text("进度: 0%");
  107. });
  108. };
  109. //读取文件
  110. fileReader.readAsDataURL(spTheFile3[0]);
  111. fileReader.onprogress = updateProgress3;
  112. };
  113. // 上传文件-视频
  114. let spInputFile4 = document.getElementById("uploadAddSP4");
  115. let spTheFile4;
  116. spInputFile4.onchange = function () {
  117. // 获取用户上传的文件对象
  118. spTheFile4 = spInputFile4.files;
  119. // 回显
  120. // 实例化一个文件读取器
  121. let fileReader = new FileReader();
  122. fileReader.onload = function () {
  123. let videoLineDataHtml = `<div class="HoutaiContainerDialogLine4VideoFile btn" id="HoutaiContainerDialogLine4VideoFile4">
  124. <div class="videoFileName">视频文件 ${spTheFile4[0].name}</div>
  125. <div class="delVideo">删除</div>
  126. </div>`;
  127. $("#HoutaiContainerDialogLine4RightAdd4").append(videoLineDataHtml);
  128. $("#HoutaiContainerDialogLine4AddSP4").hide();
  129. spFilesArr.push(spTheFile4[0]);
  130. // 功能-添加中删除-反差内容-视频
  131. $("#HoutaiContainerDialogLine4VideoFile4").on("click", function () {
  132. console.log($(this).index());
  133. spFilesArr.splice($(this).index() - 1, 1);
  134. console.log(spFilesArr);
  135. this.remove();
  136. $("#HoutaiContainerDialogLine4AddSP4").show();
  137. $("#uploadNum4").text("进度: 0%");
  138. });
  139. };
  140. //读取文件
  141. fileReader.readAsDataURL(spTheFile4[0]);
  142. fileReader.onprogress = updateProgress4;
  143. // console.log(fileReader.onprogress);
  144. // $(".uploadNum").text(`进度: ${percentLoaded}%`)
  145. };
  146. // 上传文件-视频
  147. let spInputFile5 = document.getElementById("uploadAddSP5");
  148. let spTheFile5;
  149. spInputFile5.onchange = function () {
  150. // 获取用户上传的文件对象
  151. spTheFile5 = spInputFile5.files;
  152. // 回显
  153. // 实例化一个文件读取器
  154. let fileReader = new FileReader();
  155. fileReader.onload = function () {
  156. let videoLineDataHtml = `<div class="HoutaiContainerDialogLine4VideoFile btn" id="HoutaiContainerDialogLine4VideoFile5">
  157. <div class="videoFileName">视频文件 ${spTheFile5[0].name}</div>
  158. <div class="delVideo">删除</div>
  159. </div>`;
  160. $("#HoutaiContainerDialogLine4RightAdd5").append(videoLineDataHtml);
  161. $("#HoutaiContainerDialogLine4AddSP5").hide();
  162. spFilesArr.push(spTheFile5[0]);
  163. // 功能-添加中删除-反差内容-视频
  164. $("#HoutaiContainerDialogLine4VideoFile5").on("click", function () {
  165. console.log($(this).index());
  166. spFilesArr.splice($(this).index() - 1, 1);
  167. console.log(spFilesArr);
  168. this.remove();
  169. $("#HoutaiContainerDialogLine4AddSP5").show();
  170. $("#uploadNum5").text("进度: 0%");
  171. });
  172. };
  173. //读取文件
  174. fileReader.readAsDataURL(spTheFile5[0]);
  175. fileReader.onprogress = updateProgress5;
  176. // console.log(fileReader.onprogress);
  177. // $(".uploadNum").text(`进度: ${percentLoaded}%`)
  178. };
  179. // 接口调用-数据获取-反差列表
  180. function getData() {
  181. $.ajax({
  182. type: "post",
  183. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminback/take_photo_on_street_list",
  184. dataType: "json",
  185. data: {
  186. type: "2",
  187. page: tabId,
  188. },
  189. success: function (res) {
  190. console.log(res);
  191. data = res.data;
  192. $(".SLHeader p").text(`抄底偷拍( ${res.all_num} )`);
  193. let AppleListHTML = "";
  194. $.each(data, function (index, value) {
  195. AppleListHTML += `
  196. <div id="${value.id}" class="HoutaiContainerBottomAppleListHeaders">
  197. <p class="HoutaiContainerBottomAppleListHeaderFM">`;
  198. if (value.top_img) {
  199. AppleListHTML += `<img src="${value.top_img}" alt="">`;
  200. }
  201. AppleListHTML += `</p>
  202. <p class="HoutaiContainerBottomAppleListHeaderBT">${value.title}</p>`;
  203. if (value.type == "0") {
  204. AppleListHTML += ` <p class="HoutaiContainerBottomAppleListHeaderNR chulizhong">待处理`;
  205. } else if (value.type == "1") {
  206. AppleListHTML += ` <p class="HoutaiContainerBottomAppleListHeaderNR chulizhong">处理中`;
  207. } else {
  208. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderNR">完成`;
  209. }
  210. AppleListHTML += `
  211. </p>
  212. <div class="HoutaiContainerBottomAppleListHeaderCZ">
  213. <p class="HoutaiContainerBottomAppleListHeaderCZck" type="${value.type}" url="${value.m3u8_url}">预览</p>
  214. <p class="HoutaiContainerBottomAppleListHeaderCZsc">删除</p>
  215. </div>
  216. </div>
  217. `;
  218. });
  219. $("#AppleList").html(AppleListHTML);
  220. },
  221. complete: function (res, status) {
  222. console.log(res);
  223. $("#page").paging({
  224. pageNo: tabId,
  225. totalPage: Math.ceil(res.responseJSON.all_num / 50),
  226. callback: function (num) {
  227. window.location.href =
  228. "https://api.9169kkxstzsjkdd222.app/tabBtn13?TabId=" + num;
  229. },
  230. });
  231. let index;
  232. // 功能-删除-反差内容-弹窗展示
  233. $(".HoutaiContainerBottomAppleListHeaderCZsc").on(
  234. "click",
  235. function () {
  236. id = $(this).parent().parent().attr("id");
  237. $(".HoutaiContainerDialogSC").show();
  238. }
  239. );
  240. // 功能-删除-反差内容-取消删除
  241. $(".HoutaiContainerDialogASCdvertLeft").on(
  242. "click",
  243. function () {
  244. $(".HoutaiContainerDialogSC").hide();
  245. }
  246. );
  247. // 功能-删除-反差内容-确定删除
  248. $(".HoutaiContainerDialogSCAdvertRight").on(
  249. "click",
  250. function () {
  251. $.ajax({
  252. type: "post",
  253. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminback/delete_take_photo",
  254. dataType: "json",
  255. data: {
  256. id: id,
  257. },
  258. success: function (res) {
  259. console.log(res);
  260. window.location.reload();
  261. },
  262. });
  263. }
  264. );
  265. // 功能-查看-反差内容-弹窗展示
  266. $(".HoutaiContainerBottomAppleListHeaderCZck").on(
  267. "click",
  268. function () {
  269. id = $(this).parent().parent().attr("id");
  270. index = $(this).parent().parent().index();
  271. let url = $(this).attr("url");
  272. let type = $(this).attr("type");
  273. if (type == "2") {
  274. let videoHTML = `
  275. <div>
  276. <div id="h5">
  277. <img class="toogleImg" src="/Public/Admin/img/end.png" alt="">
  278. </div>
  279. </div>
  280. <div class="HoutaiContainerDialogLine4Check">
  281. <p class="HoutaiContainerDialogLine4CheckBtn btn checkbtn" id="qr">确认</p>
  282. </div>
  283. `;
  284. $(".HoutaiContainerDialogDeputyCheck").html(videoHTML);
  285. let videoSrc = url;
  286. let videoImg = "";
  287. var md = new MuiPlayer({
  288. container: "#h5",
  289. title: "",
  290. // autoplay: true,
  291. initFullFixed: true,
  292. autoplay: false,
  293. themeColor: "#FF6A00",
  294. lang: "en",
  295. poster: videoImg,
  296. src: videoSrc,
  297. // src: 'https://www.9169slck.com/video/414958811/test/test.m3u8',
  298. parse: {
  299. type: "hls",
  300. loader: Hls,
  301. config: {
  302. debug: false,
  303. },
  304. },
  305. videoAttribute: [
  306. {
  307. attrKey: "webkit-playsinline",
  308. attrValue: "webkit-playsinline",
  309. },
  310. {
  311. attrKey: "playsinline",
  312. attrValue: "playsinline",
  313. },
  314. {
  315. attrKey: "x5-video-player-type",
  316. attrValue: "h5-page",
  317. },
  318. ],
  319. plugins: [
  320. new MuiPlayerMobilePlugin({
  321. key: "01F01D01G01I01F01H01H01K01C01J01F01J01D01H01K",
  322. showMenuButton: true,
  323. }),
  324. ],
  325. });
  326. md.on("ready", function () {
  327. $("#h5").show();
  328. $(".quanquan").hide();
  329. document.querySelector(
  330. ".mplayer-header"
  331. ).style.display = "none";
  332. md.on("seek-progress", function (e) {
  333. // console.log("names");
  334. md.video().play();
  335. });
  336. md.video().onended = function () {
  337. console.log("播放完成");
  338. // if (ad.video.currentTime > '33') {//视频时间,单位’秒‘,建议减1秒
  339. $("#mui-player").remove();
  340. };
  341. $(".toogleImg").on("click", function (e) {
  342. e.stopPropagation();
  343. console.log($(this).attr("src"));
  344. let toogleStatus = $(this).attr("src");
  345. if (toogleStatus == "/Public/Admin/img/end.png") {
  346. md.video().play();
  347. $(".toogleImg").attr(
  348. "src",
  349. "/Public/Admin/img/star.png"
  350. );
  351. } else {
  352. md.video().pause();
  353. $(".toogleImg").attr(
  354. "src",
  355. "/Public/Admin/img/end.png"
  356. );
  357. }
  358. });
  359. md.video().addEventListener(
  360. "playing",
  361. function () {
  362. $(".toogleImg").attr(
  363. "src",
  364. "/Public/Admin/img/star.png"
  365. );
  366. console.log("开始播放");
  367. md.toggleControls(false);
  368. }
  369. );
  370. md.video().addEventListener(
  371. "pause",
  372. function () {
  373. console.log("暂停播放");
  374. md.video().pause();
  375. $(".toogleImg").attr(
  376. "src",
  377. "/Public/Admin/img/end.png"
  378. );
  379. }
  380. );
  381. });
  382. $(".HoutaiContainerDialogCheck").show();
  383. // 功能-查看-反差内容-弹窗隐藏
  384. $(".HoutaiContainerDialogLine4CheckBtn").on(
  385. "click",
  386. function () {
  387. $(".HoutaiContainerDialogDeputyCheck").html("");
  388. $(".HoutaiContainerDialogCheck").hide();
  389. }
  390. );
  391. }
  392. }
  393. );
  394. },
  395. });
  396. }
  397. getData();
  398. // 功能-上传视频-打开上传视频窗口
  399. $("#SPImg1").on("click", function () {
  400. $("#uploadAddSP1").click();
  401. });
  402. // 功能-上传视频-打开上传视频窗口
  403. $("#SPImg2").on("click", function () {
  404. $("#uploadAddSP2").click();
  405. });
  406. // 功能-上传视频-打开上传视频窗口
  407. $("#SPImg3").on("click", function () {
  408. $("#uploadAddSP3").click();
  409. });
  410. // 功能-上传视频-打开上传视频窗口
  411. $("#SPImg4").on("click", function () {
  412. $("#uploadAddSP4").click();
  413. });
  414. // 功能-上传视频-打开上传视频窗口
  415. $("#SPImg5").on("click", function () {
  416. $("#uploadAddSP5").click();
  417. });
  418. // 功能-新增-反差内容-弹窗展示
  419. $(".SLHeaderCreate").on("click", function () {
  420. $(".HoutaiContainerDialogAdd").show();
  421. });
  422. // 功能-新增-反差内容-弹窗隐藏
  423. $(".HoutaiContainerDialogLine5LeftAdd").on("click", function () {
  424. $(".HoutaiContainerDialogAdd").hide();
  425. });
  426. // 功能-新增-反差内容-确认新增
  427. $(".HoutaiContainerDialogLine5RightAdd").on("click", function () {
  428. if ($(this).text() == "正在上传中") {
  429. alert("正在上传中!请耐心等待!!!");
  430. return;
  431. }
  432. $(this).text("正在上传中");
  433. $(this).css("background", "#575f6e");
  434. var formFile = new FormData();
  435. formFile.append(
  436. "title",
  437. `${$("#inputtext1").val()},${$("#inputtext2").val()},${$(
  438. "#inputtext3"
  439. ).val()},${$("#inputtext4").val()},${$("#inputtext5").val()}`
  440. );
  441. formFile.append("uploader", "2");
  442. formFile.append("token", "b8e3bb6ef8747d7");
  443. console.log(spFilesArr);
  444. for (let i in spFilesArr) {
  445. formFile.append("mp4[]", spFilesArr[i]);
  446. console.log(spFilesArr[i]);
  447. }
  448. $.ajax({
  449. type: "post",
  450. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminback/upload_video_new",
  451. dataType: "json",
  452. data: formFile,
  453. async: true,
  454. cache: false,
  455. contentType: false,
  456. processData: false,
  457. success: function (res) {
  458. // alert("添加成功");
  459. console.log(res);
  460. window.location.reload();
  461. },
  462. });
  463. });
  464. // 更新进度条
  465. function updateProgress1(e) {
  466. // e 是一个 ProgressEvent.
  467. if (e.lengthComputable) {
  468. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  469. // 更新进度条长度
  470. if (percentLoaded <= 100) {
  471. // progress.style.width = percentLoaded + "%";
  472. // progress.textContent = percentLoaded + "%";
  473. $(`#uploadNum1`).text(`进度: ${percentLoaded}%`);
  474. }
  475. }
  476. }
  477. function updateProgress2(e) {
  478. // e 是一个 ProgressEvent.
  479. if (e.lengthComputable) {
  480. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  481. // 更新进度条长度
  482. if (percentLoaded <= 100) {
  483. // progress.style.width = percentLoaded + "%";
  484. // progress.textContent = percentLoaded + "%";
  485. $(`#uploadNum2`).text(`进度: ${percentLoaded}%`);
  486. }
  487. }
  488. }
  489. function updateProgress3(e) {
  490. // e 是一个 ProgressEvent.
  491. if (e.lengthComputable) {
  492. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  493. // 更新进度条长度
  494. if (percentLoaded <= 100) {
  495. // progress.style.width = percentLoaded + "%";
  496. // progress.textContent = percentLoaded + "%";
  497. $(`#uploadNum3`).text(`进度: ${percentLoaded}%`);
  498. }
  499. }
  500. }
  501. function updateProgress4(e) {
  502. // e 是一个 ProgressEvent.
  503. if (e.lengthComputable) {
  504. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  505. // 更新进度条长度
  506. if (percentLoaded <= 100) {
  507. // progress.style.width = percentLoaded + "%";
  508. // progress.textContent = percentLoaded + "%";
  509. $(`#uploadNum4`).text(`进度: ${percentLoaded}%`);
  510. }
  511. }
  512. }
  513. function updateProgress5(e) {
  514. // e 是一个 ProgressEvent.
  515. if (e.lengthComputable) {
  516. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  517. // 更新进度条长度
  518. if (percentLoaded <= 100) {
  519. // progress.style.width = percentLoaded + "%";
  520. // progress.textContent = percentLoaded + "%";
  521. $(`#uploadNum5`).text(`进度: ${percentLoaded}%`);
  522. }
  523. }
  524. }
  525. });