Răsfoiți Sursa

update:福利吧图片页展示优化 v2

lvzhiqiang 1 an în urmă
părinte
comite
adc8902eab

+ 2 - 0
src/main/java/top/lvzhiqiang/entity/FileCrawlerImage.java

@@ -27,6 +27,8 @@ public class FileCrawlerImage extends FileImage {
 
     private Integer sort;
 
+    private String mainTitle;
+
     /**
      * 发布时间
      */

+ 1 - 1
src/main/java/top/lvzhiqiang/mapper/PictureInfoMapper.java

@@ -80,7 +80,7 @@ public interface PictureInfoMapper {
     int insertIgnoreFileCrawlerImageLog(FileCrawlerImageLog crawlerImageLog);
 
     @Select({"<script>" +
-            "select fi.*,fcic.category_name from file_crawler_image fi left join file_crawler_image_category fcic on fi.category_id = fcic.id " +
+            "select fi.*,fcic.category_name,fcil.publish_time,fcil.main_title from file_crawler_image fi left join file_crawler_image_category fcic on fi.category_id = fcic.id " +
             "left join file_crawler_image_log fcil on fi.log_id = fcil.id WHERE 1 = 1" +
             "<if test=\"keyword != null and keyword != ''\">" +
             "   and fi.remark like concat('%',#{keyword},'%')" +

+ 11 - 2
src/main/java/top/lvzhiqiang/service/impl/PictureInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package top.lvzhiqiang.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
@@ -14,6 +15,7 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
 import org.springframework.util.StopWatch;
 import org.springframework.web.multipart.MultipartFile;
 import top.lvzhiqiang.config.InitRunner;
@@ -64,10 +66,11 @@ public class PictureInfoServiceImpl extends BaseServiceImpl<Object> implements P
         paramsToLike(params, "keyword");
         // 分页
         paramsToPagination(params);
-        // 排序
-        paramsToSort(params);
 
         if ("上传".equals(bigType)) {
+            // 排序
+            paramsToSort(params);
+
             List<FileImage> pictureInfoList = pictureInfoMapper.getUploadImageInfoList(params);
 
             String bpicsUrl = InitRunner.dicCodeMap.get("bpics_url").getCodeValue();
@@ -81,6 +84,12 @@ public class PictureInfoServiceImpl extends BaseServiceImpl<Object> implements P
 
             return new PageInfo<>(pictureInfoList);
         } else if ("爬虫".equals(bigType)) {
+            // 排序
+            if (params.containsKey(ORDER_FIELD) && params.containsKey(ORDER)
+                    && !ObjectUtils.isEmpty(params.get(ORDER_FIELD)) && !ObjectUtils.isEmpty(params.get(ORDER))) {
+                PageHelper.orderBy(params.get(ORDER_FIELD) + " " + params.get(ORDER) + ",fi.sort asc");
+            }
+
             List<FileCrawlerImage> crawlerImageList = pictureInfoMapper.getCrawlerImageInfoList(params);
 
             String bpicsUrl = InitRunner.dicCodeMap.get("bpics_url").getCodeValue();

+ 8 - 4
src/main/resources/static/js/my-picture.js

@@ -86,7 +86,7 @@ function search(pageNo, startFlag, searchSelectFlag) {
         cast = "";
         if (bigType == '爬虫') {
             genres = "福利吧";
-            orderField = "fi.publish_time";
+            orderField = "fcil.publish_time";
         } else {
             orderField = "vi.issue_date";
         }
@@ -95,7 +95,7 @@ function search(pageNo, startFlag, searchSelectFlag) {
     } else {
         if (bigType == '爬虫') {
             genres = "福利吧";
-            orderField = "fi.publish_time";
+            orderField = "fcil.publish_time";
         }
     }
 
@@ -132,6 +132,9 @@ function search(pageNo, startFlag, searchSelectFlag) {
                     if (orderField == 'fci.modify_time') {
                         date = picInfo.modifyTime;
                     }
+                    if (bigType == '爬虫') {
+                        date = picInfo.publishTime;
+                    }
 
                     var scoreStr = '';
                     var orginUrl= '';
@@ -152,12 +155,13 @@ function search(pageNo, startFlag, searchSelectFlag) {
                         "       <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;" + picInfo.thumbnailPath + "&quot;),url(&quot;" + picInfo.path + "&quot;);\">" +
                         "           <span class=\"bigpreview playvideo play hidden-xs\" imgUrl='" + picInfo.path + "'></span>" +
                         "           <span class=\"pic-tag pic-tag-top\">" +
-                        "               <span class=\"tag identificationDate\" title=\"" + orginUrl + "\" style=\"background-color: #00C0FF;\">" + picInfo.newName + "</span>" +
+                        "               <span class=\"tag identificationDate\" title=\"" + orginUrl + "\" style=\"background-color: #00C0FF;\">" + date + "</span>" +
+                        "               <span class=\"tag identificationDate\" title=\"" + orginUrl + "\" style=\"background-color: #00C0FF;\">" + picInfo.sort + "</span>" +
                         "           </span>" +
                         "           <span class=\"pic-text text-right\" title=\"\" \">" + scoreStr + "</span>" +
                         "       </a>" +
                         "       <div class=\"myui-vodlist__detail\">" +
-                        "           <h4 class=\"videodetail title text-overflow\" orginUrl='" + picInfo.path + "'><a title=\" " + picInfo.remark + " \">" + picInfo.remark + "</a></h4>" +
+                        "           <h4 class=\"videodetail title text-overflow\" orginUrl='" + picInfo.path + "'><a title=\" " + picInfo.remark + " \">" + picInfo.mainTitle + "</a></h4>" +
                         "       </div>" +
                         "   </div>" +
                         "</li>";

+ 2 - 2
src/main/resources/static/picture.html

@@ -208,12 +208,12 @@
                         <a class="more text-muted" id="shaixuan">筛选</a>
                         <div class="myui-header__search search-box">
                             <a class="search-select dropdown-hover" href="javascript:">
-                                <span class="text" id="bigType" prepath="upload">上传</span>
+                                <span class="text" id="bigType" prepath="crawler">爬虫</span>
                                 <i class="fa fa-caret-down"></i>
                                 <div class="dropdown-box bottom fadeInDown">
                                     <ul class="item" style="line-height: 140%;">
-                                        <li class="" prepath="upload">上传</li>
                                         <li class="" prepath="crawler">爬虫</li>
+                                        <li class="" prepath="upload">上传</li>
                                     </ul>
                                 </div>
                             </a>