diff --git a/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@2x.png b/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@2x.png index 19d5d2c2..2f35c5d3 100644 Binary files a/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@2x.png and b/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@3x.png b/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@3x.png index fa396669..54a5652a 100644 Binary files a/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@3x.png and b/xplan-ios/Assets.xcassets/Home/home_hot_section_logo.imageset/home_hot_section_logo@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/Contents.json new file mode 100644 index 00000000..415060f6 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_nav_open_room@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_nav_open_room@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@2x.png b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@2x.png new file mode 100644 index 00000000..45602df2 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@3x.png b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@3x.png new file mode 100644 index 00000000..8effaedc Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_nav_open_room.imageset/home_nav_open_room@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@2x.png b/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@2x.png index b315f311..002f1265 100644 Binary files a/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@2x.png and b/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@3x.png b/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@3x.png index 1969fc16..a24339de 100644 Binary files a/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@3x.png and b/xplan-ios/Assets.xcassets/Home/home_nav_rank.imageset/home_nav_rank@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/Contents.json new file mode 100644 index 00000000..dfa884f4 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_nav_search@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_nav_search@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@2x.png b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@2x.png new file mode 100644 index 00000000..4c5fab99 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@3x.png b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@3x.png new file mode 100644 index 00000000..58f8e6ef Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_nav_search.imageset/home_nav_search@3x.png differ diff --git a/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.h b/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.h index ce3b6aca..7855f917 100644 --- a/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.h +++ b/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.h @@ -11,12 +11,12 @@ NS_ASSUME_NONNULL_BEGIN @class XPHomeNavView; @protocol XPHomeNavViewDelegate - -///点击了搜索按钮 -- (void)xPHomeNavViewDidClickSearch:(XPHomeNavView *)view; - +///点击了搜索房间 +- (void)xPHomeNavView:(XPHomeNavView *)view didClickSearch:(UIButton *)sender; ///点击了榜单按钮 - (void)xPHomeNavView:(XPHomeNavView *)view didClickRank:(UIButton *)sender; +///点击了开房按钮 +- (void)xPHomeNavView:(XPHomeNavView *)view didClickOpenRoom:(UIButton *)sender; @end diff --git a/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.m b/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.m index a533d44a..c5b1f283 100644 --- a/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.m +++ b/xplan-ios/Main/Home/View/SubViews/XPHomeNavView.m @@ -17,8 +17,10 @@ @interface XPHomeNavView () ///排行榜 @property (nonatomic,strong) UIButton *rankButton; -///搜索框 -@property (nonatomic,strong) UITextField *searchTextField; +///开启自己的房间 +@property (nonatomic,strong) UIButton *openRoomButton; +///搜索 +@property (nonatomic,strong) UIButton *searchButton; ///滑块 @property (nonatomic,strong) JXCategoryTitleView *titleView; @end @@ -39,29 +41,33 @@ - (void)initSubViews { self.backgroundColor = [UIColor clearColor]; [self addSubview:self.titleView]; - [self addSubview:self.searchTextField]; [self addSubview:self.rankButton]; + [self addSubview:self.openRoomButton]; + [self addSubview:self.searchButton]; } - (void)initSubViewConstraints { [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self).offset(12); make.height.mas_equalTo(40); - make.centerY.mas_equalTo(self.searchTextField); - make.width.mas_equalTo(150); - }]; - - [self.searchTextField mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(self.titleView.mas_right).offset(2); - make.right.mas_equalTo(self.rankButton.mas_left).offset(-10); - make.height.mas_equalTo(30); - make.top.mas_equalTo(statusbarHeight + 14); + make.centerY.mas_equalTo(self.rankButton); + make.width.mas_equalTo(200); }]; [self.rankButton mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(22, 22)); make.right.mas_equalTo(-14); - make.centerY.mas_equalTo(self.searchTextField); + make.top.mas_equalTo(statusbarHeight + 14); + }]; + + [self.openRoomButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.centerY.mas_equalTo(self.rankButton); + make.right.mas_equalTo(self.rankButton.mas_left).offset(-20); + }]; + + [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.centerY.mas_equalTo(self.rankButton); + make.right.mas_equalTo(self.openRoomButton.mas_left).offset(-20); }]; } @@ -71,9 +77,9 @@ } #pragma mark - Event Response -- (void)didTapTextFieldRecognizer { - if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeNavViewDidClickSearch:)]) { - [self.delegate xPHomeNavViewDidClickSearch:self]; +- (void)searchButtonAction:(UIButton *)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeNavView:didClickSearch:)]) { + [self.delegate xPHomeNavView:self didClickSearch:sender]; } } @@ -83,33 +89,14 @@ } } -#pragma mark - Getters And Setters -- (UITextField *)searchTextField { - if (!_searchTextField) { - _searchTextField = [[UITextField alloc] init]; - _searchTextField.layer.cornerRadius = 15; - _searchTextField.layer.masksToBounds = YES; - _searchTextField.backgroundColor = [ThemeColor appCellBackgroundColor]; - _searchTextField.font = [UIFont systemFontOfSize:13]; - _searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"搜索昵称或ID" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:13], NSForegroundColorAttributeName : [ThemeColor textThirdColor]}]; - UIImageView *searchIcon = [[UIImageView alloc] init]; - searchIcon.image = [UIImage imageNamed:@"home_search_input_search"]; - searchIcon.frame = CGRectMake(11, 7, 16, 16); - searchIcon.contentMode = UIViewContentModeCenter; - UIView *searchIconView = [[UIView alloc] init]; - [searchIconView addSubview:searchIcon]; - searchIconView.frame = CGRectMake(0, 0, 34, 30); - _searchTextField.leftView = searchIconView; - _searchTextField.leftViewMode = UITextFieldViewModeAlways; - _searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - _searchTextField.returnKeyType = UIReturnKeySearch; - _searchTextField.enablesReturnKeyAutomatically = YES; - UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapTextFieldRecognizer)]; - [_searchTextField addGestureRecognizer:tap]; +- (void)openRoomButtonAction:(UIButton *)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeNavView:didClickOpenRoom:)]) { + [self.delegate xPHomeNavView:self didClickOpenRoom:sender]; } - return _searchTextField; } +#pragma mark - Getters And Setters + - (UIButton *)rankButton { if (!_rankButton) { _rankButton = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -120,6 +107,26 @@ return _rankButton; } +- (UIButton *)searchButton { + if (!_searchButton) { + _searchButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_searchButton setImage:[UIImage imageNamed:@"home_nav_search"] forState:UIControlStateNormal]; + [_searchButton setImage:[UIImage imageNamed:@"home_nav_search"] forState:UIControlStateSelected]; + [_searchButton addTarget:self action:@selector(searchButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _searchButton; +} + +- (UIButton *)openRoomButton { + if (!_openRoomButton) { + _openRoomButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_openRoomButton setImage:[UIImage imageNamed:@"home_nav_open_room"] forState:UIControlStateNormal]; + [_openRoomButton setImage:[UIImage imageNamed:@"home_nav_open_room"] forState:UIControlStateSelected]; + [_openRoomButton addTarget:self action:@selector(openRoomButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _openRoomButton; +} + - (JXCategoryTitleView *)titleView { if (!_titleView) { _titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero]; @@ -136,9 +143,11 @@ _titleView.contentEdgeInsetLeft = 15; JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; - lineView.indicatorImageViewSize = CGSizeMake(54, 15); + lineView.indicatorImageViewSize = CGSizeMake(48, 12); lineView.verticalMargin = 6; - lineView.indicatorImageView.image = [UIImage imageNamed:@"home_reommend_indicator"]; + lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFC000), UIColorFromRGB(0xFFD15A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(48, 12)]; + lineView.indicatorImageView.layer.masksToBounds = YES; + lineView.indicatorImageView.layer.cornerRadius = 6; _titleView.indicators = @[lineView]; } return _titleView; diff --git a/xplan-ios/Main/Home/View/XPHomePartyViewController.m b/xplan-ios/Main/Home/View/XPHomePartyViewController.m index a51f7085..802089af 100644 --- a/xplan-ios/Main/Home/View/XPHomePartyViewController.m +++ b/xplan-ios/Main/Home/View/XPHomePartyViewController.m @@ -75,6 +75,7 @@ footer.stateLabel.textColor = [ThemeColor secondTextColor]; footer.stateLabel.font = [UIFont systemFontOfSize:10.0]; self.collectionView.mj_footer = footer; + } #pragma mark - 刷新的fangfa @@ -185,6 +186,16 @@ return self.view; } #pragma mark - Getters And Setters + +- (void)setIsAnchor:(BOOL)isAnchor { + _isAnchor = isAnchor; + if (_isAnchor) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self headerRefresh]; + }); + } +} + - (void)setTabId:(NSString *)tabId { _tabId = tabId; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ @@ -192,7 +203,6 @@ }); } - - (UICollectionView *)collectionView{ if (!_collectionView) { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; diff --git a/xplan-ios/Main/Home/View/XPHomeViewController.m b/xplan-ios/Main/Home/View/XPHomeViewController.m index a6a9c534..d6df530b 100644 --- a/xplan-ios/Main/Home/View/XPHomeViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeViewController.m @@ -14,12 +14,19 @@ #import "XPMacro.h" #import "XPHtmlURL.h" #import "XPConstant.h" +#import "Api+Room.h" +#import "AccountInfoStorage.h" +#import "TTPopup.h" ///View #import "XPHomeNavView.h" #import "XPHomeRecommendViewController.h" #import "XPRoomSearchContainerViewController.h" #import "XPHomePartyContainerViewController.h" +#import "XPHomePartyViewController.h" #import "XPWebViewController.h" +#import "XPHomeHotRoomViewController.h" +#import "XPRoomViewController.h" +#import "XPLittleGameRoomOpenView.h" UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; @@ -34,6 +41,8 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; @property (nonatomic,assign) NSInteger defaultSelectedIndex; @property (nonatomic,strong) XPHomeRecommendViewController *recommendVC; @property (nonatomic,strong) XPHomePartyContainerViewController *partyVC; +///个播房的 +@property (nonatomic,strong) XPHomePartyViewController *anchorRoomListVC; @end @implementation XPHomeViewController @@ -89,12 +98,20 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; return self.recommendVC; }else if (index == 1) { return self.partyVC; + } else if(index == 2) { + return self.anchorRoomListVC; } return nil; } +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { + if (index == 2) { + self.anchorRoomListVC.isAnchor = YES; + } +} + #pragma mark - XPHoneNavViewDelegate -- (void)xPHomeNavViewDidClickSearch:(XPHomeNavView *)view { +- (void)xPHomeNavView:(XPHomeNavView *)view didClickSearch:(UIButton *)sender { XPRoomSearchContainerViewController * searchVC = [[XPRoomSearchContainerViewController alloc] init]; searchVC.modalPresentationStyle = UIModalPresentationFullScreen; [self.navigationController presentViewController:searchVC animated:YES completion:nil]; @@ -106,6 +123,25 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; [self.navigationController pushViewController:webVC animated:YES]; } +- (void)xPHomeNavView:(XPHomeNavView *)view didClickOpenRoom:(UIButton *)sender { + NSString* roomUid = [AccountInfoStorage instance].getUid; + [Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data]; + if (roomInfo.isReselect) { + XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init]; + roomOpenView.roomInfo = roomInfo; + roomOpenView.currentVC = self; + [TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet]; + } else { + [XPRoomViewController openRoom:roomUid viewController:self]; + } + } else { + [self showErrorToast:msg]; + } + } uid:roomUid intoUid:roomUid]; +} + #pragma mark - Event Response - (void)recommendMoreNotification:(NSNotification *)notification { [self.homeNavView.titleView selectItemAtIndex:1]; @@ -141,7 +177,7 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; - (NSArray *)titles { if (!_titles) { - _titles = @[@"推荐",@"派对"]; + _titles = @[@"推荐",@"派对", @"直播"]; } return _titles; } @@ -161,5 +197,12 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey; return _partyVC; } +- (XPHomePartyViewController *)anchorRoomListVC { + if (!_anchorRoomListVC) { + _anchorRoomListVC = [[XPHomePartyViewController alloc] init]; + _anchorRoomListVC.isAnchor = YES; + } + return _anchorRoomListVC; +} @end