my-video.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. $(function () {
  2. initOther();
  3. search(1, true, false);
  4. });
  5. /**
  6. * 初始化其他操作
  7. */
  8. function initOther() {
  9. $(".slideDown-btn").click(function () {
  10. var display = $('.slideDown-box');
  11. if (display.css('display') == 'block') {
  12. display.slideUp("slow");
  13. $(this).html('展开 <i class="fa fa-angle-down"></i>');
  14. } else {
  15. display.slideDown("slow");
  16. $(this).html('收起 <i class="fa fa-angle-up"></i>');
  17. }
  18. });
  19. $("#searchbutton").click(function () {
  20. search(1, false, false);
  21. });
  22. $("#shaixuan").click(function () {
  23. $("#wd").val("");
  24. search(1, false, false);
  25. });
  26. $("#wd").keydown(function (e) {
  27. if (e.keyCode == 13) {
  28. search(1, false, false);
  29. }
  30. });
  31. $(".dropdown-box").find("li").click(function () {
  32. $("#bigType").text($(this).text());
  33. $("#bigType").attr("prepath", $(this).attr("prepath"));
  34. $(".dropdown-box").attr("style", "display: none;");
  35. getQueryHeaderInfo($("#bigType").text(), false, true);
  36. search(1, false, true);
  37. });
  38. $(".dropdown-hover").mouseover(function () {
  39. $(".dropdown-box").attr("style", "display: block;");
  40. });
  41. $(".dropdown-hover").mouseout(function () {
  42. $(".dropdown-box").attr("style", "display: none;");
  43. });
  44. $(".clearAll").click(function () {
  45. $("#playvideo").find("video").attr("src", "");
  46. $("#bigpreview").find("img").attr("src", "");
  47. $("#playvideo").css("display", "none");
  48. $("#bigpreview").css("display", "none");
  49. });
  50. }
  51. /**
  52. * 多条件搜索
  53. * @param pageNo
  54. */
  55. function search(pageNo, startFlag, searchSelectFlag) {
  56. var genres = "";
  57. var cast = "";
  58. var keyword = "";
  59. if (searchSelectFlag) {
  60. $("#wd").val("");
  61. }
  62. if (!startFlag) {
  63. genres = $(".leixingul").find(".btn-warm").text().replace("全部", "");
  64. cast = $(".yanyuanul").find(".btn-warm").text().replace("全部", "");
  65. keyword = $("#wd").val();
  66. }
  67. var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
  68. var order = $(".paixuul").find(".btn-warm").attr("order");
  69. var bigType = $("#bigType").text();
  70. var prepath = $("#bigType").attr("prepath");
  71. if (searchSelectFlag) {
  72. genres = "";
  73. cast = "";
  74. orderField = "vi.issue_date";
  75. order = "desc";
  76. }
  77. $.ajax({
  78. url: "videoInfo/getVideoInfoPage", //请求的url地址
  79. dataType: "json", //返回格式为json
  80. data: JSON.stringify({
  81. "pageNo": pageNo,
  82. "pageSize": 10,
  83. "genres": genres,
  84. "cast": cast,
  85. "orderField": orderField,
  86. "order": order,
  87. "keyword": keyword,
  88. "bigType": bigType
  89. }), //参数值
  90. type: "post", //请求方式
  91. contentType: "application/json;charset=utf-8",
  92. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  93. success: function (data) {
  94. //请求成功时处理
  95. if (data != null && $.trim(data) != "" && data.success) {
  96. if (startFlag) {
  97. getQueryHeaderInfo($("#bigType").text(), startFlag, false);
  98. }
  99. data = data.data;
  100. var videoInfoList = data.list;
  101. var str = "";
  102. for (var i = 0; i < videoInfoList.length; i++) {
  103. var videoInfo = videoInfoList[i];
  104. var date = videoInfo.issueDate;
  105. if (orderField == 'vi.modify_time') {
  106. date = videoInfo.modifyTime;
  107. }
  108. var scoreStr = '';
  109. if (bigType == '骑兵') {
  110. scoreStr += videoInfo.resolutionRatio + '|';
  111. scoreStr += (videoInfo.original === null ? '?' : (videoInfo.original == 1 ? '原档' : '非原档')) + '|';
  112. scoreStr += (videoInfo.subtitle === null ? '?' : (videoInfo.subtitle == 1 ? '字幕' : '无字幕')) + '|';
  113. scoreStr += (videoInfo.recoding === null ? '?' : (videoInfo.recoding == 1 ? '压缩' : '未压缩')) + '|';
  114. scoreStr += videoInfo.score;
  115. } else {
  116. scoreStr = videoInfo.score;
  117. }
  118. str += "<li class=\"col-lg-8 col-md-6 col-sm-4 col-xs-3\">" +
  119. " <div class=\"myui-vodlist__box\">" +
  120. " <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;apics/" + videoInfo.imgUrl + "&quot;);\">" +
  121. " <span class=\"bigpreview playvideo play hidden-xs\" imgUrl='" + videoInfo.imgUrl + "'></span>" +
  122. " <span class=\"pic-tag pic-tag-top\">" +
  123. " <span class=\"tag identificationCode\" style=\"background-color: #FB7299;\">" + videoInfo.identificationCode + "</span>" +
  124. " <span class=\"tag\" style=\"background-color: #00C0FF;\">" + date + "</span>" +
  125. " </span>" +
  126. " <span class=\"pic-text text-right\" title='" + (videoInfo.comment === '' ? '暂无评论' : videoInfo.comment) + "'>" + scoreStr + "</span>" +
  127. " </a>" +
  128. " <div class=\"myui-vodlist__detail\">" +
  129. " <h4 class=\"videodetail title text-overflow\" identificationCode='" + videoInfo.identificationCode + "' ><a title=\" " + videoInfo.name + " \">" + videoInfo.name + "</a></h4>" +
  130. " <p class=\"text text-overflow text-muted hidden-xs\" title='" + videoInfo.mainWho + "'>直属:" + videoInfo.mainWho + "</p>" +
  131. " </div>" +
  132. " </div>" +
  133. "</li>";
  134. }
  135. $(".myui-vodlist").html(str);
  136. if (str == "") {
  137. $(".vodlistnone").attr("style", "padding: 50px;display: block;");
  138. $(".myui-page").html("");
  139. } else {
  140. $(".vodlistnone").attr("style", "padding: 50px;display: none;");
  141. $(".myui-page").pagination({
  142. pageSize: "10",
  143. pageNo: pageNo,
  144. total: data.total,
  145. callback: function (pageNo) {
  146. //$("#wd").val("");
  147. search(pageNo, false, false);
  148. }
  149. });
  150. }
  151. initContentEvent();
  152. } else {
  153. alert(data.message);
  154. }
  155. },
  156. beforeSend: function () {
  157. //请求前的处理
  158. if (startFlag) {
  159. $("#cover").css("display", "block");
  160. } else {
  161. $(".loading").css("display", "block");
  162. }
  163. },
  164. complete: function () {
  165. //请求完成的处理
  166. if (startFlag) {
  167. $("#cover").css("display", "none");
  168. } else {
  169. $(".loading").css("display", "none");
  170. }
  171. },
  172. error: function (data) {
  173. //请求出错处理
  174. alert('error:' + data);
  175. }
  176. });
  177. }
  178. /**
  179. * 查询头信息
  180. * @param bigType
  181. * @param startFlag
  182. */
  183. function getQueryHeaderInfo(bigType, startFlag, searchSelectFlag) {
  184. var infantryType = "";
  185. if (bigType == '步兵' && !searchSelectFlag) {
  186. infantryType = $(".leixingul").find(".btn-warm").text().replace("全部", "");
  187. }
  188. $.ajax({
  189. url: "queryHeader/getQueryHeaderInfo", //请求的url地址
  190. dataType: "json", //返回格式为json
  191. data: {"bigType": bigType, "infantryType": infantryType}, //参数值
  192. type: "post", //请求方式
  193. async: !startFlag, //请求是否异步,默认为异步,这也是ajax重要特性
  194. success: function (data) {
  195. if (bigType == '步兵') {
  196. $(".leixingli").css("display", "none");
  197. } else {
  198. $(".leixingli").css("display", "block");
  199. }
  200. if (searchSelectFlag) {
  201. $("ul.leixingul").find("a:eq(1)").addClass("btn-warm");
  202. $("ul.yanyuanul").find("a:eq(1)").addClass("btn-warm");
  203. $("ul.paixuul").find("a.btn-warm").removeClass("btn-warm");
  204. $("ul.paixuul").find("a:eq(1)").addClass("btn-warm");
  205. }
  206. //请求成功时处理
  207. if (data != null && $.trim(data.data) != "" && data.success) {
  208. data = data.data;
  209. if ($.isEmptyObject(data)) {
  210. if ($(".displayli").length > 0) {
  211. $(".displayli").remove();
  212. }
  213. $(".vodlistnone").attr("style", "padding: 50px;display: block;");
  214. $(".myui-vodlist").html("");
  215. $(".myui-page").html("");
  216. return;
  217. }
  218. if ($(".displayli").length > 0) {
  219. $(".displayli").remove();
  220. }
  221. if (data.videoCastList.length > 0) {
  222. var videoCastList = data.videoCastList;
  223. var str = "";
  224. for (var i = 0; i < videoCastList.length; i++) {
  225. var videoCast = videoCastList[i];
  226. str += "<li class='displayli'><a class=\"btn searchbtn\" title='" + videoCast.count + "'>" + videoCast.name + "</a></li>";
  227. }
  228. $(".yanyuanul").append(str);
  229. }
  230. if (data.videoGenresList.length > 0) {
  231. var videoGenresList = data.videoGenresList;
  232. var str = "";
  233. for (var i = 0; i < videoGenresList.length; i++) {
  234. var videoGenres = videoGenresList[i];
  235. if (bigType == '步兵' && i == 0) {
  236. str += "<li class='displayli'><a class=\"btn btn-warm searchbtn\" title='" + videoGenres.count + "'>" + videoGenres.name + "</a></li>";
  237. } else {
  238. str += "<li class='displayli'><a class=\"btn searchbtn\" title='" + videoGenres.count + "'>" + videoGenres.name + "</a></li>";
  239. }
  240. }
  241. $(".leixingul").append(str);
  242. }
  243. $(".searchbtn").unbind("click");
  244. $(".searchbtn").click(function () {
  245. $(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
  246. $(this).addClass("btn-warm");
  247. if ($(this).attr('order') != undefined) {
  248. var order = $(this).attr('order');
  249. if ("desc" == order) {
  250. $(this).attr("order", "asc");
  251. } else if ("asc" == order) {
  252. $(this).attr("order", "desc");
  253. }
  254. }
  255. $("#wd").val("");
  256. search(1, false, false);
  257. });
  258. } else {
  259. alert(data.message);
  260. }
  261. },
  262. beforeSend: function () {
  263. //请求前的处理
  264. if (!startFlag) {
  265. $(".loading-shaixuan").css("display", "block");
  266. }
  267. },
  268. complete: function () {
  269. //请求完成的处理
  270. if (!startFlag) {
  271. $(".loading-shaixuan").css("display", "none");
  272. }
  273. },
  274. error: function (data) {
  275. //请求出错处理
  276. alert('error:' + data);
  277. }
  278. });
  279. }
  280. /**
  281. * 初始化主内容事件
  282. */
  283. function initContentEvent() {
  284. var prepath = $("#bigType").attr("prepath");
  285. // $(".playvideo").dblclick(function () {
  286. // if (prepath == "machi") {
  287. // return;
  288. // }
  289. //
  290. // if ($("#playvideo").css("display") === 'none') {
  291. // $("#playvideo").css("display", "block");
  292. // $("#playvideo").find("video").attr("src", prepath + "/" + $(this).attr("videoUrl"));
  293. // $("#playvideo").find("video").prop('muted', true);
  294. // } else if ($("#playvideo").css("display") === 'block') {
  295. // $("#playvideo").css("display", "none");
  296. // $("#playvideo").find("video").attr("src", "");
  297. // }
  298. // });
  299. $(".videodetail").click(function () {
  300. var type = $("#bigType").attr("prepath");
  301. var code = $(this).attr("identificationCode");
  302. window.open("voddetail.html?type=" + type + "&code=" + code, "_blank");
  303. });
  304. $(".bigpreview").dblclick(function () {
  305. if ($("#bigpreview").css("display") === 'none') {
  306. $("#bigpreview").css("display", "block");
  307. $("#bigpreview").find("img").attr("src", "apics/" + $(this).attr("imgUrl"));
  308. } else if ($("#bigpreview").css("display") === 'block') {
  309. $("#bigpreview").css("display", "none");
  310. $("#bigpreview").find("img").attr("src", "");
  311. }
  312. });
  313. $(".identificationCode").dblclick(function () {
  314. window.open("https://www.javbus.com/" + $(this).text(), "_blank");
  315. });
  316. }