Browse Source

关注feed流,推荐feed流完成

南鑫林 5 years ago
parent
commit
2b06966074
42 changed files with 990 additions and 1314 deletions
  1. 7 0
      RainbowPlanet/Podfile
  2. 15 1
      RainbowPlanet/Podfile.lock
  3. 12 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  4. 1 1
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+HandleOpen.swift
  5. 19 12
      RainbowPlanet/RainbowPlanet/Macro/Common.swift
  6. 31 17
      RainbowPlanet/RainbowPlanet/Macro/EnumMacro.swift
  7. 8 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/Comment/CardContentCommnetTableViewCell.swift
  8. 16 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListContentTableViewCell.swift
  9. 7 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListFooterView.swift
  10. 33 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListTableViewCell.swift
  11. 11 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewCell.swift
  12. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewLayout.swift
  13. 6 6
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoModel.swift
  14. 105 9
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoTableViewCell.swift
  15. 200 39
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/TitleContent/CardContentTitleTableViewCell.swift
  16. 10 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift
  17. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift
  18. 32 12
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FollowStatus/CommunityFollowStatusTableViewCell.swift
  19. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/PopularVideo/PopularVideoCollectionViewCell.swift
  20. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/PopularVideo/PopularVideoTableViewCell.swift
  21. 11 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowCollectionViewCell.swift
  22. 31 4
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowTableViewCell.swift
  23. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Header/CommunityFollowTableHeaderView.swift
  24. 224 1172
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  25. 23 10
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  26. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/ModifyData/View/ModifyDataAvatarView.swift
  27. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/OtherPersonalCenter/ViewController/OtherPersonalCenterViewController.swift
  28. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherHeaderView.swift
  29. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift
  30. 2 2
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/View/SearchContentListCollectionCell.swift
  31. 5 5
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchUser/View/SearchUserLitTableViewCell.swift
  32. 2 0
      RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSMemberListModel.swift
  33. 108 1
      RainbowPlanet/RainbowPlanet/Service/Model/CommunityModel/CommunityFollowFeedModel.swift
  34. 3 1
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift
  35. 0 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/Contents.json
  36. 0 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/defaul_tavatar@2x.png
  37. 0 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/defaul_tavatar@3x.png
  38. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/Contents.json
  39. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/followed@2x.png
  40. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/followed@3x.png
  41. 19 1
      RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+UIImage.swift
  42. 13 0
      RainbowPlanet/RainbowPlanet/Tools/ImageSizeFetcher.swift

+ 7 - 0
RainbowPlanet/Podfile

@@ -48,6 +48,13 @@ target 'RainbowPlanet' do
   pod 'KeychainAccess'
   # js交互
   pod 'WebViewJavascriptBridge'
+  # 路由
+  pod 'SwiftyMediator/Routable'
+  # 上下滚动的Label
+  pod 'DPScrollNumberLabel'
+  # 左右Label
+  pod 'FlickerNumber'
+  
 
   #======================第三方平台===========
   #======================友盟===========

+ 15 - 1
RainbowPlanet/Podfile.lock

@@ -24,6 +24,8 @@ PODS:
   - BMKLocationKit (1.5.0)
   - Cache (5.2.0)
   - DeviceKit (2.0.0)
+  - DPScrollNumberLabel (0.0.2)
+  - FlickerNumber (1.1)
   - FMDB (2.7.5):
     - FMDB/standard (= 2.7.5)
   - FMDB/standard (2.7.5)
@@ -54,6 +56,9 @@ PODS:
   - RxSwift (4.5.0)
   - SnapKit (4.2.0)
   - SwiftyJSON (5.0.0)
+  - SwiftyMediator/Core (0.2.0)
+  - SwiftyMediator/Routable (0.2.0):
+    - SwiftyMediator/Core
   - UMCAnalytics (6.0.3):
     - UMCCommon
   - UMCCommon (2.0.1)
@@ -90,6 +95,8 @@ DEPENDENCIES:
   - BMKLocationKit (= 1.5.0)
   - Cache
   - DeviceKit
+  - DPScrollNumberLabel
+  - FlickerNumber
   - FMDB
   - FSPagerView
   - FWPopupView
@@ -110,6 +117,7 @@ DEPENDENCIES:
   - RxSwift
   - SnapKit
   - SwiftyJSON
+  - SwiftyMediator/Routable
   - UMCAnalytics
   - UMCCommon
   - UMCCommonLog
@@ -134,6 +142,8 @@ SPEC REPOS:
     - BMKLocationKit
     - Cache
     - DeviceKit
+    - DPScrollNumberLabel
+    - FlickerNumber
     - FMDB
     - FSPagerView
     - FWPopupView
@@ -155,6 +165,7 @@ SPEC REPOS:
     - RxSwift
     - SnapKit
     - SwiftyJSON
+    - SwiftyMediator
     - UMCAnalytics
     - UMCCommon
     - UMCCommonLog
@@ -175,6 +186,8 @@ SPEC CHECKSUMS:
   BMKLocationKit: 40d267478acd8704ddebd0e9deaddc727b13df9f
   Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4
   DeviceKit: 72d36709552d4b3582abd76a53949148acad9811
+  DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
+  FlickerNumber: bce41da51904d533393d69e9734df6281ab1c646
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
   FWPopupView: c1dbb33fbe4d223f619f28a7e5e5a00f08c10342
@@ -196,6 +209,7 @@ SPEC CHECKSUMS:
   RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575
   SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
   SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7
+  SwiftyMediator: 73d97b2387f03c4f0320c1fbdf615e5fbb98871d
   UMCAnalytics: ff58714ada407682c4a07548156f94bcec92f055
   UMCCommon: 0263a057a2e1ae1da4c8308541e56904a493ce13
   UMCCommonLog: 05a2d5de21858e3d870551562cff405c1366d244
@@ -206,6 +220,6 @@ SPEC CHECKSUMS:
   WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: f2515813b84520a070f88feee517e629257bda36
+PODFILE CHECKSUM: a224330b1afa4c6586b4a2138a27df46bbc0b074
 
 COCOAPODS: 1.7.1

+ 12 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -277,6 +277,7 @@
 		A7AA9F6322C62B270086498B /* CommunityRecommnendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AA9F6222C62B270086498B /* CommunityRecommnendViewController.swift */; };
 		A7AA9F6522C63DCD0086498B /* CommunityFollowFeedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AA9F6422C63DCD0086498B /* CommunityFollowFeedModel.swift */; };
 		A7AA9F6722C640F10086498B /* CommunityRecommendFeedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AA9F6622C640F10086498B /* CommunityRecommendFeedModel.swift */; };
+		A7AA9FA322C7A5260086498B /* ImageSizeFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AA9FA222C7A5260086498B /* ImageSizeFetcher.swift */; };
 		A7B4E71F228131720012914A /* ProductSlidingLeftRightCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E71E228131720012914A /* ProductSlidingLeftRightCollectionViewCell.swift */; };
 		A7B4E721228151F40012914A /* ProductFloorTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E720228151F40012914A /* ProductFloorTitleView.swift */; };
 		A7B4E723228154750012914A /* ProductFloorBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E722228154750012914A /* ProductFloorBannerView.swift */; };
@@ -943,6 +944,7 @@
 		A7AA9F6222C62B270086498B /* CommunityRecommnendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityRecommnendViewController.swift; sourceTree = "<group>"; };
 		A7AA9F6422C63DCD0086498B /* CommunityFollowFeedModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommunityFollowFeedModel.swift; sourceTree = "<group>"; };
 		A7AA9F6622C640F10086498B /* CommunityRecommendFeedModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommunityRecommendFeedModel.swift; sourceTree = "<group>"; };
+		A7AA9FA222C7A5260086498B /* ImageSizeFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSizeFetcher.swift; sourceTree = "<group>"; };
 		A7B4E71E228131720012914A /* ProductSlidingLeftRightCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSlidingLeftRightCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7B4E720228151F40012914A /* ProductFloorTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorTitleView.swift; sourceTree = "<group>"; };
 		A7B4E722228154750012914A /* ProductFloorBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorBannerView.swift; sourceTree = "<group>"; };
@@ -2177,6 +2179,7 @@
 		A72A725422321B9400B21995 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
+				A7AA9FA422C895650086498B /* RouteManner */,
 				A797FDE922C5AC570076DCB3 /* CacheManager */,
 				A7D5F24E22BC7B0500F8E9AF /* WebViewJavascriptBridgeManager */,
 				A73911AB229CD6080033177E /* AlamofireReachabilityManager */,
@@ -2958,6 +2961,7 @@
 				A72A727722321DDF00B21995 /* Regex */,
 				A77F2CC422320627001BD3F6 /* WRNavigationBar */,
 				A72A729F22321DE000B21995 /* WKWebView */,
+				A7AA9FA222C7A5260086498B /* ImageSizeFetcher.swift */,
 			);
 			path = Tools;
 			sourceTree = "<group>";
@@ -3260,6 +3264,13 @@
 			path = Recommend;
 			sourceTree = "<group>";
 		};
+		A7AA9FA422C895650086498B /* RouteManner */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = RouteManner;
+			sourceTree = "<group>";
+		};
 		A7B4E71B22812D390012914A /* ShoppingMallSlidingLeftRight */ = {
 			isa = PBXGroup;
 			children = (
@@ -6041,6 +6052,7 @@
 				BD6122E922C3654500D3F513 /* AliyunTimelineTimeFilterItem.m in Sources */,
 				A729B5B42267254B004AE098 /* PasswordLoginViewController.swift in Sources */,
 				A7B4E7582282897B0012914A /* ProductFloorLeftHeaderCollectionReusableView.swift in Sources */,
+				A7AA9FA322C7A5260086498B /* ImageSizeFetcher.swift in Sources */,
 				A7D4608E227616F800A5A54E /* SQLiteManager.swift in Sources */,
 				A70B2C6B2288815300B2449F /* PickHeaderView.swift in Sources */,
 				A7274C50228EE5F0000E3A07 /* PhotoAndCameraManager.swift in Sources */,

+ 1 - 1
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+HandleOpen.swift

@@ -63,6 +63,6 @@ extension AppDelegate {
             let hexString = String(format: "%02x", byte)
             tokenString += hexString
         }
-        NXLLog(tokenString)
+        NXLLog("获取设备的 DeviceToken:\(tokenString)")
     }
 }

+ 19 - 12
RainbowPlanet/RainbowPlanet/Macro/Common.swift

@@ -255,13 +255,20 @@ func commonCopy(string:String) {
 ///
 /// - Returns: 返回Sting
 func getImageWidthheightStr(imgStr:String) -> String {
-    var imgStr1 = imgStr.suffix(from: (imgStr.lastIndex(of: "*"))!)
-    NXLLog(imgStr1)
-    imgStr1 = (imgStr1.suffix(imgStr1.count - 1))
-    NXLLog(imgStr1)
-    imgStr1 = imgStr1.prefix(upTo:(imgStr1.firstIndex(of: "."))!)
-    NXLLog(imgStr1)
-    return String(imgStr1)
+    if imgStr.contains("*") {
+        var imgStr1 = imgStr.suffix(from: (imgStr.lastIndex(of: "*"))!)
+//        NXLLog(imgStr1)
+        imgStr1 = (imgStr1.suffix(imgStr1.count - 1))
+//        NXLLog(imgStr1)
+        imgStr1 = imgStr1.prefix(upTo:(imgStr1.firstIndex(of: "."))!)
+//        NXLLog(imgStr1)
+        return String(imgStr1)
+    }else {
+//        let size = UIImage.getImageSize(imgStr)
+//        return "\(size.width)_\(size.height)"
+        return "280_280"
+    }
+    
 }
 
 /// 获取图片的宽
@@ -271,10 +278,10 @@ func getImageWidthheightStr(imgStr:String) -> String {
 func getImageWidth(imgStr:String) -> CGFloat {
     let imageStr = getImageWidthheightStr(imgStr: imgStr)
     let widthStr = imageStr.prefix(upTo:(imageStr.firstIndex(of: "_"))!)
-    NXLLog(widthStr)
+//    NXLLog(widthStr)
     let width = Double(widthStr)
     let widthFloat = CGFloat(width ?? 0)
-    NXLLog(widthFloat)
+//    NXLLog(widthFloat)
     return widthFloat/2
 }
 /// 获取图片的高
@@ -284,11 +291,11 @@ func getImageWidth(imgStr:String) -> CGFloat {
 func getImageHeight(imgStr:String) -> CGFloat {
     let imageStr = getImageWidthheightStr(imgStr: imgStr)
     let widthStr = imageStr.prefix(upTo:(imageStr.firstIndex(of: "_"))!)
-    NXLLog(widthStr)
+//    NXLLog(widthStr)
     let heightStr = imageStr.suffix(imageStr.count - widthStr.count - 1)
-    NXLLog(heightStr)
+//    NXLLog(heightStr)
     let height = Double(heightStr)
     let heightFloat = CGFloat(height ?? 0)
-    NXLLog(heightFloat)
+//    NXLLog(heightFloat)
     return heightFloat/2
 }

+ 31 - 17
RainbowPlanet/RainbowPlanet/Macro/EnumMacro.swift

@@ -110,22 +110,6 @@ enum FollowType : Int {
     case mutualFollow = 2
 }
 
-// MARK: - 用户状态类型
-/// 用户状态类型
-///
-/// - follow: 关注
-/// - comment: 评论
-/// - forward: 转发
-/// - like: 点赞
-/// - collection: 收藏
-enum FollowUserStatus {
-    case follow
-    case comment
-    case forward
-    case like
-    case collection
-}
-
 // MARK: - 个人中心内容
 /// 个人中心内容
 ///
@@ -146,7 +130,7 @@ enum CommunityPostMyType : String{
 /// - video: 视频推荐
 /// - topic: 精选话题
 /// - post: 内容
-enum CommunityPostSuggestCType : String {
+enum CommunityPostSuggestType : String {
     case banner = "banner"
     case user = "user"
     case video = "video"
@@ -155,6 +139,24 @@ enum CommunityPostSuggestCType : String {
 }
 
 
+
+/// 关注feed流
+///
+/// - like: 喜欢
+/// - forward: 转发
+/// - collection: 收藏
+/// - commnet: 评论
+/// - follow: 关注
+/// - pulish: 发布
+enum CommunityFollowType : String {
+    case like = "1"
+    case forward = "2"
+    case collection = "3"
+    case comment = "4"
+    case follow = "5"
+    case post = "6"
+}
+
 /// 贴子类型
 ///
 /// - image: 图片
@@ -165,3 +167,15 @@ enum PostType : String{
     case video = "video"
     case html = "html"
 }
+
+
+/// 社区类型
+///
+/// - follow: 关注
+/// - recommend: 推荐
+/// - planet: 星球
+enum CommunityType {
+    case follow
+    case recommend
+    case planet
+}

+ 8 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/Comment/CardContentCommnetTableViewCell.swift

@@ -58,7 +58,7 @@ class CardContentCommnetTableViewCell: UITableViewCell {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton()
-        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.cornerRadius = 14
         avatarButton.masksToBounds = true
         avatarButton.rx.tap.subscribe(onNext: {
@@ -86,7 +86,13 @@ class CardContentCommnetTableViewCell: UITableViewCell {
     
     var communityRecommendDataModel: CommunityRecommendDataModel? {
         didSet {
-            avatarButton.kf.setImage(with: kURLImage(name: communityRecommendDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+        }
+    }
+    
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            avatarButton.kf.setImage(with: kURLImage(name: communityFollowDataModel?.relateData?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
+
         }
     }
     

+ 16 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListContentTableViewCell.swift

@@ -69,5 +69,21 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
             }
         }
     }
+    
+    var communityFollowPostCommentModel: CommunityFollowPostCommentModel? {
+        didSet {
+            let nameStr = "\(communityFollowPostCommentModel?.username ?? ""):"
+            let contentStr = "\(communityFollowPostCommentModel?.content ?? "")"
+            commentLabel.text =  nameStr + contentStr
+            if nameStr != "" {
+                self.commentLabel.addClickText(nameStr, attributeds: [NSAttributedString.Key.font:kBoldFont14], transmitBody: nil) {
+                    (data) in
+                    
+                }
+            }
+        }
+    }
+    
+    
 
 }

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListFooterView.swift

@@ -37,5 +37,12 @@ class CardContentCommentListFooterView: BaseView {
             allCommentLabel.text = "共\(communityRecommendDataModel?.commentCount ?? 0)条评论"
         }
     }
+    
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            allCommentLabel.text = "共\(communityFollowDataModel?.relateData?.commentCount ?? 0)条评论"
+
+        }
+    }
 
 }

+ 33 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/CommentList/CardContentCommentListTableViewCell.swift

@@ -8,6 +8,7 @@
 
 import UIKit
 
+
 class CardContentCommentListTableViewCell: UITableViewCell {
     
     var cellHeightsDictionary = Dictionary<IndexPath, Any>()
@@ -83,6 +84,8 @@ class CardContentCommentListTableViewCell: UITableViewCell {
         
     }
     
+    var communityType: CommunityType?
+    
     var communityRecommendDataModel: CommunityRecommendDataModel? {
         didSet {
             if communityRecommendDataModel?.commentCount ?? 0 > 2 {
@@ -92,20 +95,47 @@ class CardContentCommentListTableViewCell: UITableViewCell {
             reloadData()
         }
     }
+    
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            if communityFollowDataModel?.relateData?.commentCount ?? 0 > 2 {
+                footerView.communityFollowDataModel = communityFollowDataModel
+                tableView.tableFooterView = footerView
+            }
+            reloadData()
+        }
+    }
 }
 
 extension CardContentCommentListTableViewCell : UITableViewDelegate,UITableViewDataSource {
     func numberOfSections(in tableView: UITableView) -> Int {
-        return communityRecommendDataModel?.comment?.isEmpty ?? true ? 0 : 1
+        if communityType == .follow {
+            return communityFollowDataModel?.relateData?.postComment?.isEmpty ?? true ? 0 : 1
+
+        }else {
+            return communityRecommendDataModel?.comment?.isEmpty ?? true ? 0 : 1
+
+        }
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return communityRecommendDataModel?.comment?.isEmpty ?? true ? 0 : communityRecommendDataModel?.comment?.count ?? 0
+        if communityType == .follow {
+            return communityFollowDataModel?.relateData?.postComment?.isEmpty ?? true ? 0 : communityFollowDataModel?.relateData?.postComment?.count ?? 0
+
+        }else {
+            return communityRecommendDataModel?.comment?.isEmpty ?? true ? 0 : communityRecommendDataModel?.comment?.count ?? 0
+
+        }
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = CardContentCommentListContentTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-        cell.communityRecommendCommentModel = communityRecommendDataModel?.comment?[indexPath.row]
+        if communityType == .follow {
+            cell.communityFollowPostCommentModel = communityFollowDataModel?.relateData?.postComment?[indexPath.row]
+        }else {
+            cell.communityRecommendCommentModel = communityRecommendDataModel?.comment?[indexPath.row]
+
+        }
         return cell
     }
     

+ 11 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewCell.swift

@@ -79,5 +79,16 @@ class CardContentPicVideoCollectionViewCell: UICollectionViewCell {
         }
     }
     
+    var communityFollowDataModel: CommunityFollowDataModel? {
+        didSet {
+            if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") == .video {
+                pauseImageView.isHidden = false
+            }else {
+                pauseImageView.isHidden = true
+                
+            }
+        }
+    }
+    
     
 }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewLayout.swift

@@ -71,7 +71,7 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
                         return CGRect(x: 0, y: 0, width: (kScreenWidth-28), height: (height / width) * kScaleWidth)
 
                     }else {
-                        let height = (232 * (cardContentPicVideoModel?.height ?? 0))
+                        let height = (280 * (cardContentPicVideoModel?.height ?? 0))
                         let width = (cardContentPicVideoModel?.width ?? 0)
                         return CGRect(x: 0, y: 0, width: 280 * kScaleWidth, height: (height / width) * kScaleWidth)
                     }

+ 6 - 6
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoModel.swift

@@ -12,12 +12,12 @@ class CardContentPicVideoModel: NSObject {
     
     var width : CGFloat = 0
     var height : CGFloat = 0
-    var postType : PostType = .image
+    var postType : PostType?
     var number : Int = 0
     
     func collectionViewHeight() -> CGFloat {
-        
-        if postType == .image || postType == .html { //图片
+        switch postType { //图片
+        case .html?,.image?:
             switch number {
             case 1:
                 if width < height { //图片宽度大于图片高度
@@ -29,9 +29,9 @@ class CardContentPicVideoModel: NSObject {
                 }else if width == height { //图片宽度等于图片高度
                     return 280 * kScaleWidth
                 }else{
-                     if width / height > 2 {
+                    if width / height > 2 {
                         return ((347 * height) / width) * kScaleWidth
-                     }else {
+                    }else {
                         return ((280 * height) / width) * kScaleWidth
                     }
                 }
@@ -54,7 +54,7 @@ class CardContentPicVideoModel: NSObject {
             default:
                 return 0
             }
-        }else { //视频
+        default: //视频
             if width > height {
                 return 462.5 * kScaleWidth
             }else {

+ 105 - 9
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoTableViewCell.swift

@@ -45,7 +45,7 @@ class CardContentPicVideoTableViewCell: UITableViewCell {
     }
     private lazy var collectionView: UICollectionView = {
         let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
-        collectionView.backgroundColor = .gray
+        collectionView.backgroundColor = .white
         collectionView.delegate = self;
         collectionView.dataSource = self;
         collectionView.showsVerticalScrollIndicator = false
@@ -62,19 +62,68 @@ class CardContentPicVideoTableViewCell: UITableViewCell {
     var communityRecommendDataModel: CommunityRecommendDataModel? {
         didSet {
             let cardContentPicVideoModel = CardContentPicVideoModel()
-            cardContentPicVideoModel.number = communityRecommendDataModel?.imgs?.count ?? 1
             let imgStr = communityRecommendDataModel?.img
-            if communityRecommendDataModel?.imgs?.count ?? 0 == 1 {
-                if communityRecommendDataModel?.img != "" || communityRecommendDataModel?.img != nil {
+            
+            if communityRecommendDataModel?.imgs?.isEmpty ?? true {
+                if communityRecommendDataModel?.img != "" && communityRecommendDataModel?.img != nil {
+                    cardContentPicVideoModel.number = 1
+                    cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
+                    cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
+                    cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel?.type ?? "image")!
+                    self.cardContentPicVideoModel = cardContentPicVideoModel
+                }
+            }else {
+                
+                if communityRecommendDataModel?.imgs?.count ?? 0 == 1 {
+                    if communityRecommendDataModel?.img != "" || communityRecommendDataModel?.img != nil {
+                        cardContentPicVideoModel.number = 1
+                        cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
+                        cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
+                        cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel?.type ?? "image")!
+                        self.cardContentPicVideoModel = cardContentPicVideoModel
+                    }
+                }else {
+                    cardContentPicVideoModel.number = communityRecommendDataModel?.imgs?.count ?? 1
+                    cardContentPicVideoModel.postType = PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image")!
+                    self.cardContentPicVideoModel = cardContentPicVideoModel
+                }
+            }
+        }
+    }
+    
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            let cardContentPicVideoModel = CardContentPicVideoModel()
+            let imgStr = communityFollowDataModel?.relateData?.img
+            
+            if communityFollowDataModel?.relateData?.imgs?.isEmpty ?? true {
+                if communityFollowDataModel?.relateData?.img != "" && communityFollowDataModel?.relateData?.img != nil {
+                    cardContentPicVideoModel.number = 1
                     cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                     cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
+                    cardContentPicVideoModel.postType = PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image")!
+                    self.cardContentPicVideoModel = cardContentPicVideoModel
+                }
+            }else {
+                if communityFollowDataModel?.relateData?.imgs?.count ?? 0 == 1 {
+                    if imgStr != "" || imgStr != nil {
+                        cardContentPicVideoModel.number = 1
+                        cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
+                        cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
+                        cardContentPicVideoModel.postType = PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image")!
+                        self.cardContentPicVideoModel = cardContentPicVideoModel
+                    }
+                }else {
+                    cardContentPicVideoModel.number = communityFollowDataModel?.relateData?.imgs?.count ?? 1
+                    cardContentPicVideoModel.postType = PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image")!
+                    self.cardContentPicVideoModel = cardContentPicVideoModel
                 }
+                
             }
-            cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel?.type ?? "image")!
-            self.cardContentPicVideoModel = cardContentPicVideoModel
         }
     }
     
+    
     var cardContentPicVideoModel: CardContentPicVideoModel? {
         didSet {
             collectionViewLayout.cardContentPicVideoModel = cardContentPicVideoModel
@@ -88,6 +137,7 @@ class CardContentPicVideoTableViewCell: UITableViewCell {
             collectionView.reloadData()
         }
     }
+    var type : CommunityRecommendFollowTableViewCellType?
 }
 
 extension CardContentPicVideoTableViewCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
@@ -96,13 +146,59 @@ extension CardContentPicVideoTableViewCell: UICollectionViewDelegateFlowLayout,U
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        return cardContentPicVideoModel?.number ?? 0
+        if type == .recommend {
+            if communityRecommendDataModel?.imgs?.isEmpty ?? true {
+                if communityRecommendDataModel?.img == "" || communityRecommendDataModel?.img == nil {
+                    return 0
+                }else {
+                   return 1
+                }
+            }else {
+                return communityRecommendDataModel?.imgs?.count ?? 0
+            }
+        } else if type == .follow {
+            if communityFollowDataModel?.relateData?.imgs?.isEmpty ?? true {
+                if communityFollowDataModel?.relateData?.img == "" || communityFollowDataModel?.relateData?.img == nil {
+                    return 0
+                }else {
+                    return 1
+                }
+            }else {
+                return communityFollowDataModel?.relateData?.imgs?.count ?? 0
+            }
+        } else {
+            return 0
+        }
+        
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = CardContentPicVideoCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-        cell.imgStr = communityRecommendDataModel?.imgs?[indexPath.row]
-        cell.communityRecommendDataModel = communityRecommendDataModel
+        
+        if type == .recommend {
+            if communityRecommendDataModel?.imgs?.isEmpty ?? true {
+                if communityRecommendDataModel?.img == "" || communityRecommendDataModel?.img == nil {
+                    
+                }else {
+                    cell.imgStr = communityRecommendDataModel?.img
+
+                }
+            }else {
+                cell.imgStr = communityRecommendDataModel?.imgs?[indexPath.row]
+            }
+            cell.communityRecommendDataModel = communityRecommendDataModel
+        } else if type == .follow {
+            if communityRecommendDataModel?.imgs?.isEmpty ?? true {
+                if communityRecommendDataModel?.img == "" || communityRecommendDataModel?.img == nil {
+                    
+                }else {
+                    cell.imgStr = communityFollowDataModel?.relateData?.img
+                    
+                }
+            }else {
+                cell.imgStr = communityFollowDataModel?.relateData?.imgs?[indexPath.row]
+            }
+        }
         return cell
     }
     

+ 200 - 39
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/TitleContent/CardContentTitleTableViewCell.swift

@@ -97,33 +97,43 @@ class CardContentTitleTableViewCell: UITableViewCell {
         }
     }
     
-    
     var cardContentTitleTableViewCellType: CardContentTitleTableViewCellType? {
         didSet {
             switch cardContentTitleTableViewCellType {
             case .noTitleMoreThan?:
                 titleLabel.isHidden = true
-                var str = (communityRecommendDataModel?.content)!
-
-                if str.count >= 46 {
-                    str = String(str.prefix(46) + "...更多")
-                    let str1 = str.suffix(2)
-                    subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
-
+                if PostType(rawValue: communityRecommendDataModel?.type ?? "image") != .html {
+                    subtitleLabel.isHidden = false
+                    var str = communityRecommendDataModel?.content ?? ""
+                    
+                    if str.count >= 46 {
+                        str = String(str.prefix(46) + "...更多")
+                        let str1 = str.suffix(2)
+                        subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
+                        
+                    }else {
+                        let attr = NSMutableAttributedString.init(string: str)
+                        subtitleLabel.attributedText = attr
+                    }
                 }else {
-                    let attr = NSMutableAttributedString.init(string: str)
-                    subtitleLabel.attributedText = attr
+                    subtitleLabel.isHidden = true
                 }
-
                 subtitleLabel.snp_remakeConstraints { (make) in
                     make.top.bottom.equalToSuperview()
                     make.left.equalTo(14)
                     make.right.equalTo(-14)
                 }
+
                 break
             case .noTitleNoMoreThan?:
                 titleLabel.isHidden = true
-                subtitleLabel.text = communityRecommendDataModel?.content
+                if PostType(rawValue: communityRecommendDataModel?.type ?? "image") != .html {
+                    subtitleLabel.text = communityRecommendDataModel?.content
+                    subtitleLabel.isHidden = false
+                }else {
+                    subtitleLabel.isHidden = true
+                }
+               
                 subtitleLabel.snp_remakeConstraints { (make) in
                     make.top.bottom.equalToSuperview()
                     make.left.equalTo(14)
@@ -133,48 +143,199 @@ class CardContentTitleTableViewCell: UITableViewCell {
             case .titleMoreThan?:
                 titleLabel.isHidden = false
                 titleLabel.text = communityRecommendDataModel?.title
-                var str = (communityRecommendDataModel?.content)!
-                if str.count >= 46 {
-                    str = String(str.prefix(46) + "...更多")
-                    let str1 = str.suffix(2)
-                    subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
+                if PostType(rawValue: communityRecommendDataModel?.type ?? "image") != .html {
+                    subtitleLabel.isHidden = false
+                    var str = communityRecommendDataModel?.content ?? ""
+                    if str.count >= 46 {
+                        str = String(str.prefix(46) + "...更多")
+                        let str1 = str.suffix(2)
+                        subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
+                        
+                    }else {
+                        let attr = NSMutableAttributedString.init(string: str)
+                        subtitleLabel.attributedText = attr
+                    }
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                        make.height.equalTo(22)
+                    }
+                    
+                    subtitleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalTo(titleLabel.snp_bottom).offset(10)
+                        make.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
+                }else {
+                    subtitleLabel.isHidden = true
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
+                }
+                
+                break
+            case .titleNoMoreThan?:
+                titleLabel.isHidden = false
+                titleLabel.text = communityRecommendDataModel?.title
+                if PostType(rawValue: communityRecommendDataModel?.type ?? "image") != .html {
+                    subtitleLabel.text = communityRecommendDataModel?.content
+                    subtitleLabel.isHidden = false
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalToSuperview()
+                        make.leading.equalTo(14)
+                        make.trailing.equalTo(-14)
+                        make.height.equalTo(22)
+                    }
+                    subtitleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalTo(titleLabel.snp_bottom).offset(10)
+                        make.bottom.equalToSuperview()
+                        make.leading.equalTo(14)
+                        make.trailing.equalTo(-14)
+                    }
+                }else {
+                    subtitleLabel.isHidden = true
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
+                }
+                break
+            default:
+                break
+            }
+        }
+    }
+    
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            if (communityFollowDataModel?.relateData?.title == "" || communityFollowDataModel?.relateData?.title == nil) {
+                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 46 {
+                    cardContentTitleTableViewCellType1 = .noTitleMoreThan
+                }else {
+                    cardContentTitleTableViewCellType1 = .noTitleNoMoreThan
+                }
+            }else {
+                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 46 {
+                    cardContentTitleTableViewCellType1 = .titleMoreThan
+                }else {
+                    cardContentTitleTableViewCellType1 = .titleNoMoreThan
+                }
+            }
+        }
+    }
+    
+    var cardContentTitleTableViewCellType1: CardContentTitleTableViewCellType? {
+        didSet {
+            switch cardContentTitleTableViewCellType1 {
+            case .noTitleMoreThan?:
+                titleLabel.isHidden = true
+                if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") != .html {
+                    subtitleLabel.isHidden = false
+                    var str = communityFollowDataModel?.relateData?.content ?? ""
                     
+                    if str.count >= 46 {
+                        str = String(str.prefix(46) + "...更多")
+                        let str1 = str.suffix(2)
+                        subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
+                        
+                    }else {
+                        let attr = NSMutableAttributedString.init(string: str)
+                        subtitleLabel.attributedText = attr
+                    }
                 }else {
-                    let attr = NSMutableAttributedString.init(string: str)
-                    subtitleLabel.attributedText = attr
+                    subtitleLabel.isHidden = true
                 }
-                titleLabel.snp_remakeConstraints { (make) in
-                    make.top.equalToSuperview()
+                subtitleLabel.snp_remakeConstraints { (make) in
+                    make.top.bottom.equalToSuperview()
                     make.left.equalTo(14)
                     make.right.equalTo(-14)
-                    make.height.equalTo(22)
+                }
+                
+                break
+            case .noTitleNoMoreThan?:
+                titleLabel.isHidden = true
+                if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") != .html {
+                    subtitleLabel.text = communityFollowDataModel?.relateData?.content
+                    subtitleLabel.isHidden = false
+                }else {
+                    subtitleLabel.isHidden = true
                 }
                 
                 subtitleLabel.snp_remakeConstraints { (make) in
-                    make.top.equalTo(titleLabel.snp_bottom).offset(10)
-                    make.bottom.equalToSuperview()
+                    make.top.bottom.equalToSuperview()
                     make.left.equalTo(14)
                     make.right.equalTo(-14)
                 }
-
                 break
-            case .titleNoMoreThan?:
+            case .titleMoreThan?:
                 titleLabel.isHidden = false
-                titleLabel.text = communityRecommendDataModel?.title
-                subtitleLabel.text = communityRecommendDataModel?.content
-                titleLabel.snp_remakeConstraints { (make) in
-                    make.top.equalToSuperview()
-                    make.leading.equalTo(14)
-                    make.trailing.equalTo(-14)
-                    make.height.equalTo(22)
+                titleLabel.text = communityFollowDataModel?.relateData?.title
+                if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") != .html {
+                    subtitleLabel.isHidden = false
+                    var str = communityFollowDataModel?.relateData?.content ?? ""
+                    if str.count >= 46 {
+                        str = String(str.prefix(46) + "...更多")
+                        let str1 = str.suffix(2)
+                        subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
+                        
+                    }else {
+                        let attr = NSMutableAttributedString.init(string: str)
+                        subtitleLabel.attributedText = attr
+                    }
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                        make.height.equalTo(22)
+                    }
+                    
+                    subtitleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalTo(titleLabel.snp_bottom).offset(10)
+                        make.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
+                }else {
+                    subtitleLabel.isHidden = true
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
                 }
-                subtitleLabel.snp_remakeConstraints { (make) in
-                    make.top.equalTo(titleLabel.snp_bottom).offset(10)
-                    make.bottom.equalToSuperview()
-                    make.leading.equalTo(14)
-                    make.trailing.equalTo(-14)
+                
+                break
+            case .titleNoMoreThan?:
+                titleLabel.isHidden = false
+                titleLabel.text = communityFollowDataModel?.relateData?.title
+                if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") != .html {
+                    subtitleLabel.text = communityFollowDataModel?.relateData?.content
+                    subtitleLabel.isHidden = false
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalToSuperview()
+                        make.leading.equalTo(14)
+                        make.trailing.equalTo(-14)
+                        make.height.equalTo(22)
+                    }
+                    subtitleLabel.snp_remakeConstraints { (make) in
+                        make.top.equalTo(titleLabel.snp_bottom).offset(10)
+                        make.bottom.equalToSuperview()
+                        make.leading.equalTo(14)
+                        make.trailing.equalTo(-14)
+                    }
+                }else {
+                    subtitleLabel.isHidden = true
+                    titleLabel.snp_remakeConstraints { (make) in
+                        make.top.bottom.equalToSuperview()
+                        make.left.equalTo(14)
+                        make.right.equalTo(-14)
+                    }
                 }
-
                 break
             default:
                 break

+ 10 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift

@@ -137,13 +137,22 @@ class CardContentUserTableViewCell: UITableViewCell {
     
     var communityRecommendDataModel: CommunityRecommendDataModel? {
         didSet {
-            avatarButton.kf.setImage(with: kURLImage(name: communityRecommendDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: communityRecommendDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(communityRecommendDataModel?.username, for: UIControl.State.normal)
             timeLabel.text = communityRecommendDataModel?.createdAt
             followType = FollowType(rawValue: communityRecommendDataModel?.isFollow ?? 0)
         }
     }
     
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            avatarButton.kf.setImage(with: kURLImage(name: communityFollowDataModel?.relateData?.avatar ?? ""), for: UIControl.State.normal , placeholder: kImage(name: "default_avatar"))
+            titleButton.setTitle(communityFollowDataModel?.relateData?.username, for: UIControl.State.normal)
+            timeLabel.text = communityFollowDataModel?.relateData?.createdAt
+            followType = FollowType(rawValue: communityFollowDataModel?.relateData?.isFollow ?? 0)
+        }
+    }
+    
     var followType: FollowType! {
         didSet {
             switch followType {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift

@@ -47,7 +47,7 @@ class FeaturedTopicsTableViewCell: UITableViewCell {
     
     private lazy var collectionView: UICollectionView = {
         let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
-        collectionView.backgroundColor = .gray
+        collectionView.backgroundColor = kf7f8faColor
         collectionView.delegate = self;
         collectionView.dataSource = self;
         collectionView.showsVerticalScrollIndicator = false

+ 32 - 12
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FollowStatus/CommunityFollowStatusTableViewCell.swift

@@ -117,7 +117,7 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         twoSubtitleLabel.snp_makeConstraints { (make) in
             make.bottom.equalTo(-15)
             make.left.equalTo(15)
-            make.right.equalTo(-107)
+            make.right.equalTo(-37)
             make.height.equalTo(14)
         }
         twoGoImageView.snp_makeConstraints { (make) in
@@ -146,7 +146,7 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setImage(kImage(name: "pic_preload"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.imageView?.contentMode = .scaleAspectFit
         avatarButton.cornerRadius = 14
         avatarButton.masksToBounds = true
@@ -209,6 +209,7 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         return titleOtherButton
     }()
     
+    
     private lazy var followButton: UIButton = {
         let followButton = UIButton(type: UIButton.ButtonType.custom)
         followButton.titleLabel?.font = kRegularFont13
@@ -296,11 +297,23 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         return skittlesTitleLabel
     }()
     
-    var followUserStatus: FollowUserStatus! {
+    var communityFollowDataModel : CommunityFollowDataModel? {
+        didSet {
+            avatarButton.kf.setImage(with: kURLImage(name: communityFollowDataModel?.followAvatar ?? ""), for: UIControl.State.normal , placeholder: kImage(name: "default_avatar"))
+            titleButton.setTitle(communityFollowDataModel?.followUsername, for: UIControl.State.normal)
+            communityFollowType = CommunityFollowType(rawValue: communityFollowDataModel?.type ?? "1")
+        }
+    }
+    
+    
+    var communityFollowType: CommunityFollowType? {
         didSet {
-            switch followUserStatus {
+            switch communityFollowType {
             case .follow?:
-                timeStatusLabel.text = "刚刚 关注了"
+                timeStatusLabel.text = "\(communityFollowDataModel?.createdAt ?? "") 关注了"
+                avatarOtherButton.kf.setImage(with: kURLImage(name: communityFollowDataModel?.relateData?.avatar ?? ""), for: UIControl.State.normal , placeholder: kImage(name: "default_avatar"))
+                titleButton.setTitle(communityFollowDataModel?.relateData?.username, for: UIControl.State.normal)
+                followType = FollowType(rawValue: communityFollowDataModel?.relateData?.isFollow ?? 0)
                 oneCardView.isHidden = false
                 twoCardView.isHidden = true
                 threeCardView.isHidden = true
@@ -308,24 +321,29 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
                 skittlesTitleLabel.isHidden = true
                 break
             case .comment?:
-                timeStatusLabel.text = "30秒前 评论"
+                timeStatusLabel.text = "\(communityFollowDataModel?.createdAt ?? "") 评论"
+                twoTitleLabel.text = communityFollowDataModel?.content?.postDesc ?? ""
+                twoSubtitleLabel.text = "“\(communityFollowDataModel?.content?.commentDesc ?? "")”"
+                skittlesTitleLabel.text = "收获 \(communityFollowDataModel?.content?.beans ?? 0) 个彩虹豆"
+                
                 oneCardView.isHidden = true
                 twoCardView.isHidden = false
                 threeCardView.isHidden = true
                 skittlesImageView.isHidden = false
                 skittlesTitleLabel.isHidden = false
-                skittlesImageView.snp_makeConstraints { (make) in
+                skittlesImageView.snp_remakeConstraints { (make) in
                     make.left.equalTo(15)
                     make.top.equalTo(twoCardView.snp_bottom).offset(12)
                     make.size.equalTo(16)
                 }
-                skittlesTitleLabel.snp_makeConstraints { (make) in
+                skittlesTitleLabel.snp_remakeConstraints { (make) in
                     make.left.equalTo(skittlesImageView.snp_right).offset(2)
-                    make.centerY.equalTo(skittlesImageView)
+                    make.top.equalTo(skittlesImageView)
                 }
                 break
             case .forward?:
-                timeStatusLabel.text = "2019-02-01 转发"
+                timeStatusLabel.text = "\(communityFollowDataModel?.createdAt ?? "") 转发"
+                twoTitleLabel.text = communityFollowDataModel?.content?.postDesc ?? ""
                 oneCardView.isHidden = true
                 twoCardView.isHidden = true
                 threeCardView.isHidden = false
@@ -342,7 +360,8 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
                 }
                 break
             case .like?:
-                timeStatusLabel.text = "30秒前 点赞"
+                timeStatusLabel.text = "\(communityFollowDataModel?.createdAt ?? "") 点赞"
+                twoTitleLabel.text = communityFollowDataModel?.content?.postDesc ?? ""
                 oneCardView.isHidden = true
                 twoCardView.isHidden = true
                 threeCardView.isHidden = false
@@ -359,7 +378,8 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
                 }
                 break
             case .collection?:
-                timeStatusLabel.text = "2天前 收藏"
+                timeStatusLabel.text = "\(communityFollowDataModel?.createdAt ?? "") 收藏"
+                twoTitleLabel.text = communityFollowDataModel?.content?.postDesc ?? ""
                 oneCardView.isHidden = true
                 twoCardView.isHidden = true
                 threeCardView.isHidden = false

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/PopularVideo/PopularVideoCollectionViewCell.swift

@@ -67,7 +67,7 @@ class PopularVideoCollectionViewCell: UICollectionViewCell {
     
     private lazy var avatarImageView : UIImageView = {
         let avatarImageView = UIImageView()
-        avatarImageView.image = kImage(name: "defaul_tavatar")
+        avatarImageView.image = kImage(name: "default_avatar")
         avatarImageView.cornerRadius = 27
         avatarImageView.masksToBounds = true
         return avatarImageView
@@ -84,7 +84,7 @@ class PopularVideoCollectionViewCell: UICollectionViewCell {
     var communityRecommendTypeDataModel : CommunityRecommendTypeDataModel? {
         didSet {
             picImageView.kf.setImage(with: kURLImage(name: communityRecommendTypeDataModel?.img ?? ""), placeholder: kImage(name: "pic_preload"))
-            avatarImageView.kf.setImage(with: kURLImage(name: communityRecommendTypeDataModel?.avatar ?? ""), placeholder: kImage(name: "defaul_tavatar"))
+            avatarImageView.kf.setImage(with: kURLImage(name: communityRecommendTypeDataModel?.avatar ?? ""), placeholder: kImage(name: "default_avatar"))
             nameLabel.text = communityRecommendTypeDataModel?.userName
         }
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/PopularVideo/PopularVideoTableViewCell.swift

@@ -46,7 +46,7 @@ class PopularVideoTableViewCell: UITableViewCell {
     
     private lazy var collectionView: UICollectionView = {
         let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
-        collectionView.backgroundColor = .gray
+        collectionView.backgroundColor = kf7f8faColor
         collectionView.delegate = self;
         collectionView.dataSource = self;
         collectionView.showsVerticalScrollIndicator = false

+ 11 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowCollectionViewCell.swift

@@ -129,13 +129,23 @@ class CommunityRecommendFollowCollectionViewCell: UICollectionViewCell {
     
     var communityRecommendTypeDataModel : CommunityRecommendTypeDataModel? {
         didSet {
-            avatarButton.kf.setImage(with: kURLImage(name: communityRecommendTypeDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: communityRecommendTypeDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(communityRecommendTypeDataModel?.userName, for: UIControl.State.normal)
             topicLabel.text = "#\(communityRecommendTypeDataModel?.topicName ?? "")"
             followType = FollowType(rawValue: communityRecommendTypeDataModel?.followStatus ?? 0)
         }
     }
     
+    var cmsMemberModel : CMSMemberModel? {
+        didSet {
+            avatarButton.kf.setImage(with: kURLImage(name: cmsMemberModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
+            titleButton.setTitle(cmsMemberModel?.username, for: UIControl.State.normal)
+            topicLabel.text = "#\(cmsMemberModel?.topicName ?? "")"
+            followType = FollowType(rawValue: cmsMemberModel?.followStatus ?? 0)
+        }
+    }
+    
+    
     var followType: FollowType! {
         didSet {
             switch followType {

+ 31 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowTableViewCell.swift

@@ -8,6 +8,11 @@
 
 import UIKit
 
+enum CommunityRecommendFollowTableViewCellType {
+    case recommend
+    case follow
+}
+
 class CommunityRecommendFollowTableViewCell: UITableViewCell {
 
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommunityRecommendFollowTableViewCell {
@@ -73,23 +78,45 @@ class CommunityRecommendFollowTableViewCell: UITableViewCell {
             collectionView.reloadData()
         }
     }
+    
+    var cmsMemberModels: Array<CMSMemberModel>? {
+        didSet {
+            collectionView.reloadData()
+        }
+    }
+    
+    var type : CommunityRecommendFollowTableViewCellType?
+    
 
 }
 
 extension CommunityRecommendFollowTableViewCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
     func numberOfSections(in collectionView: UICollectionView) -> Int {
-        
-        return communityRecommendTypeDataModels?.isEmpty ?? true ? 0 : 1
+        if type == .recommend {
+            return communityRecommendTypeDataModels?.isEmpty ?? true ? 0 : 1
+        }else if type == .follow {
+            return cmsMemberModels?.isEmpty ?? true ? 0 : 1
+        }else {
+             return 0
+        }
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        return communityRecommendTypeDataModels?.isEmpty ?? true ? 0 : communityRecommendTypeDataModels?.count ?? 0
+        if type == .recommend {
+            return communityRecommendTypeDataModels?.isEmpty ?? true ? 0 : communityRecommendTypeDataModels?.count ?? 0
+        }else {
+            return cmsMemberModels?.isEmpty ?? true ? 0 : cmsMemberModels?.count ?? 0
+        }
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         let cell = CommunityRecommendFollowCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-        cell.communityRecommendTypeDataModel = communityRecommendTypeDataModels?[indexPath.row]
+        if type == .recommend {
+            cell.communityRecommendTypeDataModel = communityRecommendTypeDataModels?[indexPath.row]
+        }else {
+            cell.cmsMemberModel = cmsMemberModels?[indexPath.row]
+        }
         return cell
         
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Header/CommunityFollowTableHeaderView.swift

@@ -46,7 +46,7 @@ class CommunityFollowTableHeaderView: BaseView {
     
     private lazy var iconImageView: UIImageView = {
         let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "pic_preload")
+        iconImageView.image = kImage(name: "followed")
         return iconImageView
     }()
     

File diff suppressed because it is too large
+ 224 - 1172
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift


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

@@ -102,7 +102,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         let communityRecommendDataModel = communityRecommendDataModels[section]
-        if  CommunityPostSuggestCType(rawValue: communityRecommendDataModel.showType ?? "") == .post {
+        if  CommunityPostSuggestType(rawValue: communityRecommendDataModel.showType ?? "") == .post {
             return 6
         }else {
             return 1
@@ -113,7 +113,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         
         let communityRecommendDataModel = communityRecommendDataModels[indexPath.section]
-        let communityPostSuggestCType = CommunityPostSuggestCType(rawValue: communityRecommendDataModel.showType ?? "")
+        let communityPostSuggestCType = CommunityPostSuggestType(rawValue: communityRecommendDataModel.showType ?? "")
         switch communityPostSuggestCType {
         case .banner?: //banner
             let cell = CommunityBannerTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
@@ -123,6 +123,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
             return cell
         case .user?: //推荐用户
             let cell = CommunityRecommendFollowTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.type = .recommend
             if !(communityRecommendDataModel.data?.isEmpty ?? true) {
                 cell.communityRecommendTypeDataModels = communityRecommendDataModel.data
             }
@@ -149,6 +150,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
             //图片视频
             case 1:
                 let cell = CardContentPicVideoTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.type = .recommend
                 cell.communityRecommendDataModel = communityRecommendDataModel
                 return cell
             //内容标题
@@ -200,7 +202,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
         
         let communityRecommendDataModel = communityRecommendDataModels[indexPath.section]
-        let communityPostSuggestCType = CommunityPostSuggestCType(rawValue: communityRecommendDataModel.showType ?? "")
+        let communityPostSuggestCType = CommunityPostSuggestType(rawValue: communityRecommendDataModel.showType ?? "")
         switch communityPostSuggestCType {
         //banner
         case .banner?:
@@ -240,15 +242,22 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
             case 1:
                 
                 let cardContentPicVideoModel = CardContentPicVideoModel()
-                cardContentPicVideoModel.number = communityRecommendDataModel.imgs?.count ?? 1
-                cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel.type ?? "image")!
+                cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel.type ?? "html")
 
                 let imgStr = communityRecommendDataModel.img
-                if communityRecommendDataModel.imgs?.isEmpty ?? true {
-                    return 0
+                if communityRecommendDataModel.imgs?.count ?? 0 == 0 {
+                    if communityRecommendDataModel.img != "" && communityRecommendDataModel.img != nil {
+                        cardContentPicVideoModel.number = 1
+                        cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
+                        cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
+                        return cardContentPicVideoModel.collectionViewHeight() + 20
+                    }else {
+                        return 0
+                    }
                 }else {
                     if communityRecommendDataModel.imgs?.count ?? 0 == 1 {
                         if communityRecommendDataModel.img != "" || communityRecommendDataModel.img != nil {
+                            cardContentPicVideoModel.number = 1
                             cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                             cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
                             return cardContentPicVideoModel.collectionViewHeight() + 20
@@ -256,6 +265,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
                             return 0
                         }
                     }else {
+                        cardContentPicVideoModel.number = communityRecommendDataModel.imgs?.count ?? 0
                         return cardContentPicVideoModel.collectionViewHeight() + 20
                     }
                 }
@@ -267,7 +277,10 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
                 return 54
             //评论列表
             case 4:
-                return UITableView.automaticDimension
+                if !(communityRecommendDataModel.comment?.isEmpty ?? true) {
+                    return UITableView.automaticDimension
+                }
+                return 0
             //评论
             case 5:
                 return 74
@@ -282,7 +295,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
         
         let communityRecommendDataModel = communityRecommendDataModels[section]
-        let communityPostSuggestCType = CommunityPostSuggestCType(rawValue: communityRecommendDataModel.showType ?? "")
+        let communityPostSuggestCType = CommunityPostSuggestType(rawValue: communityRecommendDataModel.showType ?? "")
         switch communityPostSuggestCType {
         //banner
         case .banner?:
@@ -325,7 +338,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
         
         let communityRecommendDataModel = communityRecommendDataModels[section]
-        let communityPostSuggestCType = CommunityPostSuggestCType(rawValue: communityRecommendDataModel.showType ?? "")
+        let communityPostSuggestCType = CommunityPostSuggestType(rawValue: communityRecommendDataModel.showType ?? "")
         let headerView = CommunityCommonSectionHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 62))
 
         switch communityPostSuggestCType {

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/ModifyData/View/ModifyDataAvatarView.swift

@@ -37,7 +37,7 @@ class ModifyDataAvatarView: BaseView {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setBackgroundImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setBackgroundImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.cornerRadius = 40
         avatarButton.masksToBounds = true
         avatarButton.rx.tap.subscribe(onNext: {
@@ -77,7 +77,7 @@ class ModifyDataAvatarView: BaseView {
     
     var userDetailModel: UserDetailModel? {
         didSet {
-            avatarButton.kf.setBackgroundImage(with: kURLImage(name: userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setBackgroundImage(with: kURLImage(name: userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
         }
     }
 

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/OtherPersonalCenter/ViewController/OtherPersonalCenterViewController.swift

@@ -90,7 +90,7 @@ class OtherPersonalCenterViewController: BaseViewController {
     
     lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.alpha = 0
         return avatarButton
     }()
@@ -178,7 +178,7 @@ extension OtherPersonalCenterViewController {
             self?.userDetailModel = userDetailModel as? UserDetailModel
             self?.otherHeaderView.userDetailModel = self?.userDetailModel
             self?.navigationBar.backgroundImageView.kf.setImage(with: kURLImage(name: self?.userDetailModel?.backgroundImg ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            self?.avatarButton.kf.setImage(with: kURLImage(name: self?.userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            self?.avatarButton.kf.setImage(with: kURLImage(name: self?.userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             self?.nameButton.setTitle(self?.userDetailModel?.username, for: UIControl.State.normal)
             self?.cmsTemplateTitles = ["发布 \(self?.userDetailModel?.postCount ?? "0")","收藏 \(self?.userDetailModel?.collectCount ?? "0")","分享 \(self?.userDetailModel?.shareCount ?? "0")"]
             self?.reloadData()

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

@@ -162,7 +162,7 @@ class PersonViewUserAndOtherHeaderView: BaseView {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setBackgroundImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setBackgroundImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.cornerRadius = 30
         avatarButton.masksToBounds = true
         avatarButton.rx.tap.subscribe(onNext: {[weak self] (data) in
@@ -242,7 +242,7 @@ class PersonViewUserAndOtherHeaderView: BaseView {
             }
             followNumberButton.setTitle("\(userDetailModel?.followCount ?? "0") 关注", for: UIControl.State.normal)
             fanNumberButton.setTitle("\(userDetailModel?.fansCount ?? "0") 粉丝", for: UIControl.State.normal)
-            avatarButton.kf.setBackgroundImage(with: kURLImage(name: userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setBackgroundImage(with: kURLImage(name: userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift

@@ -127,7 +127,7 @@ class UserPersonalCenterViewController: BaseViewController {
     
     lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.alpha = 0
         avatarButton.cornerRadius = 10
         avatarButton.masksToBounds = true
@@ -230,7 +230,7 @@ extension UserPersonalCenterViewController {
             self?.userDetailModel = userDetailModel as? UserDetailModel
             self?.userHeaderView.userDetailModel = self?.userDetailModel
             self?.navigationBar.backgroundImageView.kf.setImage(with: kURLImage(name: self?.userDetailModel?.backgroundImg ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            self?.avatarButton.kf.setImage(with: kURLImage(name: self?.userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            self?.avatarButton.kf.setImage(with: kURLImage(name: self?.userDetailModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             self?.nameButton.setTitle(self?.userDetailModel?.username, for: UIControl.State.normal)
             self?.cmsTemplateTitles = ["发布 \(self?.userDetailModel?.postCount ?? "0")","收藏 \(self?.userDetailModel?.collectCount ?? "0")","分享 \(self?.userDetailModel?.shareCount ?? "0")"]
             self?.reloadData()

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/View/SearchContentListCollectionCell.swift

@@ -112,7 +112,7 @@ class SearchContentListCollectionCell: UICollectionViewCell {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.cornerRadius = 18/2
         avatarButton.masksToBounds = true
         avatarButton.rx.tap.subscribe(onNext: {
@@ -156,7 +156,7 @@ class SearchContentListCollectionCell: UICollectionViewCell {
         didSet {
             contentImageView.kf.setImage(with: kURLImage(name: communityPostDataModel?.img ?? ""), placeholder: kImage(name: "pic_preload"))
             titleLabel.text = communityPostDataModel?.title
-            avatarButton.kf.setImage(with: kURLImage(name: communityPostDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: communityPostDataModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             nameButton.setTitle(communityPostDataModel?.username, for: UIControl.State.normal)
             likeBtn.setTitle("\(communityPostDataModel?.praiseCount ?? 0)", for: UIControl.State.normal)
             if communityPostDataModel?.isLike == 0 {

+ 5 - 5
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchUser/View/SearchUserLitTableViewCell.swift

@@ -79,7 +79,7 @@ class SearchUserLitTableViewCell: UITableViewCell {
     
     private lazy var avatarButton: UIButton = {
         let avatarButton = UIButton(type: UIButton.ButtonType.custom)
-        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
         avatarButton.imageView?.contentMode = .scaleAspectFit
         avatarButton.isUserInteractionEnabled = false
         avatarButton.cornerRadius = 22
@@ -133,7 +133,7 @@ class SearchUserLitTableViewCell: UITableViewCell {
     var userFollowModel: UserFollowModel? {
         didSet {
             followType = FollowType(rawValue: userFollowModel?.isFollowStatus ?? 0)
-            avatarButton.kf.setImage(with: kURLImage(name: userFollowModel?.followAvatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: userFollowModel?.followAvatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(userFollowModel?.followUsername, for: UIControl.State.normal)
             var followTopic = Array<String>()
             if !(userFollowModel?.followTopic?.isEmpty ?? true) {
@@ -154,7 +154,7 @@ class SearchUserLitTableViewCell: UITableViewCell {
     var userFanModel: UserFanModel? {
         didSet {
             followType = FollowType(rawValue: userFanModel?.isFollowStatus ?? 0)
-            avatarButton.kf.setImage(with: kURLImage(name: userFanModel?.fanAvatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: userFanModel?.fanAvatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(userFanModel?.fanUsername, for: UIControl.State.normal)
             var followTopic = Array<String>()
             if !(userFanModel?.fanTopic?.isEmpty ?? true) {
@@ -175,7 +175,7 @@ class SearchUserLitTableViewCell: UITableViewCell {
     var cmsMemberModel: CMSMemberModel? {
         didSet {
             followType = FollowType(rawValue: cmsMemberModel?.followStatus ?? 0)
-            avatarButton.kf.setImage(with: kURLImage(name: cmsMemberModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: cmsMemberModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(cmsMemberModel?.username, for: UIControl.State.normal)
             var followTopic = Array<String>()
             if !(cmsMemberModel?.followTopic?.isEmpty ?? true) {
@@ -197,7 +197,7 @@ class SearchUserLitTableViewCell: UITableViewCell {
     var searchMemberModel: SearchMemberModel? {
         didSet {
             followType = FollowType(rawValue: searchMemberModel?.followStatus ?? 0)
-            avatarButton.kf.setImage(with: kURLImage(name: searchMemberModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "defaul_tavatar"))
+            avatarButton.kf.setImage(with: kURLImage(name: searchMemberModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
             titleButton.setTitle(searchMemberModel?.username, for: UIControl.State.normal)
             var followTopic = Array<String>()
             if !(searchMemberModel?.followTopic?.isEmpty ?? true) {

+ 2 - 0
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSMemberListModel.swift

@@ -31,6 +31,7 @@ class CMSMemberModel : NSObject, Mappable{
     var followTopic : [String]?
     var uid : Int?
     var username : String?
+    var topicName : String?
     
     
     class func newInstance(map: Map) -> Mappable?{
@@ -46,6 +47,7 @@ class CMSMemberModel : NSObject, Mappable{
         followTopic <- map["follow_topic"]
         uid <- map["uid"]
         username <- map["username"]
+        topicName <- map["topic_name"]
         
     }
     

+ 108 - 1
RainbowPlanet/RainbowPlanet/Service/Model/CommunityModel/CommunityFollowFeedModel.swift

@@ -35,7 +35,7 @@ class CommunityFollowDataModel : NSObject, Mappable{
     var followUid : Int?
     var followUsername : String?
     var id : Int?
-    var relateData : AnyObject?
+    var relateData : CommunityFollowRelateDataModel?
     var relateId : Int?
     var type : String?
     var uid : Int?
@@ -68,6 +68,7 @@ class CommunityFollowContentModel : NSObject, Mappable{
     
     var beans : Int?
     var postDesc : String?
+    var commentDesc:String?
     
     
     class func newInstance(map: Map) -> Mappable?{
@@ -80,9 +81,115 @@ class CommunityFollowContentModel : NSObject, Mappable{
     {
         beans <- map["beans"]
         postDesc <- map["post_desc"]
+        commentDesc <- map["comment_desc"]
         
     }
     
 }
 
+class CommunityFollowRelateDataModel : NSObject, Mappable{
+    
+    var availableBean : Int?
+    var avatar : String?
+    var commentCount : Int?
+    var content : String?
+    var createdAt : String?
+    var id : Int?
+    var img : String?
+    var imgs : [String]?
+    var isCollect : Int?
+    var isDislike : Int?
+    var isFollow : Int?
+    var isLike : Int?
+    var location : String?
+    var postComment : [CommunityFollowPostCommentModel]?
+    var praiseCount : Int?
+    var pv : Int?
+    var title : String?
+    var topic : [CommunityFollowTopicModel]?
+    var type : String?
+    var uid : Int?
+    var username : String?
+    var video : String?
+    var willCollectBean : Int?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CommunityFollowRelateDataModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        availableBean <- map["available_bean"]
+        avatar <- map["avatar"]
+        commentCount <- map["comment_count"]
+        content <- map["content"]
+        createdAt <- map["created_at"]
+        id <- map["id"]
+        img <- map["img"]
+        imgs <- map["imgs"]
+        isCollect <- map["is_collect"]
+        isDislike <- map["is_dislike"]
+        isFollow <- map["is_follow"]
+        isLike <- map["is_like"]
+        location <- map["location"]
+        postComment <- map["post_comment"]
+        praiseCount <- map["praise_count"]
+        pv <- map["pv"]
+        title <- map["title"]
+        topic <- map["topic"]
+        type <- map["type"]
+        uid <- map["uid"]
+        username <- map["username"]
+        video <- map["video"]
+        willCollectBean <- map["will_collect_bean"]
+        
+    }
+}
 
+class CommunityFollowTopicModel: NSObject, Mappable{
+    
+    var id : Int?
+    var name : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CommunityFollowTopicModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        id <- map["id"]
+        name <- map["name"]
+        
+    }
+    
+}
+
+class CommunityFollowPostCommentModel : NSObject, Mappable{
+    
+    var content : String?
+    var id : Int?
+    var uid : Int?
+    var username : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CommunityFollowPostCommentModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        content <- map["content"]
+        id <- map["id"]
+        uid <- map["uid"]
+        username <- map["username"]
+        
+    }
+}

+ 3 - 1
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift

@@ -80,7 +80,9 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     ///   - completion: completion description
     func cmsMemberListApi(takeCount:Int = 0,completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
-        if takeCount != 0 {
+        if takeCount == 0 {
+            parameters.updateValue("", forKey: "take_count")
+        }else {
             parameters.updateValue(takeCount, forKey: "take_count")
         }
         SwiftMoyaNetWorkManager.shared.requestObject(CMSMemberListModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsMemberList(parameters: parameters))) {

RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/defaul_tavatar.imageset/Contents.json → RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/Contents.json


RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/defaul_tavatar.imageset/defaul_tavatar@2x.png → RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/defaul_tavatar@2x.png


RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/defaul_tavatar.imageset/defaul_tavatar@3x.png → RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/DefaultPage/default_avatar.imageset/defaul_tavatar@3x.png


+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "followed@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "followed@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/followed@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/followed.imageset/followed@3x.png


+ 19 - 1
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+UIImage.swift

@@ -176,6 +176,24 @@ extension UIImage {
         UIGraphicsEndImageContext()
         return image!
     }
-
     
+    class func getImageSize(_ url: String?) -> CGSize {
+        guard let urlStr = url else {
+            return CGSize.zero
+        }
+        
+        let tempUrl = URL(string: urlStr)
+        let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
+        var width: CGFloat = 0
+        var height: CGFloat = 0
+        if let imageSRef = imageSourceRef {
+            let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
+            if let imageP = imageProperties {
+                let imageDict = imageP as Dictionary
+                width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
+                height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
+            }
+        }
+        return CGSize(width: width, height: height)
+    }
 }

+ 13 - 0
RainbowPlanet/RainbowPlanet/Tools/ImageSizeFetcher.swift

@@ -0,0 +1,13 @@
+//
+//  ImageSizeFetcher.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/6/29.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class ImageSizeFetcher: NSObject {
+
+}