房内推荐更多房间

This commit is contained in:
chenguilong
2022-04-28 20:52:38 +08:00
parent 1db92d62c9
commit a8bbca8a56
21 changed files with 769 additions and 37 deletions

View File

@@ -155,6 +155,10 @@
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
9B5F1503280FF02600C3C2B1 /* anchorPk_crossPking.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */; };
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; };
9B6E856A281A982A0041A321 /* XPRoomRecommendView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6E8569281A982A0041A321 /* XPRoomRecommendView.m */; };
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6E856D281AABAB0041A321 /* XPRoomRecommendModel.m */; };
9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6E8572281AB9B20041A321 /* XPRoomInsideRecommendCell.m */; };
9B6E8577281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6E8576281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m */; };
9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */; };
9B73CD09279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD08279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m */; };
9B73CD11279AE99B006AF255 /* XPSkillCardListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD10279AE99B006AF255 /* XPSkillCardListCell.m */; };
@@ -1018,6 +1022,14 @@
9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchorPk_crossPking.svga; sourceTree = "<group>"; };
9B6B3AA9278C2EA7005551EC /* XPRoomNobleLevelUpView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomNobleLevelUpView.h; sourceTree = "<group>"; };
9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomNobleLevelUpView.m; sourceTree = "<group>"; };
9B6E8568281A982A0041A321 /* XPRoomRecommendView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomRecommendView.h; sourceTree = "<group>"; };
9B6E8569281A982A0041A321 /* XPRoomRecommendView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRecommendView.m; sourceTree = "<group>"; };
9B6E856C281AABAB0041A321 /* XPRoomRecommendModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomRecommendModel.h; sourceTree = "<group>"; };
9B6E856D281AABAB0041A321 /* XPRoomRecommendModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRecommendModel.m; sourceTree = "<group>"; };
9B6E8571281AB9B20041A321 /* XPRoomInsideRecommendCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomInsideRecommendCell.h; sourceTree = "<group>"; };
9B6E8572281AB9B20041A321 /* XPRoomInsideRecommendCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomInsideRecommendCell.m; sourceTree = "<group>"; };
9B6E8575281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomInsideRecommendEmptyCell.h; sourceTree = "<group>"; };
9B6E8576281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomInsideRecommendEmptyCell.m; sourceTree = "<group>"; };
9B73CD03279A9A6A006AF255 /* XPSkillCardSaveModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardSaveModel.h; sourceTree = "<group>"; };
9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardSaveModel.m; sourceTree = "<group>"; };
9B73CD07279A9AA2006AF255 /* XPSkillCardUpdatePropModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardUpdatePropModel.h; sourceTree = "<group>"; };
@@ -2998,6 +3010,37 @@
path = File;
sourceTree = "<group>";
};
9B6E856B281AAB8B0041A321 /* Model */ = {
isa = PBXGroup;
children = (
9B6E856C281AABAB0041A321 /* XPRoomRecommendModel.h */,
9B6E856D281AABAB0041A321 /* XPRoomRecommendModel.m */,
);
path = Model;
sourceTree = "<group>";
};
9B6E8570281AAD260041A321 /* RoomRecommend */ = {
isa = PBXGroup;
children = (
9B6E8574281ABEB20041A321 /* SubViews */,
9B6E8568281A982A0041A321 /* XPRoomRecommendView.h */,
9B6E8569281A982A0041A321 /* XPRoomRecommendView.m */,
9B6E856B281AAB8B0041A321 /* Model */,
);
path = RoomRecommend;
sourceTree = "<group>";
};
9B6E8574281ABEB20041A321 /* SubViews */ = {
isa = PBXGroup;
children = (
9B6E8571281AB9B20041A321 /* XPRoomInsideRecommendCell.h */,
9B6E8572281AB9B20041A321 /* XPRoomInsideRecommendCell.m */,
9B6E8575281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.h */,
9B6E8576281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m */,
);
path = SubViews;
sourceTree = "<group>";
};
9B73CD06279A9A8B006AF255 /* UpdateModel */ = {
isa = PBXGroup;
children = (
@@ -4971,6 +5014,7 @@
E8AEAED8271413530017FCE0 /* View */ = {
isa = PBXGroup;
children = (
9B6E8570281AAD260041A321 /* RoomRecommend */,
9B1B72A228002F76003FACE9 /* AnchorPK */,
9B92C01A27E0BAEB0044C5EA /* NobleTrumpet */,
9B7B605827BB52FD0070BB72 /* AnchorView */,
@@ -6187,6 +6231,7 @@
E890BC04273CF0500007C46B /* XPGiftCountModel.m in Sources */,
E855516A280599A7005F293F /* XPGuildEmptyCollectionViewCell.m in Sources */,
E899C68C275093B800E189E5 /* XPUserCardMicroItemModel.m in Sources */,
9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */,
E87A270027588445002DDC7A /* XPHomeListEmptyCollectionViewCell.m in Sources */,
E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */,
E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */,
@@ -6356,6 +6401,7 @@
E8DEC99E2764A5B60078CB70 /* XPRoomMoreMenuViewController.m in Sources */,
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
E8C167182806A03800ECB15C /* XPSuperAdminSetPresenter.m in Sources */,
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */,
E8C6FFCA27548120004DC9F0 /* XPHomePresenter.m in Sources */,
E8412FB02779CB4D006E1101 /* XPRoomSettingPresenter.m in Sources */,
E8C1671228067F6C00ECB15C /* XPGuildChooseManagerRoomTableViewCell.m in Sources */,
@@ -6490,6 +6536,7 @@
9BBC028B2786E05A0007C24B /* XPNobleCenterEntranceView.m in Sources */,
E8834E4228003A270029CCC1 /* XPMineGuildManagerSetViewController.m in Sources */,
E81C279326EB394D0031E639 /* LoginForgetPasswordViewController.m in Sources */,
9B6E856A281A982A0041A321 /* XPRoomRecommendView.m in Sources */,
E8DBB6FD27B63CE000AA285D /* LittleGameMicroView.m in Sources */,
E81C278D26EAFAF60031E639 /* DESEncrypt.m in Sources */,
E81366E726F0A49E0076364C /* NSString+Utils.m in Sources */,
@@ -6537,6 +6584,7 @@
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,
9B85F3532806AB9A006EDF51 /* XPAnchorPKResultView.m in Sources */,
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */,
9B6E8577281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m in Sources */,
E880B3A6278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m in Sources */,
E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */,
9B9DFD9A27DB2194000F95B3 /* XPSessionMessageHeadView.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -160,6 +160,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - 超管
///获取房间超管列表
+ (void)getRoomSuperAdminList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
///房内引流推荐
+ (void)reqeustRecommendRoom:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -186,4 +186,9 @@
[self makeRequest:@"hall/superManager/listSuperManageInRoom" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
}
///
+ (void)reqeustRecommendRoom:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId {
[self makeRequest:@"roominsiderecommend/recommendRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomId, nil];
}
@end

View File

@@ -12,6 +12,7 @@
#import <MarqueeLabel.h>
#import <YYText/YYLabel.h>
#import "TTPopup.h"
#import <FFPopup/FFPopup.h>
///Tool
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
@@ -24,20 +25,22 @@
#import "AccountInfoStorage.h"
#import "HttpRequestHelper.h"
#import "Api+Room.h"
#import "XCCurrentVCStackManager.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
#import "AttachMentModel.h"
#import "MicroQueueModel.h"
#import "XPRoomRecommendModel.h"
///View
#import "XPShareView.h"
#import "XPRoomRecommendView.h"
///VC
#import "XPWebViewcontroller.h"
#import "XPRoomOnLineViewController.h"
#import "XPRoomViewController.h"
@interface RoomHeaderView ()<XCShareViewDelegate>
///
@property (nonatomic,strong) UIButton *backButton;
@interface RoomHeaderView ()<XCShareViewDelegate, XPRoomRecommendViewDelegate>
///
@property (nonatomic,strong) UIStackView *nickStackView;
///
@@ -61,6 +64,8 @@
///
@property (nonatomic,strong) UIButton *settingButton;
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
///
@property (nonatomic, strong) XPRoomRecommendView *recommendRoomView;
@end
@@ -85,23 +90,29 @@
[self showSharePanel];
}
- (void)settingButtonAction:(UIButton *)sender {
TTActionSheetConfig *exitRoom = [TTActionSheetConfig normalTitle:@"退出房间" clickAction:^{
[self.hostDelegate exitRoom];
}];
TTActionSheetConfig *miniRoom = [TTActionSheetConfig normalTitle:@"最小化房间" clickAction:^{
[self.hostDelegate miniRoom];
}];
TTActionSheetConfig *reportRoom = [TTActionSheetConfig normalTitle:@"举报房间" clickAction:^{
XPWebViewController * webVC = [[XPWebViewController alloc] init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM", URLWithType(kReportRoomURL),self.hostDelegate.getRoomInfo.uid];
webVC.url = urlstr;
[[self.hostDelegate getCurrentNav] pushViewController:webVC animated:YES];
}];
[TTPopup actionSheetWithItems:@[exitRoom, miniRoom, reportRoom]];
- (void)settingButtonAction:(UIButton *)sender {
self.recommendRoomView.frame = CGRectMake(KScreenWidth, 0, 250, KScreenHeight);
FFPopup *popup = [FFPopup popupWithContentView:self.recommendRoomView];
popup.showType = FFPopupShowType_SlideInFromRight;
popup.dismissType = FFPopupDismissType_SlideOutToRight;
popup.maskType = FFPopupMaskType_Dimmed;
popup.dimmedMaskAlpha = 0.0;
popup.shouldDismissOnBackgroundTouch = YES;
FFPopupHorizontalLayout horizontalLayout = FFPopupHorizontalLayout_Right;
FFPopupVerticalLayout verticalLayout = FFPopupVerticalLayout_Center;
[popup showWithLayout:FFPopupLayoutMake(horizontalLayout, verticalLayout) duration:0.0];
popup.didFinishDismissingBlock = ^{
[self.recommendRoomView removeFromSuperview];
};
popup.didFinishShowingBlock = ^{
};
[Api reqeustRecommendRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray *array = [XPRoomRecommendModel modelsWithArray:data.data];
self.recommendRoomView.roomList = array;
}
} roomId:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid]];
}
- (void)onlineTapRecognizer {
@@ -110,7 +121,6 @@
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backButton];
[self addSubview:self.nickStackView];
[self addSubview:self.collectButton];
[self addSubview:self.shareButton];
@@ -128,12 +138,6 @@
}
- (void)initSubViewConstraints {
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(14);
make.bottom.equalTo(self).offset(-14);
make.height.width.equalTo(@22);
}];
//
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
@@ -155,7 +159,7 @@
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.settingButton);
make.left.mas_equalTo(self.backButton.mas_right).offset(10);
make.left.mas_equalTo(15);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -335,17 +339,34 @@
[TTPopup dismiss];
}
#pragma mark - Getters And Setters
- (UIButton *)backButton{
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"room_info_back"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_backButton setEnlargeEdgeWithTop:15 right:15 bottom:15 left:15];
}
return _backButton;
#pragma mark - XPRoomRecommendViewDelegate
- (void)xPRoomRecommendViewReport {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
XPWebViewController * webVC = [[XPWebViewController alloc] init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM", URLWithType(kReportRoomURL),self.hostDelegate.getRoomInfo.uid];
webVC.url = urlstr;
[[self.hostDelegate getCurrentNav] pushViewController:webVC animated:YES];
}
- (void)xPRoomRecommendViewMiniRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate miniRoom];
}
- (void)xPRoomRecommendViewExitRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
}
- (void)xPRoomRecommendViewJumpToRoom:(NSString *)roomUid {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
#pragma mark - Getters And Setters
- (UIButton *)shareButton {
if(!_shareButton){
_shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -462,4 +483,12 @@
return _idLabel;
}
- (XPRoomRecommendView *)recommendRoomView {
if (!_recommendRoomView) {
_recommendRoomView = [[XPRoomRecommendView alloc] init];
self.recommendRoomView.delegate = self;
}
return _recommendRoomView;
}
@end

View File

@@ -0,0 +1,32 @@
//
// XPRoomRecommendModel.h
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomRecommendModel : NSObject
@property (nonatomic, assign) NSInteger roomId;
@property (nonatomic, assign) NSInteger uid;
@property (nonatomic, assign) NSInteger isPermitRoom;
//@property (nonatomic, strong) NSArray<RecommendUserInRoomModel *> *micUsers;//群成员列表
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) NSInteger onlineNum;
@property (nonatomic, assign) NSInteger micUserCount;
@property (nonatomic, copy) NSString *tagPict;
@property (nonatomic, copy) NSString *roomTag;
@property (nonatomic, copy) NSString *avatar;
@property (nonatomic , assign) GenderType gender;
@property (nonatomic, copy) NSString *infoUid;
@property (nonatomic, copy) NSString *nick;
@property (nonatomic, copy) NSString *roomPwd;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPRoomRecommendModel.m
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import "XPRoomRecommendModel.h"
@implementation XPRoomRecommendModel
@end

View File

@@ -0,0 +1,19 @@
//
// XPRoomInsideRecommendCell.h
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import <UIKit/UIKit.h>
#import "XPRoomRecommendModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomInsideRecommendCell : UITableViewCell
@property (nonatomic, strong) XPRoomRecommendModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,138 @@
//
// XPRoomInsideRecommendCell.m
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import "XPRoomInsideRecommendCell.h"
#import "NetImageView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
@interface XPRoomInsideRecommendCell ()
///
@property (nonatomic, strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UILabel *nickLabel;
///
@property (nonatomic,strong) NetImageView *tagImageView;
///🔥
@property (nonatomic,strong) UIImageView *hotImageView;
///线
@property (nonatomic,strong) UILabel *numberLabel;
@end
@implementation XPRoomInsideRecommendCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self addSubview:self.avatarImageView];
[self addSubview:self.nickLabel];
[self addSubview:self.tagImageView];
[self addSubview:self.hotImageView];
[self addSubview:self.numberLabel];
}
- (void)initSubViewConstraints {
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.left.mas_equalTo(15);
make.width.height.mas_equalTo(72);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avatarImageView).mas_offset(12);
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(7);
make.height.mas_equalTo(14);
make.right.mas_equalTo(0);
}];
[self.tagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel);
make.width.mas_equalTo(43);
make.height.mas_equalTo(18);
make.top.mas_equalTo(self.nickLabel.mas_bottom).mas_offset(12);
}];
[self.hotImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.tagImageView.mas_right).mas_offset(12);
make.width.height.mas_equalTo(13);
make.centerY.mas_equalTo(self.tagImageView);
}];
[self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.hotImageView.mas_right).mas_offset(3);
make.centerY.mas_equalTo(self.tagImageView);
make.right.mas_equalTo(0);
make.height.mas_equalTo(12);
}];
}
#pragma mark - Getters And Setters
- (void)setModel:(XPRoomRecommendModel *)model {
_model = model;
self.avatarImageView.imageUrl = model.avatar;
self.nickLabel.text = model.title;
self.tagImageView.imageUrl = model.tagPict;
self.numberLabel.text = [NSString stringWithFormat:@"%ld", model.onlineNum];
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 8;
}
return _avatarImageView;
}
- (NetImageView *)tagImageView {
if (!_tagImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_tagImageView = [[NetImageView alloc] initWithConfig:config];
}
return _tagImageView;
}
- (UIImageView *)hotImageView {
if (!_hotImageView) {
_hotImageView = [[UIImageView alloc] init];
_hotImageView.userInteractionEnabled = YES;
_hotImageView.image = [UIImage imageNamed:@"room_like_collect_room_hot"];
}
return _hotImageView;
}
- (UILabel *)nickLabel {
if (!_nickLabel) {
_nickLabel = [[UILabel alloc] init];
_nickLabel.font = [UIFont boldSystemFontOfSize:14];
_nickLabel.textColor = [UIColor whiteColor];
}
return _nickLabel;
}
- (UILabel *)numberLabel {
if (!_numberLabel) {
_numberLabel = [[UILabel alloc] init];
_numberLabel.font = [UIFont systemFontOfSize:12];
_numberLabel.textColor = [UIColor whiteColor];
}
return _numberLabel;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPRoomInsideRecommendEmptyCell.h
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomInsideRecommendEmptyCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,56 @@
//
// XPRoomInsideRecommendEmptyCell.m
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import "XPRoomInsideRecommendEmptyCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIImageConstant.h"
@interface XPRoomInsideRecommendEmptyCell ()
///
@property (nonatomic,strong) UILabel *emptyLabel;
@end
@implementation XPRoomInsideRecommendEmptyCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyLabel];
}
- (void)initSubViewConstraints {
[self.emptyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.contentView);
make.centerY.mas_equalTo(self.contentView);
}];
}
#pragma mark - Getters And Setters
- (UILabel *)emptyLabel {
if (!_emptyLabel) {
_emptyLabel = [[UILabel alloc] init];
_emptyLabel.text = @"努力寻找合适房间中~";
_emptyLabel.font = [UIFont systemFontOfSize:14];
_emptyLabel.textAlignment = NSTextAlignmentCenter;
_emptyLabel.textColor = [UIColor whiteColor];
}
return _emptyLabel;
}
@end

View File

@@ -0,0 +1,32 @@
//
// XPRoomRecommendView.h
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPRoomRecommendViewDelegate <NSObject>
///举报房间
- (void)xPRoomRecommendViewReport;
///最小化房间
- (void)xPRoomRecommendViewMiniRoom;
///退出房间
- (void)xPRoomRecommendViewExitRoom;
///跳转到房间
- (void)xPRoomRecommendViewJumpToRoom:(NSString *)roomUid;
@end
@interface XPRoomRecommendView : UIView
@property (nonatomic, strong) NSMutableArray *roomList;
@property (nonatomic, weak) id<XPRoomRecommendViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,275 @@
//
// XPRoomRecommendView.m
// xplan-ios
//
// Created by GreenLand on 2022/4/28.
//
#import "XPRoomRecommendView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
///View
#import "XPRoomInsideRecommendCell.h"
#import "XPRoomInsideRecommendEmptyCell.h"
@interface XPRoomRecommendView ()<UITableViewDelegate, UITableViewDataSource>
///
@property (nonatomic, strong) UIToolbar *toolBar;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) UIStackView *reportStackView;
@property (nonatomic, strong) UIStackView *miniStackView;
@property (nonatomic, strong) UIStackView *exitStackView;
///
@property (nonatomic,strong) UIButton *reportButton;
///
@property (nonatomic,strong) UIButton *miniButton;
///退
@property (nonatomic,strong) UIButton *exitButton;
///
@property (nonatomic,strong) UILabel *reportLabel;
///
@property (nonatomic,strong) UILabel *miniLabel;
///退
@property (nonatomic,strong) UILabel *exitLabel;
@end
@implementation XPRoomRecommendView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self setUpUI];
[self setUpConstraints];
}
return self;
}
#pragma mark - lifeCycle
- (void)setUpUI {
[self addSubview:self.toolBar];
[self addSubview:self.reportStackView];
[self addSubview:self.miniStackView];
[self addSubview:self.exitStackView];
[self.reportStackView addArrangedSubview:self.reportButton];
[self.reportStackView addArrangedSubview:self.reportLabel];
[self.miniStackView addArrangedSubview:self.miniButton];
[self.miniStackView addArrangedSubview:self.miniLabel];
[self.exitStackView addArrangedSubview:self.exitButton];
[self.exitStackView addArrangedSubview:self.exitLabel];
[self addSubview:self.tableView];
}
- (void)setRoomList:(NSMutableArray *)roomList {
_roomList = roomList;
[self.tableView reloadData];
}
#pragma mark - Constraints
- (void)setUpConstraints {
[self.toolBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.bottom.mas_equalTo(self);
}];
[self.reportStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kStatusBarHeight + 8);
make.left.mas_equalTo(15);
}];
[self.miniStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kStatusBarHeight + 8);
make.left.mas_equalTo(self.reportStackView.mas_right).mas_offset(30);
}];
[self.exitStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kStatusBarHeight + 8);
make.left.mas_equalTo(self.miniStackView.mas_right).mas_offset(30);
}];
[self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(54);
}];
[self.miniButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(54);
}];
[self.exitButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(54);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(0);
make.top.mas_equalTo(self.miniStackView.mas_bottom).mas_offset(8);
}];
}
#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.roomList.count ? self.roomList.count : 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.roomList.count > 0) {
XPRoomInsideRecommendCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomInsideRecommendCell class])];
XPRoomRecommendModel *model = self.roomList[indexPath.row];
cell.model = model;
return cell;
}
XPRoomInsideRecommendEmptyCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomInsideRecommendEmptyCell class])];
if (cell == nil) {
cell = [[XPRoomInsideRecommendEmptyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomInsideRecommendEmptyCell class])];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.roomList.count > 0) {
XPRoomRecommendModel *model = self.roomList[indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomRecommendViewJumpToRoom:)]) {
[self.delegate xPRoomRecommendViewJumpToRoom:[NSString stringWithFormat:@"%ld", model.uid]];
}
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.roomList.count > 0 ? 84 : KScreenHeight - kStatusBarHeight -8 - 120;
}
#pragma mark - atcion
- (void)reportButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomRecommendViewReport)]) {
[self.delegate xPRoomRecommendViewReport];
}
}
- (void)miniButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomRecommendViewMiniRoom)]) {
[self.delegate xPRoomRecommendViewMiniRoom];
}
}
- (void)exitButtonAction:(UIButton *)sender{
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomRecommendViewExitRoom)]) {
[self.delegate xPRoomRecommendViewExitRoom];
}
}
#pragma mark - getter
- (UIToolbar *)toolBar {
if (!_toolBar) {
_toolBar = [[UIToolbar alloc] init];
_toolBar.barStyle = UIBarStyleBlack;
_toolBar.translucent = YES;
}
return _toolBar;
}
- (UIButton *)miniButton {
if(!_miniButton){
_miniButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_miniButton setImage:[UIImage imageNamed:@"room_info_mini"] forState:UIControlStateNormal];
[_miniButton addTarget:self action:@selector(miniButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_miniButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_miniButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
}
return _miniButton;
}
- (UIButton *)exitButton {
if (!_exitButton) {
_exitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_exitButton setImage:[UIImage imageNamed:@"room_info_exit"] forState:UIControlStateNormal];
[_exitButton addTarget:self action:@selector(exitButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _exitButton;
}
- (UIButton *)reportButton {
if (!_reportButton) {
_reportButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_reportButton setImage:[UIImage imageNamed:@"room_info_report"] forState:UIControlStateNormal];
[_reportButton addTarget:self action:@selector(reportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _reportButton;
}
- (UIStackView *)reportStackView {
if (!_reportStackView) {
_reportStackView = [[UIStackView alloc] init];
_reportStackView.axis = UILayoutConstraintAxisVertical;
_reportStackView.distribution = UIStackViewDistributionFill;
_reportStackView.alignment = UIStackViewAlignmentCenter;
_reportStackView.spacing = 17;
}
return _reportStackView;
}
- (UIStackView *)miniStackView {
if (!_miniStackView) {
_miniStackView = [[UIStackView alloc] init];
_miniStackView.axis = UILayoutConstraintAxisVertical;
_miniStackView.distribution = UIStackViewDistributionFill;
_miniStackView.alignment = UIStackViewAlignmentCenter;
_miniStackView.spacing = 17;
}
return _miniStackView;
}
- (UIStackView *)exitStackView {
if (!_exitStackView) {
_exitStackView = [[UIStackView alloc] init];
_exitStackView.axis = UILayoutConstraintAxisVertical;
_exitStackView.distribution = UIStackViewDistributionFill;
_exitStackView.alignment = UIStackViewAlignmentCenter;
_exitStackView.spacing = 17;
}
return _exitStackView;
}
- (UILabel *)reportLabel {
if (!_reportLabel) {
_reportLabel = [[UILabel alloc] init];
_reportLabel.text = @"举报房间";
_reportLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_reportLabel.textAlignment = NSTextAlignmentCenter;
_reportLabel.textColor = [UIColor whiteColor];
}
return _reportLabel;
}
- (UILabel *)miniLabel {
if (!_miniLabel) {
_miniLabel = [[UILabel alloc] init];
_miniLabel.text = @"收起房间";
_miniLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_miniLabel.textAlignment = NSTextAlignmentCenter;
_miniLabel.textColor = [UIColor whiteColor];
}
return _miniLabel;
}
- (UILabel *)exitLabel {
if (!_exitLabel) {
_exitLabel = [[UILabel alloc] init];
_exitLabel.text = @"退出房间";
_exitLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_exitLabel.textAlignment = NSTextAlignmentCenter;
_exitLabel.textColor = [UIColor whiteColor];
}
return _exitLabel;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.showsVerticalScrollIndicator = NO;
[_tableView registerClass:[XPRoomInsideRecommendCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomInsideRecommendCell class])];
[_tableView registerClass:[XPRoomInsideRecommendEmptyCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomInsideRecommendEmptyCell class])];
_tableView.backgroundColor = [UIColor clearColor];
}
return _tableView;
}
@end