tabBtn16.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047
  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("uploadVideo1");
  20. let spTheFile1;
  21. spInputFile1.onchange = function () {
  22. // 获取用户上传的文件对象
  23. spTheFile1 = spInputFile1.files;
  24. // 回显
  25. // 实例化一个文件读取器
  26. let fileReader = new FileReader();
  27. fileReader.onload = function () {
  28. spFilesArr.push(spTheFile1[0]);
  29. };
  30. //读取文件
  31. fileReader.readAsDataURL(spTheFile1[0]);
  32. fileReader.onprogress = updateProgress1;
  33. };
  34. let spInputFile2 = document.getElementById("uploadVideo2");
  35. let spTheFile2;
  36. spInputFile2.onchange = function () {
  37. // 获取用户上传的文件对象
  38. spTheFile2 = spInputFile2.files;
  39. // 回显
  40. // 实例化一个文件读取器
  41. let fileReader = new FileReader();
  42. fileReader.onload = function () {
  43. spFilesArr.push(spTheFile2[0]);
  44. };
  45. //读取文件
  46. fileReader.readAsDataURL(spTheFile2[0]);
  47. fileReader.onprogress = updateProgress2;
  48. };
  49. let spInputFile3 = document.getElementById("uploadVideo3");
  50. let spTheFile3;
  51. spInputFile3.onchange = function () {
  52. // 获取用户上传的文件对象
  53. spTheFile3 = spInputFile3.files;
  54. // 回显
  55. // 实例化一个文件读取器
  56. let fileReader = new FileReader();
  57. fileReader.onload = function () {
  58. spFilesArr.push(spTheFile3[0]);
  59. };
  60. //读取文件
  61. fileReader.readAsDataURL(spTheFile3[0]);
  62. fileReader.onprogress = updateProgress3;
  63. };
  64. let spInputFile4 = document.getElementById("uploadVideo4");
  65. let spTheFile4;
  66. spInputFile4.onchange = function () {
  67. // 获取用户上传的文件对象
  68. spTheFile4 = spInputFile4.files;
  69. // 回显
  70. // 实例化一个文件读取器
  71. let fileReader = new FileReader();
  72. fileReader.onload = function () {
  73. spFilesArr.push(spTheFile4[0]);
  74. };
  75. //读取文件
  76. fileReader.readAsDataURL(spTheFile4[0]);
  77. fileReader.onprogress = updateProgress4;
  78. };
  79. let spInputFile5 = document.getElementById("uploadVideo5");
  80. let spTheFile5;
  81. spInputFile5.onchange = function () {
  82. // 获取用户上传的文件对象
  83. spTheFile5 = spInputFile5.files;
  84. // 回显
  85. // 实例化一个文件读取器
  86. let fileReader = new FileReader();
  87. fileReader.onload = function () {
  88. spFilesArr.push(spTheFile5[0]);
  89. };
  90. //读取文件
  91. fileReader.readAsDataURL(spTheFile5[0]);
  92. fileReader.onprogress = updateProgress5;
  93. };
  94. let spInputFile6 = document.getElementById("uploadVideo6");
  95. let spTheFile6;
  96. spInputFile6.onchange = function () {
  97. // 获取用户上传的文件对象
  98. spTheFile6 = spInputFile6.files;
  99. // 回显
  100. // 实例化一个文件读取器
  101. let fileReader = new FileReader();
  102. fileReader.onload = function () {
  103. spFilesArr.push(spTheFile6[0]);
  104. };
  105. //读取文件
  106. fileReader.readAsDataURL(spTheFile6[0]);
  107. fileReader.onprogress = updateProgress6;
  108. };
  109. let spInputFile7 = document.getElementById("uploadVideo7");
  110. let spTheFile7;
  111. spInputFile7.onchange = function () {
  112. // 获取用户上传的文件对象
  113. spTheFile7 = spInputFile7.files;
  114. // 回显
  115. // 实例化一个文件读取器
  116. let fileReader = new FileReader();
  117. fileReader.onload = function () {
  118. spFilesArr.push(spTheFile7[0]);
  119. };
  120. //读取文件
  121. fileReader.readAsDataURL(spTheFile7[0]);
  122. fileReader.onprogress = updateProgress7;
  123. };
  124. let spInputFile8 = document.getElementById("uploadVideo8");
  125. let spTheFile8;
  126. spInputFile8.onchange = function () {
  127. // 获取用户上传的文件对象
  128. spTheFile8 = spInputFile8.files;
  129. // 回显
  130. // 实例化一个文件读取器
  131. let fileReader = new FileReader();
  132. fileReader.onload = function () {
  133. spFilesArr.push(spTheFile8[0]);
  134. };
  135. //读取文件
  136. fileReader.readAsDataURL(spTheFile8[0]);
  137. fileReader.onprogress = updateProgress8;
  138. };
  139. let spInputFile9 = document.getElementById("uploadVideo9");
  140. let spTheFile9;
  141. spInputFile9.onchange = function () {
  142. // 获取用户上传的文件对象
  143. spTheFile9 = spInputFile9.files;
  144. // 回显
  145. // 实例化一个文件读取器
  146. let fileReader = new FileReader();
  147. fileReader.onload = function () {
  148. spFilesArr.push(spTheFile9[0]);
  149. };
  150. //读取文件
  151. fileReader.readAsDataURL(spTheFile9[0]);
  152. fileReader.onprogress = updateProgress9;
  153. };
  154. // 上传文件-图片
  155. // let tpInputFile1 = document.getElementById("uploadImg1");
  156. // let tpTheFile1;
  157. // tpInputFile1.onchange = function () {
  158. // // 获取用户上传的文件对象
  159. // tpTheFile1 = tpInputFile1.files;
  160. // // 实例化一个文件读取器
  161. // let fileReader = new FileReader();
  162. // // 文件读取器方法执行完毕后调用函数
  163. // fileReader.onload = function () {
  164. // $("#TPImg1").attr("src", fileReader.result);
  165. // tpFilesArr.push(tpTheFile1[0]);
  166. // };
  167. // // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL
  168. // fileReader.readAsDataURL(tpTheFile1[0]);
  169. // // 获取用户上传的文件对象
  170. // tpTheFile1 = tpInputFile1.files;
  171. // //获取选择图片的个数
  172. // let length = tpTheFileRevise.length;
  173. // // 回显
  174. // for (let i = 0; i < length; i++) {
  175. // // 实例化一个文件读取器
  176. // let fileReader = new FileReader();
  177. // fileReader.onload = function () {
  178. // tpFilesNumRevise++;
  179. // let imgDataHtml = `<div class="HoutaiContainerDialogLine3ImgFile">
  180. // <img class="HoutaiContainerDialogTPImg" src="${fileReader.result}" alt="">
  181. // <div class="delImg btn" id="delImg${tpFilesNumRevise}">删除</div>
  182. // </div>`;
  183. // $(".HoutaiContainerDialogLine3ReviseImg").before(imgDataHtml);
  184. // tpFilesArrRevise.push(tpTheFileRevise[i]);
  185. // console.log(tpFilesArrRevise);
  186. // // 功能-添加中删除-反差内容-视频
  187. // $("#delImg" + tpFilesNumRevise).on("click", function () {
  188. // tpFilesArrRevise.splice($(this).parent().index(), 1);
  189. // console.log(tpFilesArrRevise);
  190. // $(this).parent().remove();
  191. // });
  192. // };
  193. // //读取文件
  194. // fileReader.readAsDataURL(tpTheFileRevise[i]);
  195. // }
  196. // };
  197. // 上传文件-图片
  198. let tpFilesNum = 0;
  199. let tpallUploaderNum = 0;
  200. let tpInputFile = document.getElementById("uploadImg1");
  201. let tpTheFile;
  202. let tpFilesArr = [];
  203. let TpFilesArrChild = [];
  204. tpInputFile.addEventListener('change', function () {
  205. tpTheFile = [];
  206. // 获取用户上传的文件对象
  207. tpTheFile = tpInputFile.files;
  208. //获取选择图片的个数
  209. let length = tpTheFile.length;
  210. tpallUploaderNum += length;
  211. if (length > 9) {
  212. alert("超过图片上传最大数量");
  213. return
  214. } else {
  215. for (let j = 0; j < tpTheFile.length; j++) {
  216. const file = tpTheFile[j];
  217. TpFilesArrChild.push(file);
  218. };
  219. // console.log(TpFilesArrChild);
  220. if (TpFilesArrChild.length > 9) {
  221. tpFilesArr = TpFilesArrChild.slice(-9);
  222. } else {
  223. tpFilesArr = TpFilesArrChild;
  224. }
  225. // console.log(tpFilesArr);
  226. $(".HoutaiContainerDialogLine3ImgFile").remove();
  227. for (let i = 0; i < tpFilesArr.length; i++) {
  228. // 实例化一个文件读取器
  229. let fileReader = new FileReader();
  230. fileReader.onload = function () {
  231. // console.log(tpFilesArr.slice(0, 9));
  232. // console.log(tpFilesArr.length);
  233. // console.log(tpallUploaderNum);
  234. // tpFilesNum++;
  235. // console.log(fileReader.result);
  236. // if (tpallUploaderNum > 9) {
  237. // tpFilesArr.splice(tpFilesNum % 9, 1, tpTheFile[i]);
  238. // $("#HoutaiContainerDialogTPImg" + tpFilesNum % 9).attr("src", fileReader.result);
  239. // }4
  240. // console.log(tpFilesArr);
  241. // if (tpFilesArr.length >= 9) {
  242. // $("#uploaderImgContent").hide();
  243. // } else {
  244. // tpFilesArr.push(tpTheFile[i]);
  245. let imgDataHtml = `<div class="HoutaiContainerDialogLine3ImgFile">
  246. <img id="HoutaiContainerDialogTPImg${tpFilesNum}" class="HoutaiContainerDialogTPImg" src="${fileReader.result}" alt="">
  247. <!-- <div sclass="delImg btn" id="delImg${tpFilesNum}">删除</div> -->
  248. </div>`;
  249. $(".uploadImgCard").before(imgDataHtml);
  250. // }
  251. // console.log(tpFilesArr);
  252. // 功能-添加中删除-反差内容-视频
  253. // $("#delImg" + tpFilesNum).on("click", function () {
  254. // tpallUploaderNum-=1;
  255. // console.log(tpallUploaderNum);
  256. // tpFilesArr.splice($(this).parent().index(), 1);
  257. // console.log(tpFilesArr);
  258. // $(this).parent().remove();
  259. // tpFilesArr.length<9?$("#uploaderImgContent").show():"";
  260. // });
  261. };
  262. //读取文件
  263. fileReader.readAsDataURL(tpFilesArr[i]);
  264. }
  265. }
  266. // console.log(length);
  267. // 回显
  268. // console.log(tpFilesArr, "names");
  269. });
  270. // let tpInputFile2 = document.getElementById("uploadImg2");
  271. // let tpTheFile2;
  272. // tpInputFile2.onchange = function () {
  273. // // 获取用户上传的文件对象
  274. // tpTheFile2 = tpInputFile2.files;
  275. // // 实例化一个文件读取器
  276. // let fileReader = new FileReader();
  277. // // 文件读取器方法执行完毕后调用函数
  278. // fileReader.onload = function () {
  279. // $("#TPImg2").attr("src", fileReader.result);
  280. // tpFilesArr.push(tpTheFile2[0]);
  281. // };
  282. // // 将用户上传的文件对象作为参数,传入文件读取器的方法readAsDateURL
  283. // fileReader.readAsDataURL(tpTheFile2[0]);
  284. // };
  285. // 功能-上传视频-打开上传视频窗口
  286. $("#SPImg1").on("click", function () {
  287. if (tpFilesArr.length > 0) {
  288. alert("不能同时添加,图片+视频,请重新上传");
  289. } else {
  290. $("#uploadVideo1").click();
  291. }
  292. });
  293. // 功能-上传视频-打开上传视频窗口
  294. $("#SPImg2").on("click", function () {
  295. if (tpFilesArr.length > 0) {
  296. alert("不能同时添加,图片+视频,请重新上传");
  297. } else {
  298. $("#uploadVideo2").click();
  299. }
  300. });
  301. // 功能-上传视频-打开上传视频窗口
  302. $("#SPImg3").on("click", function () {
  303. if (tpFilesArr.length > 0) {
  304. alert("不能同时添加,图片+视频,请重新上传");
  305. } else {
  306. $("#uploadVideo3").click();
  307. }
  308. });
  309. // 功能-上传视频-打开上传视频窗口
  310. $("#SPImg4").on("click", function () {
  311. if (tpFilesArr.length > 0) {
  312. alert("不能同时添加,图片+视频,请重新上传");
  313. } else {
  314. $("#uploadVideo4").click();
  315. }
  316. });
  317. // 功能-上传视频-打开上传视频窗口
  318. $("#SPImg5").on("click", function () {
  319. if (tpFilesArr.length > 0) {
  320. alert("不能同时添加,图片+视频,请重新上传");
  321. } else {
  322. $("#uploadVideo5").click();
  323. }
  324. });
  325. // 功能-上传视频-打开上传视频窗口
  326. $("#SPImg6").on("click", function () {
  327. if (tpFilesArr.length > 0) {
  328. alert("不能同时添加,图片+视频,请重新上传");
  329. } else {
  330. $("#uploadVideo6").click();
  331. }
  332. });
  333. // 功能-上传视频-打开上传视频窗口
  334. $("#SPImg7").on("click", function () {
  335. if (tpFilesArr.length > 0) {
  336. alert("不能同时添加,图片+视频,请重新上传");
  337. } else {
  338. $("#uploadVideo7").click();
  339. }
  340. });
  341. // 功能-上传视频-打开上传视频窗口
  342. $("#SPImg8").on("click", function () {
  343. if (tpFilesArr.length > 0) {
  344. alert("不能同时添加,图片+视频,请重新上传");
  345. } else {
  346. $("#uploadVideo8").click();
  347. }
  348. });
  349. // 功能-上传视频-打开上传视频窗口
  350. $("#SPImg9").on("click", function () {
  351. if (tpFilesArr.length > 0) {
  352. alert("不能同时添加,图片+视频,请重新上传");
  353. } else {
  354. $("#uploadVideo9").click();
  355. }
  356. });
  357. // 功能-上传图片-打开上传图片窗口
  358. $("#TPImg1").on("click", function () {
  359. if (spFilesArr.length > 0) {
  360. alert("不能同时添加,图片+视频,请重新上传");
  361. } else {
  362. $("#uploadImg1").click();
  363. }
  364. });
  365. // // 功能-上传图片-打开上传图片窗口
  366. // $("#TPImg2").on("click", function () {
  367. // $("#uploadImg2").click();
  368. // });
  369. // // 功能-上传图片-打开上传图片窗口
  370. // $("#TPImg3").on("click", function () {
  371. // $("#uploadImg3").click();
  372. // });
  373. // // 功能-上传图片-打开上传图片窗口
  374. // $("#TPImg4").on("click", function () {
  375. // $("#uploadImg4").click();
  376. // });
  377. // // 功能-上传图片-打开上传图片窗口
  378. // $("#TPImg5").on("click", function () {
  379. // $("#uploadImg5").click();
  380. // });
  381. // // 功能-上传图片-打开上传图片窗口
  382. // $("#TPImg6").on("click", function () {
  383. // $("#uploadImg6").click();
  384. // });
  385. // // 功能-上传图片-打开上传图片窗口
  386. // $("#TPImg7").on("click", function () {
  387. // $("#uploadImg7").click();
  388. // });
  389. // // 功能-上传图片-打开上传图片窗口
  390. // $("#TPImg8").on("click", function () {
  391. // $("#uploadImg8").click();
  392. // });
  393. // // 功能-上传图片-打开上传图片窗口
  394. // $("#TPImg9").on("click", function () {
  395. // $("#uploadImg9").click();
  396. // });
  397. // 功能-修改图片-修改上传图片
  398. $("#GTPImg1").on("click", function () {
  399. $("#uploadImg1").click();
  400. });
  401. // // 功能-修改图片-修改上传图片
  402. // $("#GTPImg2").on("click", function () {
  403. // $("#uploadImg2").click();
  404. // });
  405. // // 功能-修改图片-修改上传图片
  406. // $("#GTPImg3").on("click", function () {
  407. // $("#uploadImg3").click();
  408. // });
  409. // // 功能-修改图片-修改上传图片
  410. // $("#GTPImg4").on("click", function () {
  411. // $("#uploadImg4").click();
  412. // });
  413. // // 功能-修改图片-修改上传图片
  414. // $("#GTPImg5").on("click", function () {
  415. // $("#uploadImg5").click();
  416. // });
  417. // // 功能-修改图片-修改上传图片
  418. // $("#GTPImg6").on("click", function () {
  419. // $("#uploadImg6").click();
  420. // });
  421. // // 功能-修改图片-修改上传图片
  422. // $("#GTPImg7").on("click", function () {
  423. // $("#uploadImg7").click();
  424. // });
  425. // // 功能-修改图片-修改上传图片
  426. // $("#GTPImg8").on("click", function () {
  427. // $("#uploadImg8").click();
  428. // });
  429. // // 功能-修改图片-修改上传图片
  430. // $("#GTPImg9").on("click", function () {
  431. // $("#uploadImg9").click();
  432. // });
  433. // 更新进度条
  434. function updateProgress1(e) {
  435. // e 是一个 ProgressEvent.
  436. if (e.lengthComputable) {
  437. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  438. // 更新进度条长度
  439. if (percentLoaded <= 100) {
  440. $(`#uploadNum1`).text(`进度: ${percentLoaded}%`);
  441. }
  442. if (percentLoaded == 100) {
  443. $("#uploadNum1").addClass("uploadDel");
  444. $("#uploadNum1").text("删除");
  445. // 功能-添加中删除-反差内容-视频
  446. $("#uploadNum1").on("click", function () {
  447. console.log($(this).parent().index());
  448. spFilesArr.splice($(this).parent().index(), 1);
  449. console.log(spFilesArr);
  450. $(this).text("进度: 0%");
  451. $(this).removeClass("uploadDel");
  452. });
  453. }
  454. }
  455. }
  456. function updateProgress2(e) {
  457. // e 是一个 ProgressEvent.
  458. if (e.lengthComputable) {
  459. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  460. // 更新进度条长度
  461. if (percentLoaded <= 100) {
  462. $(`#uploadNum2`).text(`进度: ${percentLoaded}%`);
  463. }
  464. if (percentLoaded == 100) {
  465. $("#uploadNum2").addClass("uploadDel");
  466. $("#uploadNum2").text("删除");
  467. // 功能-添加中删除-反差内容-视频
  468. $("#uploadNum2").on("click", function () {
  469. console.log($(this).parent().index());
  470. spFilesArr.splice($(this).parent().index(), 1);
  471. console.log(spFilesArr);
  472. $(this).text("进度: 0%");
  473. $(this).removeClass("uploadDel");
  474. });
  475. }
  476. }
  477. }
  478. function updateProgress3(e) {
  479. // e 是一个 ProgressEvent.
  480. if (e.lengthComputable) {
  481. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  482. // 更新进度条长度
  483. if (percentLoaded <= 100) {
  484. $(`#uploadNum3`).text(`进度: ${percentLoaded}%`);
  485. }
  486. if (percentLoaded == 100) {
  487. $("#uploadNum3").addClass("uploadDel");
  488. $("#uploadNum3").text("删除");
  489. // 功能-添加中删除-反差内容-视频
  490. $("#uploadNum3").on("click", function () {
  491. // console.log($(this).parent().index());
  492. spFilesArr.splice($(this).parent().index(), 1);
  493. // console.log(spFilesArr);
  494. $(this).text("进度: 0%");
  495. $(this).removeClass("uploadDel");
  496. });
  497. }
  498. }
  499. }
  500. function updateProgress4(e) {
  501. // e 是一个 ProgressEvent.
  502. if (e.lengthComputable) {
  503. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  504. // 更新进度条长度
  505. if (percentLoaded <= 100) {
  506. $(`#uploadNum4`).text(`进度: ${percentLoaded}%`);
  507. }
  508. if (percentLoaded == 100) {
  509. $("#uploadNum4").addClass("uploadDel");
  510. $("#uploadNum4").text("删除");
  511. // 功能-添加中删除-反差内容-视频
  512. $("#uploadNum4").on("click", function () {
  513. console.log($(this).parent().index());
  514. spFilesArr.splice($(this).parent().index(), 1);
  515. console.log(spFilesArr);
  516. $(this).text("进度: 0%");
  517. $(this).removeClass("uploadDel");
  518. });
  519. }
  520. }
  521. }
  522. function updateProgress5(e) {
  523. // e 是一个 ProgressEvent.
  524. if (e.lengthComputable) {
  525. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  526. // 更新进度条长度
  527. if (percentLoaded <= 100) {
  528. $(`#uploadNum5`).text(`进度: ${percentLoaded}%`);
  529. }
  530. if (percentLoaded == 100) {
  531. $("#uploadNum5").addClass("uploadDel");
  532. $("#uploadNum5").text("删除");
  533. // 功能-添加中删除-反差内容-视频
  534. $("#uploadNum5").on("click", function () {
  535. console.log($(this).parent().index());
  536. spFilesArr.splice($(this).parent().index(), 1);
  537. console.log(spFilesArr);
  538. $(this).text("进度: 0%");
  539. $(this).removeClass("uploadDel");
  540. });
  541. }
  542. }
  543. }
  544. function updateProgress6(e) {
  545. // e 是一个 ProgressEvent.
  546. if (e.lengthComputable) {
  547. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  548. // 更新进度条长度
  549. if (percentLoaded <= 100) {
  550. $(`#uploadNum6`).text(`进度: ${percentLoaded}%`);
  551. }
  552. if (percentLoaded == 100) {
  553. $("#uploadNum6").addClass("uploadDel");
  554. $("#uploadNum6").text("删除");
  555. // 功能-添加中删除-反差内容-视频
  556. $("#uploadNum6").on("click", function () {
  557. console.log($(this).parent().index());
  558. spFilesArr.splice($(this).parent().index(), 1);
  559. console.log(spFilesArr);
  560. $(this).text("进度: 0%");
  561. $(this).removeClass("uploadDel");
  562. });
  563. }
  564. }
  565. }
  566. function updateProgress7(e) {
  567. // e 是一个 ProgressEvent.
  568. if (e.lengthComputable) {
  569. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  570. // 更新进度条长度
  571. if (percentLoaded <= 100) {
  572. $(`#uploadNum7`).text(`进度: ${percentLoaded}%`);
  573. }
  574. if (percentLoaded == 100) {
  575. $("#uploadNum7").addClass("uploadDel");
  576. $("#uploadNum7").text("删除");
  577. // 功能-添加中删除-反差内容-视频
  578. $("#uploadNum7").on("click", function () {
  579. console.log($(this).parent().index());
  580. spFilesArr.splice($(this).parent().index(), 1);
  581. console.log(spFilesArr);
  582. $(this).text("进度: 0%");
  583. $(this).removeClass("uploadDel");
  584. });
  585. }
  586. }
  587. }
  588. function updateProgress8(e) {
  589. // e 是一个 ProgressEvent.
  590. if (e.lengthComputable) {
  591. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  592. // 更新进度条长度
  593. if (percentLoaded <= 100) {
  594. $(`#uploadNum8`).text(`进度: ${percentLoaded}%`);
  595. }
  596. if (percentLoaded == 100) {
  597. $("#uploadNum8").addClass("uploadDel");
  598. $("#uploadNum8").text("删除");
  599. // 功能-添加中删除-反差内容-视频
  600. $("#uploadNum8").on("click", function () {
  601. console.log($(this).parent().index());
  602. spFilesArr.splice($(this).parent().index(), 1);
  603. console.log(spFilesArr);
  604. $(this).text("进度: 0%");
  605. $(this).removeClass("uploadDel");
  606. });
  607. }
  608. }
  609. }
  610. function updateProgress9(e) {
  611. // e 是一个 ProgressEvent.
  612. if (e.lengthComputable) {
  613. var percentLoaded = Math.round((e.loaded / e.total) * 100);
  614. // 更新进度条长度
  615. if (percentLoaded <= 100) {
  616. $(`#uploadNum9`).text(`进度: ${percentLoaded}%`);
  617. }
  618. if (percentLoaded == 100) {
  619. $("#uploadNum9").addClass("uploadDel");
  620. $("#uploadNum9").text("删除");
  621. // 功能-添加中删除-反差内容-视频
  622. $("#uploadNum9").on("click", function () {
  623. console.log($(this).parent().index());
  624. spFilesArr.splice($(this).parent().index(), 1);
  625. console.log(spFilesArr);
  626. $(this).text("进度: 0%");
  627. $(this).removeClass("uploadDel");
  628. });
  629. }
  630. }
  631. }
  632. // 功能-新增-反差内容-弹窗展示
  633. $(".SLHeaderCreate").on("click", function () {
  634. $(".HoutaiContainerDialogAdd").show();
  635. });
  636. // 功能-新增-反差内容-弹窗隐藏
  637. $(".HoutaiContainerDialogLine5LeftAdd").on("click", function () {
  638. tpFilesArr = [];
  639. TpFilesArrChild = [];
  640. $(".HoutaiContainerDialogLine3ImgFile").remove();
  641. $(".HoutaiContainerDialogAdd").hide();
  642. });
  643. // 功能-新增-反差内容-确认新增
  644. $(".HoutaiContainerDialogLine5RightAdd").on("click", function () {
  645. console.log(tpFilesArr);
  646. if (!$("#inputtext1").val()) {
  647. alert("请输入标题");
  648. } else if (spFilesArr.length == 0 && tpFilesArr.length == 0) {
  649. alert("请上传文件");
  650. } else {
  651. if ($(this).text() == "正在上传中") {
  652. alert("正在上传中!请耐心等待!!!");
  653. return;
  654. }
  655. $(this).text("正在上传中");
  656. $(this).css("background", "#575f6e");
  657. var formFile = new FormData();
  658. formFile.append("title", $("#inputtext1").val());
  659. formFile.append("uploader", "4");
  660. formFile.append("token", "b8e3bb6ef8747d7");
  661. console.log(spFilesArr);
  662. for (let i in spFilesArr) {
  663. formFile.append("mp4[]", spFilesArr[i]);
  664. console.log(spFilesArr[i]);
  665. }
  666. console.log(tpFilesArr);
  667. for (let i in tpFilesArr) {
  668. formFile.append("img[]", tpFilesArr[i]);
  669. console.log(tpFilesArr[i]);
  670. }
  671. for (let value of formFile.values()) {
  672. console.log(value);
  673. }
  674. $.ajax({
  675. type: "post",
  676. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/pengyouquan_add",
  677. dataType: "json",
  678. data: formFile,
  679. async: true,
  680. cache: false,
  681. contentType: false,
  682. processData: false,
  683. success: function (res) {
  684. // alert("添加成功");
  685. console.log(res);
  686. window.location.reload();
  687. },
  688. });
  689. }
  690. });
  691. // 接口调用-数据获取-反差列表
  692. function getData() {
  693. $.ajax({
  694. type: "post",
  695. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/take_photo_on_street_list",
  696. dataType: "json",
  697. data: {
  698. type: "4",
  699. page: tabId,
  700. },
  701. success: function (res) {
  702. console.log(res);
  703. data = res.data;
  704. $(".SLHeader p").text(`牛逼( ${res.all_num} )`);
  705. let AppleListHTML = "";
  706. $.each(data, function (index, value) {
  707. let splitImgArray = [];
  708. let splitTopImgArray = [];
  709. let splitVideoArray = [];
  710. let splitTopVideoArray = [];
  711. let TongjiLength;
  712. if (value.img_url) {
  713. if (value.img_url) {
  714. splitImgArray = value.img_url.split(",");
  715. }
  716. if (splitImgArray.length < 9) {
  717. TongjiLength = 9 - splitImgArray.length;
  718. }
  719. if (value.top_img) {
  720. splitTopImgArray = value.top_img.split(",");
  721. }
  722. for (let i = 0; i < TongjiLength; i++) {
  723. splitImgArray.push("");
  724. splitTopImgArray.push("");
  725. }
  726. } else if (value.m3u8_url) {
  727. if (value.m3u8_url != "") {
  728. splitVideoArray = value.m3u8_url.split(",");
  729. }
  730. if (splitVideoArray.length < 9) {
  731. TongjiLength = 9 - splitVideoArray.length;
  732. }
  733. if (value.top_img) {
  734. splitTopVideoArray = value.top_img.split(",");
  735. } else {
  736. for (let i = 0; i < 9; i++) {
  737. splitVideoArray.push("");
  738. }
  739. }
  740. for (let i = 0; i < TongjiLength; i++) {
  741. splitVideoArray.push("");
  742. splitTopVideoArray.push("");
  743. }
  744. }
  745. AppleListHTML += `
  746. <div id="${value.id}" class="HoutaiContainerBottomAppleListHeaders">`;
  747. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderBT">${value.title}</p>`;
  748. // AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderxiazai">${value.down_num}</p>`;
  749. if (value.img_url) {
  750. if (value.top_img == "") {
  751. for (let i = 0; i < 9; i++) {
  752. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderVideo"></p>`;
  753. }
  754. } else {
  755. $.each(splitTopImgArray, function (i, value1) {
  756. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderTP1" imgurl="${value1}">${value1
  757. ? `<img src="${value1}" alt="">`
  758. : ""
  759. }</p>`;
  760. })
  761. }
  762. } else if (value.m3u8_url) {
  763. $.each(splitTopVideoArray, function (i, value1) {
  764. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderVideo" m3u8="${splitVideoArray[i]}">${value1
  765. ? `<img src="${value1}" alt="">`
  766. : ""
  767. }</p>`;
  768. })
  769. } else {
  770. for (let i = 0; i < 9; i++) {
  771. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderVideo"></p>`;
  772. }
  773. }
  774. if (value.type == "0") {
  775. AppleListHTML += ` <p class="HoutaiContainerBottomAppleListHeaderNR chulizhong">待处理`;
  776. } else if (value.type == "1") {
  777. AppleListHTML += ` <p class="HoutaiContainerBottomAppleListHeaderNR chulizhong">处理中`;
  778. } else {
  779. AppleListHTML += `<p class="HoutaiContainerBottomAppleListHeaderNR">完成`;
  780. }
  781. AppleListHTML += `
  782. </p>
  783. <div class="HoutaiContainerBottomAppleListHeaderCZ">
  784. <p class="HoutaiContainerBottomAppleListHeaderCZsc">删除</p>
  785. </div>
  786. </div>
  787. `;
  788. });
  789. $("#AppleList").html(AppleListHTML);
  790. },
  791. complete: function (res, status) {
  792. console.log(res);
  793. $("#page").paging({
  794. pageNo: tabId,
  795. totalPage: Math.ceil(res.responseJSON.all_num / 50),
  796. callback: function (num) {
  797. window.location.href =
  798. "https://api.9169kkxstzsjkdd222.app/tabBtn16?TabId=" + num;
  799. },
  800. });
  801. // 看图||看视频
  802. $(".HoutaiContainerBottomAppleListHeaderTP1").on("click", function () {
  803. let type = $(this).attr("type");
  804. // if (type == 1) {
  805. if ($(this).attr("imgurl")) {
  806. $(".bannerImgBJ").show();
  807. let imgurl = $(this).attr("imgurl");
  808. $(".bannerImg").attr("src", imgurl);
  809. }
  810. });
  811. $(".HoutaiContainerBottomAppleListHeaderVideo").on("click", function () {
  812. if ($(this).attr("m3u8")) {
  813. let url = $(this).attr("m3u8");
  814. player(url);
  815. }
  816. // let type = $(this).attr("type");
  817. })
  818. $(".bannerImgBJ").on("click", function () {
  819. $(this).fadeOut(300);
  820. });
  821. // 功能-删除-反差内容-弹窗展示
  822. $(".HoutaiContainerBottomAppleListHeaderCZsc").on(
  823. "click",
  824. function () {
  825. id = $(this).parent().parent().attr("id");
  826. $(".HoutaiContainerDialogSC").show();
  827. }
  828. );
  829. // 功能-删除-反差内容-取消删除
  830. $(".HoutaiContainerDialogASCdvertLeft").on(
  831. "click",
  832. function () {
  833. $(".HoutaiContainerDialogSC").hide();
  834. }
  835. );
  836. // 功能-删除-反差内容-确定删除
  837. $(".HoutaiContainerDialogSCAdvertRight").on(
  838. "click",
  839. function () {
  840. $.ajax({
  841. type: "post",
  842. url: "https://api.9169kkxstzsjkdd222.app/Admin/Adminbackonenine/delete_cowb_data",
  843. dataType: "json",
  844. data: {
  845. id: id,
  846. },
  847. success: function (res) {
  848. console.log(res);
  849. window.location.reload();
  850. },
  851. });
  852. }
  853. );
  854. },
  855. });
  856. }
  857. getData();
  858. function player(url) {
  859. let videoHTML = `
  860. <div>
  861. <div id="h5">
  862. <img class="toogleImg" src="./Public/Admin/img/end.png" alt="">
  863. </div>
  864. </div>
  865. <div class="HoutaiContainerDialogLine4Check">
  866. <p class="HoutaiContainerDialogLine4CheckBtn btn checkbtn" id="qr">确认</p>
  867. </div>
  868. `;
  869. $(".HoutaiContainerDialogDeputyCheck").html(
  870. videoHTML
  871. );
  872. let videoSrc = url;
  873. let videoImg = "";
  874. var md = new MuiPlayer({
  875. container: "#h5",
  876. title: "",
  877. // autoplay: true,
  878. initFullFixed: true,
  879. autoplay: false,
  880. themeColor: "#FF6A00",
  881. lang: "en",
  882. poster: videoImg,
  883. src: videoSrc,
  884. // src: 'https://www.9169slck.com/video/414958811/test/test.m3u8',
  885. parse: {
  886. type: "hls",
  887. loader: Hls,
  888. config: {
  889. debug: false,
  890. },
  891. },
  892. videoAttribute: [
  893. {
  894. attrKey: "webkit-playsinline",
  895. attrValue: "webkit-playsinline",
  896. },
  897. {
  898. attrKey: "playsinline",
  899. attrValue: "playsinline",
  900. },
  901. {
  902. attrKey: "x5-video-player-type",
  903. attrValue: "h5-page",
  904. },
  905. ],
  906. // plugins: [
  907. // new MuiPlayerMobilePlugin({
  908. // key: "01F01D01G01I01F01H01H01K01C01J01F01J01D01H01K",
  909. // showMenuButton: true,
  910. // }),
  911. // ],
  912. });
  913. md.on("ready", function () {
  914. $("#h5").show();
  915. $(".quanquan").hide();
  916. document.querySelector(
  917. ".mplayer-header"
  918. ).style.display = "none";
  919. md.on("seek-progress", function (e) {
  920. // console.log("names");
  921. md.video().play();
  922. });
  923. md.video().onended = function () {
  924. // console.log("播放完成");
  925. $("#mui-player").remove();
  926. };
  927. $(".toogleImg").on("click", function (e) {
  928. e.stopPropagation();
  929. console.log($(this).attr("src"));
  930. let toogleStatus = $(this).attr("src");
  931. if (
  932. toogleStatus ==
  933. "./Public/Admin/img/end.png"
  934. ) {
  935. md.video().play();
  936. $(".toogleImg").attr(
  937. "src",
  938. "./Public/Admin/img/star.png"
  939. );
  940. } else {
  941. md.video().pause();
  942. $(".toogleImg").attr(
  943. "src",
  944. "./Public/Admin/img/end.png"
  945. );
  946. }
  947. });
  948. md.video().addEventListener(
  949. "playing",
  950. function () {
  951. $(".toogleImg").attr(
  952. "src",
  953. "./Public/Admin/img/star.png"
  954. );
  955. console.log("开始播放");
  956. md.toggleControls(false);
  957. }
  958. );
  959. md.video().addEventListener(
  960. "pause",
  961. function () {
  962. console.log("暂停播放");
  963. md.video().pause();
  964. $(".toogleImg").attr(
  965. "src",
  966. "./Public/Admin/img/end.png"
  967. );
  968. }
  969. );
  970. });
  971. $(".HoutaiContainerDialogCheck").show();
  972. // 功能-查看-反差内容-弹窗隐藏
  973. $(".HoutaiContainerDialogLine4CheckBtn").on(
  974. "click",
  975. function () {
  976. $(
  977. ".HoutaiContainerDialogDeputyCheck"
  978. ).html("");
  979. $(".HoutaiContainerDialogCheck").hide();
  980. }
  981. );
  982. }
  983. // }
  984. });