Ver código fonte

删除完成

南鑫林 5 anos atrás
pai
commit
1386ea0339
27 arquivos alterados com 571 adições e 70 exclusões
  1. 8 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 9 0
      RainbowPlanet/RainbowPlanet/Model/UserModel/UserModel.swift
  3. 90 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserDeleteView.swift
  4. 24 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserDisLikeView.swift
  5. 0 4
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift
  6. 31 4
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  7. 20 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  8. 31 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  9. 31 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  10. 12 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  11. 15 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift
  12. 18 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListView.swift
  13. 5 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift
  14. 20 5
      RainbowPlanet/RainbowPlanet/Modules/ShareModules/ShareCommunityModule/ShareCommunity/ShareCommunityView.swift
  15. 14 0
      RainbowPlanet/RainbowPlanet/Modules/ShareModules/ShareShop/View/ShareView.swift
  16. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductInfo/ProductDetailProductInfoTableViewCell.swift
  17. 29 3
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift
  18. 12 1
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift
  19. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/edit_pic_delete.imageset/Contents.json
  20. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/edit_pic_delete.imageset/edit_pic_delete@2x.png
  21. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/edit_pic_delete.imageset/edit_pic_delete@3x.png
  22. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/feed_btn_delete.imageset/Contents.json
  23. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/feed_btn_delete.imageset/feed_btn_delete@2x.png
  24. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/feed_btn_delete.imageset/feed_btn_delete@3x.png
  25. 0 39
      RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift
  26. 153 0
      RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/SheetSureView.swift
  27. 4 4
      RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

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

@@ -206,6 +206,8 @@
 		A75B787C22E07A51007B986A /* shoppingMallModuleTabbar.json in Resources */ = {isa = PBXBuildFile; fileRef = A75B787822E07A50007B986A /* shoppingMallModuleTabbar.json */; };
 		A75B787D22E07A51007B986A /* MineModuleTabbar.json in Resources */ = {isa = PBXBuildFile; fileRef = A75B787922E07A50007B986A /* MineModuleTabbar.json */; };
 		A75C474E22938B3900139C0C /* OrderFreightTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75C474D22938B3900139C0C /* OrderFreightTableViewCell.swift */; };
+		A76068E022E43DAC008DF18F /* CardContentUserDeleteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A76068DF22E43DAC008DF18F /* CardContentUserDeleteView.swift */; };
+		A76068E222E44D6A008DF18F /* SheetSureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A76068E122E44D6A008DF18F /* SheetSureView.swift */; };
 		A7636AC52268139C00374F9E /* LocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7636AC42268139C00374F9E /* LocationViewController.swift */; };
 		A7636AC822682BAF00374F9E /* LocationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7636AC722682BAF00374F9E /* LocationView.swift */; };
 		A76390EB2248E27A0067EEE0 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A76390EA2248E27A0067EEE0 /* UserNotifications.framework */; };
@@ -909,6 +911,8 @@
 		A75B787822E07A50007B986A /* shoppingMallModuleTabbar.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = shoppingMallModuleTabbar.json; sourceTree = "<group>"; };
 		A75B787922E07A50007B986A /* MineModuleTabbar.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = MineModuleTabbar.json; sourceTree = "<group>"; };
 		A75C474D22938B3900139C0C /* OrderFreightTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderFreightTableViewCell.swift; sourceTree = "<group>"; };
+		A76068DF22E43DAC008DF18F /* CardContentUserDeleteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardContentUserDeleteView.swift; sourceTree = "<group>"; };
+		A76068E122E44D6A008DF18F /* SheetSureView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetSureView.swift; sourceTree = "<group>"; };
 		A7636AC42268139C00374F9E /* LocationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationViewController.swift; sourceTree = "<group>"; };
 		A7636AC722682BAF00374F9E /* LocationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationView.swift; sourceTree = "<group>"; };
 		A76390EA2248E27A0067EEE0 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
@@ -2234,6 +2238,7 @@
 			isa = PBXGroup;
 			children = (
 				A729B5A72266F2E0004AE098 /* AlertSheetView.swift */,
+				A76068E122E44D6A008DF18F /* SheetSureView.swift */,
 			);
 			path = AlertSheetView;
 			sourceTree = "<group>";
@@ -4412,6 +4417,7 @@
 			children = (
 				A7F2D6D622B1ED370093000B /* CardContentUserTableViewCell.swift */,
 				A71CAB3D22CAF57500D908A8 /* CardContentUserDisLikeView.swift */,
+				A76068DF22E43DAC008DF18F /* CardContentUserDeleteView.swift */,
 			);
 			path = User;
 			sourceTree = "<group>";
@@ -6176,6 +6182,7 @@
 				A757C9302274839900226355 /* SelfMentionAddressListModel.swift in Sources */,
 				BD6122B922C3639E00D3F513 /* AlivcEditBottomHeaderView.m in Sources */,
 				BDD22F0B228FAA5B00D43BFB /* ImageUrlModel.swift in Sources */,
+				A76068E022E43DAC008DF18F /* CardContentUserDeleteView.swift in Sources */,
 				BD6122BB22C3639E00D3F513 /* AlivcEditIconButton.m in Sources */,
 				A72A72D522321E2700B21995 /* ColorMacro.swift in Sources */,
 				A72A7333223256E100B21995 /* PayManager.swift in Sources */,
@@ -6211,6 +6218,7 @@
 				A70B843422911AF600882BC5 /* ProductDetailView.swift in Sources */,
 				A72623D722C26A2A00AEF875 /* MessageListModel.swift in Sources */,
 				A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */,
+				A76068E222E44D6A008DF18F /* SheetSureView.swift in Sources */,
 				A7FF157D228C837100A85748 /* OrderDetailStatusTableViewCell.swift in Sources */,
 				A7C0FDFB22B6672F00BC1E86 /* PopularVideoTableViewCell.swift in Sources */,
 				A7A98E41228046C5005306E9 /* ShoppingMallSepcialTableViewCell.swift in Sources */,

+ 9 - 0
RainbowPlanet/RainbowPlanet/Model/UserModel/UserModel.swift

@@ -178,6 +178,15 @@ public class UserModel : NSObject, NSCoding, Mappable{
         return userInfoDic
     }
 
+    
+    func isEqualUid(uid:Int) -> Bool {
+        if uid == UserModel.shared().getModel()?.uid {
+            return true
+        }else {
+            return false
+        }
+    }
+
 }
 
 

+ 90 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserDeleteView.swift

@@ -0,0 +1,90 @@
+//
+//  CardContentUserDeleteView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/21.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FWPopupView
+import RxSwift
+import RxCocoa
+class CardContentUserDeleteView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupViews() {
+        self.cornerRadius = 8
+        self.masksToBounds = true
+        self.isUserInteractionEnabled = true
+        self.backgroundColor = UIColor.white
+        addTapGesture(1, target: self, action: #selector(hideView))
+        addSubview(deleteButton)
+    }
+    
+    func setupLayouts() {
+        deleteButton.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.left.equalTo(20)
+        }
+        deleteButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 10)
+    }
+    
+    @objc  func hideView() {
+        if let deleteButtonClosure = self.deleteButtonClosure {
+            deleteButtonClosure()
+        }
+    }
+    
+    typealias DeleteButtonClosure = () -> Void
+    var  deleteButtonClosure : DeleteButtonClosure?
+    
+    lazy var deleteButton: UIButton = {
+        let deleteButton = UIButton(type: UIButton.ButtonType.custom)
+        deleteButton.setTitle("删除", for: UIControl.State.normal)
+        deleteButton.setImage(kImage(name: "feed_btn_delete"), for: UIControl.State.normal)
+        deleteButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+        deleteButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+            if let deleteButtonClosure = self?.deleteButtonClosure {
+                deleteButtonClosure()
+            }
+        }).disposed(by: disposeBag)
+        return deleteButton
+    }()
+    
+    class func sheetDeleteView(y:CGFloat,sureClosure:@escaping ((CardContentUserDeleteView) -> Void)) {
+        let view = CardContentUserDeleteView(frame: CGRect(x: 0, y: 0, width: kScreenWidth-28, height: 50))
+        let vProperty = FWPopupViewProperty()
+        if y > kScreenHeight/2 {
+            vProperty.popupCustomAlignment = .bottomCenter
+            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: kScreenHeight-y+29, right: 0)
+            
+        }else {
+            vProperty.popupCustomAlignment = .topCenter
+            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: y+51, left: 0, bottom: 0, right: 0)
+        }
+        vProperty.popupAnimationType = .scale
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        view.vProperty = vProperty
+        view.deleteButtonClosure = {
+            view.hide()
+            SheetSureView.sheetSureView(titleStr: "确认删除这条内容吗?", sureStr: "确认删除", sureClosure: {
+                sureClosure(view)
+            })
+        }
+        view.show()
+    }
+    
+}

+ 24 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserDisLikeView.swift

@@ -81,5 +81,29 @@ class CardContentUserDisLikeView: FWPopupView {
             }
         }
     }
+    
+    class func sheetDislike(dislike:Int,y:CGFloat,sureClosure:@escaping ((CardContentUserDisLikeView) -> Void)) {
+        let view = CardContentUserDisLikeView(frame: CGRect(x: 0, y: 0, width: kScreenWidth-28, height: 50))
+        view.isDisLike = dislike
+        let vProperty = FWPopupViewProperty()
+        
+        if y > kScreenHeight/2 {
+            vProperty.popupCustomAlignment = .bottomCenter
+            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: kScreenHeight-y+29, right: 0)
+            
+        }else {
+            vProperty.popupCustomAlignment = .topCenter
+            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: y+51, left: 0, bottom: 0, right: 0)
+        }
+        vProperty.popupAnimationType = .scale
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        view.vProperty = vProperty
+        view.disLikeButtonClosure = {
+            view.hide()
+            sureClosure(view)
+        }
+        view.show()
+    }
 
 }

+ 0 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift

@@ -152,10 +152,8 @@ class CardContentUserTableViewCell: UITableViewCell {
             followType = FollowType(rawValue: communityRecommendDataModel?.isFollow ?? 0)
             if communityRecommendDataModel?.uid == UserModel.shared().getModel()?.uid {
                 followButton.isHidden = true
-                setButton.isHidden = true
             }else {
                 followButton.isHidden = false
-                setButton.isHidden = false
 
             }
         }
@@ -170,11 +168,9 @@ class CardContentUserTableViewCell: UITableViewCell {
 
             if communityFollowDataModel?.relateData?.uid == UserModel.shared().getModel()?.uid {
                 followButton.isHidden = true
-                setButton.isHidden = true
 
             }else {
                 followButton.isHidden = false
-                setButton.isHidden = false
 
             }
         }

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

@@ -130,6 +130,18 @@ class CommunityFollowViewController: UIViewController {
             self?.tableView.reloadData()
         }
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("communityDeletePostApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let postId = notification.object as? Int
+            if !(self?.communityFollowDataModels.isEmpty ?? true) {
+                for (index,communityFollowDataModel) in (self?.communityFollowDataModels)!.enumerated() {
+                    if communityFollowDataModel.relateData?.id == postId {
+                        self?.communityFollowDataModels.remove(at: index)
+                    }
+                }
+                self?.tableView.reloadData()
+            }
+        }
+        
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityModuleFollowTop"), object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in
             if self?.tableView.contentOffset == CGPoint(x: 0, y: 0) {
@@ -249,6 +261,14 @@ extension CommunityFollowViewController {
         }
     }
     
+    /// 删除帖子
+    func communityDeleteApi(postId:Int,section:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) { [weak self] (data) -> (Void) in
+            self?.communityFollowDataModels.remove(at: section)
+            self?.tableView.reloadData()
+        }
+    }
+    
 }
 
 extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSource {
@@ -302,7 +322,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
         }else  if !communityFollowDataModels.isEmpty && cmsMemberModels.isEmpty { //关注列表
             let communityFollowDataModel = communityFollowDataModels[indexPath.section]
             if CommunityFollowType(rawValue:communityFollowDataModel.type ?? "1") == .post { //帖子
-                return postCell(indexPath: indexPath, communityFollowDataModel: communityFollowDataModel)
+                return postCell(indexPath: indexPath,section:indexPath.section, communityFollowDataModel: communityFollowDataModel)
             }else { //关注
                 let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.followClosure = {
@@ -330,7 +350,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
             }else {//关注列表
                 let communityFollowDataModel = communityFollowDataModels[indexPath.section - 1]
                 if CommunityFollowType(rawValue: communityFollowDataModel.type ?? "1") == .post { //帖子
-                    return postCell(indexPath: indexPath, communityFollowDataModel: communityFollowDataModel)
+                    return postCell(indexPath: indexPath,section: (indexPath.section - 1), communityFollowDataModel: communityFollowDataModel)
                     
                 }else {//关注
                     let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
@@ -345,7 +365,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
         }
     }
     
-    func postCell(indexPath:IndexPath,communityFollowDataModel:CommunityFollowDataModel) -> UITableViewCell {
+    func postCell(indexPath:IndexPath,section:Int,communityFollowDataModel:CommunityFollowDataModel) -> UITableViewCell {
         switch indexPath.row {
         //贴子用户
         case 0:
@@ -357,7 +377,14 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
             }
             cell.likeClosure = {
                 [weak self] y in
-                VirusViewModel.shared.like(communityFollowDataModel: communityFollowDataModel, y: y, tableView: (self?.tableView)!)
+                if UserModel.shared().isEqualUid(uid: communityFollowDataModel.relateData?.uid ?? 0) {
+                    CardContentUserDeleteView.sheetDeleteView(y: y, sureClosure: { [weak self] (cardContentUserDeleteView) in
+                        self?.communityDeleteApi(postId: communityFollowDataModel.relateData?.id ?? 0, section: section)
+                    })
+                }else {
+                    VirusViewModel.shared.like(communityFollowDataModel: communityFollowDataModel, y: y, tableView: (self?.tableView)!)
+
+                }
             }
             return cell
         //图片视频

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

@@ -243,7 +243,7 @@ class CommunityViewController: BaseViewController {
             title = contentStr?.prefix(12) ?? ""
         }
         let shareCommunityView =  ShareCommunityView.shareCommunityView(
-            title: "向好友传递美好生活,送TA 500彩虹豆",
+            uid: uid ?? 0, title: "向好友传递美好生活,送TA 500彩虹豆",
             detailTitle: "越多好友看到,收获彩虹豆越多",
             h5Str: (H5UrlStr ?? "" + "\(UserModel.shared().getModel()?.inviteCode ?? "")"),
             thumbnailImg: UIImage.imageUrl(imgUrl),
@@ -275,6 +275,25 @@ class CommunityViewController: BaseViewController {
             vc.contentStr = contentStr
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        shareCommunityView.deleteCompletion = {
+            [weak self] in
+            self?.communityDeleteApi(postId: postId ?? 0)
+        }
+    }
+    
+    /// 删除帖子
+    func communityDeleteApi(postId:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) {(data) -> (Void) in}
+    }
+    
+    //选中推荐
+    func reloadSegmentedFollowView() {
+        self.segmentedView.selectItemAt(index: 0)
+        self.segmentedView.defaultSelectedIndex = 0
+        self.listContainerView.defaultSelectedIndex = 0
+        self.segmentedDataSource.reloadData(selectedIndex: 0)
+        self.listContainerView.reloadData()
+        
     }
     
     //选中推荐

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

@@ -105,6 +105,20 @@ class CommunityRecommnendViewController: UIViewController {
             self?.tableView.reloadData()
         }
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("communityDeletePostApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+                let postId = notification.object as? Int
+                if !(self?.communityRecommendDataModels.isEmpty ?? true) {
+                    for (index,communityRecommendDataModel) in (self?.communityRecommendDataModels)!.enumerated() {
+                        if communityRecommendDataModel.id == postId {
+                            self?.communityRecommendDataModels.remove(at: index)
+                    }
+                }
+                self?.tableView.reloadData()
+            }
+        }
+        
+        
+        
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityModuleRecommendTop"), object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in
             if self?.tableView.contentOffset == CGPoint(x: 0, y: 0) {
@@ -207,6 +221,15 @@ extension CommunityRecommnendViewController {
             
         }
     }
+    
+    
+    /// 删除帖子
+    func communityDeleteApi(postId:Int,section:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) { [weak self] (data) -> (Void) in
+            self?.communityRecommendDataModels.remove(at: section)
+            self?.tableView.reloadData()
+        }
+    }
 
 }
 
@@ -278,7 +301,14 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
                     CommunityFollowUserViewModel.shared.follow(communityRecommendDataModel: communityRecommendDataModel, communityRecommendDataModels: (self?.communityRecommendDataModels)!, tableView: tableView)
                 }
                 cell.likeClosure = { y in
-                    VirusViewModel.shared.like(communityRecommendDataModel: communityRecommendDataModel, y: y, tableView: tableView)
+                    if UserModel.shared().isEqualUid(uid: communityRecommendDataModel.uid ?? 0) {
+                        CardContentUserDeleteView.sheetDeleteView(y: y, sureClosure: { [weak self] (cardContentUserDeleteView) in
+                            self?.communityDeleteApi(postId: communityRecommendDataModel.id ?? 0, section: indexPath.section)
+                        })
+                    }else {
+                        VirusViewModel.shared.like(communityRecommendDataModel: communityRecommendDataModel, y: y, tableView: tableView)
+
+                    }
                 }
                 return cell
             //图片视频

+ 31 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -235,8 +235,22 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             }
             self?.tableView.reloadData()
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("communityDeletePostApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let postId = notification.object as? Int
+            if !(self?.communityRecommendDataModels.isEmpty ?? true) {
+                for (index,communityRecommendDataModel) in (self?.communityRecommendDataModels)!.enumerated() {
+                    if communityRecommendDataModel.id == postId {
+                        self?.communityRecommendDataModels.remove(at: index)
+                    }
+                }
+                self?.tableView.reloadData()
+            }
+        }
     }
     
+    
+    
     /// 显示键盘
     func showKeyBoardCommentView() {
         keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(sendClosure: {
@@ -359,6 +373,14 @@ extension CommunityFeaturedTopicsViewController {
         }
     }
     
+    /// 删除帖子
+    func communityDeleteApi(postId:Int,section:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) { [weak self] (data) -> (Void) in
+            self?.communityRecommendDataModels.remove(at: section)
+            self?.tableView.reloadData()
+        }
+    }
+    
 }
 
 extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableViewDataSource {
@@ -383,7 +405,15 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
                 CommunityFollowUserViewModel.shared.follow(communityRecommendDataModel: communityRecommendDataModel, communityRecommendDataModels: (self?.communityRecommendDataModels)!, tableView: tableView)
             }
             cell.likeClosure = { y in
-                VirusViewModel.shared.like(communityRecommendDataModel: communityRecommendDataModel, y: y, tableView: tableView)
+                if UserModel.shared().isEqualUid(uid: communityRecommendDataModel.uid ?? 0) {
+                    CardContentUserDeleteView.sheetDeleteView(y: y, sureClosure: { [weak self] (cardContentUserDeleteView) in
+                        self?.communityDeleteApi(postId: communityRecommendDataModel.id ?? 0, section: indexPath.section)
+
+                    })
+                }else {
+                    VirusViewModel.shared.like(communityRecommendDataModel: communityRecommendDataModel, y: y, tableView: tableView)
+                    
+                }
             }
             return cell
         //图片视频

+ 12 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -291,7 +291,7 @@ class CommunityRecommendController: BaseViewController {
             title = self.communityPostDetailModel?.content?.prefix(12) ?? ""
         }
         let shareCommunityView =  ShareCommunityView.shareCommunityView(
-            title: "向好友传递美好生活,送TA 500彩虹豆",
+            uid: self.communityPostDetailModel?.uid ?? 0, title: "向好友传递美好生活,送TA 500彩虹豆",
             detailTitle: "越多好友看到,收获彩虹豆越多",
             h5Str: (self.communityPostDetailModel?.h5url ?? "" + "\(UserModel.shared().getModel()?.inviteCode ?? "")"),
             thumbnailImg: UIImage.imageUrl(self.communityPostDetailModel?.img),
@@ -324,6 +324,10 @@ class CommunityRecommendController: BaseViewController {
             vc.contentStr = self?.communityPostDetailModel?.content
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        shareCommunityView.deleteCompletion = {
+            [weak self] in
+            self?.communityDeleteApi(postId: self?.communityPostDetailModel?.id ?? 0)
+        }
     }
     
 }
@@ -531,6 +535,13 @@ extension CommunityRecommendController {
             complete()
         }
     }
+    
+    /// 删除帖子
+    func communityDeleteApi(postId:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) { [weak self] (data) -> (Void) in
+            self?.navigationController?.popViewController(animated: true)
+        }
+    }
 }
 
 // MARK: - tableView dataSource && delegate

+ 15 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -168,7 +168,7 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
         }
         cell.shareClosure = {
             [weak self] (videoItemMdl) in
-            self?.share(videoItemMdl)
+            self?.share(videoItemMdl,row:indexPath.row)
         }
         cell.followClosure = {
             [weak self] (videoItemMdl, followButton) in
@@ -272,13 +272,13 @@ extension CommunityVideoListController {
     }
     
     /// 分享
-    func share(_ videoItemModel: CommunityVideoItemModel) {
+    func share(_ videoItemModel: CommunityVideoItemModel,row:Int) {
         var title = videoItemModel.title?.prefix(12)
         if title == nil || title == "" {
             title = videoItemModel.content?.prefix(12) ?? ""
         }
         let shareCommunityView =  ShareCommunityView.shareCommunityView(
-            title: "向好友传递美好生活,送TA 500彩虹豆",
+            uid: videoItemModel.uid ?? 0, title: "向好友传递美好生活,送TA 500彩虹豆",
             detailTitle: "越多好友看到,收获彩虹豆越多",
             h5Str: (videoItemModel.h5url ?? "" + "\(UserModel.shared().getModel()?.inviteCode ?? "")"),
             thumbnailImg: UIImage.imageUrl(videoItemModel.img),
@@ -311,6 +311,11 @@ extension CommunityVideoListController {
             vc.contentStr = videoItemModel.content
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        
+        shareCommunityView.deleteCompletion = {
+            [weak self] in
+            self?.communityDeleteApi(postId: videoItemModel.id ?? 0,row:row)
+        }
     }
     
 }
@@ -355,4 +360,11 @@ extension CommunityVideoListController {
         VirusViewModel.shared.readVirueRecordAddApi(postId: videoItemMdl.id, postAuthorUid: "\(videoItemMdl.uid ?? 0)", postDesc: postDesc, postType: videoItemMdl.type, postCover: videoItemMdl.img, actionId: "\(videoItemMdl.id ?? 0)")
     }
     
+    /// 删除帖子
+    func communityDeleteApi(postId:Int,row:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityDeleteApi(postId: postId) { [weak self] (data) -> (Void) in
+            self?.videoItemList?.remove(at: row)
+            self?.collectionView.reloadData()
+        }
+    }
 }

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

@@ -10,11 +10,15 @@ import UIKit
 import SwiftyMediator
 
 class PersonViewUserAndOtherListView: BaseView {
-
-    var listViewDidScrollCallback: ((UIScrollView) -> ())?
+    
     deinit {
         listViewDidScrollCallback = nil
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
     }
+    weak var observe : NSObjectProtocol?
+    var listViewDidScrollCallback: ((UIScrollView) -> ())?
     
     var jumpModeType : JumpModeType? {
         didSet {
@@ -52,6 +56,18 @@ class PersonViewUserAndOtherListView: BaseView {
         emptyView?.subViewMargin = 20
         collectionView.ly_emptyView = emptyView
         collectionView.ly_startLoading()
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("communityDeletePostApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let postId = notification.object as? Int
+            if !(self?.postMyModels.isEmpty ?? true) {
+                for (index,postMyModel) in (self?.postMyModels)!.enumerated() {
+                    if postMyModel.id == postId {
+                        self?.postMyModels.remove(at: index)
+                    }
+                }
+                self?.collectionView.reloadData()
+            }
+        }
     }
     lazy var collectionView: UICollectionView = {
         let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)

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

@@ -127,6 +127,11 @@ class UserPersonalCenterViewController: BaseViewController {
             }
         })
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("communityDeletePostApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            self?.cmsTemplateTitles = ["发布 \((Int(self?.userDetailModel?.postCount ?? "0") ?? 1) - 1)","收藏 \(self?.userDetailModel?.collectCount ?? "0")","分享 \(self?.userDetailModel?.shareCount ?? "0")"]
+            self?.reloadData()
+        }
+        
         
   
     }

+ 20 - 5
RainbowPlanet/RainbowPlanet/Modules/ShareModules/ShareCommunityModule/ShareCommunity/ShareCommunityView.swift

@@ -20,8 +20,8 @@ class ShareCommunityView: FWPopupView {
     
     let disposeBag = DisposeBag()
     
-    let platformTitles = ["微信","朋友圈","微博","复制链接","保存图片"]
-    let platformImages = ["edit_pic_wechat","edit_pic_moments","edit_pic_sina","edit_pic_link","edit_pic_download"]
+    let platformTitles = ["微信","朋友圈","微博","复制链接","保存图片","删除"]
+    let platformImages = ["edit_pic_wechat","edit_pic_moments","edit_pic_sina","edit_pic_link","edit_pic_download","edit_pic_delete"]
     
     private var title : String?
     private var detailTitle : String?
@@ -30,6 +30,7 @@ class ShareCommunityView: FWPopupView {
     private var h5Str : String?
     private var thumbnailImg : UIImage?
     private var shareCommunityViewType : ShareCommunityViewType?
+    var uid : Int?
     
     override init(frame: CGRect) {
         super.init(frame: frame)
@@ -39,8 +40,11 @@ class ShareCommunityView: FWPopupView {
     var completion : Completion?
     typealias SaveCompletion = (() -> Void)
     var saveCompletion : SaveCompletion?
-    init(title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType) {
+    typealias DeleteCompletion = (() -> Void)
+    var deleteCompletion : DeleteCompletion?
+    init(uid:Int,title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType) {
         self.init()
+        self.uid = uid
         self.title = title
         self.detailTitle = detailTitle
         self.h5Str = h5Str
@@ -157,8 +161,9 @@ class ShareCommunityView: FWPopupView {
     
     
     /// 初始化
-    class func shareCommunityView(title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType,completion: @escaping Completion) -> ShareCommunityView {
+    class func shareCommunityView(uid:Int,title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType,completion: @escaping Completion) -> ShareCommunityView {
         let view = ShareCommunityView(
+            uid:uid,
             title:title,
             detailTitle: detailTitle,
             h5Str: h5Str,
@@ -184,6 +189,7 @@ class ShareCommunityView: FWPopupView {
     /// 邀请好友
     class func inviteGoodFriends() {
         let shareCommunityView =  ShareCommunityView.shareCommunityView(
+            uid:0,
             title: kCommunityPushingNewActivitiesTitle,
             detailTitle: kCommunityPushingNewActivitiesDetailTitle,
             h5Str: kH5InviteUrl + "\(UserModel.shared().getModel()?.inviteCode ?? "")",
@@ -205,7 +211,11 @@ extension ShareCommunityView: UICollectionViewDelegateFlowLayout,UICollectionVie
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        return platformTitles.count
+        if UserModel.shared().isEqualUid(uid: self.uid ?? 0) {
+            return platformTitles.count
+        }else {
+            return platformTitles.prefix(5).count
+        }
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
@@ -252,6 +262,11 @@ extension ShareCommunityView: UICollectionViewDelegateFlowLayout,UICollectionVie
                 break
             }
             break
+        case 5:
+            if let deleteCompletion = self.deleteCompletion {
+                deleteCompletion()
+            }
+            break
         default:
             break
         }

+ 14 - 0
RainbowPlanet/RainbowPlanet/Modules/ShareModules/ShareShop/View/ShareView.swift

@@ -112,6 +112,20 @@ class ShareView: FWPopupView {
         return collectionViewLayout
     }()
     
+    /// 分享
+    class func sheetShareView() {
+        let view = ShareView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 250))
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.animationDuration = 0.2
+        view.vProperty = vProperty
+        view.show()
+    }
+    
 }
 
 extension ShareView: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductInfo/ProductDetailProductInfoTableViewCell.swift

@@ -189,7 +189,7 @@ class ProductDetailProductInfoTableViewCell: UITableViewCell {
         maskLayer.path = maskPath.cgPath
         shareButton.layer.mask = maskLayer
         shareButton.rx.tap.subscribe(onNext: { (data) in
-            AlertSheetView.sheetShareView()
+            ShareView.sheetShareView()
         }).disposed(by: disposeBag)
         return shareButton
     }()

+ 29 - 3
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -145,6 +145,22 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 删除内容
+    /// 删除内容
+    ///
+    /// - Parameters:
+    ///   - postId: 帖子Id
+    func communityDeleteApi(postId:Int, completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(postId, forKey: "id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared.requestAny(target: MultiTarget(SwiftMoyaServiceCommunityApi.communityDelete(parameters: parameters))) { (data) in
+            SwiftProgressHUD.shared().showText("删除成功")
+            NotificationCenter.default.post(name: NSNotification.Name("communityDeletePostApi"), object: postId)
+            completion("")
+        }
+    }
+    
     // MARK: - 获取上传地址和凭证
     /// 获取上传地址和凭证
     ///
@@ -206,6 +222,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 热门推荐音乐列表
     /// 热门推荐音乐列表
     ///
     /// - Parameters:
@@ -221,6 +238,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 获取音乐分类
     /// 获取音乐分类
     ///
     /// - Parameters:
@@ -235,6 +253,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 获取分类下所有音乐
     /// 获取分类下所有音乐
     ///
     /// - Parameters:
@@ -268,6 +287,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     }
     
     
+    // MARK: - 推荐
     ///  推荐
     ///
     /// - Parameters:
@@ -283,7 +303,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
-    
+    // MARK: - 话题详情
     /// 话题详情
     ///
     /// - Parameters:
@@ -299,7 +319,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
-    
+    // MARK: - 话题内容列表
     /// 话题内容列表
     ///
     /// - Parameters:
@@ -317,7 +337,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
-    
+    // MARK: - 我关注的话题列表
     /// 我关注的话题列表
     ///
     /// - Parameters:
@@ -335,6 +355,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 关注话题(单个)
     /// 关注话题(单个)
     ///
     /// - Parameters:
@@ -350,6 +371,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 取消关注话题
     /// 取消关注话题
     ///
     /// - Parameters:
@@ -366,6 +388,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     }
     
     
+    // MARK: - 内容详情
     /// 内容详情(前端)
     ///
     /// - Parameters:
@@ -382,6 +405,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     }
     
     
+    // MARK: - 评论列表
     /// 评论列表
     ///
     /// - Parameters:
@@ -400,6 +424,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 回复列表
     /// 回复列表
     ///
     /// - Parameters:
@@ -417,6 +442,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 评论&回复
     /// 评论&回复
     ///
     /// - Parameters:

+ 12 - 1
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift

@@ -33,6 +33,10 @@ public let kCommunityPostsApi = "/community/post"
 /// 发布内容(Post)
 public let kCommunityPublishApi = "/community/post"
 
+// MARK: - 删除内容
+/// 删除内容(Post)
+public let kCommunityDeleteApi = "/community/post"
+
 // MARK: - 获取上传地址和凭证
 /// 获取上传地址和凭证
 public let kCommunityVideoUploadAuthApi = "/community/getVodUploadAuth"
@@ -134,6 +138,7 @@ public enum SwiftMoyaServiceCommunityApi {
     case communityTopics(parameters:Dictionary<String, Any>)
     case communityPosts(parameters:Dictionary<String, Any>)
     case communityPublish(parameters:Dictionary<String, Any>)
+    case communityDelete(parameters:Dictionary<String, Any>)
     case communityVideoUploadAuth(parameters:Dictionary<String, Any>)
     case communityVideoList(parameters:Dictionary<String, Any>)
     case communityFollowFeed(parameters:Dictionary<String, Any>)
@@ -163,6 +168,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityTopics,
              .communityPosts,
              .communityPublish,
+             .communityDelete,
              .communityVideoUploadAuth,
              .communityVideoList,
              .communityFollowFeed,
@@ -199,6 +205,8 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
             return kCommunityPostsApi
         case .communityPublish:
             return kCommunityPublishApi
+        case .communityDelete:
+            return kCommunityDeleteApi
         case .communityVideoUploadAuth:
             return kCommunityVideoUploadAuthApi
         case .communityVideoList:
@@ -264,7 +272,8 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityCateMusicList
             :
             return .get
-        case .communityMemberFollowTopicCancelFollow
+        case .communityMemberFollowTopicCancelFollow,
+             .communityDelete
             :
             return .delete
 
@@ -280,6 +289,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityTopics(var parameters),
              .communityPosts(var parameters),
              .communityPublish(var parameters),
+             .communityDelete(var parameters),
              .communityVideoUploadAuth(var parameters),
              .communityVideoList(var parameters),
              .communityFollowFeed(var parameters),
@@ -325,6 +335,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityTopics,
              .communityPosts,
              .communityPublish,
+             .communityDelete,
              .communityVideoUploadAuth,
              .communityVideoList,
              .communityFollowFeed,

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

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

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


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


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

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

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


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


+ 0 - 39
RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

@@ -135,21 +135,6 @@ class AlertSheetView: NSObject {
         return commentView
     }
     
-    /// 分享
-    class func sheetShareView() {
-        let view = ShareView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 250))
-        
-        let vProperty = FWPopupViewProperty()
-        vProperty.popupCustomAlignment = .bottomCenter
-        vProperty.popupAnimationType = .frame
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
-        vProperty.touchWildToHide = "1"
-        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.animationDuration = 0.2
-        view.vProperty = vProperty
-        view.show()
-    }
-    
     
     /// 单个选择器
     class func sheetPickViewOneComponentsView(titles:[String],title:String,height:CGFloat,sureClosure:((_ row: Int,_ value:String) -> Void)?) {
@@ -174,30 +159,6 @@ class AlertSheetView: NSObject {
 
 // MARK: - Sheet
 extension AlertSheetView {
-    class func sheetDislike(dislike:Int,y:CGFloat,sureClosure:@escaping ((CardContentUserDisLikeView) -> Void)) {
-        let view = CardContentUserDisLikeView(frame: CGRect(x: 0, y: 0, width: kScreenWidth-28, height: 50))
-        view.isDisLike = dislike
-        let vProperty = FWPopupViewProperty()
-        
-        if y > kScreenHeight/2 {
-            vProperty.popupCustomAlignment = .bottomCenter
-            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: kScreenHeight-y+29, right: 0)
-
-        }else {
-            vProperty.popupCustomAlignment = .topCenter
-            vProperty.popupViewEdgeInsets = UIEdgeInsets(top: y+51, left: 0, bottom: 0, right: 0)
-        }
-        vProperty.popupAnimationType = .scale
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
-        vProperty.touchWildToHide = "1"
-        view.vProperty = vProperty
-        view.disLikeButtonClosure = {
-            view.hide()
-            sureClosure(view)
-        }
-        view.show()
-    }
-    
     
     /// 评论回复
     class func sheetCommentReplyView(userName:String,content:String,replyClosure:@escaping (() -> Void))  {

+ 153 - 0
RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/SheetSureView.swift

@@ -0,0 +1,153 @@
+//
+//  SheetSureView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/21.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FWPopupView
+import RxSwift
+
+class SheetSureView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    var titleStr : String = ""
+    var sureStr : String = ""
+    var cancleStr : String = ""
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+    }
+    
+    init(titleStr:String,sureStr:String,cancleStr:String = "取消") {
+        self.init()
+        self.titleStr = titleStr
+        self.sureStr = sureStr
+        self.cancleStr = cancleStr
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 150+kSafeTabBarHeight)
+        // fillCode
+        self.configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
+        setupViews()
+        setLayouts()
+        setupData()
+        
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupViews() {
+        addSubview(titleLabel)
+        addSubview(lineLabel)
+        addSubview(sureButton)
+        addSubview(specLabel)
+        addSubview(cancelButton)
+    }
+    
+    func setLayouts() {
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(14)
+            make.left.equalTo(28)
+            make.right.equalTo(-28)
+            make.height.equalTo(20)
+        }
+        lineLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(titleLabel.snp_bottom).offset(14)
+            make.right.left.equalToSuperview()
+            make.height.equalTo(1)
+        }
+        sureButton.snp.makeConstraints { (make) in
+            make.top.equalTo(lineLabel.snp_bottom)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(48)
+        }
+        specLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(sureButton.snp_bottom)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(5)
+        }
+        cancelButton.snp.makeConstraints { (make) in
+            make.top.equalTo(specLabel.snp_bottom)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(48)
+        }
+        
+    }
+    
+    lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.text = titleStr
+        titleLabel.textColor = k999999Color
+        titleLabel.font = kRegularFont14
+        titleLabel.textAlignment = .center
+        return titleLabel
+    }()
+    
+    lazy var lineLabel: UILabel = {
+        let lineLabel = UILabel()
+        lineLabel.backgroundColor = keeeeeeColor
+        return lineLabel
+    }()
+    
+    lazy var sureButton: UIButton = {
+        let sureButton = UIButton(type: UIButton.ButtonType.custom)
+        sureButton.setTitle(sureStr, for: UIControl.State.normal)
+        sureButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+        sureButton.titleLabel?.font = kRegularFont16
+        return sureButton
+    }()
+    
+    lazy var specLabel: UILabel = {
+        let specLabel = UILabel()
+        specLabel.backgroundColor = kf2f2f2Color
+        return specLabel
+    }()
+    
+    lazy var cancelButton: UIButton = {
+        let cancelButton = UIButton(type: UIButton.ButtonType.custom)
+        cancelButton.setTitle(cancleStr, for: UIControl.State.normal)
+        cancelButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+        cancelButton.titleLabel?.font = kRegularFont16
+        
+        return cancelButton
+    }()
+    
+    typealias SureButtonClosure = () -> Void
+    var sureButtonClosure: SureButtonClosure?
+    
+    func setupData() {
+        cancelButton.rx.tap.subscribe(onNext: {[weak self] (data) in
+            self?.hide()
+        }).disposed(by: disposeBag)
+        
+        sureButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            self?.hide()
+            if let sureButtonClosure = self?.sureButtonClosure {
+                sureButtonClosure()
+            }
+        }).disposed(by: disposeBag)
+        
+    }
+    
+    class func sheetSureView(titleStr:String,sureStr:String,cancleStr:String = "取消", sureClosure:@escaping (() -> Void)) {
+        let view = SheetSureView(titleStr: titleStr, sureStr: sureStr,cancleStr: cancleStr)
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "0"
+        view.vProperty = vProperty
+        view.sureButtonClosure = {
+            view.hide()
+            sureClosure()
+        }
+        view.show()
+    }
+    
+}

+ 4 - 4
RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

@@ -57,7 +57,7 @@ extension VirusViewModel {
     func like(communityRecommendDataModel: CommunityRecommendDataModel,y:CGFloat,tableView:UITableView) {
         if communityRecommendDataModel.isDislike == 0 {//喜欢
             
-            AlertSheetView.sheetDislike(dislike: 0, y: y) {
+            CardContentUserDisLikeView.sheetDislike(dislike: 0, y: y) {
                 [weak self] (view:CardContentUserDisLikeView) in
                 self?.virueRecordAddApiLike(communityRecommendDataModel: communityRecommendDataModel, completion: { (isDislike) in
                     communityRecommendDataModel.isDislike = isDislike
@@ -65,7 +65,7 @@ extension VirusViewModel {
                 })
             }
         }else {//不喜欢
-            AlertSheetView.sheetDislike(dislike: 1, y: y) {
+            CardContentUserDisLikeView.sheetDislike(dislike: 1, y: y) {
                 (view:CardContentUserDisLikeView) in
                 
             }
@@ -237,7 +237,7 @@ extension VirusViewModel {
     func like(communityFollowDataModel:CommunityFollowDataModel,y:CGFloat,tableView:UITableView) {
         if communityFollowDataModel.relateData?.isDislike == 0 {//喜欢
             
-            AlertSheetView.sheetDislike(dislike: 0, y: y) {
+            CardContentUserDisLikeView.sheetDislike(dislike: 0, y: y) {
                 [weak self] (view:CardContentUserDisLikeView) in
                 self?.virueRecordAddApiLike(communityFollowDataModel: communityFollowDataModel, completion: { (isFollow) in
                     communityFollowDataModel.relateData?.isDislike = isFollow
@@ -245,7 +245,7 @@ extension VirusViewModel {
                 })
             }
         }else {//不喜欢
-            AlertSheetView.sheetDislike(dislike: 1, y: y) {
+            CardContentUserDisLikeView.sheetDislike(dislike: 1, y: y) {
                 (view:CardContentUserDisLikeView) in
                 
             }