Browse Source

个人中心完成

南鑫林 5 years ago
parent
commit
f712964050
13 changed files with 448 additions and 50 deletions
  1. 20 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 3 2
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  3. 32 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/OtherPersonalCenter/View/OtherPersonalCenterHeaderView/OtherPersonalCenterHeaderView.swift
  4. 217 10
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/OtherPersonalCenter/ViewController/OtherPersonalCenterViewController.swift
  5. 35 16
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherHeaderView.swift
  6. 1 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/View/UserPersonalCenterHeaderView/UserPersonalCenterHeaderView.swift
  7. 96 22
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift
  8. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/Contents.json
  9. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/center_install@2x.png
  10. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/center_install@3x.png
  11. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/Contents.json
  12. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/center_share @2x.png
  13. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/center_share @3x.png

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

@@ -332,6 +332,7 @@
 		A7D07CD222B784B800186014 /* UserPersonalCenterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D07CD122B784B800186014 /* UserPersonalCenterHeaderView.swift */; };
 		A7D07CD422B789DE00186014 /* PersonViewUserAndOtherListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D07CD322B789DE00186014 /* PersonViewUserAndOtherListView.swift */; };
 		A7D07CD622B78BC300186014 /* PersonViewUserAndOtherListCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D07CD522B78BC300186014 /* PersonViewUserAndOtherListCollectionViewCell.swift */; };
+		A7D07CDA22B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D07CD922B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift */; };
 		A7D4608E227616F800A5A54E /* SQLiteManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D4608D227616F800A5A54E /* SQLiteManager.swift */; };
 		A7D46090227617D200A5A54E /* SQLModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D4608F227617D200A5A54E /* SQLModel.swift */; };
 		A7D46092227619CD00A5A54E /* BaiduToCityFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D46091227619CC00A5A54E /* BaiduToCityFactory.swift */; };
@@ -862,6 +863,7 @@
 		A7D07CD122B784B800186014 /* UserPersonalCenterHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPersonalCenterHeaderView.swift; sourceTree = "<group>"; };
 		A7D07CD322B789DE00186014 /* PersonViewUserAndOtherListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonViewUserAndOtherListView.swift; sourceTree = "<group>"; };
 		A7D07CD522B78BC300186014 /* PersonViewUserAndOtherListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonViewUserAndOtherListCollectionViewCell.swift; sourceTree = "<group>"; };
+		A7D07CD922B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OtherPersonalCenterHeaderView.swift; sourceTree = "<group>"; };
 		A7D4608D227616F800A5A54E /* SQLiteManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteManager.swift; sourceTree = "<group>"; };
 		A7D4608F227617D200A5A54E /* SQLModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLModel.swift; sourceTree = "<group>"; };
 		A7D46091227619CC00A5A54E /* BaiduToCityFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaiduToCityFactory.swift; sourceTree = "<group>"; };
@@ -3194,6 +3196,7 @@
 		A7D07CBA22B73E7300186014 /* OtherPersonalCenter */ = {
 			isa = PBXGroup;
 			children = (
+				A7D07CD822B7DF6300186014 /* View */,
 				A7D07CBB22B73E9D00186014 /* ViewController */,
 			);
 			path = OtherPersonalCenter;
@@ -3261,6 +3264,22 @@
 			path = UserPersonalCenterHeaderView;
 			sourceTree = "<group>";
 		};
+		A7D07CD822B7DF6300186014 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				A7D07CDB22B7E00900186014 /* OtherPersonalCenterHeaderView */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		A7D07CDB22B7E00900186014 /* OtherPersonalCenterHeaderView */ = {
+			isa = PBXGroup;
+			children = (
+				A7D07CD922B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift */,
+			);
+			path = OtherPersonalCenterHeaderView;
+			sourceTree = "<group>";
+		};
 		A7D4608C227616E600A5A54E /* FMDB */ = {
 			isa = PBXGroup;
 			children = (
@@ -4506,6 +4525,7 @@
 				A7BB68552268DE8600AB07A2 /* SelfRecommendationView.swift in Sources */,
 				BD12B69622B4F72900AEB10B /* KSMediaPickerPreviewView.swift in Sources */,
 				A7BF203122B47CC000396DB3 /* CardContentCommnetTableViewCell.swift in Sources */,
+				A7D07CDA22B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift in Sources */,
 				A72A72AF22321DE000B21995 /* AppInfo.swift in Sources */,
 				A70B843422911AF600882BC5 /* ProductDetailView.swift in Sources */,
 				A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */,

+ 3 - 2
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -49,8 +49,9 @@ class BaseTabbarViewController: ESTabBarController {
         let v4 = MessageMainViewController()
         /// 我的
 //        let v5 = MineViewController()
-        let v5 = UserPersonalCenterViewController()
-        
+//        let v5 = UserPersonalCenterViewController()
+        let v5 = OtherPersonalCenterViewController()
+
         v1.tabBarItem = ESTabBarItem.init(BaseIrregularityBasicContentView(),title: "社区", image: UIImage(named: "tabbar_home"), selectedImage: UIImage(named: "tabbar_home_pre"))
         v2.tabBarItem = ESTabBarItem.init(BaseIrregularityBasicContentView(),title: "商城", image: UIImage(named: "tabbar_shopping"), selectedImage: UIImage(named: "tabbar_shopping_pre"))
         v3.tabBarItem = ESTabBarItem.init(BaseIrregularityContentView(), title: nil, image: UIImage(named: "tabbar_publish"), selectedImage: UIImage(named: "tabbar_publish"))

+ 32 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/OtherPersonalCenter/View/OtherPersonalCenterHeaderView/OtherPersonalCenterHeaderView.swift

@@ -0,0 +1,32 @@
+//
+//  OtherPersonalCenterHeaderView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/6/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class OtherPersonalCenterHeaderView: BaseView {
+
+    override func setupViews() {
+        self.backgroundColor = kFEFEFEColor
+        addSubview(personViewUserAndOtherHeaderView)
+    }
+    
+    override func setupLayouts() {
+        personViewUserAndOtherHeaderView.snp.makeConstraints { (make) in
+            make.top.right.left.equalToSuperview()
+            make.height.equalTo(140+kNavBarTotalHeight)
+        }
+        
+    }
+    
+    lazy var personViewUserAndOtherHeaderView: PersonViewUserAndOtherHeaderView = {
+        let personViewUserAndOtherHeaderView = PersonViewUserAndOtherHeaderView()
+        personViewUserAndOtherHeaderView.personViewUserAndOtherHeaderViewType = .other
+        return personViewUserAndOtherHeaderView
+    }()
+    
+}

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

@@ -7,24 +7,231 @@
 //
 
 import UIKit
+import JXSegmentedView
+import RxSwift
 
 class OtherPersonalCenterViewController: BaseViewController {
 
+    let JXTableHeaderViewHeight: Int = Int(140 + kNavBarTotalHeight)
+    let JXheightForHeaderInSection: Int = 44
+    var cmsTemplateTitles = ["发布 0", "收藏 0", "分享 0"]
+    var otherPersonalCenterVCType : Int = 0
+    
     override func viewDidLoad() {
         super.viewDidLoad()
-
-        // Do any additional setup after loading the view.
+        setupViews()
+        setupLayouts()
+        setupData()
     }
     
+    override func setupViews() {
+        otherHeaderContainerView.addSubview(otherHeaderView)
+        view.addSubview(segmentedView)
+        view.addSubview(pagingView)
+        view.insertSubview(navigationBar, aboveSubview: pagingView)
+        setnavigationBar()
+    }
+    
+    /// 设置navigationBar
+    func setnavigationBar() {
+        navigationBar.addSubview(navigationBgView)
+        navigationBar.addSubview(avatarButton)
+        navigationBar.addSubview(nameButton)
+        navigationBar.insertSubview(navigationBgView, aboveSubview: navigationBar.backgroundImageView)
+        navigationBar.backgroundImageView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
+        navigationBar.backgroundImageView.contentMode = .scaleAspectFill
+        navigationBar.clipsToBounds = true
+        navigationBar.wr_setRightButton(image: kImage(name: "center_share")!)
+        // 设置导航栏显示图片
+        navigationBar.barBackgroundImage = UIImage(named: "Rectangle 2")
+        // 设置初始导航栏透明度
+        navigationBar.wr_setBackgroundAlpha(alpha: 0)
+        // 设置状态栏style
+        statusBarStyle = .lightContent
+    }
+    
+    override func setupLayouts() {
+        navigationBgView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
+        avatarButton.snp.makeConstraints { (make) in
+//            make.left.equalTo(navigationBar.snp_right).offset(8)
+            make.left.equalTo(8)
+            make.size.equalTo(20)
+            make.centerY.equalTo(navigationBar.rightButton)
+        }
+        nameButton.snp.makeConstraints { (make) in
+            make.centerY.equalTo(avatarButton)
+            make.left.equalTo(avatarButton.snp_right).offset(4)
+        }
+    }
+    
+    
+    override func setupData() {
+        reloadData()
+    }
+    
+    
+    /// 刷新页面
+    func reloadData() {
+        segmentedDataSource.titles = cmsTemplateTitles
+        segmentedView.indicators = [indicator]
+        self.segmentedDataSource.reloadData(selectedIndex: otherPersonalCenterVCType)
+        self.segmentedView.defaultSelectedIndex = otherPersonalCenterVCType
+        self.segmentedView.reloadData()
+        self.pagingView.reloadData()
+    }
+    
+    lazy var avatarButton: UIButton = {
+        let avatarButton = UIButton(type: UIButton.ButtonType.custom)
+        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.alpha = 0
+        return avatarButton
+    }()
+    
+    lazy var nameButton: UIButton = {
+        let nameButton = UIButton(type: UIButton.ButtonType.custom)
+        nameButton.setTitle("昵称", for: UIControl.State.normal)
+        nameButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        nameButton.titleLabel?.font = kBoldFont18
+        nameButton.alpha = 0
+        return nameButton
+    }()
+    
+    private lazy var navigationBgView: UIView = {
+        let navigationBgView = UIView()
+        navigationBgView.backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        navigationBgView.alpha = 0
+        return navigationBgView
+    }()
+    
+    //1.初始化JXSegmentedView
+    lazy var segmentedView: JXSegmentedView = {
+        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: CGFloat(JXheightForHeaderInSection)))
+        segmentedView.delegate = self
+        segmentedView.dataSource = segmentedDataSource
+        segmentedView.contentScrollView = pagingView.listContainerView.collectionView
+        return segmentedView
+    }()
+    
+    //2.初始化dataSource
+    lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
+        let segmentedDataSource = JXSegmentedTitleDataSource()
+        segmentedDataSource.isTitleColorGradientEnabled = true
+        segmentedDataSource.isItemSpacingAverageEnabled = true
+        segmentedDataSource.isTitleZoomEnabled = true
+        segmentedDataSource.titleNormalColor = k999999Color
+        segmentedDataSource.titleSelectedColor = k333333Color
+        segmentedDataSource.titleNormalFont = kRegularFont14!
+        segmentedDataSource.titleSelectedFont = kBoldFont16
+        
+        //reloadData(selectedIndex:)方法一定要调用,方法内部会刷新数据源数组
+        segmentedDataSource.reloadData(selectedIndex: 0)
+        return segmentedDataSource
+    }()
+    //3.初始化指示器indicator
+    lazy var indicator: JXSegmentedIndicatorLineView = {
+        let indicator = JXSegmentedIndicatorLineView()
+        indicator.indicatorColor = k333333Color
+        indicator.indicatorHeight = 4
+        indicator.indicatorWidth = 22
+        return indicator
+    }()
+    
+    //4.pagingView
+    lazy var pagingView: JXPagingView = {
+        let pagingView = JXPagingView(delegate: self)
+        return pagingView
+    }()
+    // 5.头部headerView
+    lazy var otherHeaderContainerView: UIView = {
+        let otherHeaderContainerView = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: CGFloat(JXTableHeaderViewHeight)))
+        return otherHeaderContainerView
+    }()
+    
+    /// 6.包含头部
+    lazy var otherHeaderView: OtherPersonalCenterHeaderView = {
+        var otherHeaderView =  OtherPersonalCenterHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: CGFloat(JXTableHeaderViewHeight)))
+        return otherHeaderView
+    }()
+    
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+        pagingView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight)
+        
+    }
+    
+}
 
-    /*
-    // MARK: - Navigation
-
-    // In a storyboard-based application, you will often want to do a little preparation before navigation
-    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        // Get the new view controller using segue.destination.
-        // Pass the selected object to the new view controller.
+extension OtherPersonalCenterViewController : JXSegmentedViewDelegate {
+    //点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,而不关心具体是点击还是滚动选中的情况。
+    func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
+        self.otherPersonalCenterVCType = index
     }
-    */
+    
+    // 点击选中的情况才会调用该方法
+    func segmentedView(_ segmentedView: JXSegmentedView, didClickSelectedItemAt index: Int) {
+    }
+    
+    // 滚动选中的情况才会调用该方法
+    func segmentedView(_ segmentedView: JXSegmentedView, didScrollSelectedItemAt index: Int) {
+    }
+    
+    // 正在滚动中的回调
+    func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
+    }
+    
+    /// 是否允许点击选中目标index的item
+    func segmentedView(_ segmentedView: JXSegmentedView, canClickItemAt index: Int) -> Bool {
+        return true
+    }
+}
 
+extension OtherPersonalCenterViewController: JXPagingViewDelegate {
+    
+    func tableHeaderViewHeight(in pagingView: JXPagingView) -> Int {
+        return JXTableHeaderViewHeight
+    }
+    
+    func tableHeaderView(in pagingView: JXPagingView) -> UIView {
+        return otherHeaderContainerView
+    }
+    
+    func heightForPinSectionHeader(in pagingView: JXPagingView) -> Int {
+        return JXheightForHeaderInSection
+    }
+    
+    func viewForPinSectionHeader(in pagingView: JXPagingView) -> UIView {
+        pagingView.pinSectionHeaderVerticalOffset = kNavBarTotalHeight
+        return segmentedView
+    }
+    
+    func numberOfLists(in pagingView: JXPagingView) -> Int {
+        return cmsTemplateTitles.count
+    }
+    
+    func pagingView(_ pagingView: JXPagingView, initListAtIndex index: Int) -> JXPagingViewListViewDelegate {
+        let list = PersonViewUserAndOtherListView()
+        return list
+    }
+    
+    func mainTableViewDidScroll(_ scrollView: UIScrollView) {
+        otherHeaderView.personViewUserAndOtherHeaderView.scrollViewDidScroll(contentOffsetY: scrollView.contentOffset.y)
+        
+        let offsetY = scrollView.contentOffset.y
+        if (offsetY > kSafeStatusBarHeight) {
+            let alpha = (offsetY - kSafeStatusBarHeight) / CGFloat(kNavBarTotalHeight)
+            navigationBar.wr_setBackgroundAlpha(alpha: alpha)
+            avatarButton.alpha = alpha
+            nameButton.alpha = alpha
+            navigationBgView.alpha = alpha
+            
+        } else {
+            navigationBar.wr_setBackgroundAlpha(alpha: 0)
+            avatarButton.alpha = 0
+            nameButton.alpha = 0
+            navigationBgView.alpha = 0
+        }
+    }
 }
+

+ 35 - 16
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherHeaderView.swift

@@ -8,12 +8,27 @@
 
 import UIKit
 
+enum PersonViewUserAndOtherHeaderViewType {
+    case user
+    case other
+}
+
 class PersonViewUserAndOtherHeaderView: BaseView {
-    var imageView: UIImageView!
-    var imageViewFrame: CGRect!
+
+    var imageViewFrame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 140 + kNavBarTotalHeight)
+    var personViewUserAndOtherHeaderViewType : PersonViewUserAndOtherHeaderViewType? {
+        didSet {
+            if personViewUserAndOtherHeaderViewType == .user {
+                followButton.isHidden = true
+                editButton.isHidden = false
+            }else {
+                followButton.isHidden = false
+                editButton.isHidden = true
+            }
+        }
+    }
 
     override func setupViews() {
-        imageViewFrame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 140 + kNavBarTotalHeight)
         addSubview(bgImageView)
         addSubview(bgView)
         bgView.addSubview(titleLabel)
@@ -45,23 +60,24 @@ class PersonViewUserAndOtherHeaderView: BaseView {
             make.centerY.height.equalTo(followNumberButton)
             make.left.equalTo(followNumberButton.snp_right).offset(20)
         }
+        avatarButton.snp_makeConstraints { (make) in
+            make.bottom.equalTo(-66)
+            make.right.equalTo(-20)
+            make.size.equalTo(60)
+        }
         editButton.snp_makeConstraints { (make) in
-             make.right.equalTo(-20)
+            make.centerX.equalTo(avatarButton)
             make.bottom.equalTo(-23)
             make.width.equalTo(64)
             make.height.equalTo(24)
         }
         followButton.snp_makeConstraints { (make) in
-            make.right.equalTo(-20)
+            make.centerX.equalTo(avatarButton)
             make.bottom.equalTo(-23)
             make.width.equalTo(64)
             make.height.equalTo(24)
         }
-        avatarButton.snp_makeConstraints { (make) in
-            make.bottom.equalTo(-66)
-            make.right.equalTo(-20)
-            make.size.equalTo(60)
-        }
+        
     }
     
     private lazy var bgImageView: UIImageView = {
@@ -125,8 +141,9 @@ class PersonViewUserAndOtherHeaderView: BaseView {
         editButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
         editButton.titleLabel?.font = kRegularFont12
         editButton.layer.borderColor = kffffffColor.cgColor
-        editButton.layer.borderWidth = 64
+        editButton.layer.borderWidth = 1
         editButton.isHidden = true
+        editButton.backgroundColor = UIColor.clear
         return editButton
     }()
     
@@ -150,11 +167,13 @@ class PersonViewUserAndOtherHeaderView: BaseView {
     }()
     
     func scrollViewDidScroll(contentOffsetY: CGFloat) {
-        var frame = imageViewFrame!
-        frame.size.height -= contentOffsetY
-        frame.origin.y = contentOffsetY
-        bgImageView.frame = frame
-        bgView.frame = frame
+        if contentOffsetY < 0 {
+            var frame = imageViewFrame
+            frame.size.height -= contentOffsetY
+            frame.origin.y = contentOffsetY
+            bgImageView.frame = frame
+            bgView.frame = frame
+        }
     }
     
 }

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/View/UserPersonalCenterHeaderView/UserPersonalCenterHeaderView.swift

@@ -37,6 +37,7 @@ class UserPersonalCenterHeaderView: BaseView {
     
     lazy var personViewUserAndOtherHeaderView: PersonViewUserAndOtherHeaderView = {
         let personViewUserAndOtherHeaderView = PersonViewUserAndOtherHeaderView()
+        personViewUserAndOtherHeaderView.personViewUserAndOtherHeaderViewType = .user
         return personViewUserAndOtherHeaderView
     }()
     

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

@@ -10,12 +10,18 @@ import UIKit
 import JXSegmentedView
 import RxSwift
 
+enum UserPersonalCenterVCPushType {
+    case none
+    case push
+}
+
 class UserPersonalCenterViewController: BaseViewController {
     
     let JXTableHeaderViewHeight: Int = Int(140 + kNavBarTotalHeight + 109 + 104)
     let JXheightForHeaderInSection: Int = 44
     var cmsTemplateTitles = ["发布 0", "收藏 0", "分享 0"]
-    var shoppingMallListVCType : Int = 0
+    var userPersonalCenterVCType : Int = 0
+    var userPersonalCenterVCPushType : UserPersonalCenterVCPushType = UserPersonalCenterVCPushType.none
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -29,30 +35,54 @@ class UserPersonalCenterViewController: BaseViewController {
         view.addSubview(segmentedView)
         view.addSubview(pagingView)
 //        view.insertSubview(navigationBar, aboveSubview: segmentedView)
+        view.insertSubview(navigationBar, aboveSubview: pagingView)
         setnavigationBar()
     }
     
-    override func setupLayouts() {
-        
-    }
-    
     /// 设置navigationBar
     func setnavigationBar() {
-//        navigationBar.addSubview(navigationBgView)
-//        navigationBar.addSubview(topicLable)
-//        navigationBar.addSubview(followButton)
-//        navigationBar.insertSubview(navigationBgView, aboveSubview: navigationBar.backgroundImageView)
-//        navigationBar.backgroundImageView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
-//        navigationBar.clipsToBounds = true
-//        navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
-//        navigationBar.wr_setRightButton(title: "我的话题", titleColor: .white)
-//        // 设置导航栏显示图片
-//        navigationBar.barBackgroundImage = UIImage(named: "pic_example_12")
-//        // 设置初始导航栏透明度
-//        navigationBar.wr_setBackgroundAlpha(alpha: 0)
+        navigationBar.addSubview(navigationBgView)
+        navigationBar.addSubview(avatarButton)
+        navigationBar.addSubview(nameButton)
+        navigationBar.addSubview(setButton)
+        navigationBar.insertSubview(navigationBgView, aboveSubview: navigationBar.backgroundImageView)
+        navigationBar.backgroundImageView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
+        navigationBar.backgroundImageView.contentMode = .scaleAspectFill
+        navigationBar.clipsToBounds = true
+        navigationBar.wr_setRightButton(image: kImage(name: "center_share")!)
+        // 设置导航栏显示图片
+        navigationBar.barBackgroundImage = UIImage(named: "Rectangle 2")
+        // 设置初始导航栏透明度
+        navigationBar.wr_setBackgroundAlpha(alpha: 0)
         // 设置状态栏style
         statusBarStyle = .lightContent
     }
+    
+    override func setupLayouts() {
+        navigationBgView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
+        avatarButton.snp.makeConstraints { (make) in
+            if userPersonalCenterVCPushType == .none {
+                make.left.equalTo(14)
+            }else {
+                make.left.equalTo(navigationBar.snp_right).offset(8)
+            }
+            make.size.equalTo(20)
+            make.centerY.equalTo(navigationBar.rightButton)
+        }
+        nameButton.snp.makeConstraints { (make) in
+            make.centerY.equalTo(avatarButton)
+            make.left.equalTo(avatarButton.snp_right).offset(4)
+        }
+        setButton.snp_makeConstraints { (make) in
+            make.centerY.equalTo(navigationBar.rightButton)
+            make.right.equalTo(navigationBar.rightButton.snp_left)
+            make.size.equalTo(34)
+        }
+    }
+    
+    
     override func setupData() {
         reloadData()
     }
@@ -62,15 +92,44 @@ class UserPersonalCenterViewController: BaseViewController {
     func reloadData() {
         segmentedDataSource.titles = cmsTemplateTitles
         segmentedView.indicators = [indicator]
-        self.segmentedDataSource.reloadData(selectedIndex: shoppingMallListVCType)
-        self.segmentedView.defaultSelectedIndex = shoppingMallListVCType
+        self.segmentedDataSource.reloadData(selectedIndex: userPersonalCenterVCType)
+        self.segmentedView.defaultSelectedIndex = userPersonalCenterVCType
         self.segmentedView.reloadData()
         self.pagingView.reloadData()
     }
     
+    lazy var avatarButton: UIButton = {
+        let avatarButton = UIButton(type: UIButton.ButtonType.custom)
+        avatarButton.setImage(kImage(name: "defaul_tavatar"), for: UIControl.State.normal)
+        avatarButton.alpha = 0
+        return avatarButton
+    }()
+    
+    lazy var nameButton: UIButton = {
+        let nameButton = UIButton(type: UIButton.ButtonType.custom)
+        nameButton.setTitle("昵称", for: UIControl.State.normal)
+        nameButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        nameButton.titleLabel?.font = kBoldFont18
+        nameButton.alpha = 0
+        return nameButton
+    }()
+    
+    lazy var setButton: UIButton = {
+        let setButton = UIButton(type: UIButton.ButtonType.custom)
+        setButton.setImage(kImage(name: "center_install"), for: UIControl.State.normal)
+        return setButton
+    }()
+    
+    private lazy var navigationBgView: UIView = {
+        let navigationBgView = UIView()
+        navigationBgView.backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        navigationBgView.alpha = 0
+        return navigationBgView
+    }()
+    
     //1.初始化JXSegmentedView
     lazy var segmentedView: JXSegmentedView = {
-        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: kNavBarTotalHeight, width: UIScreen.main.bounds.size.width, height: CGFloat(JXheightForHeaderInSection)))
+        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: CGFloat(JXheightForHeaderInSection)))
         segmentedView.delegate = self
         segmentedView.dataSource = segmentedDataSource
         segmentedView.contentScrollView = pagingView.listContainerView.collectionView
@@ -129,7 +188,7 @@ class UserPersonalCenterViewController: BaseViewController {
 extension UserPersonalCenterViewController : JXSegmentedViewDelegate {
     //点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,而不关心具体是点击还是滚动选中的情况。
     func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
-//        self.shoppingMallListVCType = index
+        self.userPersonalCenterVCType = index
     }
     
     // 点击选中的情况才会调用该方法
@@ -179,7 +238,22 @@ extension UserPersonalCenterViewController: JXPagingViewDelegate {
     }
     
     func mainTableViewDidScroll(_ scrollView: UIScrollView) {
-        userHeaderView.personViewUserAndOtherHeaderView.scrollViewDidScroll(contentOffsetY: scrollView.contentOffset.y)
+    userHeaderView.personViewUserAndOtherHeaderView.scrollViewDidScroll(contentOffsetY: scrollView.contentOffset.y)
+        
+        let offsetY = scrollView.contentOffset.y
+        if (offsetY > kSafeStatusBarHeight) {
+            let alpha = (offsetY - kSafeStatusBarHeight) / CGFloat(kNavBarTotalHeight)
+            navigationBar.wr_setBackgroundAlpha(alpha: alpha)
+            avatarButton.alpha = alpha
+            nameButton.alpha = alpha
+            navigationBgView.alpha = alpha
+
+        } else {
+            navigationBar.wr_setBackgroundAlpha(alpha: 0)
+            avatarButton.alpha = 0
+            nameButton.alpha = 0
+            navigationBgView.alpha = 0
+        }
     }
 }
 

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/Contents.json

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

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/center_install@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_install.imageset/center_install@3x.png


+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/Contents.json

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

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/center_share @2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/MineModule.xcassets/center_share.imageset/center_share @3x.png