From c40620fc9e9727464e3e414b2e0288c421dfb75d Mon Sep 17 00:00:00 2001 From: chenguilong <598604202@qq.com> Date: Thu, 24 Nov 2022 19:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E6=B4=BE=E5=AF=B9=E4=B8=AD?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 14 +++++++++++ .../SessionList/SessionListViewController.m | 14 ++++++++++- .../Model/XPSessionListFansPartyModel.h | 23 +++++++++++++++++++ .../Model/XPSessionListFansPartyModel.m | 12 ++++++++++ .../XPSessionListHeadFriendCell.h | 3 +++ .../XPSessionListHeadFriendCell.m | 18 ++++++++------- .../XPSessionListHeadView.m | 21 +++++++++++++---- xplan-ios/Main/Mine/Api/Api+Mine.h | 4 ++++ xplan-ios/Main/Mine/Api/Api+Mine.m | 6 +++++ 9 files changed, 101 insertions(+), 14 deletions(-) create mode 100644 xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.h create mode 100644 xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.m diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 8270ffb6..f16d9202 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -173,6 +173,7 @@ 9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */; }; 9B46B91728DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */; }; 9B4769AD28DB270F00CCD312 /* XPHomePartyNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */; }; + 9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */; }; 9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; }; 9B4D449328F15765002572D5 /* XPGiftLuckyGiftBroadcastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D449228F15765002572D5 /* XPGiftLuckyGiftBroadcastView.m */; }; 9B4D449628F15EE7002572D5 /* XPGiftWeekStarBroadcastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D449528F15EE7002572D5 /* XPGiftWeekStarBroadcastView.m */; }; @@ -1568,6 +1569,8 @@ 9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeRedommendCollectionViewCell.m; sourceTree = ""; }; 9B4769AB28DB270F00CCD312 /* XPHomePartyNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomePartyNavView.h; sourceTree = ""; }; 9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomePartyNavView.m; sourceTree = ""; }; + 9B4C5B84292F81FA00CEA41B /* XPSessionListFansPartyModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListFansPartyModel.h; sourceTree = ""; }; + 9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListFansPartyModel.m; sourceTree = ""; }; 9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = ""; }; 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = ""; }; 9B4D449128F15765002572D5 /* XPGiftLuckyGiftBroadcastView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftLuckyGiftBroadcastView.h; sourceTree = ""; }; @@ -4457,6 +4460,15 @@ path = Cell; sourceTree = ""; }; + 9B4C5B83292F81D000CEA41B /* Model */ = { + isa = PBXGroup; + children = ( + 9B4C5B84292F81FA00CEA41B /* XPSessionListFansPartyModel.h */, + 9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */, + ); + path = Model; + sourceTree = ""; + }; 9B53D57728E2CEE8005187A3 /* Teenager */ = { isa = PBXGroup; children = ( @@ -5086,6 +5098,7 @@ 9BD798AE29262306003E03E6 /* SessionListHeadView */ = { isa = PBXGroup; children = ( + 9B4C5B83292F81D000CEA41B /* Model */, 9BD798AF29262434003E03E6 /* XPSessionListHeadView.h */, 9BD798B029262434003E03E6 /* XPSessionListHeadView.m */, 9BD798B2292632FE003E03E6 /* XPSessionListHeadItemView.h */, @@ -9522,6 +9535,7 @@ 9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */, E87A270027588445002DDC7A /* XPHomeListEmptyCollectionViewCell.m in Sources */, E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */, + 9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */, E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */, E80EC80B28ACD84000D133C5 /* QInputBarViewConfiguration.m in Sources */, E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */, diff --git a/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m b/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m index 94cb0c0b..e8d5ffe4 100644 --- a/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m +++ b/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m @@ -16,6 +16,7 @@ #import "ClientConfig.h" ///Model #import "UserInfoModel.h" +#import "XPSessionListFansPartyModel.h" ///View #import "XPSessionFindNewViewController.h" #import "TTPopUp.h" @@ -114,13 +115,24 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey"; [self getUserInfo]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + if (self.openType == SessionListOpenTypeDefault) { + [Api requestFansParty:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + NSArray *array = [XPSessionListFansPartyModel modelsWithArray:data.data]; + self.headView.friendsArray = array; + } + }]; + } +} - (void)getUserInfo { NSString * uid = [AccountInfoStorage instance].getUid; [Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:data.data]; self.userInfo = userInfo; -// [self.sessionListView reloadData]; + [self.sessionListView reloadData]; [self.headView updateToolViewWithUserLevel:self.userInfo.userLevelVo.charmLevelSeq]; } } uid:uid]; diff --git a/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.h b/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.h new file mode 100644 index 00000000..8ac21b89 --- /dev/null +++ b/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.h @@ -0,0 +1,23 @@ +// +// XPSessionListFansPartyModel.h +// xplan-ios +// +// Created by GreenLand on 2022/11/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPSessionListFansPartyModel : NSObject + +@property (nonatomic, copy) NSString *avatar; +@property (nonatomic, copy) NSString *uid; +@property (nonatomic, copy) NSString *erbanNo; +@property (nonatomic, copy) NSString *nick; +@property (nonatomic, copy) NSString *roomUid; +@property (nonatomic, assign) NSInteger gender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.m b/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.m new file mode 100644 index 00000000..07daa7b2 --- /dev/null +++ b/xplan-ios/Main/Message/View/SessionListHeadView/Model/XPSessionListFansPartyModel.m @@ -0,0 +1,12 @@ +// +// XPSessionListFansPartyModel.m +// xplan-ios +// +// Created by GreenLand on 2022/11/24. +// + +#import "XPSessionListFansPartyModel.h" + +@implementation XPSessionListFansPartyModel + +@end diff --git a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.h b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.h index a6d0a6ca..08eade50 100644 --- a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.h +++ b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.h @@ -9,8 +9,11 @@ NS_ASSUME_NONNULL_BEGIN +@class XPSessionListFansPartyModel; @interface XPSessionListHeadFriendCell : UICollectionViewCell +- (void)configData:(XPSessionListFansPartyModel *)data; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.m b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.m index 1afbdfb1..b2c5089c 100644 --- a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.m +++ b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadFriendCell.m @@ -10,6 +10,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "UIImage+Utils.h" +#import "XPSessionListFansPartyModel.h" @interface XPSessionListHeadFriendCell() @@ -51,6 +52,7 @@ make.centerX.mas_equalTo(self); make.top.mas_equalTo(self.dotView.mas_bottom).mas_offset(2); make.height.mas_equalTo(17); + make.left.mas_equalTo(0); }]; [self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.right.bottom.mas_equalTo(self.dotView); @@ -58,20 +60,20 @@ }]; } -- (void)setTitle:(NSString *)title { - self.nameLabel.text = title; -} - -- (void)setImageName:(NSString *)imageName { - self.imageView.image = [UIImage imageNamed:imageName]; +- (void)configData:(XPSessionListFansPartyModel *)data { + self.imageView.imageUrl = data.avatar; + NSString *name = data.nick.length > 4 ? [data.nick substringToIndex:4] : data.nick; + self.nameLabel.text = name; + self.genderImageView.image = data.gender == 1 ? [UIImage imageNamed:@"common_male"] : [UIImage imageNamed:@"common_female"]; } - (UILabel *)nameLabel { if (!_nameLabel) { _nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _nameLabel.backgroundColor = [UIColor clearColor]; - _nameLabel.font = [UIFont systemFontOfSize:14]; - _nameLabel.textColor = ThemeColor.mainTextColor; + _nameLabel.font = [UIFont systemFontOfSize:12]; + _nameLabel.textColor = ThemeColor.secondTextColor; + _nameLabel.textAlignment = NSTextAlignmentCenter; } return _nameLabel; } diff --git a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadView.m b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadView.m index 915f34dc..d36457d7 100644 --- a/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadView.m +++ b/xplan-ios/Main/Message/View/SessionListHeadView/XPSessionListHeadView.m @@ -15,6 +15,9 @@ #import "XPSessionListHeadItemView.h" #import "XPSessionListHeadFriendCell.h" #import "NSArray+Safe.h" +#import "XPSessionListFansPartyModel.h" +#import "XCCurrentVCStackManager.h" +#import "XPRoomViewController.h" NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey"; @@ -106,18 +109,19 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey"; #pragma mark - UICollectionViewDelegate - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { -// return self.friendsArray.count; - return 6; + return self.friendsArray.count; } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPSessionListHeadFriendCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class]) forIndexPath:indexPath]; - + XPSessionListFansPartyModel *model = [self.friendsArray safeObjectAtIndex1:indexPath.row]; + [cell configData:model]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - + XPSessionListFansPartyModel *model = [self.friendsArray safeObjectAtIndex1:indexPath.row]; + [XPRoomViewController openRoom:model.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; } - (void)updateToolViewWithUserLevel:(NSInteger)level { @@ -194,6 +198,13 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey"; } } +- (void)setFriendsArray:(NSArray *)friendsArray { + _friendsArray = friendsArray; + if (friendsArray.count) { + self.friendContentView.hidden = NO; + [self.collectionView reloadData]; + } +} - (UIStackView *)mainStackView { if (!_mainStackView) { _mainStackView = [[UIStackView alloc] init]; @@ -223,7 +234,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey"; - (UIView *)friendContentView { if (!_friendContentView) { _friendContentView = [[UIView alloc] init]; -// _friendContentView.hidden = YES; + _friendContentView.hidden = YES; } return _friendContentView; } diff --git a/xplan-ios/Main/Mine/Api/Api+Mine.h b/xplan-ios/Main/Mine/Api/Api+Mine.h index a2d50408..ec7b2e31 100644 --- a/xplan-ios/Main/Mine/Api/Api+Mine.h +++ b/xplan-ios/Main/Mine/Api/Api+Mine.h @@ -276,6 +276,10 @@ NS_ASSUME_NONNULL_BEGIN /// @param uid uid + (void)requestEveryoneSearch:(HttpRequestHelperCompletion)completion uid:(NSString *)uid; +/// 获取好友派对列表 +/// @param completion 完成 ++ (void)requestFansParty:(HttpRequestHelperCompletion)completion; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/Api/Api+Mine.m b/xplan-ios/Main/Mine/Api/Api+Mine.m index f0d243a0..b51d0366 100644 --- a/xplan-ios/Main/Mine/Api/Api+Mine.m +++ b/xplan-ios/Main/Mine/Api/Api+Mine.m @@ -310,4 +310,10 @@ [self makeRequest:@"" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil]; } +/// 获取好友派对列表 +/// @param completion 完成 ++ (void)requestFansParty:(HttpRequestHelperCompletion)completion { + [self makeRequest:@"fans/fansPartList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil]; +} + @end