南鑫林 5 年 前
コミット
ba2de37fed

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

@@ -14,6 +14,7 @@ class CommunitySubCommentController: BaseViewController {
     var communityPostDetailModel : CommunityPostDetailModel?
     var communityPostCommentModel : CommunityPostCommentModel?
     
+    var communityPostReplysModel : CommunityPostReplysModel?
     var communityPostReplyModels = Array<CommunityPostReplyModel>()
     var communityPostReplyModel : CommunityPostReplyModel?
     var keyBoardCommentView:KeyBoardCommentView?
@@ -28,7 +29,7 @@ class CommunitySubCommentController: BaseViewController {
     }
     
     override func setupViews() {
-        navigationBar.title = "3条评论"
+        navigationBar.title = "0条评论"
         view.backgroundColor = kf7f8faColor
         
         view.addSubview(tableView)
@@ -108,6 +109,8 @@ extension CommunitySubCommentController {
     func communityPostReplyApi(page:Int) {
         SwiftMoyaNetWorkServiceCommunity.shared().communityPostReplyApi(postId: communityPostCommentModel?.id ?? 0, page: page) { [weak self] (communityPostReplysModel) -> (Void) in
             let communityPostReplysModel = communityPostReplysModel as? CommunityPostReplysModel
+            self?.navigationBar.title = "\(self?.communityPostReplysModel?.pagination?.total ?? 0)条评论"
+
             if communityPostReplysModel?.pagination?.currentPage ?? 1  <= communityPostReplysModel?.pagination?.totalPages ?? 1 {
                 if communityPostReplysModel?.pagination?.currentPage == 1{
                     self?.communityPostReplyModels.removeAll()
@@ -144,8 +147,9 @@ extension CommunitySubCommentController {
             if self?.communityPostReplyModel != nil {
                 communityPostReplyModel.replyUsername = self?.communityPostReplyModel?.username
             }
-            self?.communityPostReplyModels.insert(communityPostReplyModel, at: 0)
+            self?.communityPostReplysModel?.pagination?.total = 1 + (self?.communityPostReplysModel?.pagination?.total ?? 0)
             self?.tableView.reloadSections([1], with: UITableView.RowAnimation.none)
+            self?.navigationBar.title = "\(self?.communityPostReplysModel?.pagination?.total ?? 0)条评论"
             if self?.communityPostReplyModel != nil {
                 VirusViewModel.shared.comment(communityPostDetailModel: (self?.communityPostDetailModel)!, id: communityPostCommentIdModel?.id ?? 0, communityPostCommentModel: (self?.communityPostCommentModel)!, communityPostReplyModel: (self?.communityPostReplyModel)!)
                 

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoSubCommentController.swift

@@ -14,6 +14,7 @@ class CommunityVideoSubCommentController: BaseViewController {
     var communityVideoItemModel : CommunityVideoItemModel?
     var communityPostCommentModel : CommunityPostCommentModel?
     
+    var communityPostReplysModel : CommunityPostReplysModel?
     var communityPostReplyModels = Array<CommunityPostReplyModel>()
     var communityPostReplyModel : CommunityPostReplyModel?
     var keyBoardCommentView:KeyBoardCommentView?
@@ -106,11 +107,14 @@ extension CommunityVideoSubCommentController {
     func communityPostReplyApi(page:Int) {
         SwiftMoyaNetWorkServiceCommunity.shared().communityPostReplyApi(postId: communityPostCommentModel?.id ?? 0, page: page) { [weak self] (communityPostReplysModel) -> (Void) in
             let communityPostReplysModel = communityPostReplysModel as? CommunityPostReplysModel
+            
             if communityPostReplysModel?.pagination?.currentPage ?? 1  <= communityPostReplysModel?.pagination?.totalPages ?? 1 {
                 if communityPostReplysModel?.pagination?.currentPage == 1{
                     self?.communityPostReplyModels.removeAll()
                 }
                 self?.communityPostReplyModels = (self?.communityPostReplyModels)! + (communityPostReplysModel?.data!)!
+                self?.navigationBar.title = "\(communityPostReplysModel?.pagination?.total ?? 0)条评论"
+
                 self?.tableView.reloadData()
                 if  self?.communityPostReplyModels.count ?? 0 >= communityPostReplysModel?.pagination?.total ?? 0 {
                     self?.tableView.endFooterNoMoreData()
@@ -143,7 +147,10 @@ extension CommunityVideoSubCommentController {
                 communityPostReplyModel.replyUsername = self?.communityPostReplyModel?.username
             }
             self?.communityPostReplyModels.insert(communityPostReplyModel, at: 0)
+            self?.communityPostReplysModel?.pagination?.total = 1 + (self?.communityPostReplysModel?.pagination?.total ?? 0)
             self?.tableView.reloadSections([1], with: UITableView.RowAnimation.none)
+            self?.navigationBar.title = "\(self?.communityPostReplysModel?.pagination?.total ?? 0)条评论"
+
             
             if self?.communityPostReplyModel != nil {
                 VirusViewModel.shared.comment(communityVideoItemModel: (self?.communityVideoItemModel)!, id: communityPostCommentIdModel?.id ?? 0, communityPostCommentModel: (self?.communityPostCommentModel)!, communityPostReplyModel: (self?.communityPostReplyModel)!)