提交
This commit is contained in:
@@ -6,11 +6,12 @@
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "QXSearchModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHomeSearchResultVC : QXBaseViewController
|
||||
@property (nonatomic,strong)NSArray *resultArray;
|
||||
@property (nonatomic,strong)QXSearchListModel *model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
|
||||
#import "QXHomeSearchResultVC.h"
|
||||
#import "QXHomeRoomCell.h"
|
||||
#import "QXSearchHeaderReusableView.h"
|
||||
#import "QXSearchUserCell.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
|
||||
@interface QXHomeSearchResultVC ()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@interface QXHomeSearchResultVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@end
|
||||
|
||||
@@ -30,33 +33,75 @@
|
||||
[self.view addSubview:self.collectionView];
|
||||
}
|
||||
|
||||
-(void)setResultArray:(NSArray *)resultArray{
|
||||
_resultArray = resultArray;
|
||||
|
||||
-(void)setModel:(QXSearchListModel *)model{
|
||||
_model = model;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.resultArray.count;
|
||||
if (section == 0) {
|
||||
return self.model.rooms.count;
|
||||
}else{
|
||||
return self.model.users.count;
|
||||
}
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.searchModel = self.resultArray[indexPath.row];
|
||||
return cell;
|
||||
if (indexPath.section == 0) {
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.model = self.model.rooms[indexPath.row];
|
||||
return cell;
|
||||
|
||||
}else{
|
||||
QXSearchUserCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSearchUserCell" forIndexPath:indexPath];
|
||||
cell.model = self.model.users[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return CGSizeMake((SCREEN_WIDTH-15*3-1)/2.0, (SCREEN_WIDTH-15*3-1)/2.0);
|
||||
if (indexPath.section == 0) {
|
||||
return CGSizeMake((SCREEN_WIDTH-15*3-1)/2.0, (SCREEN_WIDTH-15*3-1)/2.0);
|
||||
}else{
|
||||
return CGSizeMake(SCREEN_WIDTH, 92);
|
||||
}
|
||||
}
|
||||
|
||||
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
|
||||
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
|
||||
QXSearchHeaderReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSearchHeaderReusableView" forIndexPath:indexPath];
|
||||
if (indexPath.section == 0) {
|
||||
reusableView.title = @"相关房间";
|
||||
}else{
|
||||
reusableView.title = @"相关用户";
|
||||
}
|
||||
return reusableView;
|
||||
}else{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
|
||||
return CGSizeMake(SCREEN_WIDTH, 48);
|
||||
}
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{
|
||||
return CGSizeZero;
|
||||
}
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSearchModel *model = self.resultArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.id isRejoin:NO navagationController:self.navigationController];
|
||||
if (indexPath.section == 0) {
|
||||
QXRoomListModel *model = self.model.rooms[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else{
|
||||
QXUserHomeModel *model = self.model.users[indexPath.row];
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
vc.user_id = model.user_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +111,14 @@
|
||||
layout.minimumLineSpacing = 15;
|
||||
layout.minimumInteritemSpacing = 15;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 16, SCREEN_WIDTH, SCREEN_HEIGHT-(NavContentHeight+TabbarContentHeight)) collectionViewLayout:layout];
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 16, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.bounces = YES;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXSearchUserCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXSearchUserCell"];
|
||||
[_collectionView registerClass:[QXSearchHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSearchHeaderReusableView"];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
@interface QXSearchViewController ()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource,ZLCollectionViewBaseFlowLayoutDelegate,QXSearchTopViewDelegate>
|
||||
@property(nonatomic,strong)UICollectionView* collectionView;
|
||||
@property(nonatomic,strong)QXSearchTopView *topView;
|
||||
|
||||
@property(nonatomic,strong)NSMutableArray *resultArray;
|
||||
@property(nonatomic,strong)QXSearchListModel *model;
|
||||
@end
|
||||
|
||||
@implementation QXSearchViewController
|
||||
@@ -56,23 +55,22 @@
|
||||
|
||||
-(void)searchActionWithKeywords:(NSString *)keywords{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork searchApiWithType:2 search:keywords successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf.resultArray removeAllObjects];
|
||||
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXSearchModel class] json:dict];
|
||||
if (arr.count == 0) {
|
||||
[QXMineNetwork searchListApiWithKetwords:keywords successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
QXSearchListModel *model = [QXSearchListModel yy_modelWithJSON:dict];
|
||||
weakSelf.model = model;
|
||||
if (weakSelf.model.users.count == 0 && weakSelf.model.rooms.count == 0) {
|
||||
showToast(@"暂无搜索结果");
|
||||
return;
|
||||
}
|
||||
[weakSelf.resultArray addObjectsFromArray:arr];
|
||||
[weakSelf pushToResultVC];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)pushToResultVC{
|
||||
QXHomeSearchResultVC *vc = [[QXHomeSearchResultVC alloc] init];
|
||||
vc.resultArray = self.resultArray;
|
||||
vc.model = self.model;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
@@ -135,11 +133,6 @@
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
-(NSMutableArray *)resultArray{
|
||||
if (!_resultArray) {
|
||||
_resultArray = [NSMutableArray array];
|
||||
}
|
||||
return _resultArray;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -105,9 +105,17 @@
|
||||
[self.skyView updateProgress:model];
|
||||
[self.ageView updateProgress:model];
|
||||
[self.timeView updateProgress:model];
|
||||
if (model.status.intValue == 1) {
|
||||
self.acTagView.end_time = model.end_time;
|
||||
[self.view addSubview:self.acTagView];
|
||||
}else{
|
||||
[self.acTagView stopTimer];
|
||||
[self.acTagView removeFromSuperview];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel *)giftInfo{
|
||||
[self.meetView updateUserAndGiftInfoWithModel:giftInfo];
|
||||
self.acTagView.end_time = giftInfo.end_time.longLongValue;
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#import "QXAgePraizeView.h"/// 岁月之城
|
||||
#import "QXTimePraizeView.h"/// 时空之巅
|
||||
#import "QXMeetActivityView.h"
|
||||
#import "QXActivityTagView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomViewController : QXBaseViewController<QXRoomMessageManagerDelegate,QXRoomSeatDelegate>
|
||||
@@ -39,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong)QXSendGiftView *sendGiftView;
|
||||
|
||||
|
||||
|
||||
@property (nonatomic,strong)QXActivityTagView *acTagView;
|
||||
@property (nonatomic,strong)QXSkyPraizeView *skyView;
|
||||
@property (nonatomic,strong)QXAgePraizeView *ageView;
|
||||
@property (nonatomic,strong)QXTimePraizeView *timeView;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#import "QXMessageViewController.h"
|
||||
#import "QXRoomSubsidyViewController.h"
|
||||
#import "QXRoomViewController+Friend.h"
|
||||
#import "QXAllRoomHourRankView.h"
|
||||
|
||||
@interface QXRoomViewController ()<
|
||||
QXRoomBottomViewDelegate,
|
||||
@@ -71,6 +72,10 @@ QXRoomUserInfoViewDelegate
|
||||
@property (nonatomic,strong)QXCabinMovieView *movieView;
|
||||
/// 连送按钮
|
||||
@property (nonatomic,strong)QXContinuousGiftView *continuousView;
|
||||
|
||||
|
||||
@property (nonatomic,strong)QXAllRoomHourRankView *hourRankView;
|
||||
@property (nonatomic,strong)QXAllRoomHourRankTagView *hourRankIconView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomViewController
|
||||
@@ -196,6 +201,7 @@ QXRoomUserInfoViewDelegate
|
||||
[self joinRoom];
|
||||
}
|
||||
|
||||
[self.view addSubview:self.hourRankIconView];
|
||||
[self setupEffectView];
|
||||
|
||||
// [self.view addSubview:self.headlineView];
|
||||
@@ -410,6 +416,13 @@ QXRoomUserInfoViewDelegate
|
||||
[[QXAgoraEngineEx sharedEngine] quitEXChannelWithLastPkRoomId:self.roomModel.room_info.last_pk_room_id];
|
||||
}
|
||||
}
|
||||
if (self.roomModel.gift_cycle.xlh_info.xlh_status.intValue == 1) {
|
||||
self.acTagView.end_time = self.roomModel.gift_cycle.xlh_info.end_time;
|
||||
[self.view addSubview:self.acTagView];
|
||||
}else{
|
||||
[self.acTagView stopTimer];
|
||||
[self.acTagView removeFromSuperview];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1867,6 +1880,19 @@ QXRoomUserInfoViewDelegate
|
||||
}
|
||||
return _timeView;
|
||||
}
|
||||
-(QXActivityTagView *)acTagView{
|
||||
if (!_acTagView) {
|
||||
_acTagView = [[QXActivityTagView alloc] init];
|
||||
MJWeakSelf
|
||||
_acTagView.startBlock = ^{
|
||||
[weakSelf.skyView hide];
|
||||
weakSelf.meetView.roomId = weakSelf.roomId;
|
||||
[weakSelf.meetView showInView:weakSelf.view];
|
||||
};
|
||||
|
||||
}
|
||||
return _acTagView;
|
||||
}
|
||||
-(QXMeetActivityView *)meetView{
|
||||
if (!_meetView) {
|
||||
_meetView = [[QXMeetActivityView alloc] init];
|
||||
@@ -1894,5 +1920,22 @@ QXRoomUserInfoViewDelegate
|
||||
_timeView = nil;
|
||||
}
|
||||
}
|
||||
-(QXAllRoomHourRankTagView *)hourRankIconView{
|
||||
if (!_hourRankIconView) {
|
||||
_hourRankIconView = [[QXAllRoomHourRankTagView alloc] init];
|
||||
MJWeakSelf
|
||||
_hourRankIconView.startBlock = ^{
|
||||
[weakSelf.hourRankView showInView:weakSelf.view];
|
||||
};
|
||||
}
|
||||
return _hourRankIconView;
|
||||
}
|
||||
|
||||
-(QXAllRoomHourRankView *)hourRankView{
|
||||
if (!_hourRankView) {
|
||||
_hourRankView = [[QXAllRoomHourRankView alloc] init];
|
||||
}
|
||||
return _hourRankView;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user