Bladeren bron

no message

南鑫林 5 jaren geleden
bovenliggende
commit
07bf2ad3fa

+ 2 - 0
RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityFollowFeedModel.swift

@@ -112,6 +112,7 @@ class CommunityFollowRelateDataModel : NSObject, Mappable{
     var username : String?
     var video : String?
     var willCollectBean : Int?
+    var h5url : String?
     
     
     class func newInstance(map: Map) -> Mappable?{
@@ -145,6 +146,7 @@ class CommunityFollowRelateDataModel : NSObject, Mappable{
         username <- map["username"]
         video <- map["video"]
         willCollectBean <- map["will_collect_bean"]
+        h5url <- map["h5url"]
         
     }
 }

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

@@ -62,7 +62,11 @@ class CommunityCommonSectionHeaderView: BaseView {
 
                 break
             case .popularVideo?:
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityPopularVideo"), object: nil)
+                if !(self?.communityRecommendTypeDataModels?.isEmpty ?? true) {
+                    let communityRecommendTypeDataModel = self?.communityRecommendTypeDataModels?[0]
+                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityPopularVideo"), object: communityRecommendTypeDataModel?.id)
+
+                }
                 break
             default:
                 break
@@ -91,5 +95,12 @@ class CommunityCommonSectionHeaderView: BaseView {
             }
         }
     }
+    
+    var communityRecommendTypeDataModels : Array<CommunityRecommendTypeDataModel>? {
+        didSet {
+            
+        }
+    }
+    
 
 }

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

@@ -33,6 +33,7 @@ class CommunityFollowViewController: UIViewController {
     func setupViews() {
         view.backgroundColor = kf7f8faColor
         view.addSubview(tableView)
+        view.addSubview(commentInputView)
     }
     
     func setupLayouts() {
@@ -140,8 +141,9 @@ extension CommunityFollowViewController {
     
     /// 评论
     func communityPostCommentApi(text:String) {
+        
         let communityCustomCommnetModel = CommunityCustomCommnetModel()
-        communityCustomCommnetModel.postId = communityFollowDataModel?.relateData?.id ?? 0
+        communityCustomCommnetModel.postId = self.communityFollowDataModel?.relateId ?? 0
         communityCustomCommnetModel.content = text
         
         SwiftMoyaNetWorkServiceCommunity.shared().communityPostCommentApi(communityCustomCommnetModel: communityCustomCommnetModel) {
@@ -316,8 +318,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
             let cell = CardContentCommnetTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             cell.addCommnetClosureName = {
                 [weak self] in
-                self?.communityFollowDataModel = self?.communityFollowDataModels[indexPath.section]
-                self?.commentInputView.inputTextView.becomeFirstResponder()
+
             }
             return cell
         default:
@@ -327,7 +328,73 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
     
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        
+        if  communityFollowDataModels.isEmpty && cmsMemberModels.isEmpty {
+        }else  if communityFollowDataModels.isEmpty && !cmsMemberModels.isEmpty { //推荐关注
+        }else  if !communityFollowDataModels.isEmpty && cmsMemberModels.isEmpty { //关注列表
+            let communityFollowDataModel = communityFollowDataModels[indexPath.section]
+            if CommunityFollowType(rawValue:communityFollowDataModel.type ?? "1") == .post { //帖子
+                switch indexPath.row {
+                //贴子用户
+                case 0:
+                    break
+                //图片视频/内容标题/评论列表
+                case 1,2,4:
+                    if PostType(rawValue: communityFollowDataModel.relateData?.type ?? "video") == .video {
+                        NotificationCenter.default.post(name: NSNotification.Name("CommunityContentVideoClosure"), object: communityFollowDataModel.relateData?.id)
+                        
+                    }else {
+                        NotificationCenter.default.post(name: NSNotification.Name("CommunityContentDetailClosure"), object: communityFollowDataModel.relateData?.id)
+                    }
+                    break
+                //点赞,收藏,分享
+                case 3:
+                    break
+                //评论
+                case 5:
+                    self.commentInputView.inputTextView.becomeFirstResponder()
+                    self.communityFollowDataModel = self.communityFollowDataModels[indexPath.section]
+                    break
+                default:
+                    break
+                }
+            }else { //关注
+            }
+        }else {
+            if indexPath.section == 0 { //推荐关注
+                
+            }else {//关注列表
+                let communityFollowDataModel = communityFollowDataModels[indexPath.section - 1]
+                if CommunityFollowType(rawValue: communityFollowDataModel.type ?? "1") == .post { //帖子
+                    switch indexPath.row {
+                    //贴子用户
+                    case 0:
+                        break
+                    //图片视频/内容标题/评论列表
+                    case 1,2,4:
+                        if PostType(rawValue: communityFollowDataModel.relateData?.type ?? "video") == .video {
+                            NotificationCenter.default.post(name: NSNotification.Name("CommunityContentVideoClosure"), object: communityFollowDataModel.relateData?.id)
+                            
+                        }else {
+                            NotificationCenter.default.post(name: NSNotification.Name("CommunityContentDetailClosure"), object: communityFollowDataModel.relateData?.id)
+                        }
+                        break
+                    //点赞,收藏,分享
+                    case 3:
+                        break
+                    //评论
+                    case 5:
+                        self.commentInputView.inputTextView.becomeFirstResponder()
+                        self.communityFollowDataModel = self.communityFollowDataModels[indexPath.section]
+
+                        break
+                    default:
+                        break
+                    }
+                    
+                }else {//关注
+                }
+            }
+        }
     }
     
     

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -112,7 +112,7 @@ class CommunityViewController: BaseViewController {
                 titleStr: communityFollowDataModel?.relateData?.title,
                 avatarStr: communityFollowDataModel?.relateData?.avatar,
                 nameStr: communityFollowDataModel?.relateData?.username,
-                H5UrlStr: (kH5ArticleUrl + "post_id=\(String(describing: communityFollowDataModel?.relateData?.id) )invite_code=\(UserModel.shared().getModel()?.inviteCode ?? "")"),
+                H5UrlStr: communityFollowDataModel?.relateData?.h5url,
                 bean: communityFollowDataModel?.relateData?.willCollectBean,
                 postId: communityFollowDataModel?.relateData?.id,
                 uid: communityFollowDataModel?.relateData?.uid,

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

@@ -466,6 +466,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
         case .video?:
             if !(communityRecommendDataModel.data?.isEmpty ?? true) {
                 headerView.communityCommonSectionHeaderViewType = .popularVideo
+                headerView.communityRecommendTypeDataModels = communityRecommendDataModel.data
                 return headerView
             }
             return nil

+ 2 - 0
RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

@@ -502,6 +502,8 @@ extension VirusViewModel {
         virueRecordAddParameterModel.postType = communityFollowDataModel?.relateData?.type
         virueRecordAddParameterModel.postCover = communityFollowDataModel?.relateData?.img
         virueRecordAddParameterModel.actionId = "\(id)"
+        virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
+
         
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
         })