tabBtn15.js 24 KB

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