Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
67723368
Commit
67723368
authored
Feb 27, 2025
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
活动逻辑修改
parent
a199fe52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
64 deletions
+64
-64
YHCommunityViewController.swift
...s/Modules/Community(社区)/C/YHCommunityViewController.swift
+64
-64
No files found.
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHCommunityViewController.swift
View file @
67723368
...
...
@@ -65,18 +65,18 @@ class YHCommunityViewController: YHBaseViewController {
return
cleanBtn
}()
lazy
var
friendsBtn
:
UIButton
=
{
let
btn
=
UIButton
()
btn
.
setImage
(
UIImage
(
named
:
"people_friends_btn"
),
for
:
.
normal
)
btn
.
setTitle
(
"好友"
,
for
:
.
normal
)
btn
.
setTitleColor
(
UIColor
.
white
,
for
:
.
normal
)
btn
.
iconInLeft
(
spacing
:
4.0
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
15
)
btn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
btn
.
addTarget
(
self
,
action
:
#selector(
didFriendsBtnClicked
)
,
for
:
.
touchUpInside
)
return
btn
}()
//
lazy var friendsBtn:UIButton = {
//
let btn = UIButton()
//
btn.setImage(UIImage(named: "people_friends_btn"), for: .normal)
//
btn.setTitle("好友", for: .normal)
//
btn.setTitleColor(UIColor.white, for: .normal)
//
btn.iconInLeft(spacing: 4.0)
//
btn.titleLabel?.font = UIFont.PFSC_R(ofSize:15)
//
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
//
btn.addTarget(self, action: #selector(didFriendsBtnClicked), for: .touchUpInside)
//
return btn
//
}()
//
let
unreadHeight
=
16.0
lazy
var
unreadLabel
:
UILabel
=
{
let
label
=
UILabel
()
...
...
@@ -92,30 +92,30 @@ class YHCommunityViewController: YHBaseViewController {
var
unreadCount
:
Int
=
0
{
didSet
{
self
.
updateUnreadCount
(
self
.
unreadCount
)
//
self.updateUnreadCount(self.unreadCount)
}
}
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+"
}
var
width
=
unreadHeight
var
leftMargin
=
-
8
if
10
<=
count
&&
count
<
100
{
width
=
22.0
}
else
if
count
>=
100
{
width
=
30.0
leftMargin
=
-
14
}
self
.
unreadLabel
.
snp
.
updateConstraints
{
make
in
make
.
width
.
equalTo
(
width
)
make
.
left
.
equalTo
(
self
.
friendsBtn
.
snp
.
right
)
.
offset
(
leftMargin
)
}
}
//
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+"
//
}
//
var width = unreadHeight
//
var leftMargin = -8
//
if 10 <= count && count < 100 {
//
width = 22.0
//
} else if count >= 100 {
//
width = 30.0
//
leftMargin = -14
//
}
//
self.unreadLabel.snp.updateConstraints { make in
//
make.width.equalTo(width)
//
make.left.equalTo(self.friendsBtn.snp.right).offset(leftMargin)
//
}
//
}
@objc
func
didBackBtnClicked
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
...
...
@@ -197,20 +197,20 @@ class YHCommunityViewController: YHBaseViewController {
make
.
right
.
equalToSuperview
()
.
offset
(
-
20
)
}
self
.
view
.
addSubview
(
friendsBtn
)
friendsBtn
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
54.0
)
make
.
height
.
equalTo
(
21
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
12
+
k_Height_safeAreaInsetsTop
())
}
self
.
friendsBtn
.
addSubview
(
self
.
unreadLabel
)
self
.
unreadLabel
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
unreadHeight
)
make
.
left
.
equalTo
(
self
.
friendsBtn
.
snp
.
right
)
.
offset
(
-
8
)
make
.
top
.
equalTo
(
self
.
friendsBtn
.
snp
.
top
)
.
offset
(
-
8
)
}
//
self.view.addSubview(friendsBtn)
//
friendsBtn.snp.makeConstraints { make in
//
make.width.equalTo(54.0)
//
make.height.equalTo(21)
//
make.right.equalTo(-20)
//
make.top.equalTo(12+k_Height_safeAreaInsetsTop())
//
}
//
//
self.friendsBtn.addSubview(self.unreadLabel)
//
self.unreadLabel.snp.makeConstraints { make in
//
make.width.height.equalTo(unreadHeight)
//
make.left.equalTo(self.friendsBtn.snp.right).offset(-8)
//
make.top.equalTo(self.friendsBtn.snp.top).offset(-8)
//
}
segmentedView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
...
...
@@ -265,7 +265,7 @@ class YHCommunityViewController: YHBaseViewController {
self
.
friendViewModel
.
getMyFriendList
{
success
,
error
in
let
unreadCount
=
self
.
friendViewModel
.
friendListModel
.
applyFriends
.
count
self
.
unreadCount
=
unreadCount
self
.
friendsBtn
.
isHidden
=
self
.
segmentedView
.
selectedIndex
!=
1
//
self.friendsBtn.isHidden = self.segmentedView.selectedIndex != 1
}
}
else
{
self
.
unreadCount
=
0
...
...
@@ -289,22 +289,22 @@ class YHCommunityViewController: YHBaseViewController {
extension
YHCommunityViewController
:
JXSegmentedViewDelegate
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
navigationController
?
.
interactivePopGestureRecognizer
?
.
isEnabled
=
(
segmentedView
.
selectedIndex
==
0
)
if
segmentedView
.
selectedIndex
==
1
{
// 人脉
bgImgV
.
isHidden
=
false
friendsBtn
.
isHidden
=
false
cleanAllMsgBtn
.
isHidden
=
true
segmentedDataSource
.
titleNormalColor
=
UIColor
(
hex
:
0xFFFFFF
,
alpha
:
0.6
)
segmentedDataSource
.
titleSelectedColor
=
.
white
let
indicator
=
JXSegmentedIndicatorLineView
()
indicator
.
indicatorWidth
=
16
indicator
.
indicatorHeight
=
2
indicator
.
indicatorCornerRadius
=
0.0
indicator
.
indicatorColor
=
UIColor
.
white
segmentedView
.
indicators
=
[
indicator
]
}
else
{
// 非人脉tab
//
if segmentedView.selectedIndex == 1 { // 人脉
//
bgImgV.isHidden = false
//
friendsBtn.isHidden = false
//
cleanAllMsgBtn.isHidden = true
//
segmentedDataSource.titleNormalColor = UIColor(hex: 0xFFFFFF, alpha: 0.6)
//
segmentedDataSource.titleSelectedColor = .white
//
let indicator = JXSegmentedIndicatorLineView()
//
indicator.indicatorWidth = 16
//
indicator.indicatorHeight = 2
//
indicator.indicatorCornerRadius = 0.0
//
indicator.indicatorColor = UIColor.white
//
segmentedView.indicators = [indicator]
//
//
} else { // 非人脉tab
bgImgV
.
isHidden
=
true
friendsBtn
.
isHidden
=
true
//
friendsBtn.isHidden = true
cleanAllMsgBtn
.
isHidden
=
segmentedView
.
selectedIndex
!=
0
segmentedDataSource
.
titleNormalColor
=
UIColor
.
yhGreyColor
segmentedDataSource
.
titleSelectedColor
=
UIColor
.
mainTextColor
...
...
@@ -314,7 +314,7 @@ extension YHCommunityViewController: JXSegmentedViewDelegate {
indicator
.
indicatorCornerRadius
=
0.0
indicator
.
indicatorColor
=
UIColor
.
brandMainColor
segmentedView
.
indicators
=
[
indicator
]
}
//
}
segmentedView
.
dataSource
=
segmentedDataSource
self
.
segmentedView
.
reloadDataWithoutListContainer
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment