Commit af6caeb7 authored by David黄金龙's avatar David黄金龙

Merge branch '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into 630-dev

* '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  //  社区
  //  我的好友
  //  人脉
parents 7db2e755 38de71cd
...@@ -78,17 +78,22 @@ class YHCommunityViewController: YHBaseViewController { ...@@ -78,17 +78,22 @@ class YHCommunityViewController: YHBaseViewController {
var unreadCount:Int = 0 { var unreadCount:Int = 0 {
didSet { didSet {
self.unreadLabel.isHidden = (self.unreadCount <= 0) self.updateUnreadCount(self.unreadCount)
if 0 < self.unreadCount && self.unreadCount < 100 { }
self.unreadLabel.text = "\(self.unreadCount)" }
} else if self.unreadCount >= 100 {
func updateUnreadCount(_ count : Int) {
self.unreadLabel.isHidden = (count <= 0)
if 0 < count && count < 100 {
self.unreadLabel.text = "\(count)"
} else if count >= 100 {
self.unreadLabel.text = "99+" self.unreadLabel.text = "99+"
} }
var width = unreadHeight var width = unreadHeight
var leftMargin = -8 var leftMargin = -8
if 10 <= self.unreadCount && self.unreadCount < 100 { if 10 <= count && count < 100 {
width = 22.0 width = 22.0
} else if self.unreadCount >= 100 { } else if count >= 100 {
width = 30.0 width = 30.0
leftMargin = -14 leftMargin = -14
} }
...@@ -97,7 +102,6 @@ class YHCommunityViewController: YHBaseViewController { ...@@ -97,7 +102,6 @@ class YHCommunityViewController: YHBaseViewController {
make.left.equalTo(self.friendsBtn.snp.right).offset(leftMargin) make.left.equalTo(self.friendsBtn.snp.right).offset(leftMargin)
} }
} }
}
@objc func didBackBtnClicked() { @objc func didBackBtnClicked() {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
...@@ -159,7 +163,7 @@ class YHCommunityViewController: YHBaseViewController { ...@@ -159,7 +163,7 @@ class YHCommunityViewController: YHBaseViewController {
make.top.equalTo(12+k_Height_safeAreaInsetsTop()) make.top.equalTo(12+k_Height_safeAreaInsetsTop())
} }
self.view.addSubview(self.unreadLabel) self.friendsBtn.addSubview(self.unreadLabel)
self.unreadLabel.snp.makeConstraints { make in self.unreadLabel.snp.makeConstraints { make in
make.width.height.equalTo(unreadHeight) make.width.height.equalTo(unreadHeight)
make.left.equalTo(self.friendsBtn.snp.right).offset(-8) make.left.equalTo(self.friendsBtn.snp.right).offset(-8)
...@@ -193,6 +197,7 @@ class YHCommunityViewController: YHBaseViewController { ...@@ -193,6 +197,7 @@ class YHCommunityViewController: YHBaseViewController {
self.friendViewModel.getMyFriendList { success, error in self.friendViewModel.getMyFriendList { success, error in
let unreadCount = self.friendViewModel.friendListModel.applyFriends.count let unreadCount = self.friendViewModel.friendListModel.applyFriends.count
self.unreadCount = unreadCount self.unreadCount = unreadCount
self.friendsBtn.isHidden = self.segmentedView.selectedIndex != 0
} }
} else { } else {
self.unreadCount = 0 self.unreadCount = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment