房间收藏优化
This commit is contained in:
@@ -272,6 +272,8 @@
|
||||
9BC5C91F277C902B007C8719 /* XPReleaseRadioView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5C91E277C902B007C8719 /* XPReleaseRadioView.m */; };
|
||||
9BC8C83028090C9200C24F85 /* XPRoomAnchorRankBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC8C82F28090C9200C24F85 /* XPRoomAnchorRankBannerView.m */; };
|
||||
9BC9DAEF27E33B3F009EE409 /* XPRoomGiftAnimationParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */; };
|
||||
9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */; };
|
||||
9BCB99A628F582EC00466D64 /* XPMineCollectRoomEditCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */; };
|
||||
9BCD02C72796C02800F396AA /* MicroNobleWaveView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCD02C62796C02800F396AA /* MicroNobleWaveView.m */; };
|
||||
9BCE6144277D657600CC0358 /* XPReleaseRadioTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE6143277D657600CC0358 /* XPReleaseRadioTableViewCell.m */; };
|
||||
9BCE6147277D665600CC0358 /* XPReleaseRadioCellModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE6146277D665600CC0358 /* XPReleaseRadioCellModel.m */; };
|
||||
@@ -315,6 +317,7 @@
|
||||
9BE29A6B27D1BFF700446AB5 /* anchor_room_speak.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6927D1BFF700446AB5 /* anchor_room_speak.svga */; };
|
||||
9BE29A6D27D210A500446AB5 /* anchor_room_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */; };
|
||||
9BE2FA90288010D300EF3D83 /* AnchorRoomSrollTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE2FA8F288010D300EF3D83 /* AnchorRoomSrollTipView.m */; };
|
||||
9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */; };
|
||||
9BE9F0F927FED12D00667200 /* XPAnchorFansPrivilegeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0F827FED12D00667200 /* XPAnchorFansPrivilegeModel.m */; };
|
||||
9BE9F0FC27FED2E100667200 /* XPAnchorFansJoinModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0FB27FED2E100667200 /* XPAnchorFansJoinModel.m */; };
|
||||
9BE9F0FF27FED76500667200 /* XPAnchorFansTaskModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0FE27FED76500667200 /* XPAnchorFansTaskModel.m */; };
|
||||
@@ -1720,6 +1723,10 @@
|
||||
9BC8C82F28090C9200C24F85 /* XPRoomAnchorRankBannerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnchorRankBannerView.m; sourceTree = "<group>"; };
|
||||
9BC9DAED27E33B3F009EE409 /* XPRoomGiftAnimationParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftAnimationParser.h; sourceTree = "<group>"; };
|
||||
9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomGiftAnimationParser.m; sourceTree = "<group>"; };
|
||||
9BCB999E28F571B500466D64 /* XPMineCollectPartyRoomViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectPartyRoomViewController.h; sourceTree = "<group>"; };
|
||||
9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectPartyRoomViewController.m; sourceTree = "<group>"; };
|
||||
9BCB99A428F582EC00466D64 /* XPMineCollectRoomEditCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomEditCell.h; sourceTree = "<group>"; };
|
||||
9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectRoomEditCell.m; sourceTree = "<group>"; };
|
||||
9BCD02C52796C02800F396AA /* MicroNobleWaveView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroNobleWaveView.h; sourceTree = "<group>"; };
|
||||
9BCD02C62796C02800F396AA /* MicroNobleWaveView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroNobleWaveView.m; sourceTree = "<group>"; };
|
||||
9BCE6142277D657600CC0358 /* XPReleaseRadioTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPReleaseRadioTableViewCell.h; sourceTree = "<group>"; };
|
||||
@@ -1810,6 +1817,8 @@
|
||||
9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_bg.svga; sourceTree = "<group>"; };
|
||||
9BE2FA8E288010D300EF3D83 /* AnchorRoomSrollTipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorRoomSrollTipView.h; sourceTree = "<group>"; };
|
||||
9BE2FA8F288010D300EF3D83 /* AnchorRoomSrollTipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorRoomSrollTipView.m; sourceTree = "<group>"; };
|
||||
9BE570BA28F65B7200D491A5 /* XPMineCollectRoomCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomCell.h; sourceTree = "<group>"; };
|
||||
9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectRoomCell.m; sourceTree = "<group>"; };
|
||||
9BE9F0F727FED12D00667200 /* XPAnchorFansPrivilegeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansPrivilegeModel.h; sourceTree = "<group>"; };
|
||||
9BE9F0F827FED12D00667200 /* XPAnchorFansPrivilegeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorFansPrivilegeModel.m; sourceTree = "<group>"; };
|
||||
9BE9F0FA27FED2E100667200 /* XPAnchorFansJoinModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansJoinModel.h; sourceTree = "<group>"; };
|
||||
@@ -4878,6 +4887,16 @@
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BCB999D28F5716E00466D64 /* CollectRoom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BE570B928F65B6000D491A5 /* Cell */,
|
||||
9BCB999E28F571B500466D64 /* XPMineCollectPartyRoomViewController.h */,
|
||||
9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */,
|
||||
);
|
||||
path = CollectRoom;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BD2ECCF288F832300F5CD9A /* FootPrint */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -5016,6 +5035,17 @@
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BE570B928F65B6000D491A5 /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BE570BA28F65B7200D491A5 /* XPMineCollectRoomCell.h */,
|
||||
9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */,
|
||||
9BCB99A428F582EC00466D64 /* XPMineCollectRoomEditCell.h */,
|
||||
9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BFB10172897C95200B3985E /* NewUserRecharge */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -8201,6 +8231,7 @@
|
||||
E8E70D7126F2EB4900F03460 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BCB999D28F5716E00466D64 /* CollectRoom */,
|
||||
E8E20BDF281695430033B688 /* Setting */,
|
||||
E800805227FD33950055A8AB /* Guild */,
|
||||
E896EF912771AA6C00AD2CC1 /* Friend */,
|
||||
@@ -9016,6 +9047,7 @@
|
||||
E86A16C52856DBEC004228B8 /* FindNewGreetListModel.m in Sources */,
|
||||
E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */,
|
||||
9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */,
|
||||
9BCB99A628F582EC00466D64 /* XPMineCollectRoomEditCell.m in Sources */,
|
||||
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */,
|
||||
E8751E6E28A64F990056EF44 /* XPSailingEmptyTableViewCell.m in Sources */,
|
||||
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */,
|
||||
@@ -9053,6 +9085,7 @@
|
||||
E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */,
|
||||
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */,
|
||||
9BAC92F528E6E63000147DD8 /* XPRoomInsideOperationCell.m in Sources */,
|
||||
9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */,
|
||||
E86A16C22856D635004228B8 /* XPSessionFindNewGreetTableViewCell.m in Sources */,
|
||||
E824544E26F5BC1A00BE8163 /* XPMineModifPayPwdView.m in Sources */,
|
||||
E86E79CD28A4E045006DAF48 /* MessageContentRiskAlertView.m in Sources */,
|
||||
@@ -9238,6 +9271,7 @@
|
||||
E852D74728633E92001465ED /* MonentsCommentReplyModel.m in Sources */,
|
||||
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */,
|
||||
E8B3E80C2848BA40009746AB /* NewUserGreetModel.m in Sources */,
|
||||
9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */,
|
||||
E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */,
|
||||
E8AB631028ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m in Sources */,
|
||||
E877A7F127842B2F00EFACED /* XPRoomDatingWebAlertView.m in Sources */,
|
||||
|
6
xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json
Normal file
6
xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "collect_room_edit_selected@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "collect_room_edit_selected@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 395 B |
Binary file not shown.
After Width: | Height: | Size: 604 B |
22
xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "collect_room_edit_selected@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "collect_room_edit_selected@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 495 B |
Binary file not shown.
After Width: | Height: | Size: 774 B |
@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
///麦上用户
|
||||
@property (nonatomic, strong) NSArray<HomePlayMicUserModel *> *micUsers;
|
||||
///是否选中
|
||||
@property (nonatomic, assign) BOOL isSelected;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -268,7 +268,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param uid 用户的uid
|
||||
/// @param page 当前页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize;
|
||||
/// @param roomType 类型:4:个播房;其他:派对房;不传:所有房间
|
||||
+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize roomType:(NSString *)roomType;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -297,8 +297,9 @@
|
||||
/// @param uid 用户的uid
|
||||
/// @param page 当前页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize {
|
||||
[self makeRequest:@"fans/fansRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,uid , page, pageSize,nil];
|
||||
/// @param roomType 类型:4:个播房;其他:派对房;不传:所有房间
|
||||
+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize roomType:(NSString *)roomType {
|
||||
[self makeRequest:@"fans/fansRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,uid , page, pageSize, roomType, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -14,7 +14,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 获取收藏房间列表
|
||||
/// @param page 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state;
|
||||
/// @param type 类型:4:个播房;其他:派对房;不传:所有房间
|
||||
- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state type:(NSString *)type;
|
||||
|
||||
///批量删除收藏的房间
|
||||
- (void)deletecollectRoomWithRoomUids:(NSString *)roomUids;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "XPMineCollectRoomListPresenter.h"
|
||||
#import "Api+Mine.h"
|
||||
#import "Api+Room.h"
|
||||
#import "XPMineCollectRoomListProtocol.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "HomeCollectRoomModel.h"
|
||||
@@ -16,14 +17,24 @@
|
||||
/// 获取收藏房间列表
|
||||
/// @param page 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state {
|
||||
/// @param type 类型:4:个播房;其他:派对房;不传:所有房间
|
||||
- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state type:(NSString *)type {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api requestMineCollectRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [HomeCollectRoomModel modelsWithArray:data.data[@"fansRoomList"]];
|
||||
[[self getView] onGetCollectRoomListSuccess:array state:state];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] getCollectRoomListFail:state];
|
||||
}] uid:uid page:[NSString stringWithFormat:@"%d", page] pageSize:[NSString stringWithFormat:@"%d", pageSize]];
|
||||
}] uid:uid page:[NSString stringWithFormat:@"%d", page] pageSize:[NSString stringWithFormat:@"%d", pageSize] roomType:type.length ? type : NULL];
|
||||
}
|
||||
|
||||
///批量删除收藏的房间
|
||||
- (void)deletecollectRoomWithRoomUids:(NSString *)roomUids {
|
||||
NSString * type = @"3";
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api collectRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] deleteCollectRoomSuccess];
|
||||
}] roomUid:@"" uid:uid type:type roomUids:roomUids];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -43,7 +43,7 @@
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api collectRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] collectRoomSuccess];
|
||||
}] roomUid:roomUid uid:uid type:type];
|
||||
}] roomUid:roomUid uid:uid type:type roomUids:NULL];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -15,4 +15,7 @@
|
||||
///获取收藏房间列表失败
|
||||
- (void)getCollectRoomListFail:(int)state;
|
||||
|
||||
///批量删除收藏的房间成功
|
||||
- (void)deleteCollectRoomSuccess;
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XPMineCollectRoomCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/12.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class HomeCollectRoomModel;
|
||||
@interface XPMineCollectRoomCell : UITableViewCell
|
||||
|
||||
@property (nonatomic,strong) HomeCollectRoomModel *roomInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// XPMineCollectRoomCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/12.
|
||||
//
|
||||
|
||||
#import "XPMineCollectRoomCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "HomeCollectRoomModel.h"
|
||||
|
||||
@interface XPMineCollectRoomCell ()
|
||||
|
||||
///显示头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///显示名字
|
||||
@property (nonatomic,strong) UILabel *nickLabel;
|
||||
///显示id
|
||||
@property (nonatomic,strong) UILabel *idLabel;
|
||||
///分割线
|
||||
@property (nonatomic, strong) UIView *devideView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMineCollectRoomCell
|
||||
|
||||
- (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.avatarImageView];
|
||||
[self.contentView addSubview:self.nickLabel];
|
||||
[self.contentView addSubview:self.idLabel];
|
||||
[self.contentView addSubview:self.devideView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(44, 44));
|
||||
make.left.mas_equalTo(self.contentView).offset(15);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(7);
|
||||
make.top.mas_equalTo(self.avatarImageView).offset(2);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.nickLabel.mas_bottom).mas_offset(8);
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(0.5);
|
||||
make.right.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRoomInfo:(HomeCollectRoomModel *)roomInfo {
|
||||
_roomInfo = roomInfo;
|
||||
if (_roomInfo) {
|
||||
self.avatarImageView.imageUrl = _roomInfo.roomAvatar;
|
||||
self.nickLabel.text = _roomInfo.roomName;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", _roomInfo.erbanNo];
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 22;
|
||||
_avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nickLabel {
|
||||
if (!_nickLabel) {
|
||||
_nickLabel = [[UILabel alloc] init];
|
||||
_nickLabel.font = [UIFont systemFontOfSize:14];
|
||||
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _nickLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)idLabel {
|
||||
if (!_idLabel) {
|
||||
_idLabel = [[UILabel alloc] init];
|
||||
_idLabel.font = [UIFont systemFontOfSize:12];
|
||||
_idLabel.textColor = [ThemeColor secondTextColor];
|
||||
}
|
||||
return _idLabel;
|
||||
}
|
||||
|
||||
- (UIView *)devideView {
|
||||
if (!_devideView) {
|
||||
_devideView = [[UIView alloc] init];
|
||||
_devideView.backgroundColor = UIColorFromRGB(0xEAEAF1);
|
||||
}
|
||||
return _devideView;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPMineCollectRoomEditCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class HomeCollectRoomModel;
|
||||
@interface XPMineCollectRoomEditCell : UITableViewCell
|
||||
@property (nonatomic,strong) HomeCollectRoomModel *roomInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// XPMineCollectRoomEditCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/11.
|
||||
//
|
||||
|
||||
#import "XPMineCollectRoomEditCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "HomeCollectRoomModel.h"
|
||||
|
||||
@interface XPMineCollectRoomEditCell ()
|
||||
|
||||
///显示头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///显示名字
|
||||
@property (nonatomic,strong) UILabel *nickLabel;
|
||||
///显示id
|
||||
@property (nonatomic,strong) UILabel *idLabel;
|
||||
///选中按钮
|
||||
@property (nonatomic, strong) UIButton *selectBtn;
|
||||
///分割线
|
||||
@property (nonatomic, strong) UIView *devideView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMineCollectRoomEditCell
|
||||
|
||||
- (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.avatarImageView];
|
||||
[self.contentView addSubview:self.nickLabel];
|
||||
[self.contentView addSubview:self.idLabel];
|
||||
[self.contentView addSubview:self.devideView];
|
||||
[self.contentView addSubview:self.selectBtn];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(44, 44));
|
||||
make.left.mas_equalTo(self.selectBtn.mas_right).offset(15);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(7);
|
||||
make.top.mas_equalTo(self.avatarImageView).offset(2);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.nickLabel.mas_bottom).mas_offset(8);
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(0.5);
|
||||
make.right.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
[self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||||
make.left.mas_equalTo(15);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRoomInfo:(HomeCollectRoomModel *)roomInfo {
|
||||
_roomInfo = roomInfo;
|
||||
if (_roomInfo) {
|
||||
self.avatarImageView.imageUrl = _roomInfo.roomAvatar;
|
||||
self.nickLabel.text = _roomInfo.roomName;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", _roomInfo.erbanNo];
|
||||
self.selectBtn.selected = roomInfo.isSelected;
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 22;
|
||||
_avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nickLabel {
|
||||
if (!_nickLabel) {
|
||||
_nickLabel = [[UILabel alloc] init];
|
||||
_nickLabel.font = [UIFont systemFontOfSize:14];
|
||||
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _nickLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)idLabel {
|
||||
if (!_idLabel) {
|
||||
_idLabel = [[UILabel alloc] init];
|
||||
_idLabel.font = [UIFont systemFontOfSize:12];
|
||||
_idLabel.textColor = [ThemeColor secondTextColor];
|
||||
}
|
||||
return _idLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)selectBtn {
|
||||
if (!_selectBtn) {
|
||||
_selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_selectBtn setImage:[UIImage imageNamed:@"collect_room_edit_normal"] forState:UIControlStateNormal];
|
||||
[_selectBtn setImage:[UIImage imageNamed:@"collect_room_edit_selected"] forState:UIControlStateSelected];
|
||||
_selectBtn.userInteractionEnabled = NO;
|
||||
}
|
||||
return _selectBtn;
|
||||
}
|
||||
|
||||
- (UIView *)devideView {
|
||||
if (!_devideView) {
|
||||
_devideView = [[UIView alloc] init];
|
||||
_devideView.backgroundColor = UIColorFromRGB(0xEAEAF1);
|
||||
}
|
||||
return _devideView;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// XPMineCollectPartyRoomViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/11.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MineCollectRoomType) {
|
||||
MineCollectRoomTypeParty,
|
||||
MineCollectRoomTypeAnchor
|
||||
};
|
||||
|
||||
@interface XPMineCollectPartyRoomViewController : MvpViewController<JXCategoryListContentViewDelegate>
|
||||
|
||||
@property (nonatomic, assign) MineCollectRoomType type;
|
||||
///数据源
|
||||
@property (nonatomic,strong, readonly) NSMutableArray *datasource;
|
||||
///是否为编辑模式
|
||||
@property (nonatomic, assign) BOOL isEdit;
|
||||
///是否选中所有
|
||||
@property (nonatomic, assign) BOOL isSelectAll;
|
||||
///刷新数据
|
||||
- (void)headerRefresh;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// XPMineCollectPartyRoomViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/10/11.
|
||||
//
|
||||
|
||||
#import "XPMineCollectPartyRoomViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
///Model
|
||||
#import "HomeCollectRoomModel.h"
|
||||
///P
|
||||
#import "XPMineCollectRoomListPresenter.h"
|
||||
#import "XPMineCollectRoomListProtocol.h"
|
||||
///View
|
||||
#import "XPMineCollectRoomCell.h"
|
||||
#import "XPMineVisitorEmptyTableViewCell.h"
|
||||
#import "XPMineCollectRoomEditCell.h"
|
||||
///VC
|
||||
#import "XPRoomViewController.h"
|
||||
|
||||
@interface XPMineCollectPartyRoomViewController ()<UITableViewDelegate,UITableViewDataSource, XPMineCollectRoomListProtocol>
|
||||
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray *datasource;
|
||||
///当前页数
|
||||
@property (nonatomic,assign) int page;
|
||||
///更多数据
|
||||
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMineCollectPartyRoomViewController
|
||||
|
||||
#pragma mark - JXCategoryListContentViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
}
|
||||
|
||||
- (XPMineCollectRoomListPresenter *)createPresenter {
|
||||
return [[XPMineCollectRoomListPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[self.presenter getCollectRoomList:self.page pageSize:20 state:0 type:self.type == MineCollectRoomTypeParty ? @"1" : @"4"];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:@"没有更多收藏记录了"];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getCollectRoomList:self.page pageSize:20 state:1 type:self.type == MineCollectRoomTypeParty ? @"1" : @"4"];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.title = @"收藏的房间";
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPMineCollectRoomListProtocol
|
||||
///获取访客列表成功
|
||||
- (void)onGetCollectRoomListSuccess:(NSArray *)array state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
if (array.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.datasource addObjectsFromArray:array];
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
///获取访客列表失败
|
||||
- (void)getCollectRoomListFail:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
if (self.isEdit) {
|
||||
XPMineCollectRoomEditCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPMineCollectRoomEditCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])];
|
||||
}
|
||||
cell.roomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
} else {
|
||||
XPMineCollectRoomCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCollectRoomCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPMineCollectRoomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomCell class])];
|
||||
}
|
||||
cell.roomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
XPMineVisitorEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPMineVisitorEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
}
|
||||
cell.emptyTitle = @"暂无收藏的房间";
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 68;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
HomeCollectRoomModel * roomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
if (self.isEdit) {
|
||||
roomInfo.isSelected = !roomInfo.isSelected;
|
||||
[tableView reloadData];
|
||||
} else {
|
||||
if (roomInfo.roomUid.integerValue > 0) {
|
||||
[XPRoomViewController openRoom:roomInfo.roomUid viewController:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsEdit:(BOOL)isEdit {
|
||||
_isEdit = isEdit;
|
||||
for (HomeCollectRoomModel *model in self.datasource) {
|
||||
model.isSelected = NO;
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)setIsSelectAll:(BOOL)isSelectAll {
|
||||
_isSelectAll = isSelectAll;
|
||||
if (isSelectAll) {
|
||||
for (HomeCollectRoomModel *model in self.datasource) {
|
||||
model.isSelected = YES;
|
||||
}
|
||||
} else {
|
||||
for (HomeCollectRoomModel *model in self.datasource) {
|
||||
model.isSelected = NO;
|
||||
}
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
_tableView.contentInset = UIEdgeInsetsMake(8, 0, 0, 0);
|
||||
[_tableView registerClass:[XPMineVisitorEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
[_tableView registerClass:[XPMineCollectRoomCell class] forCellReuseIdentifier:NSStringFromClass([XPMineCollectRoomCell class])];
|
||||
[_tableView registerClass:[XPMineCollectRoomEditCell class] forCellReuseIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
@end
|
@@ -9,8 +9,12 @@
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
#import <JXCategoryView/JXCategoryView.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "HomeCollectRoomModel.h"
|
||||
///View
|
||||
@@ -21,16 +25,32 @@
|
||||
#import "XPMineCollectRoomListProtocol.h"
|
||||
///VC
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XPMineCollectPartyRoomViewController.h"
|
||||
|
||||
///记录最后选中的tab
|
||||
static NSString *lastSelectTab = @"lastSelectTab";
|
||||
|
||||
@interface XPMineCollectRoomListViewController ()<XPMineCollectRoomListProtocol, JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
||||
///标题
|
||||
@property (nonatomic,strong) NSArray<NSString *> *titles;
|
||||
///滑块
|
||||
@property (nonatomic,strong) JXCategoryTitleView *titleView;
|
||||
|
||||
@property (nonatomic,strong) XPMineCollectPartyRoomViewController *partyVC;
|
||||
///个播房的
|
||||
@property (nonatomic, strong) XPMineCollectPartyRoomViewController *anchorRoomListVC;
|
||||
|
||||
@interface XPMineCollectRoomListViewController ()<UITableViewDelegate,UITableViewDataSource, XPMineCollectRoomListProtocol>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray *datasource;
|
||||
///当前页数
|
||||
@property (nonatomic,assign) int page;
|
||||
///更多数据
|
||||
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||||
///底部编辑容器
|
||||
@property (nonatomic, strong) UIView *bottomView;
|
||||
///全选按钮
|
||||
@property (nonatomic, strong) UIButton *allSelectBtn;
|
||||
///删除按钮
|
||||
@property (nonatomic, strong) UIButton *deleteBtn;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMineCollectRoomListViewController
|
||||
@@ -41,141 +61,249 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self addNavigationItemWithTitles:@[@"管理"] titleColor:UIColorFromRGB(0x999999) isLeft:NO target:self action:@selector(managerButtonClick:) tags:nil];
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
- (void)managerButtonClick:(UIButton *)sender {
|
||||
sender.selected = !sender.isSelected;
|
||||
if (sender.isSelected) {//开始编辑
|
||||
self.partyVC.isEdit = YES;
|
||||
self.anchorRoomListVC.isEdit = YES;
|
||||
[sender setTitle:@"完成" forState:UIControlStateSelected];
|
||||
[sender setTitleColor:UIColorFromRGB(0x999999) forState:UIControlStateSelected];
|
||||
self.bottomView.hidden = NO;
|
||||
} else {//完成编辑
|
||||
[sender setTitle:@"管理" forState:UIControlStateNormal];
|
||||
[sender setTitleColor:UIColorFromRGB(0x999999) forState:UIControlStateNormal];
|
||||
self.bottomView.hidden = YES;
|
||||
self.allSelectBtn.selected = NO;
|
||||
self.partyVC.isEdit = NO;
|
||||
self.anchorRoomListVC.isEdit = NO;
|
||||
self.allSelectBtn.selected = NO;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[self.presenter getCollectRoomList:self.page pageSize:20 state:0];
|
||||
#pragma mark - JXCategoryListContainerViewDelegate
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:@"没有更多收藏记录了"];
|
||||
return;
|
||||
// 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||
if (index == 0) {
|
||||
return self.partyVC;
|
||||
}else if (index == 1) {
|
||||
return self.anchorRoomListVC;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getCollectRoomList:self.page pageSize:20 state:1];
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryViewDelegate
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
//记录最后选中的index
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setObject:@(index) forKey:lastSelectTab];
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
#pragma mark - XPMineCollectRoomListProtocol
|
||||
- (void)deleteCollectRoomSuccess {
|
||||
[self showSuccessToast:@"取消收藏成功"];
|
||||
if (self.titleView.selectedIndex == 0) {
|
||||
[self.partyVC headerRefresh];
|
||||
} else {
|
||||
[self.anchorRoomListVC headerRefresh];
|
||||
}
|
||||
self.allSelectBtn.selected = NO;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.title = @"收藏的房间";
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.titleView];
|
||||
[self.view addSubview:self.listContainerView];
|
||||
[self.view addSubview:self.bottomView];
|
||||
[self.bottomView addSubview:self.allSelectBtn];
|
||||
[self.bottomView addSubview:self.deleteBtn];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.width.mas_equalTo(180);
|
||||
make.top.mas_equalTo(0);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.titleView.mas_bottom);
|
||||
}];
|
||||
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(64+kSafeAreaBottomHeight);
|
||||
make.left.bottom.right.mas_equalTo(0);
|
||||
}];
|
||||
[self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(64);
|
||||
make.height.mas_equalTo(22);
|
||||
make.left.mas_equalTo(15);
|
||||
make.top.mas_equalTo(18);
|
||||
}];
|
||||
[self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-15);
|
||||
make.centerY.mas_equalTo(self.allSelectBtn);
|
||||
make.size.mas_equalTo(CGSizeMake(72, 24));
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPMineCollectRoomListProtocol
|
||||
|
||||
///获取访客列表成功
|
||||
- (void)onGetCollectRoomListSuccess:(NSArray *)array state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
if (array.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.datasource addObjectsFromArray:array];
|
||||
#pragma mark - action
|
||||
- (void)allSelectBtnAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
if (self.titleView.selectedIndex == 0) {
|
||||
self.partyVC.isSelectAll = sender.selected;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
||||
self.anchorRoomListVC.isSelectAll = sender.selected;
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
///获取访客列表失败
|
||||
- (void)getCollectRoomListFail:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
- (void)deleteBtnAction:(UIButton *)sender {
|
||||
if (self.titleView.selectedIndex == 0) {
|
||||
NSMutableArray *roomUidsArray = [NSMutableArray array];
|
||||
for (HomeCollectRoomModel *model in self.partyVC.datasource) {
|
||||
if (model.isSelected) {
|
||||
[roomUidsArray addObject:model.roomUid];
|
||||
}
|
||||
}
|
||||
if (roomUidsArray.count) {
|
||||
NSString *roomUids = [roomUidsArray componentsJoinedByString:@","];
|
||||
[self.presenter deletecollectRoomWithRoomUids:roomUids];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
[self showErrorToast:@"请选择房间"];
|
||||
}
|
||||
} else {
|
||||
NSMutableArray *roomUidsArray = [NSMutableArray array];
|
||||
for (HomeCollectRoomModel *model in self.anchorRoomListVC.datasource) {
|
||||
if (model.isSelected) {
|
||||
[roomUidsArray addObject:model.roomUid];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
if (roomUidsArray.count) {
|
||||
NSString *roomUids = [roomUidsArray componentsJoinedByString:@","];
|
||||
[self.presenter deletecollectRoomWithRoomUids:roomUids];
|
||||
} else {
|
||||
[self showErrorToast:@"请选择房间"];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPHomeCollectRoomTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPHomeCollectRoomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])];
|
||||
}
|
||||
cell.roomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
XPMineVisitorEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPMineVisitorEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
}
|
||||
cell.emptyTitle = @"暂无收藏的房间";
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 66 + 8 + 10;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
HomeCollectRoomModel * roomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
if (roomInfo.roomUid.integerValue > 0) {
|
||||
[XPRoomViewController openRoom:roomInfo.roomUid viewController:self];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
- (UIView *)bottomView {
|
||||
if (!_bottomView) {
|
||||
_bottomView = [[UIView alloc] init];
|
||||
_bottomView.backgroundColor = [UIColor whiteColor];
|
||||
_bottomView.hidden = YES;
|
||||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 64+kSafeAreaBottomHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
|
||||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||||
maskLayer.frame = CGRectMake(0, 0, KScreenWidth, 64+kSafeAreaBottomHeight);
|
||||
maskLayer.path = maskPath.CGPath;
|
||||
_bottomView.layer.mask = maskLayer;
|
||||
}
|
||||
_tableView.contentInset = UIEdgeInsetsMake(8, 0, 0, 0);
|
||||
[_tableView registerClass:[XPMineVisitorEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])];
|
||||
[_tableView registerClass:[XPHomeCollectRoomTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
return _bottomView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
- (UIButton *)allSelectBtn {
|
||||
if (!_allSelectBtn) {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
[button addTarget:self action:@selector(allSelectBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:@"全选" forState:UIControlStateNormal];
|
||||
[button setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
[button setImage:[UIImage imageNamed:@"collect_room_edit_normal"] forState:UIControlStateNormal];
|
||||
[button setImage:[UIImage imageNamed:@"collect_room_edit_selected"] forState:UIControlStateSelected];
|
||||
_allSelectBtn = button;
|
||||
}
|
||||
return _datasource;
|
||||
return _allSelectBtn;
|
||||
}
|
||||
|
||||
- (UIButton *)deleteBtn {
|
||||
if (!_deleteBtn) {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[button addTarget:self action:@selector(deleteBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:@"删除" forState:UIControlStateNormal];
|
||||
[button setTitleColor:UIColorFromRGB(0xFB486A) forState:UIControlStateNormal];
|
||||
button.layer.cornerRadius = 12;
|
||||
button.layer.masksToBounds = YES;
|
||||
button.layer.borderWidth = 1;
|
||||
button.layer.borderColor = UIColorFromRGB(0xFB486A).CGColor;
|
||||
_deleteBtn = button;
|
||||
}
|
||||
return _deleteBtn;
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (JXCategoryListContainerView *)listContainerView {
|
||||
if (!_listContainerView) {
|
||||
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||
_listContainerView.scrollView.scrollEnabled = YES;
|
||||
_listContainerView.scrollView.tag = 1000;
|
||||
_listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _listContainerView;
|
||||
}
|
||||
|
||||
- (XPMineCollectPartyRoomViewController *)partyVC {
|
||||
if (!_partyVC) {
|
||||
_partyVC = [[XPMineCollectPartyRoomViewController alloc] init];
|
||||
_partyVC.type = MineCollectRoomTypeParty;
|
||||
}
|
||||
return _partyVC;
|
||||
}
|
||||
|
||||
- (XPMineCollectPartyRoomViewController *)anchorRoomListVC {
|
||||
if (!_anchorRoomListVC) {
|
||||
_anchorRoomListVC = [[XPMineCollectPartyRoomViewController alloc] init];
|
||||
_anchorRoomListVC.type = MineCollectRoomTypeAnchor;
|
||||
}
|
||||
return _anchorRoomListVC;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)titles {
|
||||
if (!_titles) {
|
||||
_titles = @[@"派对房", @"直播房"];
|
||||
}
|
||||
return _titles;
|
||||
}
|
||||
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
_titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero];
|
||||
_titleView.backgroundColor =[UIColor clearColor];
|
||||
_titleView.titleColor = [ThemeColor secondTextColor];
|
||||
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
|
||||
_titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
_titleView.titleSelectedFont = [UIFont systemFontOfSize:14 weight:UIFontWeightHeavy];
|
||||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
_titleView.averageCellSpacingEnabled = YES;
|
||||
_titleView.listContainer = self.listContainerView;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.delegate = self;
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSNumber *index = [defaults objectForKey:lastSelectTab];
|
||||
_titleView.defaultSelectedIndex = index.intValue;
|
||||
|
||||
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
lineView.indicatorImageViewSize = CGSizeMake(50, 8);
|
||||
lineView.verticalMargin = 12;
|
||||
lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x5BC8F8),UIColorFromRGB(0x66D9D9)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(50, 8)];
|
||||
lineView.indicatorImageView.layer.masksToBounds = YES;
|
||||
lineView.indicatorImageView.layer.cornerRadius = 4;
|
||||
_titleView.indicators = @[lineView];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -95,11 +95,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid uid
|
||||
/// @param type 1 收藏 2 取消收藏
|
||||
/// @param type 1 收藏 2 取消收藏 3:批量取消收藏
|
||||
/// @param roomUids 批量删除的房间uid,用逗号隔开
|
||||
+ (void)collectRoom:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
uid:(NSString *)uid
|
||||
type:(NSString *)type;
|
||||
type:(NSString *)type
|
||||
roomUids:(NSString *)roomUids;
|
||||
|
||||
/// 改变相亲的状态的
|
||||
/// @param completion 完成
|
||||
|
@@ -105,9 +105,10 @@
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid uid
|
||||
/// @param type 1 收藏 2 取消收藏
|
||||
+ (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid type:(NSString *)type {
|
||||
[self makeRequest:@"fans/fansRoom" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, type, nil];
|
||||
/// @param type 1 收藏 2 取消收藏 3:批量取消收藏
|
||||
/// @param roomUids 批量删除的房间uid,用逗号隔开
|
||||
+ (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid type:(NSString *)type roomUids:(NSString *)roomUids {
|
||||
[self makeRequest:@"fans/fansRoom" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, type, roomUids, nil];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -300,7 +300,7 @@
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} roomUid:roomUid uid:uid type:type];
|
||||
} roomUid:roomUid uid:uid type:type roomUids:NULL];
|
||||
}
|
||||
|
||||
#pragma mark - XCShareViewDelegate
|
||||
|
Reference in New Issue
Block a user