南鑫林 5 anni fa
parent
commit
6fc5af4402
26 ha cambiato i file con 156 aggiunte e 95 eliminazioni
  1. 44 18
      RainbowPlanet/RainbowPlanet/Manager/MJRefreshManager/MJRefreshManager.swift
  2. 5 5
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  3. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  4. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  5. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift
  6. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/ViewController/CommunityMyFollowTopicController.swift
  7. 3 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  8. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift
  9. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift
  10. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift
  11. 34 26
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift
  12. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoSubCommentController/CommunityVideoSubCommentController.swift
  13. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageList/ViewController/MessageListController.swift
  14. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageMain/ViewController/MessageMainViewController.swift
  15. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetActivity/Controller/MessagePlanetActivityController.swift
  16. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetNotification/Controller/MessagePlanetNotiController.swift
  17. 4 4
      RainbowPlanet/RainbowPlanet/Modules/MineModule/MyFollowAndFan/ViewController/MyFollowAndFanViewController.swift
  18. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListView.swift
  19. 3 3
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/Controller/PublishAddTopicController.swift
  20. 2 2
      RainbowPlanet/RainbowPlanet/Modules/RedemptionAreaModule/RedemptionArea/ViewController/RedemptionAreaViewController.swift
  21. 2 3
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift
  22. 2 2
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchTopicList/ViewController/SearchTopicListViewController.swift
  23. 2 2
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchUser/ViewController/SearchUserListViewController.swift
  24. 2 1
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift
  25. 8 0
      RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.h
  26. 19 0
      RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m

+ 44 - 18
RainbowPlanet/RainbowPlanet/Manager/MJRefreshManager/MJRefreshManager.swift

@@ -11,7 +11,7 @@ import Foundation
 class MJRefreshManager: NSObject {
 
     //MARK: - tableView
-    class func hiddenHeaderWithFooter(tableView : UITableView?) {
+    class func mjRefreshManager(tableView : UITableView?) {
         if tableView?.mj_footer != nil {
             tableView?.endFooterRefresh()
         }
@@ -21,7 +21,7 @@ class MJRefreshManager: NSObject {
         tableView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooterNONetWork(tableView : UITableView?) {
+    class func mjRefreshManagerNONetWork(tableView : UITableView?) {
         DIYEmptyView.emptyNoDataActionTableView(tableView: tableView, btnClickBlock: {
             [weak tableView] in
             tableView?.mj_header.beginRefreshing()
@@ -36,7 +36,7 @@ class MJRefreshManager: NSObject {
         tableView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooterNOData(tableView : UITableView?) {
+    class func mjRefreshManagerNOData(tableView : UITableView?) {
         DIYEmptyView.emptyNoDataTableView(tableView: tableView,imageStr: .one,detailStr: .one)
         if tableView?.mj_footer != nil {
             tableView?.endFooterRefresh()
@@ -47,26 +47,34 @@ class MJRefreshManager: NSObject {
         tableView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooter(tableView:UITableView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
+    class func mjRefreshManagerLoadingStatus(tableView:UITableView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
         if tableView?.mj_footer != nil {
             tableView?.isHiddenFooter(true)
         }
         if loadingStatus == .noData {
-            MJRefreshManager.hiddenHeaderWithFooterNOData(tableView: tableView)
+            mjRefreshManagerNOData(tableView: tableView)
         }else if loadingStatus == .noNetwork {
-            MJRefreshManager.hiddenHeaderWithFooterNONetWork(tableView: tableView)
+            mjRefreshManagerNONetWork(tableView: tableView)
         }
     }
     
+    class func mjRefreshManagerPaginationNoHiddenFooter(tableView : UITableView?,pagination : PaginationModel?) {
+        mjRefreshManagerIsHiddenFooter(isHidden: false, tableView: tableView, pagination: pagination)
+
+    }
     
-    class func hiddenHeaderWithFooter(tableView : UITableView?,pagination : PaginationModel?) {
-        
+    class func mjRefreshManagerPaginationHiddenFooter(tableView : UITableView?,pagination : PaginationModel?) {
+        mjRefreshManagerIsHiddenFooter(isHidden: true, tableView: tableView, pagination: pagination)
+    }
+    
+    private class func mjRefreshManagerIsHiddenFooter(isHidden:Bool,tableView : UITableView?,pagination : PaginationModel?) {
         if tableView?.mj_header != nil {
             tableView?.endHeaderRefresh()
         }
         if tableView?.mj_footer != nil {
             tableView?.endFooterRefresh()
         }
+        
         if pagination?.total == 0 {
             if tableView?.mj_footer != nil {
                 tableView?.isHiddenFooter(true)
@@ -76,16 +84,22 @@ class MJRefreshManager: NSObject {
                 tableView?.mj_footer.isHidden = false
                 if tableView?.mj_footer != nil {
                     tableView?.endFooterNoMoreData()
-                    tableView?.mj_footer.pullingPercent = 1
+                    if isHidden {
+                        tableView?.isHiddenFooter(true)
+                    }else {
+                        tableView?.mj_footer.pullingPercent = 1
+                    }
                 }
             }
         }
+        
         tableView?.ly_endLoading()
+        
     }
     
     
     //MARK: - collectionView
-    class func hiddenHeaderWithFooter(collectionView : UICollectionView?) {
+    class func mjRefreshManager(collectionView : UICollectionView?) {
 
         if collectionView?.mj_header != nil {
             collectionView?.endHeaderRefresh()
@@ -96,7 +110,7 @@ class MJRefreshManager: NSObject {
         collectionView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooterNONetWork(collectionView : UICollectionView?) {
+    class func mjRefreshManagerNONetWork(collectionView : UICollectionView?) {
         DIYEmptyView.emptyNoDataActionCollectionView(collectionView: collectionView, btnClickBlock: {
             [weak collectionView] in
             collectionView?.mj_header.beginRefreshing()
@@ -110,7 +124,7 @@ class MJRefreshManager: NSObject {
         collectionView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooterNOData(collectionView : UICollectionView?) {
+    class func mjRefreshManagerNOData(collectionView : UICollectionView?) {
         DIYEmptyView.emptyNoDataCollectionView(collectionView: collectionView)
         if collectionView?.mj_header != nil {
             collectionView?.endHeaderRefresh()
@@ -121,18 +135,26 @@ class MJRefreshManager: NSObject {
         collectionView?.ly_endLoading()
     }
     
-    class func hiddenHeaderWithFooter(collectionView:UICollectionView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
+    class func mjRefreshManagerLoadingStatus(collectionView:UICollectionView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
         if collectionView?.mj_footer != nil {
             collectionView?.isHiddenFooter(true)
         }
         if loadingStatus == .noData {
-            MJRefreshManager.hiddenHeaderWithFooterNOData(collectionView: collectionView)
+            MJRefreshManager.mjRefreshManagerNOData(collectionView: collectionView)
         }else if loadingStatus == .noNetwork {
-            MJRefreshManager.hiddenHeaderWithFooterNONetWork(collectionView: collectionView)
+            MJRefreshManager.mjRefreshManagerNONetWork(collectionView: collectionView)
         }
     }
     
-    class func hiddenHeaderWithFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
+    class func mjRefreshManagerNoHiddenFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
+        mjRefreshManagerIsHiddenFooter(isHidden: false, collectionView: collectionView, pagination: pagination)
+    }
+    
+    class func mjRefreshManagerHiddenFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
+        mjRefreshManagerIsHiddenFooter(isHidden: true, collectionView: collectionView, pagination: pagination)
+    }
+    
+    private class func mjRefreshManagerIsHiddenFooter(isHidden:Bool,collectionView : UICollectionView?,pagination : PaginationModel?) {
         if collectionView?.mj_header != nil {
             collectionView?.endHeaderRefresh()
         }
@@ -149,11 +171,15 @@ class MJRefreshManager: NSObject {
                 collectionView?.mj_footer.isHidden = false
                 if collectionView?.mj_footer != nil {
                     collectionView?.endFooterNoMoreData()
-                    collectionView?.mj_footer.pullingPercent = 1
+                    if isHidden {
+                        collectionView?.isHiddenFooter(true)
+                    }else {
+                        collectionView?.mj_footer.pullingPercent = 1
+                    }
                 }
             }
         }
-
+        
         collectionView?.ly_endLoading()
     }
 }

+ 5 - 5
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -211,14 +211,14 @@ extension CommunityFollowViewController {
             self?.cmsMemberModels = cmsMemberListModel?.list
             if UserModel.isTokenNil() {
                 self?.tableView.tableHeaderView = self?.followLoginTableHeaderView
-                MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView)
+                MJRefreshManager.mjRefreshManager(tableView: self?.tableView)
             }
             self?.tableView.reloadData()
             
         }) {
             [weak self] (loadingStatus) in
             if UserModel.isTokenNil() {
-                MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+                MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
             }
         }
         
@@ -242,15 +242,15 @@ extension CommunityFollowViewController {
                     self?.tableView.tableHeaderView = self?.followTableHeaderView
                 }
                 self?.tableView.reloadData()
-                MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityFollowFeedModel?.pagination)
+                MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityFollowFeedModel?.pagination)
             }) {
                 [weak self] (loadingStatus) in
-                MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+                MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             }
         }else{
             self.tableView.isHiddenFooter(true)
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self.tableView)
+            MJRefreshManager.mjRefreshManager(tableView: self.tableView)
         }
         
 

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -186,10 +186,10 @@ extension CommunityRecommnendViewController {
             }
             self?.communityRecommendDataModels = (self?.communityRecommendDataModels)! + (communityRecommendFeedModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityRecommendFeedModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityRecommendFeedModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
         

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -319,10 +319,10 @@ extension CommunityFeaturedTopicsViewController {
             }
             self?.communityRecommendDataModels = (self?.communityRecommendDataModels)! + (communityRecommendFeedModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityRecommendFeedModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityRecommendFeedModel?.pagination)
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift

@@ -98,10 +98,10 @@ extension CommunityFindFriendsViewController {
             self?.cmsMemberModels = (cmsMemberListModel?.list)!
             self?.tableView.tableHeaderView = self?.communityFindFriendsView
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView:  self?.tableView)
+            MJRefreshManager.mjRefreshManager(tableView: self?.tableView)
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/ViewController/CommunityMyFollowTopicController.swift

@@ -75,9 +75,9 @@ extension CommunityMyFollowTopicController {
                 }
                 self?.communityMemberFollowTopicListDataModels = (self?.communityMemberFollowTopicListDataModels)! + (communityMemberFollowTopicListModel?.data!)!
                 self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination:communityMemberFollowTopicListModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination:communityMemberFollowTopicListModel?.pagination)
         }) {[weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -408,7 +408,7 @@ extension CommunityRecommendController {
             self?.tableView.reloadData()
             self?.readVirueRecordAddApi()
         }) { [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
     }
@@ -459,12 +459,12 @@ extension CommunityRecommendController {
             self?.communityPostDataModels = (self?.communityPostDataModels)! + (communityPostsModel?.data!)!
             self?.heightList()
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityPostsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityPostsModel?.pagination)
 
         }) {
             [weak self] (loadingStatus) in
             
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift

@@ -115,11 +115,11 @@ extension CommunitySubCommentController {
             self?.communityPostReplyModels = (self?.communityPostReplyModels)! + (communityPostReplysModel?.data!)!
             self?.tableView.reloadData()
             self?.navigationBar.title = "\(self?.communityPostReplyModels.count ?? 0)条评论"
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityPostReplysModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityPostReplysModel?.pagination)
 
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift

@@ -291,11 +291,11 @@ extension CommunityAllCommentView {
             self?.communityPostCommentModels = (self?.communityPostCommentModels)! + (self?.communityPostCommentsModel?.data!)!
             self?.tableView.reloadData()
             
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityPostCommentsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityPostCommentsModel?.pagination)
             
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus:loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus:loadingStatus)
         }
     }
     

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -237,7 +237,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         videoTitleLabel.snp.makeConstraints { (make) in
             make.left.equalTo(14)
             make.right.equalTo(-14)
-            make.bottom.equalTo(contentScrollView.snp_top).offset(-10)
+            make.bottom.equalTo(contentScrollView.snp_top).offset(-5)
         }
         
         // personView
@@ -762,7 +762,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var beanIconImageView: UIImageView = {
         let beanIconImageView = UIImageView()
-        beanIconImageView.image = kImage(name: "ico_bean_white")
+        beanIconImageView.image = kImage(name: "ico_bean_org_40px")
         return beanIconImageView
     }()
     

+ 34 - 26
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -33,13 +33,12 @@ class CommunityVideoListController: BaseViewController {
     // 单个话题id
     var topicId: Int?
     
-    var videoItemList = Array<CommunityVideoItemModel>()
+    var videoItemList : Array<CommunityVideoItemModel>?
     
     var commentAlertSheetView : CommunityAllCommentView?
     
     private var prePlayCell: CommunityVideoCoverCollectionCell?
     
-    private var videoListMdl: CommunityVideoListModel?
     
     deinit {
         if observe != nil {
@@ -127,12 +126,17 @@ class CommunityVideoListController: BaseViewController {
             self?.communityVideoListApi(page:page)
             self?.collectionView.mj_header.isHidden = true
         }
-        
-        collectionView.addAutoNormalFooter(withAutomaticallyRefresh: true, loadMoreBlock: {
+//        collectionView.addAutoNormalFooter(withAutomaticallyRefresh: true) {
+//            [weak self] (page) in
+//
+//            self?.communityVideoListApi(page:page)
+//
+//        }
+        collectionView.addPreloadingAutoNormalFooter(withAutomaticallyRefresh: true) {
             [weak self] (page) in
+        self?.communityVideoListApi(page:page)
 
-            self?.communityVideoListApi(page:page)
-        })
+        }
     }
     
     private lazy var collectionView: UICollectionView = {
@@ -163,7 +167,7 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        return videoItemList.count 
+        return videoItemList?.count ?? 0
     }
     
     func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
@@ -178,7 +182,7 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = CommunityVideoCoverCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-        cell.videoItemMdl = videoItemList[indexPath.row]
+        cell.videoItemMdl = videoItemList?[indexPath.row]
         cell.backClosure = {
             [weak self] in
             self?.navigationController?.popViewController(animated: true)
@@ -189,18 +193,18 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
         }
         cell.followClosure = {
             [weak self] (videoItemMdl, followButton) in
-            CommunityFollowUserViewModel.shared.follow(communityVideoItemModel: videoItemMdl,videoItemList:self!.videoItemList, button: followButton)
+            CommunityFollowUserViewModel.shared.follow(communityVideoItemModel: videoItemMdl,videoItemList:(self?.videoItemList)!, button: followButton)
         }
         cell.buttonClickClosure = {
             [weak self] (clickType, uid, postId) in
             switch clickType {
             case videoBtnClickType.typeComment:
-                self?.showCommentView(postId: postId, videoItemMdl: (self?.videoItemList[indexPath.row])!)
+                self?.showCommentView(postId: postId, videoItemMdl: (self?.videoItemList?[indexPath.row])!)
                 
             case videoBtnClickType.typeLike:
-                VirusViewModel.shared.praise(communityVideoItemModel: (self?.videoItemList[indexPath.row])!)
+                VirusViewModel.shared.praise(communityVideoItemModel: (self?.videoItemList?[indexPath.row])!)
                 
-            case videoBtnClickType.typeCollect:                VirusViewModel.shared.collection(communityVideoItemModel: (self?.videoItemList[indexPath.row])!)
+            case videoBtnClickType.typeCollect:                VirusViewModel.shared.collection(communityVideoItemModel: (self?.videoItemList?[indexPath.row])!)
                 
             case videoBtnClickType.typePerson:
                 
@@ -315,7 +319,7 @@ extension CommunityVideoListController {
                 vc.titleStr =
                     String(videoItemModel.content?.prefix(20) ?? "")
             }else {
-                vc.titleStr =                      String(videoItemModel.title?.prefix(20) ?? "")
+                vc.titleStr = String(videoItemModel.title?.prefix(20) ?? "")
 
             }
             vc.avatarStr = videoItemModel.avatar
@@ -341,34 +345,38 @@ extension CommunityVideoListController {
 extension CommunityVideoListController {
     /// 视频列表
     func communityVideoListApi(page:Int = 1) {
-        SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, type: paraType ?? "", topicId: topicId ?? 0, page: page) {
+        
+        SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, type: paraType ?? "", topicId: topicId ?? 0, page: page, completion: {
             [weak self] (communityVideoListModel) -> (Void) in
-            self?.videoListMdl = communityVideoListModel as? CommunityVideoListModel
-            if self?.videoListMdl?.pagination?.currentPage == 1{
-                self?.videoItemList.removeAll()
+            let videoListMdl = communityVideoListModel as? CommunityVideoListModel
+            if videoListMdl?.pagination?.currentPage == 1{
+                self?.videoItemList?.removeAll()
                 self?.collectionView.resetNoMoreData()
             }
-            self?.videoItemList = self!.videoItemList + (self?.videoListMdl?.data!)!
-            if  self?.videoListMdl?.pagination?.currentPage ?? 1 >= self?.videoListMdl?.pagination?.totalPages ?? 1 {
-                self?.collectionView.endFooterNoMoreData()
-                self?.collectionView.isHiddenFooter(true)
+            if self?.videoItemList == nil {
+                self?.videoItemList = (videoListMdl?.data)!
+            }else {
+                self?.videoItemList = (self?.videoItemList)! + (videoListMdl?.data)!
             }
             self?.collectionView.reloadData()
+            MJRefreshManager.mjRefreshManagerHiddenFooter(collectionView: self?.collectionView, pagination: videoListMdl?.pagination)
+        }) { loadingStatus in
+            
         }
     }
     
     /// 阅读virue
     func readVirueRecordAddApi(_ indexRow: Int) {
-        let videoItemMdl = self.videoItemList[indexRow]
+        let videoItemMdl = self.videoItemList?[indexRow]
         
         var postDesc : String?
-        if videoItemMdl.title == nil ||  videoItemMdl.title == "" {
-            postDesc = "\(videoItemMdl.content?.prefix(20) ?? "")"
+        if videoItemMdl?.title == nil ||  videoItemMdl?.title == "" {
+            postDesc = "\(videoItemMdl?.content?.prefix(20) ?? "")"
         }else {
-            postDesc = videoItemMdl.title
+            postDesc = videoItemMdl?.title
         }
         
-        VirusViewModel.shared.readVirueRecordAddApi(postId: videoItemMdl.id, postAuthorUid: "\(videoItemMdl.uid ?? 0)", postDesc: postDesc, postType: videoItemMdl.type, postCover: videoItemMdl.img, actionId: "\(videoItemMdl.id ?? 0)")
+        VirusViewModel.shared.readVirueRecordAddApi(postId: videoItemMdl?.id, postAuthorUid: "\(videoItemMdl?.uid ?? 0)", postDesc: postDesc, postType: videoItemMdl?.type, postCover: videoItemMdl?.img, actionId: "\(videoItemMdl?.id ?? 0)")
     }
     
     /// 删除帖子

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoSubCommentController/CommunityVideoSubCommentController.swift

@@ -112,10 +112,10 @@ extension CommunityVideoSubCommentController {
             self?.communityPostReplyModels = (self?.communityPostReplyModels)! + (communityPostReplysModel?.data!)!
             self?.navigationBar.title = "\(communityPostReplysModel?.pagination?.total ?? 0)条评论"
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityPostReplysModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityPostReplysModel?.pagination)
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageList/ViewController/MessageListController.swift

@@ -109,10 +109,10 @@ extension MessageListController {
             }
             self?.messageDataModels = (self?.messageDataModels)! + (messageListModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination:messageListModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination:messageListModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageMain/ViewController/MessageMainViewController.swift

@@ -86,10 +86,10 @@ extension MessageMainViewController {
             self?.messageIndexModel = messageIndexModel as? MessageIndexModel
             self?.collectionView.reloadData()
             self?.setTabBarItemBadge()
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView)
+            MJRefreshManager.mjRefreshManager(collectionView: self?.collectionView)
         }) {
             [weak self] loadingStauts in
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView, loadingStatus: loadingStauts)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(collectionView: self?.collectionView, loadingStatus: loadingStauts)
         }
     }
     

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetActivity/Controller/MessagePlanetActivityController.swift

@@ -80,10 +80,10 @@ extension MessagePlanetActivityController {
             }
             self?.messageDataModels = (self?.messageDataModels)! + (messageListModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,pagination: messageListModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView,pagination: messageListModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetNotification/Controller/MessagePlanetNotiController.swift

@@ -74,10 +74,10 @@ extension MessagePlanetNotiController {
             }
             self?.messageDataModels = (self?.messageDataModels)! + (messageListModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,pagination: messageListModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView,pagination: messageListModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 4 - 4
RainbowPlanet/RainbowPlanet/Modules/MineModule/MyFollowAndFan/ViewController/MyFollowAndFanViewController.swift

@@ -113,11 +113,11 @@ extension MyFollowAndFanViewController {
             }
             self?.userFollowModels = (self?.userFollowModels)! + (userFollowsModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination:userFollowsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination:userFollowsModel?.pagination)
 
         }, fail: {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
         })
     }
@@ -141,10 +141,10 @@ extension MyFollowAndFanViewController {
             }
             self?.userFanModels = (self?.userFanModels)! + (userFansModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: userFansModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: userFansModel?.pagination)
         }, fail: {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         })

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListView.swift

@@ -110,10 +110,10 @@ extension PersonViewUserAndOtherListView {
             }
             self?.postMyModels = (self?.postMyModels)! + (communityPostMyModel?.data!)!
             self?.collectionView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView, pagination: communityPostMyModel?.pagination)
+            MJRefreshManager.mjRefreshManagerNoHiddenFooter(collectionView: self?.collectionView, pagination: communityPostMyModel?.pagination)
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(collectionView: self?.collectionView,loadingStatus: loadingStatus)
 
         }
     }

+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/Controller/PublishAddTopicController.swift

@@ -224,7 +224,7 @@ extension PublishAddTopicController {
                 // 子话题
                 self?.communityTopicsApi(isSuggest: 0, categoryId: communityTopicModel?.id ?? 0, page: 1)
             }else {
-                MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: .noData)
+                MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: .noData)
             }
         }
     }
@@ -244,10 +244,10 @@ extension PublishAddTopicController {
             // 更新选中状态
             self?.fixTopicSelectedStatus()
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: communityTopicsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityTopicsModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
             
         }
 

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/RedemptionAreaModule/RedemptionArea/ViewController/RedemptionAreaViewController.swift

@@ -87,10 +87,10 @@ extension RedemptionAreaViewController {
             self?.cmsRedemptionAreaModel = cmsRedemptionAreaModel as? CMSRedemptionAreaModel
             self?.navigationBar.title = self?.cmsRedemptionAreaModel?.title
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView)
+            MJRefreshManager.mjRefreshManager(tableView: self?.tableView)
         }) {
             [weak self] loadingStatus in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
 
             
         }

+ 2 - 3
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift

@@ -101,11 +101,10 @@ extension SearchContentListViewController {
             self?.communityPostDataModels = (self?.communityPostDataModels)! + (communityPostsModel?.data!)!
             self?.heightList()
             self?.collectionView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView, pagination: communityPostsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerNoHiddenFooter(collectionView: self?.collectionView, pagination: communityPostsModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(collectionView: self?.collectionView,loadingStatus: loadingStatus)
-
+            MJRefreshManager.mjRefreshManagerLoadingStatus(collectionView: self?.collectionView,loadingStatus: loadingStatus)
             
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchTopicList/ViewController/SearchTopicListViewController.swift

@@ -81,10 +81,10 @@ extension SearchTopicListViewController {
             }
             self?.communityTopicModels = (self?.communityTopicModels)! + (self?.communityTopicsModel?.data!)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: self?.communityTopicsModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: self?.communityTopicsModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
         }
 
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchUser/ViewController/SearchUserListViewController.swift

@@ -99,10 +99,10 @@ extension SearchUserListViewController {
             }
             self?.searchMemberModels = (self?.searchMemberModels)!  + (searchMemberListModel?.data)!
             self?.tableView.reloadData()
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView, pagination: searchMemberListModel?.pagination)
+            MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: searchMemberListModel?.pagination)
         }) {
             [weak self] (loadingStatus) in
-            MJRefreshManager.hiddenHeaderWithFooter(tableView: self?.tableView,loadingStatus: loadingStatus)
+            MJRefreshManager.mjRefreshManagerLoadingStatus(tableView: self?.tableView,loadingStatus: loadingStatus)
         }
     }
     

+ 2 - 1
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -222,7 +222,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - id: 内容id(过滤用)
     ///   - type: 视频类型(hot热门视频,one一个内容)
     ///   - topicId: 话题id(过滤用)
-    func communityVideoListApi(id:Int = 0, type:String = "", topicId:Int = 0, page:Int = 1, completion: @escaping successCallBack) {
+    func communityVideoListApi(id:Int = 0, type:String = "", topicId:Int = 0, page:Int = 1, completion: @escaping successCallBack,fail:@escaping failCallback) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         parameters.updateValue(type, forKey: "type")
@@ -234,6 +234,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
             completion(communityVideoListModel)
         }) {
             (loadingStatus) in
+            fail(loadingStatus)
         }
     }
     

+ 8 - 0
RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.h

@@ -38,6 +38,14 @@
  */
 - (void)addAutoNormalFooterWithAutomaticallyRefresh:(BOOL)automaticallyRefresh loadMoreBlock:(void(^)(NSInteger pageIndex))loadMoreBlock;
 
+/**
+ 提前上啦加载
+ 
+ @param automaticallyRefresh 是否自动加载
+ @param loadMoreBlock 加载回调
+ */
+- (void)addPreloadingAutoNormalFooterWithAutomaticallyRefresh:(BOOL)automaticallyRefresh loadMoreBlock:(void(^)(NSInteger pageIndex))loadMoreBlock;
+
 /**
  默认加载
  

+ 19 - 0
RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m

@@ -95,6 +95,25 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
     self.mj_footer = footer;
 }
 
+- (void)addPreloadingAutoNormalFooterWithAutomaticallyRefresh:(BOOL)automaticallyRefresh loadMoreBlock:(void(^)(NSInteger pageIndex))loadMoreBlock {
+    __weak typeof(self) weakSelf = self;
+    self.loadMoreBlock = loadMoreBlock;
+    
+    MJRefreshAutoNormalFooter * footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
+        weakSelf.pageIndex += 1;
+        if (weakSelf.loadMoreBlock) {
+            weakSelf.loadMoreBlock(weakSelf.pageIndex);
+        }
+    }];
+    
+    footer.automaticallyRefresh = automaticallyRefresh;
+    footer.triggerAutomaticallyRefreshPercent = -50;
+    footer.onlyRefreshPerDrag = YES;
+    footer.automaticallyChangeAlpha = YES;
+    
+    self.mj_footer = footer;
+}
+
 - (void)addBackNormalFooterWithLoadMoreBlock:(void(^)(NSInteger pageIndex))loadMoreBlock {
     __weak typeof(self) weakSelf = self;
     self.loadMoreBlock = loadMoreBlock;