修改在线列表
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
//
|
||||
|
||||
#import "QXRoomViewController+Sign.h"
|
||||
|
||||
#import "QXAlertView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
@implementation QXRoomViewController (Sign)
|
||||
-(void)resetSignViews{
|
||||
[self.seatContentView setType:QXRoomSeatViewTypeSign];
|
||||
@@ -41,4 +42,33 @@
|
||||
-(void)signTimeDelayWithEndTime:(NSString*)endTime{
|
||||
[self.seatContentView signTimeDelayWithEndTime:endTime];
|
||||
}
|
||||
/// 主持邀请上签约麦
|
||||
-(void)signSeatInviteWithUserId:(NSString*)userId content:(NSString*)content{
|
||||
if ([userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
||||
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
al.type = QXAlertViewTypeSignSeat;
|
||||
al.message = content;
|
||||
al.commitBlock = ^{
|
||||
[QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"1" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
};
|
||||
al.cancelBlock = ^{
|
||||
[self refuseInvite];
|
||||
};
|
||||
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)refuseInvite{
|
||||
[QXMineNetwork signRoomRefuseSignWithRoomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -293,7 +293,7 @@ QXRoomUserInfoViewDelegate
|
||||
_roomId = roomId;
|
||||
[self.chatListView insertNoitce];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList, NSString * _Nonnull count) {
|
||||
NSMutableArray *arr = [NSMutableArray arrayWithArray:onPitList];
|
||||
[arr addObjectsFromArray:offPitList];
|
||||
weakSelf.titleView.onlineUsers = arr;
|
||||
@@ -362,7 +362,7 @@ QXRoomUserInfoViewDelegate
|
||||
|
||||
}];
|
||||
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList, NSString * _Nonnull count) {
|
||||
NSMutableArray *arr = [NSMutableArray arrayWithArray:onPitList];
|
||||
[arr addObjectsFromArray:offPitList];
|
||||
weakSelf.titleView.onlineUsers = arr;
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *onPitListArray;
|
||||
@property (nonatomic,strong)NSMutableArray *offPitListArray;
|
||||
@property (nonatomic,strong)NSMutableArray *allUsers;;
|
||||
@property (nonatomic,assign) NSInteger page;
|
||||
@end
|
||||
|
||||
@implementation QXRoomOnlineUserListView
|
||||
@@ -58,6 +60,11 @@
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getOnlineList];
|
||||
}];
|
||||
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getOnlineList];
|
||||
}];
|
||||
[self.bgView addSubview:self.tableView];
|
||||
@@ -84,33 +91,42 @@
|
||||
}
|
||||
-(void)getOnlineList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:0 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.allUsers removeAllObjects];
|
||||
[weakSelf.dataArray addObject:onPitList];
|
||||
[weakSelf.dataArray addObject:offPitList];
|
||||
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:self.page successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList, NSString * _Nonnull count) {
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.onPitListArray removeAllObjects];
|
||||
[weakSelf.offPitListArray removeAllObjects];
|
||||
[weakSelf.allUsers removeAllObjects];
|
||||
}
|
||||
[weakSelf.onPitListArray addObjectsFromArray:onPitList];
|
||||
[weakSelf.offPitListArray addObjectsFromArray:offPitList];
|
||||
[weakSelf.allUsers addObjectsFromArray:onPitList];
|
||||
[weakSelf.allUsers addObjectsFromArray:offPitList];
|
||||
weakSelf.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"用户列表(%@人)"),[NSString stringWithFormat:@"%ld",onPitList.count+offPitList.count]];
|
||||
weakSelf.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"用户列表(%@人)"),[NSString stringWithFormat:@"%@",count]];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
if (weakSelf.onlineListBlock) {
|
||||
weakSelf.onlineListBlock(weakSelf.allUsers);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
self.page = 1;
|
||||
[self getOnlineList];
|
||||
}
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.dataArray.count;
|
||||
return 2;;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
NSMutableArray *arr = self.dataArray[section];
|
||||
return arr.count;
|
||||
if (section == 0) {
|
||||
return self.onPitListArray.count;
|
||||
}else{
|
||||
return self.offPitListArray.count;
|
||||
}
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
@@ -120,13 +136,15 @@
|
||||
}else{
|
||||
cell.cellType = QXBlackListCellTypeOnline;
|
||||
}
|
||||
QXRoomUserInfoModel *model;
|
||||
if (indexPath.section == 0) {
|
||||
cell.isUpSeat = YES;
|
||||
model = self.onPitListArray[indexPath.row];
|
||||
}else{
|
||||
cell.isUpSeat = NO;
|
||||
model = self.offPitListArray[indexPath.row];
|
||||
}
|
||||
NSMutableArray *arr = self.dataArray[indexPath.section];
|
||||
cell.onlineUser = arr[indexPath.row];
|
||||
cell.onlineUser = model;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
@@ -150,8 +168,12 @@
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
NSMutableArray *arr = self.dataArray[indexPath.section];
|
||||
QXRoomUserInfoModel*user = arr[indexPath.row];
|
||||
QXRoomUserInfoModel *user;
|
||||
if (indexPath.section == 0) {
|
||||
user = self.onPitListArray[indexPath.row];
|
||||
}else{
|
||||
user = self.offPitListArray[indexPath.row];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:user.user_id];
|
||||
}
|
||||
@@ -173,11 +195,24 @@
|
||||
}
|
||||
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
//-(NSMutableArray *)dataArray{
|
||||
// if (!_dataArray) {
|
||||
// _dataArray = [NSMutableArray array];
|
||||
// }
|
||||
// return _dataArray;
|
||||
//}
|
||||
-(NSMutableArray *)onPitListArray{
|
||||
if (!_onPitListArray) {
|
||||
_onPitListArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
return _onPitListArray;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)offPitListArray{
|
||||
if (!_offPitListArray) {
|
||||
_offPitListArray = [NSMutableArray array];
|
||||
}
|
||||
return _offPitListArray;
|
||||
}
|
||||
-(NSMutableArray *)allUsers{
|
||||
if (!_allUsers) {
|
||||
|
||||
Reference in New Issue
Block a user