tujidelv 3 years ago
parent
commit
86730a0896

+ 0 - 28
src/main/java/top/lvzhiqiang/controller/IndexController.java

@@ -1,17 +1,11 @@
 package top.lvzhiqiang.controller;
 
-import com.alibaba.fastjson.JSONObject;
-import com.github.pagehelper.PageInfo;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import top.lvzhiqiang.dto.R;
-import top.lvzhiqiang.entity.VideoCast;
-import top.lvzhiqiang.entity.VideoGenres;
 import top.lvzhiqiang.entity.VideoInfo;
-import top.lvzhiqiang.service.VideoCastService;
-import top.lvzhiqiang.service.VideoGenresService;
 import top.lvzhiqiang.service.VideoInfoService;
 
 import javax.annotation.Resource;
@@ -27,27 +21,8 @@ import java.util.List;
 public class IndexController {
 
     @Resource
-    private VideoCastService videoCastService;
-
-    @Resource
     private VideoInfoService videoInfoService;
 
-    @Resource
-    private VideoGenresService videoGenresService;
-
-    @RequestMapping("/getIndexInfo")
-    @ResponseBody
-    public JSONObject getIndexInfo(int pageNo, int pageSize) {
-        JSONObject result = new JSONObject();
-        List<VideoCast> videoCastList = videoCastService.findAll();
-        List<VideoGenres> videoGenresList = videoGenresService.findAll();
-        PageInfo<VideoInfo> videoInfoPage = videoInfoService.findAll(pageNo, pageSize);
-
-        result.put("videoCastList", videoCastList);
-        result.put("videoGenresList", videoGenresList);
-        result.put("videoInfoPage", videoInfoPage);
-        return result;
-    }
 
     @RequestMapping("/initData")
     @ResponseBody
@@ -59,9 +34,6 @@ public class IndexController {
 
     @RequestMapping("/ftlIndex")
     public String ftlIndex(Model model) {
-        List<VideoCast> videoCastList = videoCastService.findAll();
-        model.addAttribute("videoCastList", videoCastList);
-
         List<VideoInfo> videoInfoList = videoInfoService.findAll();
         model.addAttribute("videoInfoList", videoInfoList);
 

+ 56 - 0
src/main/java/top/lvzhiqiang/controller/QueryHeaderController.java

@@ -0,0 +1,56 @@
+package top.lvzhiqiang.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+import top.lvzhiqiang.entity.VideoCast;
+import top.lvzhiqiang.entity.VideoGenres;
+import top.lvzhiqiang.service.VideoCastService;
+import top.lvzhiqiang.service.VideoGenresService;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 查询头 Controller
+ *
+ * @author lvzhiqiang
+ * 2022/4/13 17:40
+ */
+@RestController
+@RequestMapping("/queryHeader")
+public class QueryHeaderController {
+
+    @Resource
+    private VideoCastService videoCastService;
+
+    @Resource
+    private VideoGenresService videoGenresService;
+
+    @RequestMapping("/getQueryHeaderInfo")
+    @ResponseBody
+    public JSONObject getQueryHeaderInfo(String bigType) {
+        JSONObject result = new JSONObject();
+
+        if ("骑兵".equals(bigType)) {
+            List<VideoCast> videoCastList = videoCastService.findAll();
+            List<VideoGenres> videoGenresList = videoGenresService.findAll();
+            result.put("videoCastList", videoCastList);
+            result.put("videoGenresList", videoGenresList);
+        } else if ("步兵".equals(bigType)) {
+
+        } else if ("流出".equals(bigType)) {
+
+        } else if ("待处理".equals(bigType)) {
+
+        } else {
+            List<VideoCast> videoCastList = videoCastService.findAll();
+            List<VideoGenres> videoGenresList = videoGenresService.findAll();
+            result.put("videoCastList", videoCastList);
+            result.put("videoGenresList", videoGenresList);
+        }
+
+        return result;
+    }
+}

+ 5 - 0
src/main/java/top/lvzhiqiang/dto/VideoInfoQuery.java

@@ -41,4 +41,9 @@ public class VideoInfoQuery implements Serializable {
      * 页大小
      */
     private Integer pageSize;
+
+    /**
+     * 大类型{骑兵,步兵,流出,待处理}
+     */
+    private String bigType;
 }

+ 7 - 2
src/main/resources/static/index.html

@@ -41,6 +41,7 @@
                                         <li class="">骑兵</li>
                                         <li class="">步兵</li>
                                         <li class="">流出</li>
+                                        <li class="">待处理</li>
                                     </ul>
                                 </div>
                             </a>
@@ -56,10 +57,12 @@
                         <ul class="myui-screen__list nav-slide clearfix leixingul" data-align="left">
                             <li><a class="text-muted btn">类型</a></li>
                             <li><a class="btn btn-warm searchbtn leixing">全部</a></li>
+                            <div id="leixingdiv"></div>
                         </ul>
                         <ul class="myui-screen__list nav-slide clearfix yanyuanul" data-align="left">
                             <li><a class="btn text-muted">演员</a></li>
                             <li><a class="btn btn-warm searchbtn yanyuan">全部</a></li>
+                            <div id="yanyuandiv"></div>
                         </ul>
                     </div>
                     <ul class="myui-screen__list nav-slide clearfix paixuul" data-align="left">
@@ -92,8 +95,10 @@
     </div>
 </div>
 <div id="cover"><img src="cover/loading.gif" style="width: 80px; height: 80px;"/></div>
-<div id="playvideo"><video src="" width="800" height="500" controls></video></div>
-<div id="bigpreview"><img src="" /></div>
+<div id="playvideo">
+    <video src="" width="800" height="500" controls></video>
+</div>
+<div id="bigpreview"><img src=""/></div>
 </body>
 </html>
 

+ 179 - 117
src/main/resources/static/js/my.js

@@ -1,4 +1,9 @@
 $(function () {
+    initOther();
+    initSearch();
+});
+
+function initOther() {
     $(".slideDown-btn").click(function () {
         var display = $('.slideDown-box');
         if (display.css('display') == 'block') {
@@ -9,37 +14,69 @@ $(function () {
             $(this).html('收起   <i class="fa fa-angle-up"></i>');
         }
     });
+
+    $("#searchbutton").click(function () {
+        search(1);
+    });
+    $("#shaixuan").click(function () {
+        $("#wd").val("");
+
+        search(1);
+    });
+    $("#wd").keydown(function (e) {
+        if (e.keyCode == 13) {
+            search(1);
+        }
+    });
+    $(".dropdown-box").find("li").click(function () {
+        $("#bigType").text($(this).text());
+        $(".dropdown-box").attr("style", "display: none;");
+
+        getQueryHeaderInfo($("#bigType").text(), false);
+    });
+    $(".dropdown-hover").mouseover(function () {
+        $(".dropdown-box").attr("style", "display: block;");
+    });
+    $(".dropdown-hover").mouseout(function () {
+        $(".dropdown-box").attr("style", "display: none;");
+    });
+    $(".clearAll").click(function () {
+        $("#playvideo").find("video").attr("src", "");
+        $("#bigpreview").find("img").attr("src", "");
+        $("#playvideo").css("display", "none");
+        $("#bigpreview").css("display", "none");
+    });
+}
+
+/**
+ * 初始化搜索
+ */
+function initSearch() {
+    var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
+    var order = $(".paixuul").find(".btn-warm").attr("order");
+    var bigType = $("#bigType").text();
     $.ajax({
-        url: "getIndexInfo", //请求的url地址
+        url: "videoInfo/getVideoInfoPage", //请求的url地址
         dataType: "json", //返回格式为json
-        data: {"pageNo": 1, "pageSize": 10}, //参数值
+        data: JSON.stringify({
+            "pageNo": 1,
+            "pageSize": 10,
+            "orderField": orderField,
+            "order": order,
+            "bigType": bigType
+        }), //参数值
         type: "post", //请求方式
         async: true, //请求是否异步,默认为异步,这也是ajax重要特性
+        contentType: "application/json;charset=utf-8",
         success: function (data) {
             //请求成功时处理
             if (data != null && $.trim(data) != "" && data.success) {
+                getQueryHeaderInfo($("#bigType").text(), true);
+
                 data = data.data;
-                if (data.videoCastList.length > 0) {
-                    var videoCastList = data.videoCastList;
-                    var str = "";
-                    for (var i = 0; i < videoCastList.length; i++) {
-                        var videoCast = videoCastList[i];
-                        str += "<li><a class=\"btn searchbtn\">" + videoCast.name + "</a></li>";
-                    }
-                    $(".yanyuan").parent().after(str);
-                }
-                if (data.videoGenresList.length > 0) {
-                    var videoGenresList = data.videoGenresList;
-                    var str = "";
-                    for (var i = 0; i < videoGenresList.length; i++) {
-                        var videoGenres = videoGenresList[i];
-                        str += "<li><a class=\"btn searchbtn\">" + videoGenres.name + "</a></li>";
-                    }
-                    $(".leixing").parent().after(str);
-                }
-                if (data.videoInfoPage.size > 0) {
-                    var videoInfoList = data.videoInfoPage.list;
-                    var str = "";
+                var videoInfoList = data.list;
+                var str = "";
+                if (data.size > 0) {
                     for (var i = 0; i < videoInfoList.length; i++) {
                         var videoInfo = videoInfoList[i];
                         str += "<li class=\"col-lg-8 col-md-6 col-sm-4 col-xs-3\">" +
@@ -61,28 +98,10 @@ $(function () {
                     }
                     $(".myui-vodlist").html(str);
 
-                    $(".searchbtn").click(function () {
-                        $(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
-                        $(this).addClass("btn-warm");
-
-                        if ($(this).attr('order') != undefined) {
-                            var order = $(this).attr('order');
-                            if ("desc" == order) {
-                                $(this).attr("order", "asc");
-                            } else if ("asc" == order) {
-                                $(this).attr("order", "desc");
-                            }
-                        }
-
-                        $("#wd").val("");
-
-                        search(1);
-                    });
-
                     $(".myui-page").pagination({
                         pageSize: "10",
                         pageNo: "1",
-                        total: data.videoInfoPage.total,
+                        total: data.total,
                         callback: function (pageNo) {
                             $("#wd").val("");
 
@@ -90,28 +109,7 @@ $(function () {
                         }
                     });
 
-                    $(".playvideo").dblclick(function () {
-                        if ($("#playvideo").css("display") === 'none') {
-                            $("#playvideo").css("display", "block");
-                            $("#playvideo").find("video").attr("src", "qibing/" + $(this).attr("videoUrl"));
-                            $("#playvideo").find("video").prop('muted', true);
-                        } else if ($("#playvideo").css("display") === 'block') {
-                            $("#playvideo").css("display", "none");
-                            $("#playvideo").find("video").attr("src", "");
-                        }
-                    });
-                    $(".bigpreview").dblclick(function () {
-                        if ($("#bigpreview").css("display") === 'none') {
-                            $("#bigpreview").css("display", "block");
-                            $("#bigpreview").find("img").attr("src", "qibing/" + $(this).attr("imgUrl"));
-                        } else if ($("#bigpreview").css("display") === 'block') {
-                            $("#bigpreview").css("display", "none");
-                            $("#bigpreview").find("img").attr("src", "");
-                        }
-                    });
-                    $(".identificationCode").dblclick(function () {
-                        window.open("https://www.javbus.com/" + $(this).text(), "_blank");
-                    });
+                    initContentEvent();
                 }
             } else {
                 alert(data.message);
@@ -130,44 +128,19 @@ $(function () {
             alert('error:' + data);
         }
     });
+}
 
-    $("#searchbutton").click(function () {
-        search(1);
-    });
-    $("#shaixuan").click(function () {
-        $("#wd").val("");
-
-        search(1);
-    });
-    $("#wd").keydown(function (e) {
-        if (e.keyCode == 13) {
-            search(1);
-        }
-    });
-    $(".dropdown-box").find("li").click(function () {
-        $("#bigType").text($(this).text());
-        $(".dropdown-box").attr("style", "display: none;");
-    });
-    $(".dropdown-hover").mouseover(function () {
-        $(".dropdown-box").attr("style", "display: block;");
-    });
-    $(".dropdown-hover").mouseout(function () {
-        $(".dropdown-box").attr("style", "display: none;");
-    });
-    $(".clearAll").click(function () {
-        $("#playvideo").find("video").attr("src", "");
-        $("#bigpreview").find("img").attr("src", "");
-        $("#playvideo").css("display", "none");
-        $("#bigpreview").css("display", "none");
-    });
-});
-
+/**
+ * 多条件搜索
+ * @param pageNo
+ */
 function search(pageNo) {
     var genres = $(".leixingul").find(".btn-warm").text().replace("全部", "");
     var cast = $(".yanyuanul").find(".btn-warm").text().replace("全部", "");
     var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
     var order = $(".paixuul").find(".btn-warm").attr("order");
     var keyword = $("#wd").val();
+    var bigType = $("#bigType").text();
     $.ajax({
         url: "videoInfo/getVideoInfoPage", //请求的url地址
         dataType: "json", //返回格式为json
@@ -178,7 +151,8 @@ function search(pageNo) {
             "cast": cast,
             "orderField": orderField,
             "order": order,
-            "keyword": keyword
+            "keyword": keyword,
+            "bigType": bigType
         }), //参数值
         type: "post", //请求方式
         contentType: "application/json;charset=utf-8",
@@ -233,27 +207,89 @@ function search(pageNo) {
                     }
                 });
 
-                $(".playvideo").dblclick(function () {
-                    if ($("#playvideo").css("display") === 'none') {
-                        $("#playvideo").css("display", "block");
-                        $("#playvideo").find("video").attr("src", "qibing/" + $(this).attr("videoUrl"));
-                        $("#playvideo").find("video").prop('muted', true);
-                    } else if ($("#playvideo").css("display") === 'block') {
-                        $("#playvideo").css("display", "none");
-                        $("#playvideo").find("video").attr("src", "");
+                initContentEvent();
+            } else {
+                alert(data.message);
+            }
+        },
+        beforeSend: function () {
+            //请求前的处理
+            $(".loading").css("display", "block");
+        },
+        complete: function () {
+            //请求完成的处理
+            $(".loading").css("display", "none");
+        },
+        error: function (data) {
+            //请求出错处理
+            alert('error:' + data);
+        }
+    });
+}
+
+/**
+ *  查询头信息
+ * @param bigType
+ * @param startFlag
+ */
+function getQueryHeaderInfo(bigType, startFlag) {
+    $.ajax({
+        url: "queryHeader/getQueryHeaderInfo", //请求的url地址
+        dataType: "json", //返回格式为json
+        data: {"bigType": bigType}, //参数值
+        type: "post", //请求方式
+        async: false, //请求是否异步,默认为异步,这也是ajax重要特性
+        success: function (data) {
+            //请求成功时处理
+            if (data != null && $.trim(data.data) != "" && data.success) {
+                data = data.data;
+                if ($.isEmptyObject(data)) {
+                    $("#leixingdiv").html("");
+                    $("#yanyuandiv").html("");
+                    $(".vodlistnone").attr("style", "padding: 50px;display: block;");
+                    $(".myui-vodlist").html("");
+                    return;
+                }
+
+                if (data.videoCastList.length > 0) {
+                    var videoCastList = data.videoCastList;
+                    var str = "";
+                    for (var i = 0; i < videoCastList.length; i++) {
+                        var videoCast = videoCastList[i];
+                        str += "<li><a class=\"btn searchbtn\">" + videoCast.name + "</a></li>";
                     }
-                });
-                $(".bigpreview").dblclick(function () {
-                    if ($("#bigpreview").css("display") === 'none') {
-                        $("#bigpreview").css("display", "block");
-                        $("#bigpreview").find("img").attr("src", "qibing/" + $(this).attr("imgUrl"));
-                    } else if ($("#bigpreview").css("display") === 'block') {
-                        $("#bigpreview").css("display", "none");
-                        $("#bigpreview").find("img").attr("src", "");
+                    $("#yanyuandiv").append(str);
+                }
+                if (data.videoGenresList.length > 0) {
+                    var videoGenresList = data.videoGenresList;
+                    var str = "";
+                    for (var i = 0; i < videoGenresList.length; i++) {
+                        var videoGenres = videoGenresList[i];
+                        str += "<li><a class=\"btn searchbtn\">" + videoGenres.name + "</a></li>";
                     }
-                });
-                $(".identificationCode").dblclick(function () {
-                    window.open("https://www.javbus.com/" + $(this).text(), "_blank");
+                    $("#leixingdiv").append(str);
+                }
+
+                if (!startFlag) {
+                    search(1);
+                }
+
+                $(".searchbtn").click(function () {
+                    $(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
+                    $(this).addClass("btn-warm");
+
+                    if ($(this).attr('order') != undefined) {
+                        var order = $(this).attr('order');
+                        if ("desc" == order) {
+                            $(this).attr("order", "asc");
+                        } else if ("asc" == order) {
+                            $(this).attr("order", "desc");
+                        }
+                    }
+
+                    $("#wd").val("");
+
+                    search(1);
                 });
             } else {
                 alert(data.message);
@@ -261,15 +297,41 @@ function search(pageNo) {
         },
         beforeSend: function () {
             //请求前的处理
-            $(".loading").css("display", "block");
         },
         complete: function () {
             //请求完成的处理
-            $(".loading").css("display", "none");
         },
         error: function (data) {
             //请求出错处理
             alert('error:' + data);
         }
     });
+}
+
+/**
+ * 初始化主内容事件
+ */
+function initContentEvent() {
+    $(".playvideo").dblclick(function () {
+        if ($("#playvideo").css("display") === 'none') {
+            $("#playvideo").css("display", "block");
+            $("#playvideo").find("video").attr("src", "qibing/" + $(this).attr("videoUrl"));
+            $("#playvideo").find("video").prop('muted', true);
+        } else if ($("#playvideo").css("display") === 'block') {
+            $("#playvideo").css("display", "none");
+            $("#playvideo").find("video").attr("src", "");
+        }
+    });
+    $(".bigpreview").dblclick(function () {
+        if ($("#bigpreview").css("display") === 'none') {
+            $("#bigpreview").css("display", "block");
+            $("#bigpreview").find("img").attr("src", "qibing/" + $(this).attr("imgUrl"));
+        } else if ($("#bigpreview").css("display") === 'block') {
+            $("#bigpreview").css("display", "none");
+            $("#bigpreview").find("img").attr("src", "");
+        }
+    });
+    $(".identificationCode").dblclick(function () {
+        window.open("https://www.javbus.com/" + $(this).text(), "_blank");
+    });
 }