提交
This commit is contained in:
16
QXLive/HomePage(声播)/Controlller/QXHomeSearchResultVC.h
Normal file
16
QXLive/HomePage(声播)/Controlller/QXHomeSearchResultVC.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXHomeSearchResultVC.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/10.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHomeSearchResultVC : QXBaseViewController
|
||||
@property (nonatomic,strong)NSArray *resultArray;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
87
QXLive/HomePage(声播)/Controlller/QXHomeSearchResultVC.m
Normal file
87
QXLive/HomePage(声播)/Controlller/QXHomeSearchResultVC.m
Normal file
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// QXHomeSearchResultVC.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/10.
|
||||
//
|
||||
|
||||
#import "QXHomeSearchResultVC.h"
|
||||
#import "QXHomeRoomCell.h"
|
||||
|
||||
@interface QXHomeSearchResultVC ()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@end
|
||||
|
||||
@implementation QXHomeSearchResultVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = @"搜索结果";
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)initSubViews{
|
||||
[self.view addSubview:self.collectionView];
|
||||
}
|
||||
|
||||
-(void)setResultArray:(NSArray *)resultArray{
|
||||
_resultArray = resultArray;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.resultArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.searchModel = self.resultArray[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);
|
||||
}
|
||||
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSearchModel *model = self.resultArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.id isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
|
||||
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
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.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
18
QXLive/HomePage(声播)/Controlller/QXHomeSubViewController.h
Normal file
18
QXLive/HomePage(声播)/Controlller/QXHomeSubViewController.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXHomeSubViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/7.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "JXPagerView.h"
|
||||
#import "QXRoomListModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHomeSubViewController : QXBaseViewController<JXPagerViewListViewDelegate>
|
||||
@property (nonatomic, copy) void(^listScrollCallback)(UIScrollView *scrollView);
|
||||
@property (nonatomic, strong)QXMyRoomType *roomType;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
117
QXLive/HomePage(声播)/Controlller/QXHomeSubViewController.m
Normal file
117
QXLive/HomePage(声播)/Controlller/QXHomeSubViewController.m
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// QXHomeSubViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/7.
|
||||
//
|
||||
|
||||
#import "QXHomeSubViewController.h"
|
||||
#import "QXHomeRoomCell.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@interface QXHomeSubViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
|
||||
@end
|
||||
|
||||
@implementation QXHomeSubViewController
|
||||
-(UIView *)listView{
|
||||
return self.view;
|
||||
}
|
||||
-(void)listWillAppear{
|
||||
[self getRoomList];
|
||||
}
|
||||
-(UIScrollView *)listScrollView{
|
||||
return self.collectionView;
|
||||
}
|
||||
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
||||
self.scrollCallback = callback;
|
||||
}
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
if (self.scrollCallback != nil) {
|
||||
self.scrollCallback(scrollView);
|
||||
}
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.page = 1;
|
||||
[self.view addSubview:self.collectionView];
|
||||
// [self getRoomList];
|
||||
self.bgImageHidden = YES;
|
||||
}
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
-(void)setRoomType:(QXMyRoomType *)roomType{
|
||||
_roomType = roomType;
|
||||
[self getRoomList];
|
||||
}
|
||||
- (void)getRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[QXHomePageNetwork homeRoomListWithPage:self.page is_top:NO label_id:self.roomType.id successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
if (self.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[self.collectionView reloadData];
|
||||
if (list.count == 0) {
|
||||
self.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.model = self.dataArray[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);
|
||||
}
|
||||
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
|
||||
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 15;
|
||||
layout.minimumInteritemSpacing = 15;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-(NavContentHeight+TabbarContentHeight)) collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
MJWeakSelf
|
||||
_collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getRoomList];
|
||||
}];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
16
QXLive/HomePage(声播)/Controlller/QXHomeViewController.h
Normal file
16
QXLive/HomePage(声播)/Controlller/QXHomeViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXHomeViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/4/24.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "QXGiftScrollView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHomeViewController : QXBaseViewController
|
||||
-(void)giftScrollViewShowWithModel:(QXGiftScrollModel*)model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
454
QXLive/HomePage(声播)/Controlller/QXHomeViewController.m
Normal file
454
QXLive/HomePage(声播)/Controlller/QXHomeViewController.m
Normal file
@@ -0,0 +1,454 @@
|
||||
//
|
||||
// QXHomeViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/4/24.
|
||||
//
|
||||
|
||||
#import "QXHomeViewController.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "GKCycleScrollView.h"
|
||||
#import "QXHomeTopCell.h"
|
||||
#import "QXHomeSubViewController.h"
|
||||
#import "QXSearchViewController.h"
|
||||
#import "QXRankHomeVC.h"
|
||||
#import "SDCycleScrollView.h"
|
||||
#import "JXPagerView.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
#import "QXMyRoomViewController.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
#import "QXFirstRechargePopView.h"
|
||||
#import "QXRechargeView.h"
|
||||
#import "QXAppstoreHomeView.h"
|
||||
|
||||
@interface QXHomeViewController ()<JXPagerViewDelegate,JXCategoryViewDelegate,GKCycleScrollViewDataSource,GKCycleScrollViewDelegate,QXGiftScrollViewDelegate,SDCycleScrollViewDelegate>
|
||||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
||||
@property (nonatomic,strong)NSMutableArray *titles;
|
||||
@property (nonatomic,strong)NSArray *titleModelArray;
|
||||
@property (nonatomic,strong)GKCycleScrollView *cycleScrollView;
|
||||
@property (nonatomic,strong)JXCategoryIndicatorImageView *indicatorView;
|
||||
@property (nonatomic,strong)UIButton *rankRightBtn;
|
||||
@property (nonatomic,strong)UIButton *searchRightBtn;
|
||||
@property (nonatomic,strong)UIButton *roomBtn;
|
||||
@property (nonatomic,strong)QXGiftScrollView *giftScrollView;
|
||||
@property (nonatomic,strong)SDCycleScrollView *bannerScrollView;
|
||||
@property (nonatomic,assign)BOOL isShowGiftScrollView;
|
||||
@property (nonatomic,strong)NSMutableArray *bannerArry;
|
||||
|
||||
@property (nonatomic,strong)UIView *headerView;
|
||||
@property (nonatomic,strong)UIView *sectionView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *firstRechargeBtn;
|
||||
@property (nonatomic,strong)UIButton *skyDownBtn;
|
||||
@property (nonatomic,strong)QXFirstRechargePopView *firstRechargeView;
|
||||
|
||||
@property (nonatomic,strong)QXAppstoreHomeView *appStoreView;
|
||||
@end
|
||||
|
||||
@implementation QXHomeViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
}
|
||||
|
||||
- (void)initSubViews{
|
||||
UILabel *tLabel = [[UILabel alloc] init];
|
||||
tLabel.text = QXText(@"羽声");
|
||||
tLabel.font = [UIFont boldSystemFontOfSize:20];
|
||||
[self.view addSubview:tLabel];
|
||||
[tLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(kSafeAreaTop +10);
|
||||
}];
|
||||
[self.view addSubview:self.rankRightBtn];
|
||||
[self.view addSubview:self.searchRightBtn];
|
||||
[self.view addSubview:self.roomBtn];
|
||||
|
||||
[self.roomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(tLabel);
|
||||
make.right.equalTo(self.view).offset(-10);
|
||||
}];
|
||||
[self.searchRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.roomBtn.mas_left).offset(-10);
|
||||
make.centerY.width.height.equalTo(self.roomBtn);
|
||||
}];
|
||||
[self.rankRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.searchRightBtn.mas_left).offset(-10);
|
||||
make.centerY.equalTo(self.roomBtn);
|
||||
make.width.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
self.listVCArray = [NSMutableArray array];
|
||||
[self requestSlideToolData];
|
||||
[self getTopRoomList];
|
||||
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
||||
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
||||
self.pagingView.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.pagingView];
|
||||
|
||||
self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
||||
self.pagingView.listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
||||
// [self performSelector:@selector(giftScrollViewShow) afterDelay:5];
|
||||
MJWeakSelf
|
||||
self.pagingView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf requestSlideToolData];
|
||||
[weakSelf getTopRoomList];
|
||||
[weakSelf getBanner];
|
||||
}];
|
||||
|
||||
self.firstRechargeBtn.hidden = YES;
|
||||
[self.view addSubview:self.firstRechargeBtn];
|
||||
[self.firstRechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(-(TabbarContentHeight+5));
|
||||
make.right.equalTo(self.view).offset(-17);
|
||||
make.width.height.mas_equalTo(ScaleWidth(57));
|
||||
}];
|
||||
[self getBanner];
|
||||
[self getFirstRechargePermission];
|
||||
self.appStoreView.hidden = YES;
|
||||
[self.view addSubview:self.appStoreView];
|
||||
}
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
|
||||
self.pagingView.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight);
|
||||
}
|
||||
-(void)loginSuccess{
|
||||
[self requestSlideToolData];
|
||||
[self getTopRoomList];
|
||||
[self getBanner];
|
||||
}
|
||||
- (void)requestSlideToolData {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[QXHomePageNetwork homeRoomLabelListsuccessBlock:^(NSArray<QXMyRoomType *> * _Nonnull list) {
|
||||
[weakSelf.titles removeAllObjects];
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
[weakSelf.titles addObjectsFromArray:list];
|
||||
for (QXMyRoomType *md in list) {
|
||||
[arr addObject:md.label_name];
|
||||
}
|
||||
weakSelf.categoryView.titles = arr;
|
||||
[weakSelf.categoryView reloadData];
|
||||
[weakSelf.pagingView.mainTableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.pagingView.mainTableView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getFirstRechargePermission{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getFirstRechargePermissionSuccessBlock:^(BOOL isShow) {
|
||||
weakSelf.firstRechargeBtn.hidden = !isShow;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)firstAction{
|
||||
[self popFirstRechargeView];
|
||||
}
|
||||
-(void)popFirstRechargeView{
|
||||
MJWeakSelf
|
||||
// view.giftArray = @[@"",@"",@"",@"",@"",@""];
|
||||
self.firstRechargeView.closeActionBlock = ^{
|
||||
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
||||
QXLOG(@"页面关闭");
|
||||
|
||||
}];
|
||||
};
|
||||
self.firstRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money) {
|
||||
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
||||
QXLOG(@"页面关闭");
|
||||
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
||||
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
|
||||
model.money = money;
|
||||
recharge.selectedModel = model;
|
||||
recharge.isPop = YES;
|
||||
recharge.isOnlyDisplayPayType = YES;
|
||||
[recharge showInView:KEYWINDOW];
|
||||
}];
|
||||
};
|
||||
[self.firstRechargeView reloadData];
|
||||
[[QXGlobal shareGlobal] showView:self.firstRechargeView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - JXPagingViewDelegate
|
||||
|
||||
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
||||
return self.headerView;
|
||||
}
|
||||
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
||||
return self.headerView.height;
|
||||
}
|
||||
|
||||
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return 48;
|
||||
}
|
||||
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return self.sectionView;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
||||
QXHomeSubViewController *vc = [[QXHomeSubViewController alloc] init];
|
||||
QXMyRoomType *model = self.titles[index];
|
||||
vc.roomType = model;
|
||||
return vc;
|
||||
}
|
||||
-(void)categoryView:(JXCategoryBaseView *)categoryView didClickSelectedItemAtIndex:(NSInteger)index{
|
||||
|
||||
}
|
||||
|
||||
-(void)giftScrollViewShowWithModel:(QXGiftScrollModel*)model{
|
||||
if (self.isShowGiftScrollView == NO) {
|
||||
// self.categoryView.frame = CGRectMake(15, self.giftScrollView.bottom, SCREEN_WIDTH-30, 44);
|
||||
// self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom-TabbarHeight);
|
||||
self.bannerScrollView.top = self.giftScrollView.bottom+12;
|
||||
self.headerView.height += 12+self.giftScrollView.height;
|
||||
[self.headerView addSubview:self.giftScrollView];
|
||||
// [self.pagingView reloadData];
|
||||
[self.pagingView resizeTableHeaderViewHeightWithAnimatable:YES duration:0.1 curve:UIViewAnimationCurveLinear];
|
||||
}
|
||||
++self.page;
|
||||
self.giftScrollView.model = model;
|
||||
self.isShowGiftScrollView = YES;
|
||||
}
|
||||
-(void)didClickGiftScrollView:(QXGiftScrollView *)giftScrollView index:(NSInteger)index model:(QXGiftScrollModel *)model{
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.roomId isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
- (void)getTopRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[QXHomePageNetwork homeRoomListWithPage:0 is_top:YES label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
if (isAppStore) {
|
||||
self.appStoreView.hidden = NO;
|
||||
}else{
|
||||
self.appStoreView.hidden = YES;
|
||||
}
|
||||
// weakSelf.appStoreView.dataArray = list;
|
||||
[weakSelf.cycleScrollView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)getBanner{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork homeBannerSuccessBlock:^(NSArray<QXBanner *> * _Nonnull list) {
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for (QXBanner *banner in list) {
|
||||
[arr addObject:banner.image];
|
||||
}
|
||||
[weakSelf.bannerArry removeAllObjects];
|
||||
[weakSelf.bannerArry addObjectsFromArray:list];
|
||||
weakSelf.appStoreView.bannerArray = list;
|
||||
weakSelf.bannerScrollView.imageURLStringsGroup = arr;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - GKCycleScrollViewDataSource,GKCycleScrollViewDelegate
|
||||
- (NSInteger)numberOfCellsInCycleScrollView:(GKCycleScrollView *)cycleScrollView {
|
||||
return self.dataArray.count;
|
||||
}
|
||||
- (GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index {
|
||||
GKCycleScrollViewCell *cell = [cycleScrollView dequeueReusableCell];
|
||||
if (!cell) {
|
||||
cell = [QXHomeTopCell new];
|
||||
}
|
||||
QXHomeTopCell *topcell = (QXHomeTopCell*)cell;
|
||||
topcell.roomModel = [self.dataArray objectAtIndex:index];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGSize)sizeForCellInCycleScrollView:(GKCycleScrollView *)cycleScrollView {
|
||||
return CGSizeMake((SCREEN_WIDTH)/3, 113);
|
||||
}
|
||||
|
||||
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didSelectCellAtIndex:(NSInteger)index {
|
||||
QXRoomListModel *model = self.dataArray[index];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - SDCycleScrollViewDelegate
|
||||
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
|
||||
QXBanner *banner = self.bannerArry[index];
|
||||
if ([banner.type isEqualToString:@"2"]) {
|
||||
QXBaseWebViewController *webVc = [[QXBaseWebViewController alloc] init];
|
||||
webVc.urlStr = banner.url;
|
||||
[self.navigationController pushViewController:webVc animated:YES];
|
||||
}else if ([banner.type isEqualToString:@"3"]){
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:banner.aid isRejoin:NO navagationController:self.navigationController];
|
||||
}else if ([banner.type isEqualToString:@"4"]){
|
||||
QXUserHomePageViewController *userHomePage = [[QXUserHomePageViewController alloc] init];
|
||||
userHomePage.user_id = banner.aid;
|
||||
[self.navigationController pushViewController:userHomePage animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)gotoRoom{
|
||||
QXMyRoomViewController *vc = [[QXMyRoomViewController alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)gotoSearchVC{
|
||||
QXSearchViewController *vc = [[QXSearchViewController alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)gotoRankVC{
|
||||
QXRankHomeVC *vc = [[QXRankHomeVC alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(UIButton *)roomBtn{
|
||||
if (!_roomBtn) {
|
||||
_roomBtn = [[UIButton alloc] init];
|
||||
[_roomBtn setImage:[UIImage imageNamed:@"home_room"] forState:UIControlStateNormal];
|
||||
[_roomBtn setImage:[UIImage imageNamed:@"home_room"] forState:UIControlStateHighlighted];
|
||||
[_roomBtn addTarget:self action:@selector(gotoRoom) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _roomBtn;
|
||||
}
|
||||
- (UIButton *)rankRightBtn {
|
||||
if (!_rankRightBtn) {
|
||||
_rankRightBtn = [[UIButton alloc] init];
|
||||
[_rankRightBtn setImage:[UIImage imageNamed:@"home_ranking"] forState:UIControlStateNormal];
|
||||
[_rankRightBtn setImage:[UIImage imageNamed:@"home_ranking"] forState:UIControlStateHighlighted];
|
||||
[_rankRightBtn addTarget:self action:@selector(gotoRankVC) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _rankRightBtn;
|
||||
}
|
||||
|
||||
- (UIButton *)searchRightBtn {
|
||||
if (!_searchRightBtn) {
|
||||
_searchRightBtn = [[UIButton alloc] init];
|
||||
[_searchRightBtn setImage:[UIImage imageNamed:@"home_search"] forState:UIControlStateNormal];
|
||||
[_searchRightBtn setImage:[UIImage imageNamed:@"home_search"] forState:UIControlStateHighlighted];
|
||||
[_searchRightBtn addTarget:self action:@selector(gotoSearchVC) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _searchRightBtn;
|
||||
}
|
||||
-(UIView *)sectionView{
|
||||
if (!_sectionView) {
|
||||
_sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
|
||||
[_sectionView addSubview:self.categoryView];
|
||||
}
|
||||
return _sectionView;
|
||||
}
|
||||
-(JXCategoryTitleView *)categoryView{
|
||||
if (!_categoryView) {
|
||||
_categoryView = [[JXCategoryTitleView alloc] init];
|
||||
_categoryView.frame = CGRectMake(15, 0, SCREEN_WIDTH-30, 44);
|
||||
_categoryView.delegate = self;
|
||||
_categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
||||
_categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
|
||||
_categoryView.cellWidth = JXCategoryViewAutomaticDimension;
|
||||
_categoryView.contentEdgeInsetLeft = 3;
|
||||
_categoryView.cellSpacing = 16;
|
||||
_categoryView.titleLabelZoomEnabled = YES;
|
||||
_categoryView.titleFont = [UIFont boldSystemFontOfSize:13];
|
||||
_categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
|
||||
_categoryView.averageCellSpacingEnabled = NO;
|
||||
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
indicatorView.indicatorWidth = JXCategoryViewAutomaticDimension;
|
||||
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
||||
indicatorView.indicatorImageViewSize = CGSizeMake(29, 8);
|
||||
self.indicatorView = indicatorView;
|
||||
indicatorView.verticalMargin = 11;
|
||||
_categoryView.indicators = @[indicatorView];
|
||||
}
|
||||
return _categoryView;
|
||||
}
|
||||
-(UIView *)headerView{
|
||||
if (!_headerView) {
|
||||
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.cycleScrollView.height+self.bannerScrollView.height)];
|
||||
[_headerView addSubview:self.cycleScrollView];
|
||||
[_headerView addSubview:self.bannerScrollView];
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
-(SDCycleScrollView *)bannerScrollView{
|
||||
if (!_bannerScrollView) {
|
||||
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, self.cycleScrollView.bottom, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
|
||||
// _bannerScrollView.backgroundColor = [UIColor redColor];
|
||||
_bannerScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
[_bannerScrollView addRoundedCornersWithRadius:8] ;
|
||||
_bannerScrollView.delegate = self;
|
||||
}
|
||||
return _bannerScrollView;
|
||||
}
|
||||
-(GKCycleScrollView *)cycleScrollView{
|
||||
if (!_cycleScrollView) {
|
||||
_cycleScrollView = [[GKCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(113))];
|
||||
_cycleScrollView.dataSource = self;
|
||||
_cycleScrollView.delegate = self;
|
||||
_cycleScrollView.minimumCellAlpha = 0.0;
|
||||
_cycleScrollView.leftRightMargin = 16.0f;
|
||||
_cycleScrollView.topBottomMargin = 10.0f;
|
||||
}
|
||||
return _cycleScrollView;
|
||||
}
|
||||
-(QXGiftScrollView *)giftScrollView{
|
||||
if (!_giftScrollView) {
|
||||
_giftScrollView = [[QXGiftScrollView alloc] initWithFrame:CGRectMake(16, self.cycleScrollView.bottom, SCREEN_WIDTH-32, 31)];
|
||||
_giftScrollView.delegate = self;
|
||||
}
|
||||
return _giftScrollView;
|
||||
}
|
||||
-(NSMutableArray *)titles{
|
||||
if (!_titles) {
|
||||
_titles = [NSMutableArray array];
|
||||
}
|
||||
return _titles;
|
||||
}
|
||||
-(NSMutableArray *)bannerArry{
|
||||
if (!_bannerArry) {
|
||||
_bannerArry = [NSMutableArray array];
|
||||
}
|
||||
return _bannerArry;
|
||||
}
|
||||
-(UIButton *)firstRechargeBtn{
|
||||
if (!_firstRechargeBtn) {
|
||||
_firstRechargeBtn = [[UIButton alloc] init];
|
||||
[_firstRechargeBtn setBackgroundImage:[UIImage imageNamed:@"first_recharge_icon"] forState:(UIControlStateNormal)];
|
||||
[_firstRechargeBtn addTarget:self action:@selector(firstAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
}
|
||||
return _firstRechargeBtn;
|
||||
}
|
||||
-(UIButton *)skyDownBtn{
|
||||
if (!_skyDownBtn) {
|
||||
_skyDownBtn = [[UIButton alloc] init];
|
||||
[_skyDownBtn setBackgroundImage:[UIImage imageNamed:@"sky_down_gift_icon"] forState:(UIControlStateNormal)];
|
||||
}
|
||||
return _skyDownBtn;
|
||||
}
|
||||
-(QXFirstRechargePopView *)firstRechargeView{
|
||||
if (!_firstRechargeView) {
|
||||
_firstRechargeView = [[QXFirstRechargePopView alloc] init];
|
||||
}
|
||||
return _firstRechargeView;
|
||||
}
|
||||
|
||||
|
||||
-(QXAppstoreHomeView *)appStoreView{
|
||||
if (!_appStoreView) {
|
||||
_appStoreView = [[QXAppstoreHomeView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight)];
|
||||
}
|
||||
return _appStoreView;
|
||||
}
|
||||
@end
|
||||
21
QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h
Normal file
21
QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// QXRankHomeSubVC.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/3.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "JXCategoryView.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRankHomeSubVC : QXBaseViewController<JXCategoryListContentViewDelegate>
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
/// 1日 2 周 3月
|
||||
@property (nonatomic,strong)NSString *dataType;
|
||||
/// 1 魅力 2 财富 3 房间 4 cp
|
||||
@property (nonatomic,assign)NSInteger rankType;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
251
QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m
Normal file
251
QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m
Normal file
@@ -0,0 +1,251 @@
|
||||
//
|
||||
// QXRankHomeSubVC.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/3.
|
||||
//
|
||||
|
||||
#import "QXRankHomeSubVC.h"
|
||||
#import "QXRankTypeView.h"
|
||||
#import "QXRankListCell.h"
|
||||
#import "QXRankTopThreeView.h"
|
||||
//#import "SRRankListRequest.h"
|
||||
//#import "SRRankListAdapter.h"
|
||||
#import "QXMyRankView.h"
|
||||
#import "QXRankCPListCell.h"
|
||||
#import "QXRankCPTopThreeView.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@interface QXRankHomeSubVC ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)QXRankTypeView *rankTypeView;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic, strong) QXRankTopThreeView *headerView;
|
||||
@property (nonatomic, strong) QXRankCPTopThreeView *cpHeaderView;
|
||||
@property (nonatomic, strong) QXMyRankView *myRankView;
|
||||
@property (nonatomic, strong) NSMutableArray *topDataArray;
|
||||
@end
|
||||
|
||||
@implementation QXRankHomeSubVC
|
||||
-(UIView *)listView{
|
||||
return self.view;
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self initSubViews];
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.bgImageHidden = YES;
|
||||
self.dataType = @"1";
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.rankTypeView];
|
||||
[self.view addSubview:self.myRankView];
|
||||
if (self.rankType == 4) {
|
||||
self.tableView.tableHeaderView = self.cpHeaderView;
|
||||
self.myRankView.isCP = YES;
|
||||
}else{
|
||||
self.myRankView.isCP = NO;
|
||||
self.tableView.tableHeaderView = self.headerView;
|
||||
}
|
||||
[self.view addSubview:self.tableView];
|
||||
[self getRankData];
|
||||
}
|
||||
|
||||
|
||||
-(void)getRankData{
|
||||
MJWeakSelf
|
||||
if (self.rankType == 0) {//房间榜
|
||||
[QXHomePageNetwork rankOfRoomWithType:self.dataType successBlock:^(QXRankModel * _Nonnull model) {
|
||||
[weakSelf.headerView resetView];
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topDataArray removeAllObjects];
|
||||
for (int i = 0; i < model.lists.count; i++) {
|
||||
if (i < 3) {
|
||||
[weakSelf.topDataArray addObject:model.lists[i]];
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:model.lists[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
weakSelf.headerView.roomList = weakSelf.topDataArray;
|
||||
weakSelf.myRankView.roomModel = model.my_ranking;
|
||||
weakSelf.tableView.tableHeaderView = weakSelf.headerView;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}else if (self.rankType == 1){//财富榜
|
||||
[QXHomePageNetwork rankOfCharmWithRankingType:@"1" type:self.dataType page:self.page successBlock:^(QXRankModel * _Nonnull model) {
|
||||
[weakSelf.headerView resetView];
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topDataArray removeAllObjects];
|
||||
for (int i = 0; i < model.lists.count; i++) {
|
||||
if (i < 3) {
|
||||
[weakSelf.topDataArray addObject:model.lists[i]];
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:model.lists[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
weakSelf.headerView.list = weakSelf.topDataArray;
|
||||
weakSelf.myRankView.model = model.my_ranking;
|
||||
weakSelf.tableView.tableHeaderView = weakSelf.headerView;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}else if (self.rankType == 2){//魅力榜
|
||||
[QXHomePageNetwork rankOfCharmWithRankingType:@"2" type:self.dataType page:self.page successBlock:^(QXRankModel * _Nonnull model) {
|
||||
[weakSelf.headerView resetView];
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topDataArray removeAllObjects];
|
||||
for (int i = 0; i < model.lists.count; i++) {
|
||||
if (i < 3) {
|
||||
[weakSelf.topDataArray addObject:model.lists[i]];
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:model.lists[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
weakSelf.headerView.list = weakSelf.topDataArray;
|
||||
weakSelf.myRankView.model = model.my_ranking;
|
||||
weakSelf.tableView.tableHeaderView = weakSelf.headerView;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}else if (self.rankType == 3){//公会榜
|
||||
[QXHomePageNetwork rankOfGuildWithType:self.dataType successBlock:^(QXRankModel * _Nonnull model) {
|
||||
[weakSelf.headerView resetView];
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topDataArray removeAllObjects];
|
||||
for (int i = 0; i < model.lists.count; i++) {
|
||||
if (i < 3) {
|
||||
[weakSelf.topDataArray addObject:model.lists[i]];
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:model.lists[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
weakSelf.headerView.guildList = weakSelf.topDataArray;
|
||||
weakSelf.myRankView.guildModel = model.my_ranking;
|
||||
weakSelf.tableView.tableHeaderView = weakSelf.headerView;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
|
||||
}else{//cp榜
|
||||
[QXHomePageNetwork rankOfRealLoveWithType:self.dataType successBlock:^(QXRankModel * _Nonnull model) {
|
||||
[weakSelf.cpHeaderView resetView];
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topDataArray removeAllObjects];
|
||||
for (int i = 0; i < model.lists.count; i++) {
|
||||
if (i < 3) {
|
||||
[weakSelf.topDataArray addObject:model.lists[i]];
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:model.lists[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
weakSelf.cpHeaderView.list = weakSelf.topDataArray;
|
||||
weakSelf.myRankView.cpModel = model.my_ranking;
|
||||
weakSelf.tableView.tableHeaderView = weakSelf.cpHeaderView;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.rankType == 4) {//CP
|
||||
QXRankCPListCell *cell = [QXRankCPListCell cellWithTableView:tableView];
|
||||
// cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}else{
|
||||
QXRankListCell *cell = [QXRankListCell cellWithTableView:tableView];
|
||||
cell.rankType = self.rankType;
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
// if (self.rankType != 4) {//CP
|
||||
// QXHomeRoomListModel *model = self.dataArray[indexPath.row];
|
||||
// SRPersonalViewController *pvc = [[SRPersonalViewController alloc] initWithUserId:[model.user_id longLongValue]];
|
||||
// pvc.emchatUsername = model.emchat_username;
|
||||
// [self.navigationController pushViewController:pvc animated:YES];
|
||||
// }
|
||||
}
|
||||
-(QXRankTypeView *)rankTypeView{
|
||||
if (!_rankTypeView) {
|
||||
_rankTypeView = [[QXRankTypeView alloc] initWithFrame:CGRectMake(0, kSafeAreaTop+30, SCREEN_WIDTH, 30)];
|
||||
MJWeakSelf
|
||||
_rankTypeView.rankTypeBlock = ^(QXRankType type) {
|
||||
weakSelf.dataType = [NSString stringWithFormat:@"%ld",type];
|
||||
[weakSelf getRankData];
|
||||
};
|
||||
}
|
||||
return _rankTypeView;
|
||||
}
|
||||
-(QXRankTopThreeView *)headerView{
|
||||
if (!_headerView) {
|
||||
_headerView = [[QXRankTopThreeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 230)];
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
-(QXRankCPTopThreeView *)cpHeaderView{
|
||||
if (!_cpHeaderView) {
|
||||
_cpHeaderView = [[QXRankCPTopThreeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 230)];
|
||||
}
|
||||
return _cpHeaderView;
|
||||
}
|
||||
-(QXMyRankView *)myRankView{
|
||||
if (!_myRankView) {
|
||||
_myRankView = [[QXMyRankView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-TabbarContentHeight-60-44, SCREEN_WIDTH, 60)];
|
||||
}
|
||||
return _myRankView;
|
||||
}
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.rankTypeView.bottom+10, SCREEN_WIDTH, self.myRankView.top - self.rankTypeView.bottom-10) style:(UITableViewStyleGrouped)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.rowHeight = 50;
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf getRankData];
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)topDataArray{
|
||||
if (!_topDataArray) {
|
||||
_topDataArray = [NSMutableArray array] ;
|
||||
}
|
||||
return _topDataArray;
|
||||
}
|
||||
@end
|
||||
16
QXLive/HomePage(声播)/Controlller/QXRankHomeVC.h
Normal file
16
QXLive/HomePage(声播)/Controlller/QXRankHomeVC.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRankHomeVC.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/3.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRankHomeVC : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
80
QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m
Normal file
80
QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// QXRankHomeVC.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/3.
|
||||
//
|
||||
|
||||
#import "QXRankHomeVC.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRankHomeSubVC.h"
|
||||
|
||||
@interface QXRankHomeVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
||||
@property (nonatomic,strong)NSArray*titles;
|
||||
@end
|
||||
|
||||
@implementation QXRankHomeVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"];
|
||||
self.listVCArray = [NSMutableArray array];
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake(0, 0, SCREEN_WIDTH-100, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = self.titles;
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#999999"];
|
||||
JXCategoryIndicatorImageView *indicatorImageView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
indicatorImageView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
||||
indicatorImageView.indicatorWidth = (SCREEN_WIDTH-100)/5.0;
|
||||
indicatorImageView.indicatorHeight = 5;
|
||||
self.categoryView.indicators = @[indicatorImageView];
|
||||
self.categoryView.cellWidth = (SCREEN_WIDTH-100)/5.0;
|
||||
self.categoryView.contentEdgeInsetLeft = 0;
|
||||
self.categoryView.cellSpacing = 0;
|
||||
self.categoryView.titleLabelZoomScale = 1.1;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.titleFont = [UIFont systemFontOfSize:14];
|
||||
self.categoryView.averageCellSpacingEnabled = NO;
|
||||
|
||||
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
||||
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
|
||||
self.navigationItem.titleView = self.categoryView;
|
||||
[self.view addSubview:self.containerView];
|
||||
self.categoryView.listContainer = self.containerView;
|
||||
}
|
||||
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return self.titles.count;
|
||||
}
|
||||
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXRankHomeSubVC *vc = [[QXRankHomeSubVC alloc] init];
|
||||
vc.rankType = index;
|
||||
return vc;
|
||||
}
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
16
QXLive/HomePage(声播)/Controlller/QXSearchViewController.h
Normal file
16
QXLive/HomePage(声播)/Controlller/QXSearchViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXSearchViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/8.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSearchViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
145
QXLive/HomePage(声播)/Controlller/QXSearchViewController.m
Normal file
145
QXLive/HomePage(声播)/Controlller/QXSearchViewController.m
Normal file
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// QXSearchViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/8.
|
||||
//
|
||||
|
||||
#import "QXSearchViewController.h"
|
||||
#import "ZLCollectionViewVerticalLayout.h"
|
||||
#import "QXSearchTopView.h"
|
||||
#import "QXSearchHeaderView.h"
|
||||
#import "QXSearchCell.h"
|
||||
#import "QXFileManager.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXSearchModel.h"
|
||||
#import "QXHomeSearchResultVC.h"
|
||||
|
||||
@interface QXSearchViewController ()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource,ZLCollectionViewBaseFlowLayoutDelegate,QXSearchTopViewDelegate>
|
||||
@property(nonatomic,strong)UICollectionView* collectionView;
|
||||
@property(nonatomic,strong)QXSearchTopView *topView;
|
||||
|
||||
@property(nonatomic,strong)NSMutableArray *resultArray;
|
||||
@end
|
||||
|
||||
@implementation QXSearchViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
}
|
||||
- (void)initSubViews{
|
||||
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.collectionView];
|
||||
[self getHistoryData];
|
||||
}
|
||||
-(void)getHistoryData{
|
||||
self.dataArray = [NSMutableArray arrayWithArray:[QXFileManager getSearchHistory]];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
#pragma mark - QXSearchTopViewDelegate
|
||||
-(void)didClickCancel{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
-(void)didClickSearchWithKeywords:(NSString *)keywords{
|
||||
// 搜索
|
||||
[QXFileManager writeSearchHistoryWithContent:keywords];
|
||||
self.dataArray = [NSMutableArray arrayWithArray:[QXFileManager getSearchHistory]];
|
||||
[self.collectionView reloadData];
|
||||
[self searchActionWithKeywords:keywords];
|
||||
}
|
||||
|
||||
-(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) {
|
||||
showToast(@"暂无搜索结果");
|
||||
return;
|
||||
}
|
||||
[weakSelf.resultArray addObjectsFromArray:arr];
|
||||
[weakSelf pushToResultVC];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)pushToResultVC{
|
||||
QXHomeSearchResultVC *vc = [[QXHomeSearchResultVC alloc] init];
|
||||
vc.resultArray = self.resultArray;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSearchCell *cell = [QXSearchCell cellWithCollectionView:collectionView forIndexPath:indexPath];
|
||||
cell.titleLabel.text = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return CGSizeMake([self.dataArray[indexPath.row] boundingRectWithSize:CGSizeMake(1000000, 22) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:12]} context:nil].size.width + 20, 22);
|
||||
}
|
||||
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
|
||||
if ([kind isEqualToString : UICollectionElementKindSectionHeader]){
|
||||
QXSearchHeaderView* headerView = [QXSearchHeaderView headerViewWithCollectionView:collectionView forIndexPath:indexPath];
|
||||
headerView.title = QXText(@"历史记录");
|
||||
return headerView;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
|
||||
return CGSizeMake(SCREEN_WIDTH, 24);
|
||||
}
|
||||
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
|
||||
return UIEdgeInsetsMake(12, 16, 12, 16);
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
NSString *keywords = self.dataArray[indexPath.row];
|
||||
[self searchActionWithKeywords:keywords];
|
||||
}
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
ZLCollectionViewVerticalLayout *flowLayout = [[ZLCollectionViewVerticalLayout alloc] init];
|
||||
flowLayout.delegate = self;
|
||||
flowLayout.canDrag = NO;
|
||||
flowLayout.isFloor = NO;
|
||||
flowLayout.header_suspension = NO;
|
||||
flowLayout.columnSortType = Sequence;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.topView.bottom+12, SCREEN_WIDTH, SCREEN_HEIGHT-self.topView.bottom-12) collectionViewLayout:flowLayout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[QXSearchHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:[QXSearchHeaderView headerViewIdentifier]];
|
||||
[_collectionView registerClass:[QXSearchCell class] forCellWithReuseIdentifier:[QXSearchCell cellIdentifier]];
|
||||
_collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
-(QXSearchTopView *)topView{
|
||||
if (!_topView) {
|
||||
_topView = [[QXSearchTopView alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, SCREEN_WIDTH, NavHeight)];
|
||||
_topView.delegate = self;
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
-(NSMutableArray *)resultArray{
|
||||
if (!_resultArray) {
|
||||
_resultArray = [NSMutableArray array];
|
||||
}
|
||||
return _resultArray;
|
||||
}
|
||||
|
||||
@end
|
||||
18
QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h
Normal file
18
QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXRoomViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
/// 是否为最小化房间进来
|
||||
@property (nonatomic,assign)BOOL isReJoin;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
1732
QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
Normal file
1732
QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
Normal file
File diff suppressed because it is too large
Load Diff
27
QXLive/HomePage(声播)/Model/QXBanner.h
Normal file
27
QXLive/HomePage(声播)/Model/QXBanner.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// QXBanner.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/11.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXBanner : NSObject
|
||||
//ID
|
||||
@property (nonatomic,strong)NSString *bid;
|
||||
//跳转地址id
|
||||
@property (nonatomic,strong)NSString *aid;
|
||||
/// 1纯展示 2文章 3房间 4个人主页
|
||||
@property (nonatomic,strong)NSString *type;
|
||||
/// 1站内引导页 2启动引导页 3首页轮播
|
||||
@property (nonatomic,strong)NSString *show_type;
|
||||
//页面
|
||||
@property (nonatomic,strong)NSString *image;
|
||||
/// type = 2 的跳转地址
|
||||
@property (nonatomic,strong)NSString *url;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
12
QXLive/HomePage(声播)/Model/QXBanner.m
Normal file
12
QXLive/HomePage(声播)/Model/QXBanner.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// QXBanner.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/11.
|
||||
//
|
||||
|
||||
#import "QXBanner.h"
|
||||
|
||||
@implementation QXBanner
|
||||
|
||||
@end
|
||||
50
QXLive/HomePage(声播)/Model/QXRankModel.h
Normal file
50
QXLive/HomePage(声播)/Model/QXRankModel.h
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// QXRankModel.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/10.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXMyRankModel;
|
||||
@interface QXRankModel : NSObject
|
||||
/// 我的排行
|
||||
@property (nonatomic,strong)QXMyRankModel *my_ranking;
|
||||
@property (nonatomic,strong)NSArray<QXMyRankModel *>* lists;
|
||||
@end
|
||||
|
||||
@interface QXMyRankModel : NSObject
|
||||
@property (nonatomic,strong)NSString* avatar;
|
||||
@property (nonatomic,strong)NSString* nickname;
|
||||
@property (nonatomic,strong)NSString* user_id;
|
||||
@property (nonatomic,strong)NSString* user_code;
|
||||
@property (nonatomic,strong)NSString* sex;
|
||||
@property (nonatomic,strong)NSArray* icon;
|
||||
@property (nonatomic,strong)NSString* total;
|
||||
@property (nonatomic,strong)NSString* rank;
|
||||
@property (nonatomic,strong)NSString* diff;
|
||||
|
||||
/// 房间
|
||||
@property (nonatomic,strong)NSString* room_name;
|
||||
@property (nonatomic,strong)NSString* room_id;
|
||||
@property (nonatomic,strong)NSString* room_cover;
|
||||
@property (nonatomic,strong)NSString* room_number;
|
||||
|
||||
/// 公会
|
||||
@property (nonatomic,strong)NSString* cover;
|
||||
@property (nonatomic,strong)NSString* guild_name;
|
||||
@property (nonatomic,strong)NSString* guild_special_id;
|
||||
@property (nonatomic,strong)NSString* id;
|
||||
|
||||
/// cp
|
||||
@property (nonatomic,strong)NSString* user_id1;
|
||||
@property (nonatomic,strong)NSString* nickname1;
|
||||
|
||||
@property (nonatomic,strong)NSString* user_avatar;
|
||||
@property (nonatomic,strong)NSString* user_avatar1;
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
24
QXLive/HomePage(声播)/Model/QXRankModel.m
Normal file
24
QXLive/HomePage(声播)/Model/QXRankModel.m
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// QXRankModel.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/10.
|
||||
//
|
||||
|
||||
#import "QXRankModel.h"
|
||||
|
||||
@implementation QXRankModel
|
||||
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{
|
||||
@"my_ranking" : @"QXMyRankModel",
|
||||
@"lists": @"QXMyRankModel"
|
||||
};
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXMyRankModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
37
QXLive/HomePage(声播)/Model/QXSearchModel.h
Normal file
37
QXLive/HomePage(声播)/Model/QXSearchModel.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// QXSearchModel.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
/**
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"picture": "string",
|
||||
"code": "string",
|
||||
"icon": [
|
||||
"string"
|
||||
]
|
||||
*/
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSearchModel : NSObject
|
||||
//ID
|
||||
@property (nonatomic,strong)NSString *id;
|
||||
//名称
|
||||
@property (nonatomic,strong)NSString *name;
|
||||
//头像
|
||||
@property (nonatomic,strong)NSString *picture;
|
||||
// 显示code
|
||||
@property (nonatomic,strong)NSString *code;
|
||||
//
|
||||
@property (nonatomic,strong)NSArray *icon;
|
||||
|
||||
@property (nonatomic,strong)NSString *label_icon;
|
||||
|
||||
@property (nonatomic,strong)NSString *hot_value;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
12
QXLive/HomePage(声播)/Model/QXSearchModel.m
Normal file
12
QXLive/HomePage(声播)/Model/QXSearchModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// QXSearchModel.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/21.
|
||||
//
|
||||
|
||||
#import "QXSearchModel.h"
|
||||
|
||||
@implementation QXSearchModel
|
||||
|
||||
@end
|
||||
84
QXLive/HomePage(声播)/Services/QXHomePageNetwork.h
Normal file
84
QXLive/HomePage(声播)/Services/QXHomePageNetwork.h
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// QXHomePageNetwork.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "QXRoomListModel.h"
|
||||
#import "QXBanner.h"
|
||||
#import "QXRankModel.h"
|
||||
#import "QXGiftModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHomePageNetwork : NSObject
|
||||
/**
|
||||
首页房间列表
|
||||
*/
|
||||
+(void)homeRoomListWithPage:(NSInteger)page
|
||||
is_top:(BOOL)is_top
|
||||
label_id:(NSString*)label_id
|
||||
successBlock:(void (^)(NSArray<QXRoomListModel*>* list,BOOL isAppStore))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
首页标签列表
|
||||
*/
|
||||
+(void)homeRoomLabelListsuccessBlock:(void (^)(NSArray<QXMyRoomType*>* list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
首页banner
|
||||
*/
|
||||
+(void)homeBannerSuccessBlock:(void (^)(NSArray<QXBanner*>* list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
魅力/财富榜
|
||||
ranking_type 1财富 2魅力
|
||||
type 1日榜;2本周榜;3月榜;
|
||||
*/
|
||||
+(void)rankOfCharmWithRankingType:(NSString*)ranking_type
|
||||
type:(NSString*)type
|
||||
page:(NSInteger)page
|
||||
successBlock:(void (^)(QXRankModel*model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
/**
|
||||
房间榜
|
||||
type 1日榜;2本周榜;3月榜;
|
||||
*/
|
||||
+(void)rankOfRoomWithType:(NSString*)type
|
||||
successBlock:(void (^)(QXRankModel*model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
公会榜
|
||||
type 1日榜;2本周榜;3月榜;
|
||||
*/
|
||||
+(void)rankOfGuildWithType:(NSString*)type
|
||||
successBlock:(void (^)(QXRankModel*model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
真爱榜
|
||||
*/
|
||||
+(void)rankOfRealLoveWithType:(NSString*)type
|
||||
successBlock:(void (^)(QXRankModel*model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
/**
|
||||
首充礼物
|
||||
*/
|
||||
+(void)getFirstRechargeGiftListSuccessBlock:(void (^)(NSArray<QXFirstRechargeModel*> *list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
首充礼物权限
|
||||
*/
|
||||
+(void)getFirstRechargePermissionSuccessBlock:(void (^)(BOOL isShow))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
138
QXLive/HomePage(声播)/Services/QXHomePageNetwork.m
Normal file
138
QXLive/HomePage(声播)/Services/QXHomePageNetwork.m
Normal file
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// QXHomePageNetwork.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@implementation QXHomePageNetwork
|
||||
+(void)homeRoomLabelListsuccessBlock:(void (^)(NSArray<QXMyRoomType *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXHomeRoomTypeList parameters:@{} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
NSArray *list = [NSArray yy_modelArrayWithClass:[QXMyRoomType class] json:responseObject[@"data"]];
|
||||
successBlock(list);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)homeRoomListWithPage:(NSInteger)page is_top:(BOOL)is_top label_id:(NSString *)label_id successBlock:(nonnull void (^)(NSArray<QXRoomListModel *> * _Nonnull, BOOL))successBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"page":[NSNumber numberWithInteger:page],
|
||||
@"is_top":is_top?@"2":@"1",
|
||||
@"label_id":label_id
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXHomeRoomList parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
BOOL api_version = [responseObject[@"api_version"] boolValue];
|
||||
NSArray *list = [NSArray yy_modelArrayWithClass:[QXRoomListModel class] json:responseObject[@"data"]];
|
||||
successBlock(list,api_version);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
+(void)homeBannerSuccessBlock:(void (^)(NSArray<QXBanner*>* list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXHomeBanner parameters:@{@"type":@"3"} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
NSArray *list = [NSArray yy_modelArrayWithClass:[QXBanner class] json:responseObject[@"data"]];
|
||||
successBlock(list);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)rankOfCharmWithRankingType:(NSString *)ranking_type type:(NSString *)type page:(NSInteger)page successBlock:(void (^)(QXRankModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"page":[NSNumber numberWithInteger:page],
|
||||
@"ranking_type":ranking_type?ranking_type:@"",
|
||||
@"type":type?type:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXHomeCharmRank parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXRankModel *model = [QXRankModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)rankOfRoomWithType:(NSString *)type successBlock:(void (^)(QXRankModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"type":type?type:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXHomeRoomRank parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXRankModel *model = [QXRankModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)rankOfGuildWithType:(NSString *)type successBlock:(void (^)(QXRankModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"type":type?type:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXHomeGuildRank parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXRankModel *model = [QXRankModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)rankOfRealLoveWithType:(NSString *)type successBlock:(void (^)(QXRankModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"type":type?type:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXHomeLoveRank parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXRankModel *model = [QXRankModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)getFirstRechargeGiftListSuccessBlock:(void (^)(NSArray<QXFirstRechargeModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
|
||||
[[QXRequset shareInstance] getWithUrl:QXAppFirstRechargeGiftList parameters:@{} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
NSArray *list = [NSArray yy_modelArrayWithClass:[QXFirstRechargeModel class] json:responseObject[@"data"][@"gift_bag"]];
|
||||
successBlock(list);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
+(void)getFirstRechargePermissionSuccessBlock:(void (^)(BOOL))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXAppFirstRechargePermission parameters:@{} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
BOOL api_version = [responseObject[@"api_version"] boolValue];
|
||||
if (api_version == NO) {
|
||||
successBlock(YES);
|
||||
}else{
|
||||
BOOL permission = [responseObject[@"date"][@"permission"] boolValue];
|
||||
successBlock(permission);
|
||||
}
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
/// 首充好礼礼物列表
|
||||
//static NSString * QXAppFirstRechargeGiftList = @"api/Activities/first_charge_gift";
|
||||
/// 首充好礼弹框权限
|
||||
//static NSString * QXAppFirstRechargePermission = @"api/Activities/first_charge_gift_permission";
|
||||
@end
|
||||
34
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKResultView.h
Normal file
34
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKResultView.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// QXRoomPKResultView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// pk胜利
|
||||
QXRoomPKResulttTypeVictory = 0,
|
||||
/// pk失败
|
||||
QXRoomPKResulttTypeDefeated,
|
||||
/// 平局
|
||||
QXRoomPKResulttTypeTie,
|
||||
}QXRoomPKResulttType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomPKResultView : UIView
|
||||
-(instancetype)initWithType:(QXRoomPKResulttType)type;
|
||||
|
||||
@property (nonatomic,assign)QXRoomPKResulttType type;
|
||||
|
||||
|
||||
-(void)setResultWithVictory_name:(NSString*)victory_name
|
||||
victory_cover:(NSString*)victory_cover
|
||||
defeated_name:(NSString*)defeated_name
|
||||
defeated_cover:(NSString*)defeated_cover;
|
||||
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
176
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKResultView.m
Normal file
176
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKResultView.m
Normal file
@@ -0,0 +1,176 @@
|
||||
//
|
||||
// QXRoomPKResultView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import "QXRoomPKResultView.h"
|
||||
#import "QXTimer.h"
|
||||
|
||||
@interface QXRoomPKResultView()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UIImageView *victoryHeader;
|
||||
@property (nonatomic,strong)UILabel *victoryNameLabel;
|
||||
@property (nonatomic,strong)UIImageView *victoryImageView;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *defeatedHeader;
|
||||
@property (nonatomic,strong)UILabel *defeatedNameLabel;
|
||||
@property (nonatomic,strong)UIImageView *defeatedImageView;
|
||||
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@end
|
||||
|
||||
@implementation QXRoomPKResultView
|
||||
|
||||
- (instancetype)initWithType:(QXRoomPKResulttType)type
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_type = type;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, (SCREEN_HEIGHT-SCREEN_WIDTH)/2, SCREEN_WIDTH, SCREEN_WIDTH)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] init];
|
||||
self.bgImageView.frame = CGRectMake(0, 0, self.bgView.width, ScaleWidth(248));
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
self.victoryHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.victoryHeader.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.victoryHeader.frame = CGRectMake(ScaleWidth(34), ScaleWidth(85), ScaleWidth(50), ScaleWidth(50));
|
||||
[self.victoryHeader addRoundedCornersWithRadius:ScaleWidth(25)];
|
||||
[self.bgView addSubview:self.victoryHeader];
|
||||
|
||||
// room_pk_victory
|
||||
self.victoryNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.victoryHeader.left-ScaleWidth(18), self.victoryHeader.bottom+5, ScaleWidth(50+36), 20)];
|
||||
self.victoryNameLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.victoryNameLabel.textColor = [UIColor whiteColor];
|
||||
self.victoryNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.victoryNameLabel.text = @"张三";
|
||||
[self.bgView addSubview:self.victoryNameLabel];
|
||||
|
||||
self.victoryImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.victoryHeader.bottom-ScaleWidth(17)+5, ScaleWidth(15), ScaleWidth(17))];
|
||||
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_victory"];
|
||||
[self.bgView addSubview:self.victoryImageView];
|
||||
self.victoryImageView.centerX = self.victoryHeader.centerX;
|
||||
|
||||
self.defeatedHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.defeatedHeader.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.defeatedHeader.frame = CGRectMake(self.bgView.width-ScaleWidth(34+50), self.bgImageView.bottom-ScaleWidth(50+55), ScaleWidth(50), ScaleWidth(50));
|
||||
[self.defeatedHeader addRoundedCornersWithRadius:ScaleWidth(25)];
|
||||
[self.bgView addSubview:self.defeatedHeader];
|
||||
|
||||
self.defeatedNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.defeatedHeader.left-ScaleWidth(18), self.defeatedHeader.bottom+5, ScaleWidth(50+36), 20)];
|
||||
self.defeatedNameLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.defeatedNameLabel.textColor = [UIColor whiteColor];
|
||||
self.defeatedNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.defeatedNameLabel.text = @"李四";
|
||||
[self.bgView addSubview:self.defeatedNameLabel];
|
||||
|
||||
self.defeatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.defeatedHeader.bottom-ScaleWidth(17)+5, ScaleWidth(15), ScaleWidth(17))];
|
||||
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
|
||||
self.defeatedImageView.centerX = self.defeatedHeader.centerX;
|
||||
[self.bgView addSubview:self.defeatedImageView];
|
||||
|
||||
[self setType:_type];
|
||||
}
|
||||
|
||||
-(void)setType:(QXRoomPKResulttType)type{
|
||||
_type = type;
|
||||
NSString *imageName = @"";
|
||||
switch (_type) {
|
||||
case QXRoomPKResulttTypeVictory:
|
||||
imageName = @"room_pk_result_victory";
|
||||
break;
|
||||
case QXRoomPKResulttTypeDefeated:
|
||||
imageName = @"room_pk_result_defeated";
|
||||
break;
|
||||
case QXRoomPKResulttTypeTie:
|
||||
imageName = @"room_pk_result_tie";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
self.bgImageView.image = [UIImage imageNamed:imageName];
|
||||
}
|
||||
|
||||
-(void)setResultWithVictory_name:(NSString *)victory_name
|
||||
victory_cover:(NSString *)victory_cover
|
||||
defeated_name:(NSString *)defeated_name
|
||||
defeated_cover:(NSString *)defeated_cover{
|
||||
switch (self.type) {
|
||||
case QXRoomPKResulttTypeVictory:{
|
||||
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
|
||||
self.victoryNameLabel.text = victory_name;
|
||||
self.victoryImageView.hidden = NO;
|
||||
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_victory"];
|
||||
|
||||
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
|
||||
self.defeatedNameLabel.text = defeated_name;
|
||||
self.defeatedImageView.hidden = NO;
|
||||
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
|
||||
}
|
||||
break;
|
||||
case QXRoomPKResulttTypeDefeated:{
|
||||
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
|
||||
self.victoryNameLabel.text = defeated_name;
|
||||
self.victoryImageView.hidden = NO;
|
||||
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
|
||||
|
||||
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
|
||||
self.defeatedNameLabel.text = victory_name;
|
||||
self.defeatedImageView.hidden = NO;
|
||||
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_victory"];
|
||||
}
|
||||
break;
|
||||
case QXRoomPKResulttTypeTie:{
|
||||
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
|
||||
self.victoryNameLabel.text = victory_name;
|
||||
self.victoryImageView.hidden = YES;
|
||||
|
||||
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
|
||||
self.defeatedNameLabel.text = defeated_name;
|
||||
self.defeatedImageView.hidden = YES;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
MJWeakSelf
|
||||
__block int timeCount = 3;
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[weakSelf hide];
|
||||
}
|
||||
}];
|
||||
self.bgView.alpha = 0;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
self.bgView.alpha = 1;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
if (_timer) {
|
||||
[self->_timer invalidate];
|
||||
_timer = nil;
|
||||
}
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
19
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSearchView.h
Normal file
19
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSearchView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXRoomPKSearchView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/2.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomPKSearchView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
227
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSearchView.m
Normal file
227
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSearchView.m
Normal file
@@ -0,0 +1,227 @@
|
||||
//
|
||||
// QXRoomPKSearchView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/2.
|
||||
//
|
||||
|
||||
#import "QXRoomPKSearchView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAddDirectCell.h"
|
||||
#import "UIButton+QX.h"
|
||||
#import "QXRoomPKSetView.h"
|
||||
|
||||
@interface QXRoomPKSearchView()<UIGestureRecognizerDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource,QXDirectDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *setBtn;
|
||||
@property (nonatomic,strong)UIButton *pkBtn;
|
||||
@property (nonatomic,strong)UIView *seachBgView;
|
||||
@property (nonatomic,strong)UIImageView *searchImageView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
|
||||
@property (nonatomic,strong)UILabel*sectionLabel;
|
||||
@property (nonatomic,strong)UITableView*tableView;
|
||||
@property (nonatomic,strong)NSMutableArray*dataArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
|
||||
@property (nonatomic,strong)QXRoomPKSetView *pkSetView;
|
||||
@end
|
||||
@implementation QXRoomPKSearchView
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"发起直播对战";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.setBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50-6, 7, 50, 44)];
|
||||
[self.setBtn setTitle:@"设置" forState:(UIControlStateNormal)];
|
||||
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.setBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
[self.setBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:RGB16(0x999999)] forState:(UIControlStateNormal)];
|
||||
[self.setBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.setBtn];
|
||||
|
||||
self.pkBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.titleLabel.bottom+12, 50, 35)];
|
||||
[self.pkBtn setBackgroundImage:[UIImage imageNamed:@"room_pk_random_icon"] forState:(UIControlStateNormal)];
|
||||
[self.pkBtn addTarget:self action:@selector(pkAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.pkBtn];
|
||||
|
||||
|
||||
self.seachBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+12, SCREEN_WIDTH-16-74, 35)];
|
||||
self.seachBgView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
|
||||
self.seachBgView.layer.masksToBounds = YES;
|
||||
self.seachBgView.layer.cornerRadius = 17.5;
|
||||
[self.bgView addSubview:self.seachBgView];
|
||||
|
||||
self.searchImageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5.5, 24, 24)];
|
||||
self.searchImageView.image = [UIImage imageNamed:@"room_song_search"];
|
||||
[self.seachBgView addSubview:self.searchImageView];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchImageView.right+6, 0, self.seachBgView.width-self.searchImageView.right-6-8, 35)];
|
||||
self.textField.placeholder = @"请根据房间ID搜索";
|
||||
self.textField.font = [UIFont systemFontOfSize:14];
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
self.textField.delegate = self;
|
||||
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.seachBgView addSubview:self.textField];
|
||||
|
||||
|
||||
self.sectionLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.seachBgView.bottom+5, 300, 20)];
|
||||
self.sectionLabel.text = @"为你推荐";
|
||||
self.sectionLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.sectionLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.sectionLabel];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.sectionLabel.bottom+5, self.width, self.bgView.height-5-self.sectionLabel.bottom) style:(UITableViewStylePlain)];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomPkSearchWithRoomId:@"" page:1 successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setAction{
|
||||
[self hide];
|
||||
[self.pkSetView showInView:self.viewController.view];
|
||||
}
|
||||
-(void)pkAction{
|
||||
[self hide];
|
||||
[self sendPKWithRoomId:@""];;
|
||||
}
|
||||
|
||||
-(void)textDidChange:(UITextField*)textField{
|
||||
MJWeakSelf
|
||||
self.sectionLabel.hidden = YES;
|
||||
self.page = 1;
|
||||
[QXMineNetwork roomPkSearchWithRoomId:textField.text page:self.page successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITextFieldDelegate
|
||||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = kSafeAreaTop+90;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXAddDirectCell *cell = [QXAddDirectCell cellWithTableView:tableView];
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
cell.roomModel = model;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 52;
|
||||
}
|
||||
|
||||
- (void)sendPKWithRoomId:(NSString *)roomId{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomSendPkRoomId:self.roomId create_user_id:[QXGlobal shareGlobal].loginModel.user_id room_id_b:roomId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomPkSearchWithRoomId:@"" page:1 successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(QXRoomPKSetView *)pkSetView{
|
||||
if (!_pkSetView) {
|
||||
_pkSetView = [[QXRoomPKSetView alloc] init];
|
||||
}
|
||||
return _pkSetView;
|
||||
}
|
||||
@end
|
||||
19
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSetView.h
Normal file
19
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSetView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXRoomPKSetView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomPKSetView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,strong)NSString *is_pk;
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
149
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSetView.m
Normal file
149
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKSetView.m
Normal file
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// QXRoomPKSetView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import "QXRoomPKSetView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomPKSetView()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
|
||||
@property (nonatomic,strong)UILabel *firstLabel;
|
||||
@property (nonatomic,strong)UISwitch *firstSwitch;
|
||||
|
||||
@property (nonatomic,strong)UILabel *secondLabel;
|
||||
@property (nonatomic,strong)UISwitch *secondSwitch;
|
||||
@end
|
||||
@implementation QXRoomPKSetView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(300))/2, -self.height, ScaleWidth(300), ScaleWidth(200))];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)];
|
||||
self.titleLabel.text = @"发起直播对战";
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50, 0, 50, 50)];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(hide) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.bgView addSubview:self.closeBtn];
|
||||
|
||||
|
||||
|
||||
self.firstSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.titleLabel.bottom+27, 50, 31)];
|
||||
self.firstSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.firstSwitch addRoundedCornersWithRadius:15.5];
|
||||
self.firstSwitch.onTintColor = QXConfig.themeColor;
|
||||
self.firstSwitch.thumbTintColor = [UIColor whiteColor];
|
||||
[self.firstSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.bgView addSubview:self.firstSwitch];
|
||||
|
||||
self.firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+27, self.firstSwitch.left-16, 31)];
|
||||
self.firstLabel.text = @"不再接收好友邀请";
|
||||
self.firstLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.firstLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.firstLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.firstLabel];
|
||||
|
||||
|
||||
// self.secondSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.firstSwitch.bottom+20, 50, 31)];
|
||||
// self.secondSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
// [self.secondSwitch addRoundedCornersWithRadius:15.5];
|
||||
// self.secondSwitch.onTintColor = QXConfig.themeColor;
|
||||
// self.secondSwitch.thumbTintColor = [UIColor whiteColor];
|
||||
// [self.secondSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
|
||||
// [self.bgView addSubview:self.secondSwitch];
|
||||
//
|
||||
// self.secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.firstSwitch.bottom+20, self.secondSwitch.left-16, 31)];
|
||||
// self.secondLabel.text = @"不再接收推荐邀请";
|
||||
// self.secondLabel.textAlignment = NSTextAlignmentLeft;
|
||||
// self.secondLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
// self.secondLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
// [self.bgView addSubview:self.secondLabel];
|
||||
}
|
||||
|
||||
-(void)setIs_pk:(NSString *)is_pk{
|
||||
_is_pk = is_pk;
|
||||
if (is_pk.intValue == 1) {
|
||||
[self.firstSwitch setOn:YES animated:YES];
|
||||
}else{
|
||||
[self.firstSwitch setOn:NO animated:YES];
|
||||
}
|
||||
}
|
||||
-(void)eventSwitch:(UISwitch*)sender{
|
||||
// BOOL isLock = NO;
|
||||
// if (self.settingType == QXRoomSeatSettingMuteMic || self.settingType == QXRoomSeatSettingHugMic) {
|
||||
// isLock = NO;
|
||||
// }else{
|
||||
// isLock = YES;
|
||||
// }
|
||||
// MJWeakSelf
|
||||
BOOL isOn = sender.isOn;
|
||||
// [QXMineNetwork roomPitLockOrMuteIsLock:isLock roomId:self.roomId pit_number:self.pitModel.pit_number.integerValue is_mute:isOn successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
// if (isOn) {
|
||||
// [sender setOn:YES animated:YES];
|
||||
// }else{
|
||||
// [sender setOn:NO animated:YES];
|
||||
// }
|
||||
// if (isLock) {
|
||||
// weakSelf.pitModel.is_lock = isOn?@"1":@"0";
|
||||
// }else{
|
||||
// weakSelf.pitModel.is_mute = isOn?@"1":@"0";
|
||||
// }
|
||||
// if (weakSelf.setSuccessBlock) {
|
||||
// weakSelf.setSuccessBlock(weakSelf.pitModel);
|
||||
// }
|
||||
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
// [self.eventSwitch setOn:self.isOn animated:YES];
|
||||
// }];
|
||||
//
|
||||
[QXMineNetwork noAgreePKInvite:isOn?@"1":@"2" room_id:self.roomId successBlock:^(NSString * _Nonnull token) {
|
||||
if (isOn) {
|
||||
[sender setOn:YES animated:YES];
|
||||
}else{
|
||||
[sender setOn:NO animated:YES];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(200))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
18
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKTimeSetView.h
Normal file
18
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKTimeSetView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXRoomPKTimeSetView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomPKTimeSetView : UIView
|
||||
@property (nonatomic,strong)NSString *pkId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
229
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKTimeSetView.m
Normal file
229
QXLive/HomePage(声播)/View/房间/PK/QXRoomPKTimeSetView.m
Normal file
@@ -0,0 +1,229 @@
|
||||
//
|
||||
// QXRoomPKTimeSetView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/3.
|
||||
//
|
||||
|
||||
#import "QXRoomPKTimeSetView.h"
|
||||
#import "QXSelectAuctionInfoView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomPKTimeSetView()<UIGestureRecognizerDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UITextFieldDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXRoomRelationModel *timeModel;
|
||||
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
@property (nonatomic,strong)UIView *line;
|
||||
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@end
|
||||
|
||||
@implementation QXRoomPKTimeSetView
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"请选择PK时长";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 12;
|
||||
layout.minimumInteritemSpacing = 12;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
// layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, self.bgView.width,self.bgView.height-12-42-self.titleLabel.bottom ) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.showsVerticalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
|
||||
QXRoomRelationModel *time1 = [[QXRoomRelationModel alloc] init];
|
||||
time1.name = @"5分钟";
|
||||
time1.relation_id = @"5";
|
||||
[self.dataArray addObject:time1];
|
||||
|
||||
QXRoomRelationModel *time2 = [[QXRoomRelationModel alloc] init];
|
||||
time2.name = @"10分钟";
|
||||
time2.relation_id = @"10";
|
||||
[self.dataArray addObject:time2];
|
||||
|
||||
QXRoomRelationModel *time3 = [[QXRoomRelationModel alloc] init];
|
||||
time3.name = @"15分钟";
|
||||
time3.relation_id = @"15";
|
||||
[self.dataArray addObject:time3];
|
||||
|
||||
QXRoomRelationModel *time4 = [[QXRoomRelationModel alloc] init];
|
||||
time4.name = @"20分钟";
|
||||
time4.relation_id = @"20";
|
||||
[self.dataArray addObject:time4];
|
||||
|
||||
QXRoomRelationModel *time5 = [[QXRoomRelationModel alloc] init];
|
||||
time5.name = @"25分钟";
|
||||
time5.relation_id = @"25";
|
||||
[self.dataArray addObject:time5];
|
||||
|
||||
QXRoomRelationModel *time6 = [[QXRoomRelationModel alloc] init];
|
||||
time6.name = @"30分钟";
|
||||
time6.relation_id = @"30";
|
||||
[self.dataArray addObject:time6];
|
||||
|
||||
QXRoomRelationModel *time7 = [[QXRoomRelationModel alloc] init];
|
||||
time7.name = @"35分钟";
|
||||
time7.relation_id = @"35";
|
||||
[self.dataArray addObject:time7];
|
||||
|
||||
QXRoomRelationModel *time8 = [[QXRoomRelationModel alloc] init];
|
||||
time8.name = @"40分钟";
|
||||
time8.relation_id = @"40";
|
||||
[self.dataArray addObject:time8];
|
||||
|
||||
// self.textField = [[UITextField alloc] initWithFrame:CGRectMake(16, self.collectionView.bottom+10, self.bgView.width-32, 30)];
|
||||
// self.textField.font = [UIFont systemFontOfSize:14];
|
||||
// self.textField.textColor = RGB16(0x333333);
|
||||
// self.textField.placeholder = @"请输入自定义时间,最少5分钟";
|
||||
// self.textField.delegate = self;
|
||||
// self.textField.returnKeyType = UIReturnKeyDone;
|
||||
// [self.bgView addSubview:self.textField];
|
||||
//
|
||||
// self.line = [[UIView alloc] initWithFrame:CGRectMake(16, self.textField.bottom, self.bgView.width-32, 1)];
|
||||
// self.line.backgroundColor = RGB16(0x999999);
|
||||
// [self.bgView addSubview:self.line];
|
||||
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, 95 , 42)];
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cancelBtn.backgroundColor = RGB16(0x333333);
|
||||
[self.bgView addSubview:self.cancelBtn];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.bgView.height-kSafeAreaBottom-42, self.bgView.width-38-self.cancelBtn.right-16, 42)];
|
||||
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)commitAction{
|
||||
if (self.timeModel == nil) {
|
||||
showToast(@"请选择PK时长");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomPkStartWithPk_id:self.pkId pk_times:self.timeModel.relation_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)cancelAction{
|
||||
[self hide];
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
//-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
// [textField resignFirstResponder];
|
||||
// return YES;
|
||||
//}
|
||||
//-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
// [UIView animateWithDuration:0.3 animations:^{
|
||||
// self.bgView.y = kSafeAreaTop+90;
|
||||
// } completion:^(BOOL finished) {
|
||||
//
|
||||
// }];
|
||||
//}
|
||||
//-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
// [UIView animateWithDuration:0.3 animations:^{
|
||||
// self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
// } completion:^(BOOL finished) {
|
||||
//
|
||||
// }];
|
||||
//}
|
||||
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
|
||||
cell.timeModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
|
||||
return CGSizeMake(width, 44);
|
||||
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomRelationModel *model = self.dataArray[indexPath.row];
|
||||
if (model.isSelected) {
|
||||
return;
|
||||
}
|
||||
self.timeModel.isSelected = NO;
|
||||
model.isSelected = YES;
|
||||
self.timeModel = model;
|
||||
[collectionView reloadData];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
30
QXLive/HomePage(声播)/View/房间/QXAppstoreHomeView.h
Normal file
30
QXLive/HomePage(声播)/View/房间/QXAppstoreHomeView.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// QXAppstoreHomeView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/4.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomListModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAppstoreHomeView : UIView
|
||||
//@property (nonatomic,strong)NSArray *dataArray;
|
||||
@property (nonatomic,strong)NSArray *bannerArray;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXAppstoreRoomView : UIView
|
||||
@property (nonatomic,strong)UIImageView *tagImageView;
|
||||
@property (nonatomic,strong)UIImageView *roomCoverImageView;
|
||||
@property (nonatomic,strong)UILabel *roomNameLabel;
|
||||
@property (nonatomic,strong)UIView *displayMaskView;
|
||||
@property (nonatomic,strong)UIView *hotBgView;
|
||||
@property (nonatomic,strong)UIImageView *hotImageView;
|
||||
@property (nonatomic,strong)UILabel *hotLabel;
|
||||
|
||||
@property (nonatomic,strong)QXRoomListModel *roomModel;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
317
QXLive/HomePage(声播)/View/房间/QXAppstoreHomeView.m
Normal file
317
QXLive/HomePage(声播)/View/房间/QXAppstoreHomeView.m
Normal file
@@ -0,0 +1,317 @@
|
||||
//
|
||||
// QXAppstoreHomeView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/4.
|
||||
//
|
||||
|
||||
#import "QXAppstoreHomeView.h"
|
||||
#import "QXHomeRoomCell.h"
|
||||
#import <SDCycleScrollView.h>
|
||||
#import "QXBanner.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
|
||||
@interface QXAppstoreHomeView()<UICollectionViewDelegate,UICollectionViewDataSource,SDCycleScrollViewDelegate>
|
||||
@property (nonatomic,strong)UIScrollView *scrollView;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)SDCycleScrollView *bannerScrollView;
|
||||
@property (nonatomic,strong)UIImageView *topImageView;
|
||||
@property (nonatomic,strong)QXAppstoreRoomView *rommView;
|
||||
@property (nonatomic,strong)UIImageView *bottomImageView;
|
||||
//@property (nonatomic,strong)QXAppstoreRoomView *rommView2;
|
||||
@property (nonatomic,strong)QXRoomListModel *roomModel;
|
||||
@property (nonatomic,assign)NSInteger currentIndex;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *topArray;
|
||||
@end
|
||||
|
||||
@implementation QXAppstoreHomeView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
self.scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
|
||||
[self addSubview:self.scrollView];
|
||||
[self.scrollView addSubview:self.bannerScrollView];
|
||||
[self.scrollView addSubview:self.collectionView];
|
||||
MJWeakSelf
|
||||
self.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf getTopRoomList];
|
||||
[weakSelf getAllRoomList];
|
||||
}];
|
||||
|
||||
CGFloat roomWidth = SCREEN_WIDTH-self.collectionView.right-40;
|
||||
CGFloat roomHeight = roomWidth + 25;
|
||||
self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
|
||||
self.topImageView.frame = CGRectMake(self.collectionView.right+20, self.bannerScrollView.bottom+30, roomWidth, 70);
|
||||
[self.scrollView addSubview:self.topImageView];
|
||||
self.rommView = [[QXAppstoreRoomView alloc] initWithFrame:CGRectMake(self.collectionView.right+20, self.topImageView.bottom+10, roomWidth, roomHeight)];
|
||||
[self.rommView addTapBlock:^(id _Nonnull obj) {
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.rommView.roomModel.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
|
||||
}];
|
||||
[self.scrollView addSubview:self.rommView];
|
||||
|
||||
self.bottomImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
|
||||
self.bottomImageView.frame = CGRectMake(self.collectionView.right+20, self.rommView.bottom+10, roomWidth, 70);
|
||||
self.bottomImageView.transform = CGAffineTransformMakeRotation(M_PI);
|
||||
[self.scrollView addSubview:self.bottomImageView];
|
||||
[self getTopRoomList];
|
||||
[self getAllRoomList];
|
||||
}
|
||||
-(void)loginSuccess{
|
||||
[self getTopRoomList];
|
||||
[self getAllRoomList];
|
||||
}
|
||||
-(void)startAnimate{
|
||||
[self performSelector:@selector(startOptimizedInfiniteFlip) afterDelay:3];
|
||||
}
|
||||
|
||||
//-(void)setDataArray:(NSArray *)dataArray{
|
||||
// _dataArray = dataArray;
|
||||
// [self.collectionView reloadData];
|
||||
// self.currentIndex = 0;
|
||||
// self.roomModel = self.dataArray.firstObject;
|
||||
// self.rommView.roomModel = self.roomModel;
|
||||
//}
|
||||
-(void)setBannerArray:(NSArray *)bannerArray{
|
||||
_bannerArray = bannerArray;
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for (QXBanner *banner in bannerArray) {
|
||||
[arr addObject:banner.image];
|
||||
}
|
||||
self.bannerScrollView.imageURLStringsGroup = arr;
|
||||
}
|
||||
|
||||
- (void)getTopRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[QXHomePageNetwork homeRoomListWithPage:0 is_top:YES label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
if (isAppStore == NO) {
|
||||
return;
|
||||
}
|
||||
[weakSelf.topArray removeAllObjects];
|
||||
[self.rommView.layer removeAllAnimations];
|
||||
if (list.count > 0) {
|
||||
weakSelf.currentIndex = 0;
|
||||
weakSelf.roomModel = list.firstObject;
|
||||
weakSelf.rommView.roomModel = weakSelf.roomModel;
|
||||
[weakSelf.topArray addObjectsFromArray:list];
|
||||
[weakSelf startAnimate];
|
||||
}
|
||||
[self.scrollView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.scrollView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getAllRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[QXHomePageNetwork homeRoomListWithPage:0 is_top:NO label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
if (isAppStore == NO) {
|
||||
return;
|
||||
}
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadData];
|
||||
[self.scrollView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.scrollView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
- (void)startOptimizedInfiniteFlip {
|
||||
self.currentIndex++;
|
||||
if (self.currentIndex > self.topArray.count-1) {
|
||||
self.currentIndex = 0;
|
||||
}
|
||||
self.roomModel = self.topArray[self.currentIndex];
|
||||
// 配置动画参数
|
||||
CGFloat flipDuration = 1.5;
|
||||
UIViewAnimationOptions flipDirection = UIViewAnimationOptionTransitionFlipFromRight;
|
||||
// UIViewAnimationOptionTransitionFlipFromLeft;
|
||||
|
||||
// 配置图片过渡动画
|
||||
[UIView transitionWithView:self.rommView
|
||||
duration:flipDuration
|
||||
options:flipDirection | UIViewAnimationOptionAllowAnimatedContent
|
||||
animations:^{
|
||||
self.rommView.roomModel = self.roomModel;
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
// 切换标志位
|
||||
// self.isFront = !self.isFront;
|
||||
|
||||
// 添加延迟后继续动画
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self startOptimizedInfiniteFlip];
|
||||
});
|
||||
}];
|
||||
|
||||
// 添加辅助动画(轻微弹跳效果)
|
||||
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
|
||||
scaleAnim.duration = flipDuration/2;
|
||||
scaleAnim.autoreverses = YES;
|
||||
scaleAnim.fromValue = @1.0;
|
||||
scaleAnim.toValue = @1.1;
|
||||
[self.rommView.layer addAnimation:scaleAnim forKey:@"scaleAnimation"];
|
||||
}
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.isAppStore = YES;
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return CGSizeMake(ScaleWidth(90), ScaleWidth(90));
|
||||
}
|
||||
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.viewController.navigationController];
|
||||
}
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 15;
|
||||
layout.minimumInteritemSpacing = 15;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, self.bannerScrollView.bottom+10, ScaleWidth(90), SCREEN_HEIGHT-TabbarContentHeight-NavContentHeight-10-ScaleWidth(95)) collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
_collectionView.showsVerticalScrollIndicator = NO;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
MJWeakSelf
|
||||
// _collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
// weakSelf.page++;
|
||||
// [weakSelf getRoomList];
|
||||
// }];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
-(SDCycleScrollView *)bannerScrollView{
|
||||
if (!_bannerScrollView) {
|
||||
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
|
||||
// _bannerScrollView.backgroundColor = [UIColor redColor];
|
||||
_bannerScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
[_bannerScrollView addRoundedCornersWithRadius:8] ;
|
||||
_bannerScrollView.delegate = self;
|
||||
}
|
||||
return _bannerScrollView;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)topArray{
|
||||
if (!_topArray) {
|
||||
_topArray = [NSMutableArray array];
|
||||
}
|
||||
return _topArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXAppstoreRoomView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setRoomModel:(QXRoomListModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
|
||||
self.roomNameLabel.text = roomModel.room_name;
|
||||
[self.tagImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.label_icon]];
|
||||
self.hotLabel.text = roomModel.hot_value;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
// self.starImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
|
||||
// [self addSubview:self.starImageView];
|
||||
// [self.starImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.centerX.equalTo(self);
|
||||
// make.top.equalTo(self);
|
||||
// make.width.height.mas_equalTo(ScaleWidth(70));
|
||||
// }];
|
||||
|
||||
self.roomCoverImageView = [[UIImageView alloc] init];
|
||||
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.roomCoverImageView addRoundedCornersWithRadius:8];
|
||||
self.roomCoverImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
||||
[self addSubview:self.roomCoverImageView];
|
||||
[self.roomCoverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self);
|
||||
make.width.height.mas_equalTo(self.width);
|
||||
}];
|
||||
|
||||
self.roomNameLabel = [[UILabel alloc] init];
|
||||
[self addSubview:self.roomNameLabel];
|
||||
[self.roomNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.roomCoverImageView.mas_bottom).offset(5);
|
||||
make.height.mas_equalTo(20);
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
|
||||
self.tagImageView = [[UIImageView alloc] init];
|
||||
[self addSubview:self.tagImageView];
|
||||
[self.tagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.top.equalTo(self.roomCoverImageView);
|
||||
make.height.mas_equalTo(24);
|
||||
make.width.mas_equalTo(66);
|
||||
}];
|
||||
|
||||
self.hotBgView = [[UIView alloc] init];
|
||||
self.hotBgView.backgroundColor = RGB16(0x333333);
|
||||
[self.hotBgView addRoundedCornersWithRadius:12];
|
||||
[self addSubview:self.hotBgView];
|
||||
[self.hotBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.right.equalTo(self.roomCoverImageView).offset(-10);
|
||||
make.width.mas_equalTo(160);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.hotImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hot_icon"]];
|
||||
[self.hotBgView addSubview:self.hotImageView];
|
||||
[self.hotImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(8);
|
||||
make.centerY.equalTo(self.hotBgView);
|
||||
make.width.height.mas_equalTo(15);
|
||||
}];
|
||||
|
||||
self.hotLabel = [[UILabel alloc] init];
|
||||
self.hotLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.hotLabel.font = [UIFont systemFontOfSize:13];
|
||||
self.hotLabel.textColor = [UIColor whiteColor];
|
||||
[self.hotBgView addSubview:self.hotLabel];
|
||||
[self.hotLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.hotImageView.mas_right).offset(2);
|
||||
make.right.mas_equalTo(-10);
|
||||
make.centerY.equalTo(self.hotBgView);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
27
QXLive/HomePage(声播)/View/房间/QXCabinMovieView.h
Normal file
27
QXLive/HomePage(声播)/View/房间/QXCabinMovieView.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// QXCabinMovieView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXCabinMovieView : UIView
|
||||
@property (nonatomic,strong)UIView *videoView;
|
||||
@property (nonatomic,assign)BOOL isFullScreen;
|
||||
|
||||
-(void)resetView;
|
||||
@end
|
||||
|
||||
@interface QXCabinMovieControlView : UIView
|
||||
@property (nonatomic,strong)UIView *topView;
|
||||
@property (nonatomic,strong)UIButton *returnBtn;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
|
||||
@property (nonatomic,strong)UIView *bottomView;
|
||||
@property (nonatomic,copy)void(^returnBlock)(void);
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
131
QXLive/HomePage(声播)/View/房间/QXCabinMovieView.m
Normal file
131
QXLive/HomePage(声播)/View/房间/QXCabinMovieView.m
Normal file
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// QXCabinMovieView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/7.
|
||||
//
|
||||
|
||||
#import "QXCabinMovieView.h"
|
||||
#import "AppDelegate.h"
|
||||
@interface QXCabinMovieView()
|
||||
@property (nonatomic,strong)UIButton *fullScreenBtn;
|
||||
@property (nonatomic,strong)UIPanGestureRecognizer *panRecognizer;
|
||||
@property (nonatomic,strong)QXCabinMovieControlView *controlView;
|
||||
|
||||
@end
|
||||
@implementation QXCabinMovieView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(12, NavContentHeight, 280, 160);
|
||||
self.backgroundColor = RGB16(0x333333);
|
||||
[self initSubviews];
|
||||
self.isFullScreen = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
|
||||
[self addGestureRecognizer:self.panRecognizer];
|
||||
self.videoView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
[self addSubview:self.videoView];
|
||||
|
||||
|
||||
self.fullScreenBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-40, self.height-40, 40, 40)];
|
||||
[self.fullScreenBtn setImage:[UIImage imageNamed:@"room_full_screen"] forState:(UIControlStateNormal)];
|
||||
[self.fullScreenBtn addTarget:self action:@selector(fullAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.fullScreenBtn];
|
||||
// [self.fullScreenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.bottom.right.equalTo(self);
|
||||
// make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||
// }];
|
||||
self.controlView.hidden = YES;
|
||||
[self addSubview:self.controlView];
|
||||
|
||||
}
|
||||
|
||||
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
|
||||
if (recognizer.state == UIGestureRecognizerStateEnded) {
|
||||
NSLog(@"拖动结束");
|
||||
}
|
||||
CGPoint translation = [recognizer translationInView:self.viewController.view];
|
||||
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
if (panCenter.x-214/2 <= 0 || panCenter.x+214/2 >= SCREEN_WIDTH || panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
|
||||
}
|
||||
|
||||
-(void)fullAction{
|
||||
AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
||||
delegate.allowRotate = 1;
|
||||
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
|
||||
[UIViewController attemptRotationToDeviceOrientation];
|
||||
self.frame = CGRectMake(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
|
||||
self.videoView.frame = self.bounds;
|
||||
[self.viewController.view addSubview:self.controlView];
|
||||
self.fullScreenBtn.hidden = YES;
|
||||
self.controlView.hidden = NO;
|
||||
self.isFullScreen = YES;
|
||||
}
|
||||
-(QXCabinMovieControlView *)controlView{
|
||||
if (!_controlView) {
|
||||
_controlView = [[QXCabinMovieControlView alloc] init];
|
||||
MJWeakSelf
|
||||
_controlView.returnBlock = ^{
|
||||
[weakSelf resetView];
|
||||
};
|
||||
}
|
||||
return _controlView;
|
||||
}
|
||||
-(void)resetView{
|
||||
AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
||||
delegate.allowRotate = 0;
|
||||
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
|
||||
//刷新
|
||||
[UIViewController attemptRotationToDeviceOrientation];
|
||||
self.frame = CGRectMake(12, NavContentHeight, 280, 160);
|
||||
self.videoView.frame = self.bounds;
|
||||
self.fullScreenBtn.frame = CGRectMake(self.width-40, self.height-40, 40, 40);
|
||||
self.controlView.hidden = YES;
|
||||
self.fullScreenBtn.hidden = NO;
|
||||
self.isFullScreen = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXCabinMovieControlView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 95)];
|
||||
self.returnBtn = [UIButton buttonWithType:0];
|
||||
[self.returnBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:UIColor.whiteColor] forState:0];
|
||||
// self.returnBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||
[self.returnBtn addTarget:self action:@selector(returnBtnClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.returnBtn.frame = CGRectMake(30, 10, 45, 45);
|
||||
[self.topView addSubview:self.returnBtn];
|
||||
[self addSubview:self.topView];
|
||||
}
|
||||
-(void)returnBtnClick{
|
||||
if (self.returnBlock) {
|
||||
self.returnBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
19
QXLive/HomePage(声播)/View/房间/QXMiniRoomView.h
Normal file
19
QXLive/HomePage(声播)/View/房间/QXMiniRoomView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXMiniRoomView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/25.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXMiniRoomView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,strong)NSString *roomCoverImage;
|
||||
|
||||
-(void)show;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
124
QXLive/HomePage(声播)/View/房间/QXMiniRoomView.m
Normal file
124
QXLive/HomePage(声播)/View/房间/QXMiniRoomView.m
Normal file
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// QXMiniRoomView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/25.
|
||||
//
|
||||
|
||||
#import "QXMiniRoomView.h"
|
||||
@interface QXMiniRoomView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *roomCoverImageView;
|
||||
@property (nonatomic,strong)UIImageView *bgRoomCoverImageView;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)UIVisualEffectView *blurView;
|
||||
@end
|
||||
|
||||
@implementation QXMiniRoomView
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH-ScaleWidth(80), SCREEN_HEIGHT-200, ScaleWidth(80), ScaleWidth(44));
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgRoomCoverImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
self.bgRoomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.bgRoomCoverImageView.clipsToBounds = YES;
|
||||
[self addSubview:self.bgRoomCoverImageView];
|
||||
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
|
||||
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:effect];
|
||||
UIVisualEffectView *vibrancyView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
|
||||
[blurView.contentView addSubview:vibrancyView];
|
||||
self.blurView = blurView;
|
||||
[self.bgRoomCoverImageView addSubview:blurView];
|
||||
blurView.frame = self.bgRoomCoverImageView.bounds;
|
||||
vibrancyView.frame = self.bgRoomCoverImageView.bounds;
|
||||
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"mini_room_bg"];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self addRoundedCornersWithRadius:ScaleWidth(44) byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft)];
|
||||
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
|
||||
[self addGestureRecognizer:panRecognizer];
|
||||
|
||||
|
||||
self.roomCoverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(9, (ScaleWidth(44)-ScaleWidth(26))/2, ScaleWidth(26), ScaleWidth(26))];
|
||||
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.roomCoverImageView.clipsToBounds = YES;
|
||||
[self.roomCoverImageView addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
|
||||
|
||||
|
||||
// [blurView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.right.top.bottom.equalTo(self.photoImageView);
|
||||
// }];
|
||||
// [vibrancyView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.right.top.bottom.equalTo(blurView);
|
||||
// }];
|
||||
|
||||
|
||||
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
//旋转角度
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
|
||||
//每次旋转的时间(单位秒)
|
||||
rotationAnimation.duration = 4;
|
||||
rotationAnimation.cumulative = YES;
|
||||
rotationAnimation.removedOnCompletion = NO;
|
||||
//重复旋转的次数,如果你想要无数次,那么设置成MAXFLOAT
|
||||
rotationAnimation.repeatCount = MAXFLOAT;
|
||||
[self.roomCoverImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
|
||||
MJWeakSelf
|
||||
[self.roomCoverImageView addTapBlock:^(id _Nonnull obj) {
|
||||
[weakSelf.layer removeAnimationForKey:@"rotationAnimation"];
|
||||
[weakSelf removeFromSuperview];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.roomId isRejoin:YES navagationController:(UINavigationController*)KEYWINDOW.rootViewController];
|
||||
}];
|
||||
[self addSubview:self.roomCoverImageView];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-ScaleWidth(30)-12, 0, ScaleWidth(30), ScaleWidth(44))];
|
||||
UIImage *close = [[UIImage imageNamed:@"room_close"] imageByTintColor:RGB16(0x333333)];
|
||||
[self.closeBtn setImage:close forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
}
|
||||
-(void)show{
|
||||
[KEYWINDOW.rootViewController.view addSubview:self];
|
||||
}
|
||||
|
||||
-(void)setRoomCoverImage:(NSString *)roomCoverImage{
|
||||
_roomCoverImage = roomCoverImage;
|
||||
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomCoverImage]];
|
||||
[self.bgRoomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomCoverImage]];
|
||||
}
|
||||
|
||||
-(void)closeAction{
|
||||
[self.layer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self removeFromSuperview];
|
||||
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomId];
|
||||
}
|
||||
|
||||
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
|
||||
if (recognizer.state == UIGestureRecognizerStateEnded) {
|
||||
NSLog(@"拖动结束");
|
||||
}
|
||||
CGPoint translation = [recognizer translationInView:self.viewController.view];
|
||||
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
if (panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
recognizer.view.center = CGPointMake(SCREEN_WIDTH-ScaleWidth(80)/2,
|
||||
recognizer.view.center.y + translation.y);
|
||||
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
|
||||
}
|
||||
|
||||
@end
|
||||
56
QXLive/HomePage(声播)/View/房间/QXRoomBottomView.h
Normal file
56
QXLive/HomePage(声播)/View/房间/QXRoomBottomView.h
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// QXRoomBottomView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 静音
|
||||
QXRoomBottomViewEventTypePlayAudio = 20,
|
||||
/// 闭麦
|
||||
QXRoomBottomViewEventTypeMuteAudio,
|
||||
/// 消息
|
||||
QXRoomBottomViewEventTypeMessage,
|
||||
/// PK
|
||||
QXRoomBottomViewEventTypePK,
|
||||
/// 点歌曲
|
||||
QXRoomBottomViewEventTypeMusic,
|
||||
/// 礼物
|
||||
QXRoomBottomViewEventTypeGift,
|
||||
/// 设置
|
||||
QXRoomBottomViewEventTypeSetting,
|
||||
}QXRoomBottomViewEventType;
|
||||
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXRoomBottomViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
-(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected;
|
||||
|
||||
@end
|
||||
|
||||
@interface QXRoomBottomView : UIView
|
||||
/// 1 麦下 2 麦上
|
||||
@property (nonatomic,assign)NSInteger status;
|
||||
@property (nonatomic,weak)id<QXRoomBottomViewDelegate>delegate;
|
||||
@property (nonatomic,strong)UIViewController *vc;
|
||||
@property (nonatomic,strong)QXRoomModel *roomModel;
|
||||
-(void)setRoleType:(QXRoomRoleType)roleType hasPK:(BOOL)hasPK hasSong:(BOOL)hasSong;
|
||||
/// 是否是小黑屋
|
||||
@property (nonatomic,assign)BOOL isCabinRoom;
|
||||
|
||||
-(void)atUserWithName:(NSString*)nickname;
|
||||
/// 是否静音 1 不静音 0 静音
|
||||
-(void)setPlayAudioStatus:(BOOL)status;
|
||||
/// 是否闭麦 0 未闭麦 1 已闭麦
|
||||
-(void)setMuteAudioStatus:(BOOL)status;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
392
QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m
Normal file
392
QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m
Normal file
@@ -0,0 +1,392 @@
|
||||
//
|
||||
// QXRoomBottomView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXRoomBottomView.h"
|
||||
#import "QXDynamicCommentInputView.h"
|
||||
#import "QXRoomMessageManager.h"
|
||||
#import "QXBadgeButton.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface QXRoomBottomView()<QXDynamicCommentInputViewDelegate>
|
||||
@property (nonatomic,strong)UIView *sayBg;
|
||||
@property (nonatomic,strong)UIImageView *sayImageView;
|
||||
@property (nonatomic,strong)UILabel *sayLabel;
|
||||
|
||||
/// voice
|
||||
@property (nonatomic,strong)QXBadgeButton *playAudioBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *audioBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *messageBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *pkBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *musicBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *giftBtn;
|
||||
@property (nonatomic,strong)QXBadgeButton *setBtn;
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *eventArray;
|
||||
|
||||
@property (nonatomic,assign)QXRoomRoleType roleType;
|
||||
@property (nonatomic,strong)QXDynamicCommentInputView *commentView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomBottomView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noticeUnreadNumberDidChanged:) name:noticeUnreadNumberDidChanged object:nil];
|
||||
MJWeakSelf
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
|
||||
self.sayBg = [[UIView alloc] init];
|
||||
self.sayBg.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.sayBg addRoundedCornersWithRadius:18];
|
||||
[self.sayBg addTapBlock:^(id _Nonnull obj) {
|
||||
if (weakSelf.roomModel.user_info.is_mute.intValue == 1) {
|
||||
showToast(@"您已被禁言");
|
||||
return;
|
||||
}
|
||||
[weakSelf.vc.view addSubview:weakSelf.commentView];
|
||||
[weakSelf.commentView.textField becomeFirstResponder];
|
||||
}];
|
||||
[self addSubview:self.sayBg];
|
||||
[self.sayBg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(36);
|
||||
make.width.mas_equalTo(106);
|
||||
}];
|
||||
|
||||
self.sayImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_say_icon"]];
|
||||
[self.sayBg addSubview:self.sayImageView];
|
||||
[self.sayImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(10);
|
||||
make.centerY.equalTo(self.sayBg);
|
||||
make.width.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.sayLabel = [[UILabel alloc] init];
|
||||
self.sayLabel.textColor = [UIColor whiteColor];
|
||||
self.sayLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.sayLabel.text = QXText(@"说点什么");
|
||||
self.sayLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.sayBg addSubview:self.sayLabel];
|
||||
[self.sayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.sayImageView.mas_right);
|
||||
make.centerY.equalTo(self.sayBg);
|
||||
make.right.equalTo(self.sayBg);
|
||||
}];
|
||||
|
||||
|
||||
self.playAudioBtn = [[QXBadgeButton alloc] init];
|
||||
self.playAudioBtn.tag = 20;
|
||||
[self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_nor"] forState:(UIControlStateNormal)];
|
||||
[self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_sel"] forState:(UIControlStateSelected)];
|
||||
[self.playAudioBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.playAudioBtn.hidden = YES;
|
||||
[self addSubview:self.playAudioBtn];
|
||||
|
||||
|
||||
self.audioBtn = [[QXBadgeButton alloc] init];
|
||||
self.audioBtn.tag = 21;
|
||||
[self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_nor"] forState:(UIControlStateNormal)];
|
||||
[self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_sel"] forState:(UIControlStateSelected)];
|
||||
[self.audioBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.audioBtn.hidden = YES;
|
||||
[self addSubview:self.audioBtn];
|
||||
|
||||
|
||||
self.messageBtn = [[QXBadgeButton alloc] init];
|
||||
self.messageBtn.tag = 22;
|
||||
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
||||
NSInteger unread = appDelegate.tabbarVC.messageUnReadNumber;
|
||||
[self.messageBtn.unreadView setNum:unread];
|
||||
[self.messageBtn setImage:[UIImage imageNamed:@"room_event_message"] forState:(UIControlStateNormal)];
|
||||
[self.messageBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.messageBtn.hidden = YES;
|
||||
[self addSubview:self.messageBtn];
|
||||
|
||||
self.pkBtn = [[QXBadgeButton alloc] init];
|
||||
self.pkBtn.tag = 23;
|
||||
[self.pkBtn setImage:[UIImage imageNamed:@"room_event_pk"] forState:(UIControlStateNormal)];
|
||||
[self.pkBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.pkBtn.hidden = YES;
|
||||
[self addSubview:self.pkBtn];
|
||||
|
||||
self.musicBtn = [[QXBadgeButton alloc] init];
|
||||
self.musicBtn.tag = 24;
|
||||
[self.musicBtn setImage:[UIImage imageNamed:@"room_event_music"] forState:(UIControlStateNormal)];
|
||||
[self.musicBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.musicBtn.hidden = YES;
|
||||
[self addSubview:self.musicBtn];
|
||||
|
||||
self.giftBtn = [[QXBadgeButton alloc] init];
|
||||
self.giftBtn.tag = 25;
|
||||
[self.giftBtn setImage:[UIImage imageNamed:@"room_event_gift"] forState:(UIControlStateNormal)];
|
||||
[self.giftBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.giftBtn.hidden = YES;
|
||||
[self addSubview:self.giftBtn];
|
||||
|
||||
self.setBtn = [[QXBadgeButton alloc] init];
|
||||
self.setBtn.tag = 26;
|
||||
[self.setBtn setImage:[UIImage imageNamed:@"room_event_set"] forState:(UIControlStateNormal)];
|
||||
[self.setBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
|
||||
self.setBtn.hidden = YES;
|
||||
[self addSubview:self.setBtn];
|
||||
}
|
||||
-(void)setRoomModel:(QXRoomModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
}
|
||||
-(void)setIsCabinRoom:(BOOL)isCabinRoom{
|
||||
_isCabinRoom = isCabinRoom;
|
||||
[self.sayBg mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(36);
|
||||
make.right.mas_equalTo(-16);
|
||||
}];
|
||||
for (UIButton*btn in self.eventArray) {
|
||||
btn.hidden = YES;
|
||||
}
|
||||
}
|
||||
-(void)noticeUnreadNumberDidChanged:(NSNotification*)notice{
|
||||
NSNumber *number = notice.object;
|
||||
[self.messageBtn.unreadView setNum:number.longValue];
|
||||
}
|
||||
|
||||
-(void)setRoleType:(QXRoomRoleType)roleType hasPK:(BOOL)hasPK hasSong:(BOOL)hasSong{
|
||||
_roleType = roleType;
|
||||
/// 播放声音按钮
|
||||
self.playAudioBtn.hidden = YES;
|
||||
/// 消息按钮
|
||||
self.messageBtn.hidden = YES;
|
||||
/// pk按钮
|
||||
self.pkBtn.hidden = YES;
|
||||
/// 点歌
|
||||
self.musicBtn.hidden = YES;
|
||||
// 送礼物
|
||||
self.giftBtn.hidden = YES;
|
||||
/// 设置
|
||||
self.setBtn.hidden = YES;
|
||||
self.audioBtn.selected = NO;
|
||||
self.playAudioBtn.selected = NO;
|
||||
switch (roleType) {
|
||||
/// 主持人
|
||||
case QXRoomRoleTypeCompere:
|
||||
{
|
||||
self.eventArray = [NSMutableArray arrayWithArray:@[
|
||||
self.playAudioBtn,
|
||||
self.messageBtn,
|
||||
// self.musicBtn,
|
||||
self.giftBtn,
|
||||
self.setBtn,
|
||||
]];
|
||||
if (hasSong) {
|
||||
if (![self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray insertObject:self.musicBtn atIndex:2];
|
||||
}
|
||||
}else{
|
||||
if ([self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray removeObject:self.musicBtn];
|
||||
}
|
||||
}
|
||||
if (hasPK) {
|
||||
if (![self.eventArray containsObject:self.pkBtn]) {
|
||||
[self.eventArray insertObject:self.pkBtn atIndex:2];
|
||||
}
|
||||
}else{
|
||||
if ([self.eventArray containsObject:self.pkBtn]) {
|
||||
[self.eventArray removeObject:self.pkBtn];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/// 房主
|
||||
case QXRoomRoleTypeOwner:
|
||||
{
|
||||
self.eventArray = [NSMutableArray arrayWithArray:@[
|
||||
self.playAudioBtn,
|
||||
self.messageBtn,
|
||||
// self.musicBtn,
|
||||
self.giftBtn,
|
||||
self.setBtn,
|
||||
]];
|
||||
if (hasSong) {
|
||||
if (![self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray insertObject:self.musicBtn atIndex:2];
|
||||
}
|
||||
}else{
|
||||
if ([self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray removeObject:self.musicBtn];
|
||||
}
|
||||
}
|
||||
if (hasPK) {
|
||||
if (![self.eventArray containsObject:self.pkBtn]) {
|
||||
[self.eventArray insertObject:self.pkBtn atIndex:2];
|
||||
}
|
||||
}else{
|
||||
if ([self.eventArray containsObject:self.pkBtn]) {
|
||||
[self.eventArray removeObject:self.pkBtn];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 观众
|
||||
case QXRoomRoleTypeAudience:
|
||||
{
|
||||
self.eventArray = [NSMutableArray arrayWithArray:@[
|
||||
self.playAudioBtn,
|
||||
self.messageBtn,
|
||||
// self.musicBtn,
|
||||
self.giftBtn,
|
||||
self.setBtn,
|
||||
]];
|
||||
if (hasSong) {
|
||||
if (![self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray insertObject:self.musicBtn atIndex:2];
|
||||
}
|
||||
}else{
|
||||
if ([self.eventArray containsObject:self.musicBtn]) {
|
||||
[self.eventArray removeObject:self.musicBtn];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CGFloat btnWidth = 35;
|
||||
for ( int i = 0 ;i < self.eventArray.count;i++ ) {
|
||||
QXBadgeButton*btn = self.eventArray[i];
|
||||
btn.hidden = NO;
|
||||
[btn mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-(16+btnWidth*(self.eventArray.count-(i+1))));
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.sayBg);
|
||||
make.height.mas_equalTo(self.sayBg);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
/// 1 麦下 2 麦上
|
||||
-(void)setStatus:(NSInteger)status{
|
||||
_status = status;
|
||||
// 播放声音
|
||||
self.playAudioBtn.selected = NO;
|
||||
// 麦克风
|
||||
self.audioBtn.selected = NO;
|
||||
if (_status == 1) {
|
||||
// 隐藏麦克风
|
||||
self.audioBtn.hidden = YES;
|
||||
/// 查看数组中是否有麦克风按钮
|
||||
if ([self.eventArray containsObject:self.audioBtn]) {
|
||||
/// 有就移除
|
||||
[self.eventArray removeObject:self.audioBtn];
|
||||
}
|
||||
}else if(_status == 2){
|
||||
// 显示麦克风
|
||||
self.audioBtn.hidden = NO;
|
||||
if (![self.eventArray containsObject:self.audioBtn]) {
|
||||
/// 当前数组中不包含麦克风 就插入到下标为1的
|
||||
[self.eventArray insertObject:self.audioBtn atIndex:1];
|
||||
}
|
||||
}
|
||||
CGFloat btnWidth = 35;
|
||||
for ( int i = 0 ;i < self.eventArray.count;i++ ) {
|
||||
QXBadgeButton*btn = self.eventArray[i];
|
||||
btn.hidden = NO;
|
||||
[btn mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-(16+btnWidth*(self.eventArray.count-(i+1))));
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.sayBg);
|
||||
make.height.mas_equalTo(self.sayBg);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setMuteAudioStatus:(BOOL)status{
|
||||
self.audioBtn.selected = status;
|
||||
}
|
||||
|
||||
-(void)setPlayAudioStatus:(BOOL)status{
|
||||
self.playAudioBtn.selected = status;
|
||||
}
|
||||
-(void)eventAction:(UIButton*)sender{
|
||||
|
||||
if (sender == self.audioBtn) {
|
||||
if (self.roomModel.user_info.is_mute_pit.intValue == 1) {
|
||||
showToast(@"您已被禁麦");
|
||||
return;
|
||||
}
|
||||
sender.selected = !sender.selected;
|
||||
}
|
||||
if (sender == self.playAudioBtn) {
|
||||
sender.selected = !sender.selected;
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:isSelected:)]) {
|
||||
[self.delegate didClickEventType:sender.tag isSelected:sender.selected];
|
||||
}
|
||||
}
|
||||
-(void)atUserWithName:(NSString *)nickname{
|
||||
if (self.roomModel.user_info.is_mute.intValue == 1) {
|
||||
showToast(@"您已被禁言");
|
||||
return;
|
||||
}
|
||||
self.commentView.textField.text = [NSString stringWithFormat:@"@%@ ",nickname];
|
||||
[self.vc.view addSubview:self.commentView];
|
||||
[self.commentView.textField becomeFirstResponder];
|
||||
}
|
||||
#pragma mark - 发消息
|
||||
-(void)didClickSendWithText:(NSString*)text model:(nonnull QXDynamicCommentListModel *)model{
|
||||
if (self.roomModel.user_info.is_mute.intValue == 1) {
|
||||
showToast(@"您已被禁言");
|
||||
[self.vc.view endEditing:YES];
|
||||
return;
|
||||
}
|
||||
[[QXGlobal shareGlobal] finishTask];
|
||||
[[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES];
|
||||
self.commentView.textField.text = @"";
|
||||
[self.vc.view endEditing:YES];
|
||||
|
||||
}
|
||||
|
||||
- (void)keyboardWillHide:(NSNotification *)notification {
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.commentView.y = SCREEN_HEIGHT;
|
||||
}completion:^(BOOL finished) {
|
||||
[self.commentView removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
// CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
// [UIView animateWithDuration:0.3 animations:^{
|
||||
// self.commentView.y = keyboardFrame.origin.y+TabbarContentHeight;
|
||||
// }];
|
||||
}
|
||||
|
||||
- (void)keyboardWillChangeFrame:(NSNotification *)notification {
|
||||
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
self.commentView.y = keyboardFrame.origin.y-TabbarContentHeight;
|
||||
}];
|
||||
}
|
||||
|
||||
-(QXDynamicCommentInputView *)commentView{
|
||||
if (!_commentView) {
|
||||
_commentView = [[QXDynamicCommentInputView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, TabbarContentHeight)];
|
||||
_commentView.delegate = self;
|
||||
}
|
||||
return _commentView;
|
||||
}
|
||||
@end
|
||||
84
QXLive/HomePage(声播)/View/房间/QXRoomChatListView.h
Normal file
84
QXLive/HomePage(声播)/View/房间/QXRoomChatListView.h
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// QXRoomChatListView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
#import "QXGiftModel.h"
|
||||
#import "QXSongListModel.h"
|
||||
#import "QXRoomSeatDelegate.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 系统消息
|
||||
QXRoomChatMessageTypeSystem = 0,
|
||||
/// 聊天消息
|
||||
QXRoomChatMessageTypeChat = 1,
|
||||
/// 礼物消息
|
||||
QXRoomChatMessageTypeGift = 2,
|
||||
}QXRoomChatMessageType;
|
||||
@class QXRoomChatListModel;
|
||||
@interface QXRoomChatListView : UIView
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
|
||||
-(void)insertNoitce;
|
||||
-(void)insertMessage:(QXRoomChatListModel*)model;
|
||||
-(void)clearMessage;
|
||||
@end
|
||||
|
||||
@interface QXRoomChatListCell : UITableViewCell
|
||||
@property(nonatomic,strong)UIImageView *headerImageView;
|
||||
@property(nonatomic,strong)UIView *iconBgView;
|
||||
@property(nonatomic,strong)NSMutableArray *iconViewArray;
|
||||
@property(nonatomic,strong)UILabel *nameLabel;
|
||||
@property(nonatomic,strong)UILabel *titleLabel;
|
||||
@property(nonatomic,strong)UIImageView *bubbleImageView;
|
||||
@property (nonatomic,strong)QXRoomChatListModel *message;
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
-(void)loadBubble;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
@interface QXRoomGiftListCell : UITableViewCell
|
||||
@property(nonatomic,strong)UIImageView *headerImageView;
|
||||
@property(nonatomic,strong)UIView *iconBgView;
|
||||
/// 礼物图片
|
||||
@property(nonatomic,strong)UIImageView *giftImageView;
|
||||
/// 礼物数量
|
||||
@property(nonatomic,strong)UILabel *giftCountLabel;
|
||||
@property(nonatomic,strong)NSMutableArray *iconViewArray;
|
||||
@property(nonatomic,strong)UILabel *nameLabel;
|
||||
@property(nonatomic,strong)UILabel *titleLabel;
|
||||
@property(nonatomic,strong)UIImageView *bubbleImageView;
|
||||
@property (nonatomic,strong)QXRoomChatListModel *message;
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
-(void)loadBubble;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
@interface QXRoomChatListSystemCell : UITableViewCell
|
||||
@property(nonatomic,strong)UIView *bgView;
|
||||
@property(nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)QXRoomChatListModel *message;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
@interface QXRoomChatListModel : NSObject
|
||||
@property (nonatomic,assign)QXRoomChatMessageType messageType;
|
||||
@property (nonatomic,strong)NSString* text;
|
||||
@property (nonatomic,strong)QXGiftModel* GiftInfo;
|
||||
@property (nonatomic,strong)QXUserHomeModel* FromUserInfo;
|
||||
@property (nonatomic,strong)QXUserHomeModel* ToUserInfo;
|
||||
|
||||
/// 当前音乐
|
||||
@property (nonatomic,strong)QXSongListModel* songInfo;
|
||||
/// 下一首音乐
|
||||
@property (nonatomic,strong)QXSongListModel* nextInfo;
|
||||
@property (nonatomic,assign)BOOL havBubble;
|
||||
|
||||
@property (nonatomic,strong)NSString* total;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
757
QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m
Normal file
757
QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m
Normal file
@@ -0,0 +1,757 @@
|
||||
//
|
||||
// QXRoomChatListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXRoomChatListView.h"
|
||||
#import "UIImage+WebP.h"
|
||||
NSInteger maxMessageCount = 20;
|
||||
@interface QXRoomChatListView() <UITableViewDelegate,UITableViewDataSource,QXRoomSeatDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *giftArray;
|
||||
@property (nonatomic,strong)NSMutableArray *chatArray;
|
||||
@property (nonatomic,assign)NSInteger messageCount;
|
||||
@property (nonatomic,strong)UIButton *allBtn;
|
||||
@property (nonatomic,strong)UIButton *chatBtn;
|
||||
@property (nonatomic,strong)UIButton *giftBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
@property (nonatomic,assign)BOOL isDragging;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *messageCountBtn;
|
||||
@end
|
||||
@implementation QXRoomChatListView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
[self addSubview:self.tableView];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self).offset(40);
|
||||
make.bottom.equalTo(self).offset(-10);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.allBtn = [[UIButton alloc] init];
|
||||
NSAttributedString *allAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"全部") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
NSAttributedString *allAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"全部") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[self.allBtn setAttributedTitle:allAttrNor forState:UIControlStateNormal];
|
||||
[self.allBtn setAttributedTitle:allAttrSel forState:UIControlStateSelected];
|
||||
self.allBtn.selected = YES;
|
||||
self.selectedBtn = self.allBtn;
|
||||
[self.allBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.allBtn];
|
||||
[self.allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(40);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
self.chatBtn = [[UIButton alloc] init];
|
||||
NSAttributedString *chatAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"聊天") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
NSAttributedString *chatAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"聊天") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[self.chatBtn setAttributedTitle:chatAttrNor forState:UIControlStateNormal];
|
||||
[self.chatBtn setAttributedTitle:chatAttrSel forState:UIControlStateSelected];
|
||||
[self.chatBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.chatBtn];
|
||||
[self.chatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.allBtn.mas_right).offset(5);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(40);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
self.giftBtn = [[UIButton alloc] init];
|
||||
NSAttributedString *giftAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"礼物") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
NSAttributedString *giftAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"礼物") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[self.giftBtn setAttributedTitle:giftAttrNor forState:UIControlStateNormal];
|
||||
[self.giftBtn setAttributedTitle:giftAttrSel forState:UIControlStateSelected];
|
||||
[self.giftBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.giftBtn];
|
||||
[self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.chatBtn.mas_right).offset(5);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(40);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
self.messageCountBtn = [[UIButton alloc] init];;
|
||||
[self.messageCountBtn setTitleColor:RGB16(0xB265FA) forState:(UIControlStateNormal)];
|
||||
self.messageCountBtn.backgroundColor = [UIColor whiteColor];
|
||||
[self.messageCountBtn addRoundedCornersWithRadius:10];
|
||||
self.messageCountBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.messageCountBtn addTarget:self action:@selector(scrollToBottom) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.messageCountBtn];
|
||||
self.messageCountBtn.hidden = YES;
|
||||
[self.messageCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-40);
|
||||
make.bottom.equalTo(self);
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_equalTo(75);
|
||||
}];
|
||||
|
||||
// self.messageLabel = [[UILabel alloc] init];
|
||||
// self.messageLabel.textColor = [UIColor whiteColor];
|
||||
// self.messageLabel.text = @"张三进入了房间";
|
||||
// self.messageLabel.font = [UIFont systemFontOfSize:12];
|
||||
// [self addSubview:self.messageLabel];
|
||||
// [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(16);
|
||||
// make.bottom.equalTo(self).offset(-5);
|
||||
// make.height.mas_equalTo(20);
|
||||
// make.right.equalTo(self);
|
||||
// }];
|
||||
}
|
||||
-(void)typeAction:(UIButton*)sender{
|
||||
self.selectedBtn.selected = !self.selectedBtn.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.selectedBtn = sender;
|
||||
[self.tableView reloadData];
|
||||
[self scrollToBottom];
|
||||
}
|
||||
|
||||
-(void)scrollToBottom{
|
||||
NSArray *arr;
|
||||
if (self.selectedBtn == self.chatBtn) {
|
||||
arr = self.chatArray;
|
||||
}else if (self.selectedBtn == self.giftBtn) {
|
||||
arr = self.giftArray;
|
||||
}else{
|
||||
arr = self.dataArray;
|
||||
}
|
||||
if (arr.count > 0) {
|
||||
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:arr.count-1 inSection:0] atScrollPosition:(UITableViewScrollPositionBottom) animated:YES];
|
||||
}
|
||||
self.isDragging = NO;
|
||||
self.messageCount = 0;
|
||||
self.messageCountBtn.hidden = YES;
|
||||
}
|
||||
-(void)insertNoitce{
|
||||
QXRoomChatListModel *model = [QXRoomChatListModel new];
|
||||
model.messageType = QXRoomChatMessageTypeSystem;
|
||||
model.text = @"羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。";
|
||||
[self.dataArray addObject:model];
|
||||
[self.tableView reloadData];
|
||||
[self scrollToBottom];
|
||||
}
|
||||
-(void)insertMessage:(QXRoomChatListModel *)model{
|
||||
[self.dataArray addObject:model];
|
||||
if (model.messageType == QXRoomChatMessageTypeChat) {
|
||||
[self.chatArray addObject:model];
|
||||
}
|
||||
if (model.messageType == QXRoomChatMessageTypeGift) {
|
||||
[self.giftArray addObject:model];
|
||||
}
|
||||
if (self.dataArray.count>maxMessageCount) {
|
||||
[self.dataArray removeFirstObject];
|
||||
}
|
||||
if (self.chatArray.count>maxMessageCount) {
|
||||
[self.chatArray removeFirstObject];
|
||||
}
|
||||
if (self.giftArray.count>maxMessageCount) {
|
||||
[self.giftArray removeFirstObject];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (self.isDragging) {
|
||||
self.messageCount++;
|
||||
self.messageCountBtn.hidden = NO;
|
||||
[self.messageCountBtn setTitle:[NSString localizedStringWithFormat:QXText(@"%@条新消息"),[NSString stringWithFormat:@"%ld",self.messageCount]] forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
[self scrollToBottom];
|
||||
}
|
||||
}
|
||||
-(void)clearMessage{
|
||||
[self.dataArray removeAllObjects];
|
||||
[self.giftArray removeAllObjects];
|
||||
[self.chatArray removeAllObjects];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(void)previewUserInfoWithUserId:(NSString *)userId{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:userId];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
if (self.selectedBtn == self.chatBtn) {
|
||||
return self.chatArray.count;
|
||||
}
|
||||
if (self.selectedBtn == self.giftBtn) {
|
||||
return self.giftArray.count;
|
||||
}
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomChatListModel *model;
|
||||
if (self.selectedBtn == self.chatBtn) {
|
||||
model = self.chatArray[indexPath.row];
|
||||
}else if (self.selectedBtn == self.giftBtn) {
|
||||
model = self.giftArray[indexPath.row];
|
||||
}else{
|
||||
model = self.dataArray[indexPath.row];
|
||||
}
|
||||
// model.havBubble = indexPath.row%2;
|
||||
if (model.messageType == QXRoomChatMessageTypeChat) {
|
||||
QXRoomChatListCell *cell = [QXRoomChatListCell cellWithTableView:tableView];
|
||||
cell.delegate = self;
|
||||
cell.message = model;
|
||||
return cell;
|
||||
}else if (model.messageType == QXRoomChatMessageTypeGift) {
|
||||
QXRoomGiftListCell *cell = [QXRoomGiftListCell cellWithTableView:tableView];
|
||||
cell.delegate = self;
|
||||
cell.message = model;
|
||||
return cell;
|
||||
}else{
|
||||
QXRoomChatListSystemCell *cell = [QXRoomChatListSystemCell cellWithTableView:tableView];
|
||||
cell.message = model;
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if ([cell isKindOfClass:[QXRoomChatListCell class]]) {
|
||||
QXRoomChatListCell *Listcell = (QXRoomChatListCell *)cell;
|
||||
[Listcell loadBubble];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if ([cell isKindOfClass:[QXRoomChatListCell class]]) {
|
||||
QXRoomChatListCell *Listcell = (QXRoomChatListCell *)cell;
|
||||
[Listcell.bubbleImageView sd_cancelLatestImageLoad];
|
||||
}
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomChatListModel *model;
|
||||
if (self.selectedBtn == self.chatBtn) {
|
||||
model = self.chatArray[indexPath.row];
|
||||
}else if (self.selectedBtn == self.giftBtn) {
|
||||
model = self.giftArray[indexPath.row];
|
||||
}else{
|
||||
model = self.dataArray[indexPath.row];
|
||||
}
|
||||
CGFloat height = 0;
|
||||
if (model.messageType == QXRoomChatMessageTypeChat) {
|
||||
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
|
||||
|
||||
if (model.havBubble) {
|
||||
/// 有气泡
|
||||
height = 30+14+6+30 + height;
|
||||
}else{
|
||||
// 无气泡
|
||||
height = 30+14+6+12 + height;
|
||||
}
|
||||
|
||||
}else if (model.messageType == QXRoomChatMessageTypeGift) {
|
||||
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
|
||||
height = 30+14+6+12 + height;
|
||||
}else{
|
||||
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-8-8*2] + 12+16+1;
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
CGFloat height = scrollView.frame.size.height;
|
||||
CGFloat contentYoffset = scrollView.contentOffset.y;
|
||||
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
|
||||
if (distanceFromBottom < height) {
|
||||
self.isDragging = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
|
||||
self.isDragging = YES;
|
||||
}
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.showsHorizontalScrollIndicator = NO;
|
||||
_tableView.showsVerticalScrollIndicator = NO;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
_tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)giftArray{
|
||||
if (!_giftArray) {
|
||||
_giftArray =[ NSMutableArray array];
|
||||
}
|
||||
return _giftArray;
|
||||
}
|
||||
-(NSMutableArray *)chatArray{
|
||||
if (!_chatArray) {
|
||||
_chatArray = [NSMutableArray array];
|
||||
}
|
||||
return _chatArray;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation QXRoomChatListCell
|
||||
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString* cellId = @"QXRoomChatListCell";
|
||||
QXRoomChatListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRoomChatListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)headerAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:self.message.FromUserInfo.user_id];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setMessage:(QXRoomChatListModel *)message{
|
||||
_message = message;
|
||||
self.titleLabel.text = message.text;
|
||||
self.nameLabel.text = message.FromUserInfo.nickname;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
|
||||
self.iconBgView.hidden = YES;
|
||||
for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
|
||||
if (i < 3) {
|
||||
self.iconBgView.hidden = NO;
|
||||
UIImageView *iconImageView = self.iconViewArray[i];
|
||||
iconImageView.hidden = NO;
|
||||
[iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
|
||||
}else{
|
||||
self.iconBgView.hidden = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] init];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.headerImageView.backgroundColor = [UIColor whiteColor];
|
||||
[self.headerImageView addRoundedCornersWithRadius:14];
|
||||
[self.contentView addSubview:self.headerImageView];
|
||||
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(2);
|
||||
make.size.mas_equalTo(CGSizeMake(28, 28));
|
||||
}];
|
||||
|
||||
UIButton *headerBtn = [[UIButton alloc] init];
|
||||
[headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.contentView addSubview:headerBtn];
|
||||
[headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.equalTo(self.headerImageView).offset(-2);
|
||||
make.bottom.right.equalTo(self.headerImageView).offset(2);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.contentView);
|
||||
make.left.equalTo(self.headerImageView.mas_right).offset(6);
|
||||
make.right.equalTo(self.contentView).offset(-6);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = [UIColor whiteColor];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel).offset(8);
|
||||
make.top.equalTo(self.headerImageView.mas_bottom).offset(14);
|
||||
make.right.mas_lessThanOrEqualTo(-8);
|
||||
}];
|
||||
|
||||
|
||||
self.nameLabel.text = @"张三站撒旦撒大萨达撒";
|
||||
|
||||
self.bubbleImageView = [[UIImageView alloc] init];
|
||||
// UIImage * image = [UIImage imageWithColor:RGB16A(0xffffff, 0.2)];
|
||||
[self.bubbleImageView addRoundedCornersWithRadius:6];
|
||||
|
||||
// UIImage *image = [UIImage imageWithContentsOfFile:path];
|
||||
// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)];
|
||||
// self.bubbleImageView.image = image;
|
||||
self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[self.contentView addSubview:self.bubbleImageView];
|
||||
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-8);
|
||||
make.top.equalTo(self.titleLabel).offset(-6);
|
||||
make.bottom.equalTo(self.titleLabel).offset(6);
|
||||
make.right.equalTo(self.titleLabel).offset(8);
|
||||
// make.left.equalTo(self.titleLabel).offset(-55);
|
||||
// make.top.equalTo(self.titleLabel).offset(0);
|
||||
// make.bottom.equalTo(self.titleLabel).offset(0);
|
||||
// make.right.equalTo(self.titleLabel).offset(55);
|
||||
}];
|
||||
|
||||
[self.contentView bringSubviewToFront:self.titleLabel];
|
||||
|
||||
self.iconBgView = [[UIView alloc] init];
|
||||
[self.contentView addSubview:self.iconBgView];
|
||||
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel);
|
||||
make.right.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(16);
|
||||
make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
|
||||
}];
|
||||
|
||||
CGFloat iconWidth = 38;
|
||||
CGFloat iconHeight = 16;
|
||||
CGFloat margin = 6;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UIImageView *iconImageView = [[UIImageView alloc] init];
|
||||
iconImageView.hidden = YES;
|
||||
[self.iconBgView addSubview:iconImageView];
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(i*(iconWidth+margin));
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
}];
|
||||
[self.iconViewArray addObject:iconImageView];
|
||||
}
|
||||
}
|
||||
-(void)loadBubble{
|
||||
if (!self.message.havBubble) {
|
||||
[self.bubbleImageView sd_cancelLatestImageLoad];
|
||||
self.bubbleImageView.image = nil;
|
||||
self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-8);
|
||||
make.top.equalTo(self.titleLabel).offset(-6);
|
||||
make.bottom.equalTo(self.titleLabel).offset(6);
|
||||
make.right.equalTo(self.titleLabel).offset(8);
|
||||
// make.left.equalTo(self.titleLabel).offset(-55);
|
||||
// make.top.equalTo(self.titleLabel).offset(0);
|
||||
// make.bottom.equalTo(self.titleLabel).offset(0);
|
||||
// make.right.equalTo(self.titleLabel).offset(55);
|
||||
}];
|
||||
}else{
|
||||
NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"];
|
||||
[self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
||||
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)];
|
||||
self.bubbleImageView.image = image;
|
||||
|
||||
}];
|
||||
CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
|
||||
self.bubbleImageView.backgroundColor = [UIColor clearColor];
|
||||
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-48);
|
||||
// make.height.mas_equalTo(height+12);
|
||||
make.height.mas_equalTo(height+60);
|
||||
// make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8);
|
||||
make.centerY.equalTo(self.titleLabel);
|
||||
make.right.equalTo(self.titleLabel).offset(48);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
-(NSMutableArray *)iconViewArray{
|
||||
if (!_iconViewArray) {
|
||||
_iconViewArray = [NSMutableArray array];
|
||||
}
|
||||
return _iconViewArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomGiftListCell
|
||||
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString* cellId = @"QXRoomGiftListCell";
|
||||
QXRoomGiftListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRoomGiftListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)headerAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:self.message.FromUserInfo.user_id];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setMessage:(QXRoomChatListModel *)message{
|
||||
_message = message;
|
||||
self.titleLabel.text = message.text;
|
||||
self.nameLabel.text = message.FromUserInfo.nickname;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
|
||||
self.iconBgView.hidden = YES;
|
||||
for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
|
||||
if (i < 3) {
|
||||
self.iconBgView.hidden = NO;
|
||||
UIImageView *iconImageView = self.iconViewArray[i];
|
||||
iconImageView.hidden = NO;
|
||||
[iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
|
||||
}else{
|
||||
self.iconBgView.hidden = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] init];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.headerImageView.backgroundColor = [UIColor whiteColor];
|
||||
[self.headerImageView addRoundedCornersWithRadius:14];
|
||||
[self.contentView addSubview:self.headerImageView];
|
||||
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(2);
|
||||
make.size.mas_equalTo(CGSizeMake(28, 28));
|
||||
}];
|
||||
|
||||
UIButton *headerBtn = [[UIButton alloc] init];
|
||||
[headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.contentView addSubview:headerBtn];
|
||||
[headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.equalTo(self.headerImageView).offset(-2);
|
||||
make.bottom.right.equalTo(self.headerImageView).offset(2);
|
||||
}];
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.contentView);
|
||||
make.left.equalTo(self.headerImageView.mas_right).offset(6);
|
||||
make.right.equalTo(self.contentView).offset(-6);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = [UIColor whiteColor];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel).offset(8);
|
||||
make.top.equalTo(self.headerImageView.mas_bottom).offset(14);
|
||||
make.right.mas_lessThanOrEqualTo(-8);
|
||||
}];
|
||||
|
||||
|
||||
self.nameLabel.text = @"张三站撒旦撒大萨达撒";
|
||||
|
||||
self.bubbleImageView = [[UIImageView alloc] init];
|
||||
// UIImage * image = [UIImage imageWithColor:RGB16A(0xffffff, 0.2)];
|
||||
[self.bubbleImageView addRoundedCornersWithRadius:6];
|
||||
|
||||
// UIImage *image = [UIImage imageWithContentsOfFile:path];
|
||||
// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)];
|
||||
// self.bubbleImageView.image = image;
|
||||
self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[self.contentView addSubview:self.bubbleImageView];
|
||||
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-8);
|
||||
make.top.equalTo(self.titleLabel).offset(-6);
|
||||
make.bottom.equalTo(self.titleLabel).offset(6);
|
||||
make.right.equalTo(self.titleLabel).offset(8);
|
||||
// make.left.equalTo(self.titleLabel).offset(-55);
|
||||
// make.top.equalTo(self.titleLabel).offset(0);
|
||||
// make.bottom.equalTo(self.titleLabel).offset(0);
|
||||
// make.right.equalTo(self.titleLabel).offset(55);
|
||||
}];
|
||||
|
||||
[self.contentView bringSubviewToFront:self.titleLabel];
|
||||
|
||||
self.iconBgView = [[UIView alloc] init];
|
||||
[self.contentView addSubview:self.iconBgView];
|
||||
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel);
|
||||
make.right.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(16);
|
||||
make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
|
||||
}];
|
||||
|
||||
CGFloat iconWidth = 38;
|
||||
CGFloat iconHeight = 16;
|
||||
CGFloat margin = 6;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UIImageView *iconImageView = [[UIImageView alloc] init];
|
||||
iconImageView.hidden = YES;
|
||||
[self.iconBgView addSubview:iconImageView];
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(i*(iconWidth+margin));
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
}];
|
||||
[self.iconViewArray addObject:iconImageView];
|
||||
}
|
||||
}
|
||||
-(void)loadBubble{
|
||||
if (!self.message.havBubble) {
|
||||
[self.bubbleImageView sd_cancelLatestImageLoad];
|
||||
self.bubbleImageView.image = nil;
|
||||
self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-8);
|
||||
make.top.equalTo(self.titleLabel).offset(-6);
|
||||
make.bottom.equalTo(self.titleLabel).offset(6);
|
||||
make.right.equalTo(self.titleLabel).offset(8);
|
||||
// make.left.equalTo(self.titleLabel).offset(-55);
|
||||
// make.top.equalTo(self.titleLabel).offset(0);
|
||||
// make.bottom.equalTo(self.titleLabel).offset(0);
|
||||
// make.right.equalTo(self.titleLabel).offset(55);
|
||||
}];
|
||||
}else{
|
||||
NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"];
|
||||
[self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
||||
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)];
|
||||
self.bubbleImageView.image = image;
|
||||
|
||||
}];
|
||||
CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
|
||||
self.bubbleImageView.backgroundColor = [UIColor clearColor];
|
||||
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel).offset(-48);
|
||||
// make.height.mas_equalTo(height+12);
|
||||
make.height.mas_equalTo(height+60);
|
||||
// make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8);
|
||||
make.centerY.equalTo(self.titleLabel);
|
||||
make.right.equalTo(self.titleLabel).offset(48);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
-(NSMutableArray *)iconViewArray{
|
||||
if (!_iconViewArray) {
|
||||
_iconViewArray = [NSMutableArray array];
|
||||
}
|
||||
return _iconViewArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation QXRoomChatListSystemCell
|
||||
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString* cellId = @"QXRoomChatListSystemCell";
|
||||
QXRoomChatListSystemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRoomChatListSystemCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)setMessage:(QXRoomChatListModel *)message{
|
||||
_message = message;
|
||||
self.titleLabel.text = message.text;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgView = [[UIView alloc] init];
|
||||
self.bgView.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.bgView addRoundedCornersWithRadius:6];
|
||||
[self.contentView addSubview:self.bgView];
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_lessThanOrEqualTo(-8);
|
||||
make.top.mas_equalTo(6);
|
||||
make.bottom.mas_equalTo(-6);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = QXConfig.themeColor;
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgView).offset(8);
|
||||
make.top.mas_equalTo(8);
|
||||
make.bottom.mas_equalTo(-8);
|
||||
make.right.mas_equalTo(-8);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXRoomChatListModel
|
||||
|
||||
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{@"GiftInfo" : @"QXGiftModel",
|
||||
@"FromUserInfo":@"QXUserHomeModel",
|
||||
@"nextInfo":@"QXSongListModel",
|
||||
@"songInfo":@"QXSongListModel"
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
16
QXLive/HomePage(声播)/View/房间/QXRoomNoticeView.h
Normal file
16
QXLive/HomePage(声播)/View/房间/QXRoomNoticeView.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRoomNoticeView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomNoticeView : UIView
|
||||
@property (nonatomic,strong)NSString *roomNotice;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
84
QXLive/HomePage(声播)/View/房间/QXRoomNoticeView.m
Normal file
84
QXLive/HomePage(声播)/View/房间/QXRoomNoticeView.m
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// QXRoomNoticeView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomNoticeView.h"
|
||||
@interface QXRoomNoticeView()
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIScrollView *scrollView;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@end
|
||||
|
||||
@implementation QXRoomNoticeView
|
||||
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(200));
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
[self addRoundedCornersWithRadius:16];
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self addSubview:self.titleLabel];
|
||||
self.titleLabel.text = QXText(@"房间公告");
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(12);
|
||||
make.centerX.equalTo(self);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(5);
|
||||
make.centerY.equalTo(self.titleLabel);;
|
||||
make.width.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
self.scrollView = [[UIScrollView alloc] init];
|
||||
[self addSubview:self.scrollView];
|
||||
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.bottom.mas_equalTo(-16);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.textColor = RGB16(0x666666);
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.scrollView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.scrollView);
|
||||
make.width.equalTo(self.scrollView);
|
||||
make.centerX.equalTo(self.scrollView);
|
||||
}];
|
||||
}
|
||||
-(void)setRoomNotice:(NSString *)roomNotice{
|
||||
_roomNotice = roomNotice;
|
||||
// CGFloat height = [roomNotice heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(300)-12];
|
||||
// self.scrollView.contentSize = CGSizeMake(ScaleWidth(300)-32, height);
|
||||
// self.scrollView.contentOffset = CGPointMake(0, 0);
|
||||
self.messageLabel.text = roomNotice;
|
||||
}
|
||||
-(void)closeAction{
|
||||
[[QXGlobal shareGlobal] hideViewBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
@end
|
||||
26
QXLive/HomePage(声播)/View/房间/QXRoomOnlineUserListView.h
Normal file
26
QXLive/HomePage(声播)/View/房间/QXRoomOnlineUserListView.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// QXRoomOnlineUserListView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomSeatDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomOnlineUserListView : UIView
|
||||
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
/// 是否为抱麦
|
||||
@property (nonatomic,assign)BOOL isHugSeat;
|
||||
@property (nonatomic,strong)NSString *pitNumber;
|
||||
|
||||
@property (nonatomic,copy)void(^onlineListBlock)(NSArray*onlineUsers);
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
181
QXLive/HomePage(声播)/View/房间/QXRoomOnlineUserListView.m
Normal file
181
QXLive/HomePage(声播)/View/房间/QXRoomOnlineUserListView.m
Normal file
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// QXRoomOnlineUserListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomOnlineUserListView.h"
|
||||
#import "QXBlackListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomOnlineUserListView()<UITableViewDataSource,UITableViewDelegate,UIGestureRecognizerDelegate,QXBlackListCellDelegate>
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *allUsers;;
|
||||
@end
|
||||
|
||||
@implementation QXRoomOnlineUserListView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"在线用户(%@人)"),@"0"];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(27);
|
||||
make.left.right.equalTo(self.bgView);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.rowHeight = 60;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf getOnlineList];
|
||||
}];
|
||||
[self.bgView addSubview:self.tableView];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(12);
|
||||
make.bottom.equalTo(self.bgView);
|
||||
make.left.right.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(void)didHugSeatWithModel:(QXRoomUserInfoModel *)model{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomCompereApplyPitWithRoomId:self.roomId pit_number:self.pitNumber user_id:model.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(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];
|
||||
[weakSelf.allUsers addObjectsFromArray:onPitList];
|
||||
[weakSelf.allUsers addObjectsFromArray:offPitList];
|
||||
weakSelf.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"在线用户(%@人)"),[NSString stringWithFormat:@"%ld",onPitList.count+offPitList.count]];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
if (weakSelf.onlineListBlock) {
|
||||
weakSelf.onlineListBlock(weakSelf.allUsers);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
[self getOnlineList];
|
||||
}
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
NSMutableArray *arr = self.dataArray[section];
|
||||
return arr.count;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
if (self.isHugSeat) {
|
||||
cell.cellType = QXBlackListCellTypeHugSeat;
|
||||
}else{
|
||||
cell.cellType = QXBlackListCellTypeOnline;
|
||||
}
|
||||
|
||||
NSMutableArray *arr = self.dataArray[indexPath.section];
|
||||
cell.onlineUser = arr[indexPath.row];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
|
||||
header.backgroundColor = [UIColor whiteColor];
|
||||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 30)];
|
||||
titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
titleLabel.textColor = RGB16(0x666666);
|
||||
[header addSubview:titleLabel];
|
||||
if (section == 0) {
|
||||
titleLabel.text = @"麦上用户";
|
||||
}else{
|
||||
titleLabel.text = @"麦下用户";
|
||||
}
|
||||
return header;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 30;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
NSMutableArray *arr = self.dataArray[indexPath.section];
|
||||
QXRoomUserInfoModel*user = arr[indexPath.row];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:user.user_id];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)allUsers{
|
||||
if (!_allUsers) {
|
||||
_allUsers = [NSMutableArray array];
|
||||
}
|
||||
return _allUsers;
|
||||
}
|
||||
@end
|
||||
43
QXLive/HomePage(声播)/View/房间/QXRoomSeatSettingView.h
Normal file
43
QXLive/HomePage(声播)/View/房间/QXRoomSeatSettingView.h
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// QXRoomSeatSettingView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 闭麦
|
||||
QXRoomSeatSettingMuteMic = 0,
|
||||
/// 锁麦
|
||||
QXRoomSeatSettingLockMic,
|
||||
/// 抱麦
|
||||
QXRoomSeatSettingHugMic
|
||||
}QXRoomSeatSettingType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomSeatSettingView : UIView
|
||||
//@property (nonatomic,assign)BOOL isLockMic;
|
||||
//@property (nonatomic,assign)BOOL isMuteMic;
|
||||
@property (nonatomic,strong) QXRoomPitModel *pitModel;
|
||||
@property (nonatomic,strong) NSString *roomId;
|
||||
@property (nonatomic,copy)void (^setSuccessBlock)(QXRoomPitModel *pitModel);
|
||||
@property (nonatomic,copy)void (^clickHugBlock)(QXRoomPitModel *pitModel);
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomSeatSettingCell : UITableViewCell
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UISwitch *eventSwitch;
|
||||
@property (nonatomic,assign)BOOL isOn;
|
||||
@property (nonatomic,assign)QXRoomSeatSettingType settingType;
|
||||
@property (nonatomic,strong) QXRoomPitModel *pitModel;
|
||||
@property (nonatomic,strong) NSString *roomId;
|
||||
@property (nonatomic,copy)void (^setSuccessBlock)(QXRoomPitModel *pitModel);
|
||||
+(instancetype)cellWithTableView:(UITableView*)tableView;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
219
QXLive/HomePage(声播)/View/房间/QXRoomSeatSettingView.m
Normal file
219
QXLive/HomePage(声播)/View/房间/QXRoomSeatSettingView.m
Normal file
@@ -0,0 +1,219 @@
|
||||
//
|
||||
// QXRoomSeatSettingView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import "QXRoomSeatSettingView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomSeatSettingView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@end
|
||||
@implementation QXRoomSeatSettingView
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
// ScaleWidth(126)
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(172))/2.0, (SCREEN_HEIGHT - ScaleWidth(126))/2.0, ScaleWidth(172), ScaleWidth(84))];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:self.bgView.bounds style:(UITableViewStyleGrouped)];
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.rowHeight =ScaleWidth(84)/2;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(void)setPitModel:(QXRoomPitModel *)pitModel{
|
||||
_pitModel = pitModel;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
return [UIView new];;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
return [UIView new];;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
// return 3;
|
||||
return 2;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSeatSettingCell *cell = [QXRoomSeatSettingCell cellWithTableView:tableView];
|
||||
cell.roomId = self.roomId;
|
||||
cell.pitModel = self.pitModel;
|
||||
if (indexPath.row == 0) {
|
||||
// cell.isOn = self.pitModel.is_mute.intValue == 1;
|
||||
// cell.settingType = QXRoomSeatSettingMuteMic;
|
||||
cell.isOn = self.pitModel.is_lock.intValue == 1;
|
||||
cell.settingType = QXRoomSeatSettingLockMic;
|
||||
}
|
||||
// else if(indexPath.row == 1){
|
||||
// cell.isOn = self.pitModel.is_lock.intValue == 1;
|
||||
// cell.settingType = QXRoomSeatSettingLockMic;
|
||||
// }
|
||||
else{
|
||||
cell.settingType = QXRoomSeatSettingHugMic;
|
||||
}
|
||||
MJWeakSelf
|
||||
cell.setSuccessBlock = ^(QXRoomPitModel * _Nonnull pitModel) {
|
||||
weakSelf.setSuccessBlock(pitModel);
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.row == 1) {
|
||||
[self hide];
|
||||
if (self.clickHugBlock) {
|
||||
self.clickHugBlock(self.pitModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.alpha = 0;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
self.bgView.alpha = 1;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
self.bgView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXRoomSeatSettingCell
|
||||
|
||||
+ (instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXRoomSeatSettingCell";
|
||||
QXRoomSeatSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRoomSeatSettingCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
self.contentView.backgroundColor = UIColor.clearColor;
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.size.mas_equalTo(CGSizeMake(60, 21));
|
||||
make.centerY.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
self.eventSwitch = [[UISwitch alloc] init];
|
||||
self.eventSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.eventSwitch addRoundedCornersWithRadius:12.5];
|
||||
self.eventSwitch.onTintColor = QXConfig.themeColor;
|
||||
self.eventSwitch.thumbTintColor = [UIColor whiteColor];
|
||||
[self.eventSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.contentView addSubview:self.eventSwitch];
|
||||
[self.eventSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-12);
|
||||
make.centerY.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)setIsOn:(BOOL)isOn{
|
||||
_isOn = isOn;
|
||||
[self.eventSwitch setOn:isOn animated:YES];
|
||||
}
|
||||
-(void)setSettingType:(QXRoomSeatSettingType)settingType{
|
||||
_settingType = settingType;
|
||||
switch (settingType) {
|
||||
case QXRoomSeatSettingMuteMic:{
|
||||
self.eventSwitch.hidden = NO;
|
||||
self.titleLabel.text = @"禁麦";
|
||||
}
|
||||
break;
|
||||
case QXRoomSeatSettingLockMic:{
|
||||
self.eventSwitch.hidden = NO;
|
||||
self.titleLabel.text = @"锁麦";
|
||||
}
|
||||
break;
|
||||
case QXRoomSeatSettingHugMic:{
|
||||
self.eventSwitch.hidden = YES;
|
||||
self.titleLabel.text = @"抱麦";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)eventSwitch:(UISwitch*)sender{
|
||||
BOOL isLock = NO;
|
||||
if (self.settingType == QXRoomSeatSettingMuteMic || self.settingType == QXRoomSeatSettingHugMic) {
|
||||
isLock = NO;
|
||||
}else{
|
||||
isLock = YES;
|
||||
}
|
||||
MJWeakSelf
|
||||
BOOL isOn = sender.isOn;
|
||||
[QXMineNetwork roomPitLockOrMuteIsLock:isLock roomId:self.roomId pit_number:self.pitModel.pit_number.integerValue is_mute:isOn successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (isOn) {
|
||||
[sender setOn:YES animated:YES];
|
||||
}else{
|
||||
[sender setOn:NO animated:YES];
|
||||
}
|
||||
if (isLock) {
|
||||
weakSelf.pitModel.is_lock = isOn?@"1":@"0";
|
||||
}else{
|
||||
weakSelf.pitModel.is_mute = isOn?@"1":@"0";
|
||||
}
|
||||
if (weakSelf.setSuccessBlock) {
|
||||
weakSelf.setSuccessBlock(weakSelf.pitModel);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.eventSwitch setOn:self.isOn animated:YES];
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
@end
|
||||
26
QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h
Normal file
26
QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// QXRoomTitleView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
#import "QXRoomSeatDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@interface QXRoomTitleView : UIView
|
||||
@property (nonatomic,strong)NSArray *onlineUsers;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,strong)QXRoomModel* roomModel;
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
|
||||
|
||||
-(void)onlineNumberIsAdd:(BOOL)isAdd;
|
||||
-(void)setOnlineNumber:(NSString*)onlineNumber;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
400
QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m
Normal file
400
QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m
Normal file
@@ -0,0 +1,400 @@
|
||||
//
|
||||
// QXRoomTitleView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXRoomTitleView.h"
|
||||
#import "QXRoomOnlineUserListView.h"
|
||||
#import "QXRoomNoticeView.h"
|
||||
#import "QXRoomRankView.h"
|
||||
#import "QXGiftPlayerManager.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
#import "QXRoomMessageManager.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXDynamicNetwork.h"
|
||||
|
||||
@interface QXRoomTitleView()<QXRoomSeatDelegate>
|
||||
/// 左侧房间信息背景
|
||||
@property (nonatomic,strong) UIView *leftBgView;
|
||||
/// 房间头像
|
||||
@property (nonatomic,strong) UIImageView *roomImageView;
|
||||
/// 房间名称
|
||||
@property (nonatomic,strong) UILabel * nameLabel;
|
||||
/// 房间id
|
||||
@property (nonatomic,strong) UILabel * IdLabel;
|
||||
/// 关注
|
||||
@property (nonatomic,strong) UIButton *followBtn;
|
||||
/// 退出房间按钮
|
||||
@property (nonatomic,strong) UIButton *closeBtn;
|
||||
|
||||
@property (nonatomic,strong) UILabel *countLabel;
|
||||
@property (nonatomic,strong) UIView *onLineBgView;
|
||||
@property (nonatomic,strong) NSMutableArray *onlineHeaderViewArray;
|
||||
|
||||
/// 排行榜
|
||||
@property (nonatomic,strong) UIButton *rankBtn;
|
||||
/// 公告
|
||||
@property (nonatomic,strong) UIButton *noticeBtn;
|
||||
/// 清除魅力
|
||||
@property (nonatomic,strong)UIButton *clearCharmBtn;
|
||||
|
||||
|
||||
@property (nonatomic,strong) QXRoomOnlineUserListView *onlineListView;
|
||||
@property (nonatomic,strong) QXRoomNoticeView *noticeView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXRoomTitleView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.leftBgView = [[UIView alloc] init];
|
||||
self.leftBgView.backgroundColor = RGB16A(0xFFFFFF,0.2);
|
||||
[self.leftBgView addRoundedCornersWithRadius:ScaleWidth(20)];
|
||||
[self addSubview:self.leftBgView];
|
||||
[self.leftBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.width.mas_equalTo(ScaleWidth(168));
|
||||
make.height.mas_equalTo(ScaleWidth(40));
|
||||
make.top.equalTo(self);
|
||||
}];
|
||||
|
||||
self.roomImageView = [[UIImageView alloc] init];
|
||||
self.roomImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.leftBgView addSubview:self.roomImageView];
|
||||
[self.roomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.mas_equalTo(7);
|
||||
make.bottom.mas_equalTo(-7);
|
||||
make.width.equalTo(self.roomImageView.mas_height);
|
||||
}];
|
||||
|
||||
|
||||
self.followBtn = [[UIButton alloc] init];
|
||||
[self.followBtn setTitle:QXText(@"收藏") forState:(UIControlStateNormal)];
|
||||
[self.followBtn setTitle:QXText(@"已收藏") forState:(UIControlStateSelected)];
|
||||
[self.followBtn addRoundedCornersWithRadius:ScaleWidth(12)];
|
||||
[self.followBtn addTarget:self action:@selector(followAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)];
|
||||
[self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal];
|
||||
[self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected];
|
||||
self.followBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.leftBgView addSubview:self.followBtn];
|
||||
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-7);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(46), ScaleWidth(24)));
|
||||
make.centerY.equalTo(self.leftBgView);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.text = @"房间名称";
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
[self.leftBgView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(3);
|
||||
make.left.equalTo(self.roomImageView.mas_right).offset(4);
|
||||
make.height.mas_equalTo(ScaleWidth(15));
|
||||
make.right.equalTo(self.followBtn.mas_left).offset(-10);
|
||||
}];
|
||||
|
||||
self.IdLabel = [[UILabel alloc] init];
|
||||
self.IdLabel.text = @"ID:0000001";
|
||||
self.IdLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.IdLabel.textColor = [UIColor whiteColor];
|
||||
[self.leftBgView addSubview:self.IdLabel];
|
||||
[self.IdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(-3);
|
||||
make.left.equalTo(self.nameLabel);
|
||||
make.height.mas_equalTo(ScaleWidth(18));
|
||||
make.right.equalTo(self.nameLabel);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"room_close"] forState:(UIControlStateNormal)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(ScaleWidth(40));
|
||||
make.right.mas_equalTo(-5);
|
||||
make.centerY.equalTo(self.leftBgView);
|
||||
}];
|
||||
|
||||
self.countLabel = [[UILabel alloc] init];
|
||||
self.countLabel.textColor = [UIColor whiteColor];
|
||||
self.countLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.countLabel];
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(ScaleWidth(40));
|
||||
make.right.equalTo(self.closeBtn.mas_left).offset(-5);
|
||||
make.centerY.equalTo(self.leftBgView);
|
||||
}];
|
||||
|
||||
MJWeakSelf
|
||||
self.onLineBgView = [[UIView alloc] init];
|
||||
[self.onLineBgView addTapBlock:^(id _Nonnull obj) {
|
||||
[weakSelf showOnlineList];
|
||||
}];
|
||||
[self addSubview:self.onLineBgView];
|
||||
[self.onLineBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.countLabel.mas_left).offset(-5);
|
||||
make.left.equalTo(self.leftBgView.mas_right);
|
||||
make.height.equalTo(self.leftBgView);
|
||||
make.top.equalTo(self.leftBgView);
|
||||
}];
|
||||
|
||||
|
||||
self.rankBtn = [[UIButton alloc] init];
|
||||
[self.rankBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"排行榜")] forState:(UIControlStateNormal)];
|
||||
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.rankBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.rankBtn addTarget:self action:@selector(rankAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.rankBtn setImage:[UIImage imageNamed:@"room_rank_icon"] forState:(UIControlStateNormal)];
|
||||
self.rankBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
|
||||
[self.rankBtn addRoundedCornersWithRadius:ScaleWidth(11)];
|
||||
[self addSubview:self.rankBtn];
|
||||
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(ScaleWidth(70));
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
|
||||
self.noticeBtn = [[UIButton alloc] init];
|
||||
[self.noticeBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"公告")] forState:(UIControlStateNormal)];
|
||||
self.noticeBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.noticeBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.noticeBtn addTarget:self action:@selector(noticeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.noticeBtn setImage:[UIImage imageNamed:@"room_notice_icon"] forState:(UIControlStateNormal)];
|
||||
self.noticeBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
|
||||
[self.noticeBtn addRoundedCornersWithRadius:ScaleWidth(11)];
|
||||
[self addSubview:self.noticeBtn];
|
||||
[self.noticeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(ScaleWidth(58));
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.left.equalTo(self.rankBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
|
||||
self.clearCharmBtn = [[UIButton alloc] init];
|
||||
self.clearCharmBtn.hidden = YES;
|
||||
[self.clearCharmBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"清除魅力")] forState:(UIControlStateNormal)];
|
||||
self.clearCharmBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.clearCharmBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.clearCharmBtn addTarget:self action:@selector(clearAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.clearCharmBtn setImage:[UIImage imageNamed:@"room_clear_charm"] forState:(UIControlStateNormal)];
|
||||
self.clearCharmBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
|
||||
[self.clearCharmBtn addRoundedCornersWithRadius:ScaleWidth(11)];
|
||||
[self addSubview:self.clearCharmBtn];
|
||||
[self.clearCharmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(ScaleWidth(78));
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.left.equalTo(self.noticeBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
|
||||
}];
|
||||
}
|
||||
|
||||
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
|
||||
UIView *hitView= [super hitTest:point withEvent:event];
|
||||
if (hitView== self)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
return hitView;
|
||||
}
|
||||
}
|
||||
-(void)setIsCompere:(BOOL)isCompere{
|
||||
_isCompere = isCompere;
|
||||
self.clearCharmBtn.hidden = !isCompere;
|
||||
}
|
||||
-(void)layoutSubviews{
|
||||
[super layoutSubviews];
|
||||
[self.roomImageView addRoundedCornersWithRadius:ScaleWidth(40-14)/2];
|
||||
}
|
||||
- (void)setRoomModel:(QXRoomModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
[self.roomImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_info.room_cover]];
|
||||
self.nameLabel.text = roomModel.room_info.room_name;
|
||||
self.IdLabel.text = [NSString stringWithFormat:@"ID:%@",roomModel.room_info.room_number];
|
||||
if (roomModel.user_info.is_collect.intValue == 1) {
|
||||
self.followBtn.selected = YES;
|
||||
}else{
|
||||
self.followBtn.selected = NO;
|
||||
}
|
||||
self.countLabel.text = roomModel.room_info.online_number?roomModel.room_info.online_number:@"0";
|
||||
}
|
||||
-(void)setOnlineUsers:(NSArray *)onlineUsers{
|
||||
_onlineUsers = onlineUsers;
|
||||
[self.onLineBgView removeAllSubviews];
|
||||
[self.onlineHeaderViewArray removeAllObjects];
|
||||
QXRoomUserInfoModel *md;
|
||||
CGFloat imageWidth = 18;
|
||||
CGFloat margin = 5;
|
||||
int count = 0;
|
||||
for (QXRoomUserInfoModel *md in onlineUsers) {
|
||||
count++;
|
||||
if (count<4) {
|
||||
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[imageView addRoundedCornersWithRadius:imageWidth/2];
|
||||
[self.onLineBgView addSubview:imageView];
|
||||
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-(imageWidth-margin)*count);
|
||||
make.height.width.mas_equalTo(imageWidth);
|
||||
make.centerY.equalTo(self.onLineBgView);
|
||||
}];
|
||||
if (md) {
|
||||
[imageView sd_setImageWithURL:[NSURL URLWithString:md.avatar]];
|
||||
}
|
||||
[self.onlineHeaderViewArray addObject:imageView];
|
||||
}else{
|
||||
break;;
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < 3; i++) {
|
||||
// if (onlineUsers.count >= 3) {
|
||||
// md = onlineUsers[i];
|
||||
// }else if (onlineUsers.count == 2) {
|
||||
// if (i < 2) {
|
||||
// md = onlineUsers[i];
|
||||
// }
|
||||
// }else if (onlineUsers.count == 1) {
|
||||
// if (i < 1) {
|
||||
// md = onlineUsers[i];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
-(void)clearAction{
|
||||
[QXMineNetwork roomClearCharmWithRoomId:self.roomModel.room_info.room_id userId:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)previewUserInfoWithUserId:(NSString *)userId{
|
||||
[self.onlineListView hide];
|
||||
_onlineListView = nil;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
|
||||
[self.delegate previewUserInfoWithUserId:userId];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showOnlineList{
|
||||
self.onlineListView.roomId = self.roomModel.room_info.room_id;
|
||||
[self.onlineListView showInView:self.viewController.view];
|
||||
}
|
||||
|
||||
-(QXRoomOnlineUserListView *)onlineListView{
|
||||
if (!_onlineListView) {
|
||||
_onlineListView = [[QXRoomOnlineUserListView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
_onlineListView.delegate = self;
|
||||
MJWeakSelf
|
||||
_onlineListView.onlineListBlock = ^(NSArray * _Nonnull onlineUsers) {
|
||||
[weakSelf setOnlineUsers:onlineUsers];
|
||||
weakSelf.countLabel.text = [NSString stringWithFormat:@"%ld",onlineUsers.count];
|
||||
};
|
||||
}
|
||||
return _onlineListView;
|
||||
}
|
||||
-(QXRoomNoticeView *)noticeView{
|
||||
if (!_noticeView) {
|
||||
_noticeView = [[QXRoomNoticeView alloc] init];
|
||||
}
|
||||
return _noticeView;
|
||||
}
|
||||
|
||||
|
||||
-(void)noticeAction{
|
||||
// self.noticeView.roomNotice = @"本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传。本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传。";
|
||||
self.noticeView.roomNotice = self.roomModel.room_info.room_intro;
|
||||
[[QXGlobal shareGlobal] showView:self.noticeView controller:self.viewController popType:(PopViewTypePopFromCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)rankAction{
|
||||
QXRoomRankView *rankView = [[QXRoomRankView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
rankView.roomId = self.roomId;
|
||||
[rankView showInView:self.viewController.view];
|
||||
}
|
||||
|
||||
-(void)followAction:(UIButton*)sender{
|
||||
[QXDynamicNetwork followWithUserId:self.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
sender.selected = !sender.selected;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)onlineNumberIsAdd:(BOOL)isAdd{
|
||||
NSInteger number = self.roomModel.room_info.online_number.integerValue;
|
||||
if (isAdd) {
|
||||
number+=1;
|
||||
}else{
|
||||
number-=1;
|
||||
}
|
||||
if (number <= 0) {
|
||||
number = 0;
|
||||
}
|
||||
self.roomModel.room_info.online_number = [NSString stringWithFormat:@"%ld",number];
|
||||
self.countLabel.text = self.roomModel.room_info.online_number;
|
||||
}
|
||||
-(void)setOnlineNumber:(NSString *)onlineNumber{
|
||||
self.roomModel.room_info.online_number = onlineNumber;
|
||||
self.countLabel.text = self.roomModel.room_info.online_number;
|
||||
}
|
||||
|
||||
-(void)closeAction{
|
||||
MJWeakSelf
|
||||
UIAlertController *al = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"最小化房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[weakSelf miniRoom];
|
||||
[[QXGlobal shareGlobal] miniRoomWithRoomId:weakSelf.roomId roomCover:weakSelf.roomModel.room_info.room_cover];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"退出房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[weakSelf leaveRoom];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
}]];
|
||||
[self.viewController presentViewController:al animated:YES completion:nil];
|
||||
|
||||
}
|
||||
-(void)miniRoom{
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
-(void)leaveRoom{
|
||||
[[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomId];
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
|
||||
-(NSMutableArray *)onlineHeaderViewArray{
|
||||
if (!_onlineHeaderViewArray) {
|
||||
_onlineHeaderViewArray = [NSMutableArray array];
|
||||
}
|
||||
return _onlineHeaderViewArray;
|
||||
}
|
||||
|
||||
@end
|
||||
18
QXLive/HomePage(声播)/View/房间/QXSetApplyGiftView.h
Normal file
18
QXLive/HomePage(声播)/View/房间/QXSetApplyGiftView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXSetApplyGiftView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/16.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSetApplyGiftView : UIView
|
||||
@property (nonatomic,strong)NSString*roomId;
|
||||
@property (nonatomic,copy)void(^setScuseesBlock)(void);
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
164
QXLive/HomePage(声播)/View/房间/QXSetApplyGiftView.m
Normal file
164
QXLive/HomePage(声播)/View/房间/QXSetApplyGiftView.m
Normal file
@@ -0,0 +1,164 @@
|
||||
//
|
||||
// QXSetApplyGiftView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/16.
|
||||
//
|
||||
|
||||
#import "QXSetApplyGiftView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXGiftCell.h"
|
||||
|
||||
@interface QXSetApplyGiftView()<UICollectionViewDelegate,UICollectionViewDataSource,UIGestureRecognizerDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,assign)NSInteger selectedIndex;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
@implementation QXSetApplyGiftView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.selectedIndex = -1;
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(456)+kSafeAreaBottom)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 150, 24)];
|
||||
self.titleLabel.textColor = UIColor.whiteColor;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.text = QXText(@"设置插队礼物");
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-12*3)/4, ScaleWidth(119));
|
||||
layout.minimumLineSpacing = 12;
|
||||
layout.minimumInteritemSpacing = 12;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, self.width, self.bgView.height-kSafeAreaBottom-42-self.titleLabel.bottom-12-10) collectionViewLayout:layout];
|
||||
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, 95, 42)];
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn addTarget:self action:@selector(hide) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cancelBtn.backgroundColor = RGB16(0x333333);
|
||||
|
||||
[self.bgView addSubview:self.cancelBtn];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.bgView.height-kSafeAreaBottom-42, self.bgView.width-38-self.cancelBtn.right-16 , 42)];
|
||||
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
[self getGiftList];
|
||||
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)getGiftList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork giftListWithLabel:@"0" successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
|
||||
weakSelf.selectedIndex = -1;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)commitAction{
|
||||
if (self.selectedIndex == -1) {
|
||||
showToast(@"请选择礼物");
|
||||
return;
|
||||
}
|
||||
QXGiftModel *model = self.dataArray[self.selectedIndex];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork setApplyPitGiftWithRoomId:self.roomId gift_id:model.gift_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.setScuseesBlock) {
|
||||
weakSelf.setScuseesBlock();
|
||||
}
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeLive;
|
||||
cell.roomGiftModel = self.dataArray[indexPath.row];
|
||||
if (self.selectedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.row == self.selectedIndex) {
|
||||
return;
|
||||
}
|
||||
self.selectedIndex = indexPath.row;
|
||||
[collectionView reloadData];
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(456)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array] ;
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
34
QXLive/HomePage(声播)/View/房间/QXSoundListView.h
Normal file
34
QXLive/HomePage(声播)/View/房间/QXSoundListView.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// QXSoundListView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXSoundListModel;
|
||||
@interface QXSoundListView : UIView
|
||||
-(void)showInView:(UIView *)view;
|
||||
@property (nonatomic,copy)void(^playSoundBlock)(QXSoundListModel*model);
|
||||
@end
|
||||
|
||||
|
||||
@interface QXSoundListCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)UIButton *selectedBgBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedSoundBtn;
|
||||
@property (nonatomic,strong)UIImageView *iconImageView;
|
||||
@property (nonatomic,strong)UIButton *titleBtn;
|
||||
|
||||
@property (nonatomic,strong)QXSoundListModel *model;
|
||||
@end
|
||||
|
||||
@interface QXSoundListModel : NSObject
|
||||
@property (nonatomic,strong)NSString *icon;
|
||||
@property (nonatomic,strong)NSString *name;
|
||||
@property (nonatomic,assign)BOOL isSelected;
|
||||
@property (nonatomic,strong)NSString *filePath;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
216
QXLive/HomePage(声播)/View/房间/QXSoundListView.m
Normal file
216
QXLive/HomePage(声播)/View/房间/QXSoundListView.m
Normal file
@@ -0,0 +1,216 @@
|
||||
//
|
||||
// QXSoundListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import "QXSoundListView.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
|
||||
@interface QXSoundListView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXSoundListModel *selectedModel;
|
||||
@end
|
||||
@implementation QXSoundListView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
QXSoundListModel *md = [[QXSoundListModel alloc] init];
|
||||
md.name = QXText(@"笑声");
|
||||
md.icon = @"room_sound_icon_1";
|
||||
md.filePath = [[NSBundle mainBundle] pathForResource:@"音效-笑声" ofType:@"mp3"];
|
||||
|
||||
QXSoundListModel *md1 = [[QXSoundListModel alloc] init];
|
||||
md1.name = QXText(@"欢呼");
|
||||
md1.icon = @"room_sound_icon_2";
|
||||
md1.filePath = [[NSBundle mainBundle] pathForResource:@"音效-欢呼" ofType:@"mp3"];
|
||||
|
||||
QXSoundListModel *md2 = [[QXSoundListModel alloc] init];
|
||||
md2.name = QXText(@"尴尬");
|
||||
md2.icon = @"room_sound_icon_3";
|
||||
md2.filePath = [[NSBundle mainBundle] pathForResource:@"音效-尴尬" ofType:@"mp3"];
|
||||
|
||||
QXSoundListModel *md3 = [[QXSoundListModel alloc] init];
|
||||
md3.name = QXText(@"尖叫");
|
||||
md3.icon = @"room_sound_icon_4";
|
||||
md3.filePath = [[NSBundle mainBundle] pathForResource:@"音效-掌声" ofType:@"mp3"];
|
||||
|
||||
QXSoundListModel *md4 = [[QXSoundListModel alloc] init];
|
||||
md4.name = QXText(@"么么哒");
|
||||
md4.icon = @"room_sound_icon_5";
|
||||
md4.filePath = [[NSBundle mainBundle] pathForResource:@"音效-么么哒" ofType:@"mp3"];
|
||||
[self.dataArray addObject:md];
|
||||
[self.dataArray addObject:md1];
|
||||
[self.dataArray addObject:md2];
|
||||
[self.dataArray addObject:md3];
|
||||
[self.dataArray addObject:md4];
|
||||
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(279)+kSafeAreaBottom)];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, SCREEN_WIDTH-32, 27)];
|
||||
self.titleLabel.textColor = UIColor.whiteColor;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.text = QXText(@"选择音效");
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
CGFloat itemWidth = (SCREEN_WIDTH-16*2-10*4)/5;
|
||||
layout.itemSize = CGSizeMake(itemWidth, 100);
|
||||
layout.minimumLineSpacing = 10;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+22, self.bgView.width, self.bgView.height-self.titleLabel.bottom-22-kSafeAreaBottom) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXSoundListCell class] forCellWithReuseIdentifier:@"QXSoundListCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, SCREEN_WIDTH-38*2, 42)];
|
||||
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSoundListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSoundListCell" forIndexPath:indexPath];
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.selectedModel == nil) {
|
||||
QXSoundListModel *model = self.dataArray[indexPath.row];
|
||||
model.isSelected = YES;
|
||||
self.selectedModel = model;
|
||||
[collectionView reloadData];
|
||||
}else{
|
||||
QXSoundListModel *model = self.dataArray[indexPath.row];
|
||||
if (model.isSelected) {
|
||||
return;
|
||||
}
|
||||
self.selectedModel.isSelected = NO;
|
||||
model.isSelected = YES;
|
||||
self.selectedModel = model;
|
||||
[collectionView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(279)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)commitAction{
|
||||
[self hide];
|
||||
[[QXAgoraEngine sharedEngine].agoraKit playEffect:1 filePath:self.selectedModel.filePath loopCount:0 pitch:1 pan:0 gain:100 publish:YES];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXSoundListCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setModel:(QXSoundListModel *)model{
|
||||
_model = model;
|
||||
self.titleBtn.selected = model.isSelected;
|
||||
[self.titleBtn setTitle:model.name forState:(UIControlStateNormal)];
|
||||
self.selectedBgBtn.selected = model.isSelected;
|
||||
self.selectedSoundBtn.selected = model.isSelected;
|
||||
self.iconImageView.image = [UIImage imageNamed:model.icon];
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.selectedBgBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
|
||||
[self.selectedBgBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
|
||||
[self.selectedBgBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
|
||||
[self.selectedBgBtn addRoundedCornersWithRadius:12];
|
||||
self.selectedBgBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.selectedBgBtn];
|
||||
|
||||
self.selectedSoundBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-14-5, 5, 14, 14)];
|
||||
[self.selectedSoundBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_icon_sel"] forState:(UIControlStateSelected)];
|
||||
[self.selectedSoundBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_icon_nor"] forState:(UIControlStateNormal)];
|
||||
self.selectedSoundBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.selectedSoundBtn];
|
||||
|
||||
self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.width-ScaleWidth(48))/2, 15, ScaleWidth(48), ScaleWidth(48))];
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
|
||||
self.titleBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom, self.width, 21)];
|
||||
[self.titleBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.titleBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.titleBtn];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXSoundListModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
51
QXLive/HomePage(声播)/View/房间/QXUpSeatView.h
Normal file
51
QXLive/HomePage(声播)/View/房间/QXUpSeatView.h
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// QXUpSeatView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXUpSeatViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
-(void)didClickUpSeat;
|
||||
|
||||
@end
|
||||
@interface QXUpSeatView : UIView
|
||||
@property (nonatomic,strong)NSString* roomId;
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,weak)id<QXUpSeatViewDelegate>delegate;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
@interface QXUpSeatViewCell : UICollectionViewCell
|
||||
|
||||
@property (nonatomic,strong)NSString* roomId;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *coinBtn;
|
||||
|
||||
@property (nonatomic,strong)UIButton *insertBtn;
|
||||
|
||||
@property (nonatomic,strong) QXRoomOnlineList *model;
|
||||
|
||||
@property (nonatomic,copy)void(^insertScuccessBlock)(void);
|
||||
@end
|
||||
|
||||
@interface QXUpSeatCountView : UIView
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *typeLabel;
|
||||
@property (nonatomic,strong)UILabel *teamLabel;
|
||||
|
||||
@property (nonatomic,strong)UILabel *countLabel;
|
||||
@property (nonatomic,strong)UIButton *button;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
522
QXLive/HomePage(声播)/View/房间/QXUpSeatView.m
Normal file
522
QXLive/HomePage(声播)/View/房间/QXUpSeatView.m
Normal file
@@ -0,0 +1,522 @@
|
||||
//
|
||||
// QXUpSeatView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import "QXUpSeatView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXSetApplyGiftView.h"
|
||||
|
||||
@interface QXUpSeatView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
/// 优先通道
|
||||
@property (nonatomic,strong)UILabel *priorityLabel;
|
||||
@property (nonatomic,strong)UICollectionView *priorityCollectionView;
|
||||
/// 等待上台
|
||||
@property (nonatomic,strong)UILabel *waitLabel;
|
||||
@property (nonatomic,strong)UIButton *refuseBtn;
|
||||
@property (nonatomic,strong)UICollectionView *waitCollectionView;
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *selectedArray;
|
||||
|
||||
@property (nonatomic,strong)UIButton *agreeBtn;
|
||||
@property (nonatomic,strong)UIButton *applyBtn;
|
||||
@property (nonatomic,strong)UIButton *noAgreeBtn;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *compereHeader;
|
||||
@property (nonatomic,strong)UILabel *giftLabel;
|
||||
@property (nonatomic,strong)UIButton *setBtn;
|
||||
|
||||
@property (nonatomic,strong)QXRoomApplyPitModel *model;
|
||||
|
||||
@property (nonatomic,strong)QXSetApplyGiftView *giftView;
|
||||
@end
|
||||
|
||||
@implementation QXUpSeatView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(456)+kSafeAreaBottom)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
self.setBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-44-16, 16, 44, 24)];
|
||||
[self.setBtn setTitle:QXText(@"赠送") forState:(UIControlStateNormal)];
|
||||
[self.setBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];;
|
||||
self.setBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.setBtn addRoundedCornersWithRadius:12];
|
||||
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.setBtn];
|
||||
|
||||
self.giftLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.setBtn.left-100, 16, 100, 24)];
|
||||
self.giftLabel.textColor = UIColor.whiteColor;
|
||||
self.giftLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.giftLabel.text = [NSString stringWithFormat:@"赠送**礼物插队"];
|
||||
[self.bgView addSubview:self.giftLabel];
|
||||
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-(self.setBtn.width+4+16));
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.compereHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.compereHeader.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.compereHeader addRoundedCornersWithRadius:12];
|
||||
[self.bgView addSubview:self.compereHeader];
|
||||
[self.compereHeader mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(16);
|
||||
make.right.equalTo(self.giftLabel.mas_left).offset(-2);
|
||||
make.width.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.priorityLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 150, 24)];
|
||||
self.priorityLabel.textColor = UIColor.whiteColor;
|
||||
self.priorityLabel.font = [UIFont systemFontOfSize:16];
|
||||
self.priorityLabel.text = [NSString localizedStringWithFormat:QXText(@"优先通道(%@/20)"),@"0"];
|
||||
[self.bgView addSubview:self.priorityLabel];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(ScaleWidth(57), ScaleWidth(108));
|
||||
layout.minimumLineSpacing = 16;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.priorityCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.priorityLabel.bottom+6, self.bgView.width, ScaleWidth(108)) collectionViewLayout:layout];
|
||||
[self.priorityCollectionView registerClass:[QXUpSeatViewCell class] forCellWithReuseIdentifier:@"QXUpSeatViewCell"];
|
||||
self.priorityCollectionView.delegate = self;
|
||||
self.priorityCollectionView.dataSource = self;
|
||||
self.priorityCollectionView.backgroundColor = [UIColor clearColor];
|
||||
self.priorityCollectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.priorityCollectionView.bounces = NO;
|
||||
[self.bgView addSubview:self.priorityCollectionView];
|
||||
|
||||
|
||||
|
||||
self.waitLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.priorityCollectionView.bottom+30, 125, 24)];
|
||||
self.waitLabel.textColor = UIColor.whiteColor;
|
||||
self.waitLabel.font = [UIFont systemFontOfSize:16];
|
||||
self.waitLabel.text = [NSString localizedStringWithFormat:QXText(@"等待上台(%@/20)"),@"0"];
|
||||
[self.bgView addSubview:self.waitLabel];
|
||||
|
||||
self.refuseBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.waitLabel.right+5, self.waitLabel.top, 55, 24)];
|
||||
[self.refuseBtn setTitle:QXText(@"清空") forState:(UIControlStateNormal)];
|
||||
[self.refuseBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.refuseBtn addTarget:self action:@selector(clearAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.refuseBtn addRoundedCornersWithRadius:12];
|
||||
self.refuseBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.refuseBtn.backgroundColor = QXConfig.themeColor;
|
||||
self.refuseBtn.hidden = YES;
|
||||
[self.bgView addSubview:self.refuseBtn];
|
||||
|
||||
|
||||
UICollectionViewFlowLayout *layout1 = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout1.itemSize = CGSizeMake(ScaleWidth(57), ScaleWidth(108));
|
||||
layout1.minimumLineSpacing = 16;
|
||||
layout1.minimumInteritemSpacing = 0;
|
||||
layout1.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout1.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
self.waitCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.waitLabel.bottom+6, self.bgView.width, ScaleWidth(108)) collectionViewLayout:layout1];
|
||||
[self.waitCollectionView registerClass:[QXUpSeatViewCell class] forCellWithReuseIdentifier:@"QXUpSeatViewCell"];
|
||||
self.waitCollectionView.delegate = self;
|
||||
self.waitCollectionView.dataSource = self;
|
||||
self.waitCollectionView.backgroundColor = [UIColor clearColor];
|
||||
self.waitCollectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.waitCollectionView.bounces = NO;
|
||||
[self.bgView addSubview:self.waitCollectionView];
|
||||
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, SCREEN_WIDTH-38*2, 42)];
|
||||
[self.commitBtn setTitle:QXText(@"立即申请") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
|
||||
|
||||
CGFloat leftMargin = 26;
|
||||
CGFloat allWidth =(SCREEN_WIDTH- leftMargin*2);
|
||||
CGFloat btnWidth = 95;
|
||||
CGFloat btnSpace = (allWidth - btnWidth*3)/2;
|
||||
self.noAgreeBtn = [[UIButton alloc] initWithFrame:CGRectMake(leftMargin, self.bgView.height-kSafeAreaBottom-42, btnWidth, 42)];
|
||||
[self.noAgreeBtn setTitle:QXText(@"拒绝") forState:(UIControlStateNormal)];
|
||||
[self.noAgreeBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.noAgreeBtn addTarget:self action:@selector(noAgreeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.noAgreeBtn addRoundedCornersWithRadius:21];
|
||||
self.noAgreeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.noAgreeBtn.backgroundColor = RGB16(0x333333);
|
||||
self.noAgreeBtn.hidden = YES;
|
||||
[self.bgView addSubview:self.noAgreeBtn];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
self.agreeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.noAgreeBtn.right+btnSpace, self.bgView.height-kSafeAreaBottom-42, btnWidth , 42)];
|
||||
[self.agreeBtn setTitle:QXText(@"同意") forState:(UIControlStateNormal)];
|
||||
[self.agreeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.agreeBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.agreeBtn addRoundedCornersWithRadius:21];
|
||||
self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.agreeBtn.backgroundColor = QXConfig.themeColor;
|
||||
self.agreeBtn.hidden = YES;
|
||||
[self.bgView addSubview:self.agreeBtn];
|
||||
|
||||
|
||||
self.applyBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.agreeBtn.right+btnSpace, self.bgView.height-kSafeAreaBottom-42, btnWidth, 42)];
|
||||
[self.applyBtn setTitle:QXText(@"申请") forState:(UIControlStateNormal)];
|
||||
[self.applyBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.applyBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.applyBtn addRoundedCornersWithRadius:21];
|
||||
self.applyBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.applyBtn.backgroundColor = RGB16(0x333333);
|
||||
self.applyBtn.hidden = YES;
|
||||
[self.bgView addSubview:self.applyBtn];
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomApplyPitListWithRoomId:self.roomId successBlock:^(QXRoomApplyPitModel * _Nonnull model) {
|
||||
[weakSelf.selectedArray removeAllObjects];
|
||||
weakSelf.model = model;
|
||||
[weakSelf.priorityCollectionView reloadData];
|
||||
[weakSelf.waitCollectionView reloadData];
|
||||
if (model.gift_info != nil) {
|
||||
weakSelf.giftLabel.text = [NSString localizedStringWithFormat:QXText(@"赠送%@插队"),model.gift_info.gift_name?model.gift_info.gift_name:@" "];
|
||||
[weakSelf.compereHeader sd_setImageWithURL:[NSURL URLWithString:model.gift_info.base_image]];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)setIsCompere:(BOOL)isCompere{
|
||||
_isCompere = isCompere;
|
||||
self.agreeBtn.hidden = !isCompere;
|
||||
self.noAgreeBtn.hidden = !isCompere;
|
||||
self.commitBtn.hidden = isCompere;
|
||||
self.refuseBtn.hidden = !isCompere;
|
||||
self.applyBtn.hidden = !isCompere;
|
||||
[self.setBtn setTitle:isCompere?QXText(@"设置"):QXText(@"赠送") forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (collectionView == self.priorityCollectionView) {
|
||||
// return self.priorityArray.count;
|
||||
if (self.model) {
|
||||
return self.model.special.count;
|
||||
}
|
||||
return 0;
|
||||
}else{
|
||||
// return self.waitArray.count;
|
||||
if (self.model) {
|
||||
return self.model.regular.count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXUpSeatViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUpSeatViewCell" forIndexPath:indexPath];
|
||||
cell.selectedBtn.hidden = !self.isCompere;
|
||||
if (collectionView == self.priorityCollectionView) {
|
||||
cell.model = self.model.special[indexPath.row];
|
||||
}else{
|
||||
cell.model = self.model.regular[indexPath.row];
|
||||
}
|
||||
cell.roomId = self.roomId;
|
||||
MJWeakSelf
|
||||
cell.insertScuccessBlock = ^{
|
||||
[weakSelf setRoomId:weakSelf.roomId];
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomOnlineList *model;
|
||||
QXUpSeatViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
|
||||
if (collectionView == self.priorityCollectionView) {
|
||||
model = self.model.special[indexPath.row];
|
||||
}else{
|
||||
model = self.model.regular[indexPath.row];
|
||||
}
|
||||
model.isSelected = !model.isSelected;
|
||||
cell.model = model;
|
||||
if (model.isSelected) {
|
||||
[self.selectedArray addObject:model.user_id];
|
||||
}else{
|
||||
[self.selectedArray removeObject:model.user_id];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(456)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)commitAction{
|
||||
// if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUpSeat)]) {
|
||||
// [self.delegate didClickUpSeat];
|
||||
// }
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf setRoomId:weakSelf.roomId];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)clearAction{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork clearApplyPitListRoomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf.selectedArray removeAllObjects];
|
||||
self.model.special = @[];
|
||||
self.model.regular = @[];
|
||||
[weakSelf.priorityCollectionView reloadData];
|
||||
[weakSelf.waitCollectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)noAgreeAction{
|
||||
if (self.selectedArray.count == 0) {
|
||||
showToast(@"请选择观众");
|
||||
return;
|
||||
}
|
||||
NSString *userId = [self.selectedArray componentsJoinedByString:@","];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork agreeUpSeatIsAgree:NO roomId:self.roomId userId:userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf setRoomId:weakSelf.roomId];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)agreeAction{
|
||||
if (self.selectedArray.count == 0) {
|
||||
showToast(@"请选择观众");
|
||||
return;
|
||||
}
|
||||
NSString *userId = [self.selectedArray componentsJoinedByString:@","];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork agreeUpSeatIsAgree:YES roomId:self.roomId userId:userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf setRoomId:weakSelf.roomId];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)setAction{
|
||||
if (self.isCompere) {
|
||||
QXLOG(@"设置礼物");
|
||||
[self.giftView showInView:self.viewController.view];
|
||||
}else{
|
||||
QXLOG(@"赠送");
|
||||
///
|
||||
}
|
||||
}
|
||||
|
||||
-(NSMutableArray *)selectedArray{
|
||||
if (!_selectedArray) {
|
||||
_selectedArray = [NSMutableArray array];
|
||||
}
|
||||
return _selectedArray;
|
||||
}
|
||||
-(QXSetApplyGiftView *)giftView{
|
||||
if (!_giftView) {
|
||||
_giftView = [[QXSetApplyGiftView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
_giftView.roomId = self.roomId;
|
||||
MJWeakSelf
|
||||
_giftView.setScuseesBlock = ^{
|
||||
[weakSelf setRoomId:weakSelf.roomId];
|
||||
};
|
||||
}
|
||||
return _giftView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXUpSeatViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.headerImageView addRoundedCornersWithRadius:ScaleWidth(25)];
|
||||
[self.contentView addSubview:self.headerImageView];
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(50), ScaleWidth(50)));
|
||||
make.top.mas_equalTo(0);
|
||||
make.centerX.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
self.nameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.nameLabel.text = @"张三";
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView);
|
||||
make.top.equalTo(self.headerImageView.mas_bottom);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.selectedBtn = [[UIButton alloc] init];
|
||||
self.selectedBtn.userInteractionEnabled = NO;
|
||||
[self.selectedBtn setImage:[[UIImage imageNamed:@"login_agreement_nor"] imageByTintColor:UIColor.whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
|
||||
[self.contentView addSubview:self.selectedBtn];
|
||||
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.contentView);
|
||||
make.top.equalTo(self.contentView);
|
||||
make.size.mas_equalTo(CGSizeMake(16, 16));
|
||||
}];
|
||||
|
||||
|
||||
self.coinBtn = [[UIButton alloc] init];
|
||||
[self.coinBtn setImage:[UIImage imageNamed:@"room_upseat_coin"] forState:(UIControlStateNormal)];
|
||||
[self.coinBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
self.coinBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.coinBtn setTitle:@" 0" forState:(UIControlStateNormal)];
|
||||
self.coinBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.coinBtn];
|
||||
[self.coinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView);
|
||||
make.top.equalTo(self.nameLabel.mas_bottom);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.insertBtn = [[UIButton alloc] init];
|
||||
[self.insertBtn setBackgroundImage:[UIImage imageNamed:@"room_upseat_insert"] forState:(UIControlStateNormal)];
|
||||
[self.contentView addSubview:self.insertBtn];
|
||||
[self.insertBtn addTarget:self action:@selector(insertAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.insertBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.contentView);
|
||||
make.bottom.equalTo(self.contentView);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(57), ScaleWidth(20)));
|
||||
}];
|
||||
}
|
||||
-(void)insertAction{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomApplyPitPowerWithRoomId:self.roomId userId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.insertScuccessBlock) {
|
||||
weakSelf.insertScuccessBlock();
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXRoomOnlineList *)model{
|
||||
_model = model;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
|
||||
self.nameLabel.text = model.nickname;
|
||||
[self.coinBtn setTitle:[NSString stringWithFormat:@" %@",model.rank_value] forState:(UIControlStateNormal)];
|
||||
self.selectedBtn.selected = model.isSelected;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXUpSeatCountView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_mic_team"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.top.equalTo(self);
|
||||
}];
|
||||
|
||||
self.typeLabel = [[UILabel alloc] init];
|
||||
self.typeLabel.text = @"排麦模式";
|
||||
self.typeLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.typeLabel.textColor = RGB16(0xffffff);
|
||||
[self addSubview:self.typeLabel];
|
||||
[self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self).offset(ScaleWidth(2));
|
||||
make.right.mas_equalTo(-10);
|
||||
make.height.mas_equalTo(ScaleWidth(18));
|
||||
}];
|
||||
|
||||
self.teamLabel = [[UILabel alloc] init];
|
||||
self.teamLabel.text = @"人排队";
|
||||
self.teamLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.teamLabel.textColor = RGB16(0xffffff);
|
||||
[self addSubview:self.teamLabel];
|
||||
[self.teamLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self).offset(-ScaleWidth(2));;
|
||||
make.right.mas_equalTo(-10);
|
||||
make.height.mas_equalTo(ScaleWidth(18));
|
||||
}];
|
||||
|
||||
self.countLabel = [[UILabel alloc] init];
|
||||
self.countLabel.text = @"0";
|
||||
self.countLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.countLabel.textColor = RGB16(0xF4DF39);
|
||||
[self addSubview:self.countLabel];
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self);
|
||||
make.right.equalTo(self.teamLabel.mas_left);
|
||||
make.centerY.equalTo(self.teamLabel);
|
||||
}];
|
||||
|
||||
// self.button = [[UIButton alloc] init];
|
||||
// [self addSubview:self.button];
|
||||
// [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.right.bottom.top.equalTo(self);
|
||||
// }];
|
||||
}
|
||||
|
||||
@end
|
||||
17
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionRankView.h
Normal file
17
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionRankView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXRoomAuctionRankView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/1.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomAuctionRankView : UIView
|
||||
@property (nonatomic,strong)NSString *auctionId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
177
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionRankView.m
Normal file
177
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionRankView.m
Normal file
@@ -0,0 +1,177 @@
|
||||
//
|
||||
// QXRoomAuctionRankView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/1.
|
||||
//
|
||||
|
||||
#import "QXRoomAuctionRankView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXRoomRankSubView.h"
|
||||
#import "QXBlackListCell.h"
|
||||
|
||||
@interface QXRoomAuctionRankView()<UIGestureRecognizerDelegate,UITableViewDataSource,UITableViewDelegate>
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIView *tableHeaderView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *firstView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *secondView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *thirdView;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
@end
|
||||
|
||||
@implementation QXRoomAuctionRankView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
|
||||
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(144))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_rank_bg"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
self.bgImageView.frame = self.bgView.bounds;
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 12, self.bgView.width, 30)];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
self.titleLabel.textColor = [UIColor whiteColor];
|
||||
self.titleLabel.text = @"出价榜单";
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 220+44+38+40+8)];
|
||||
CGFloat itemWidth = (self.width-36)/3;
|
||||
self.secondView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(18, 44+38+40+8+50, itemWidth, 135)];
|
||||
self.secondView.number = 2;
|
||||
[self.tableHeaderView addSubview:self.secondView];
|
||||
|
||||
|
||||
self.firstView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.secondView.right, 44+38+40+8, itemWidth, 161)];
|
||||
self.firstView.number = 1;
|
||||
[self.tableHeaderView addSubview:self.firstView];
|
||||
|
||||
self.thirdView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.firstView.right, 44+38+40+8+50, itemWidth, 135)];
|
||||
self.thirdView.number = 3;
|
||||
[self.tableHeaderView addSubview:self.thirdView];
|
||||
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.bgView.height) style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = 60;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableHeaderView = self.tableHeaderView;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getAuctionUserList];
|
||||
}];
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getAuctionUserList];
|
||||
}];
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)setAuctionId:(NSString *)auctionId{
|
||||
_auctionId = auctionId;
|
||||
self.page = 1;
|
||||
[self getAuctionUserList];
|
||||
}
|
||||
-(void)getAuctionUserList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomAuctionUserListWithAuctionId:self.auctionId successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
|
||||
if (weakSelf.page == 1) {
|
||||
weakSelf.firstView.md = nil;
|
||||
weakSelf.secondView.md = nil;
|
||||
weakSelf.thirdView.md = nil;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
for (int i = 0 ; i < list.count; i++) {
|
||||
QXRoomOnlineList*md = list[i];
|
||||
if (i == 0) {
|
||||
// [weakSelf.topArray addObject:md];
|
||||
weakSelf.firstView.md = md;
|
||||
}else if (i == 1) {
|
||||
weakSelf.secondView.md = md;
|
||||
}else if (i == 2) {
|
||||
weakSelf.thirdView.md = md;
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:md];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (list.count == 0) {
|
||||
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
cell.cellType = QXBlackListCellTypeRank;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
cell.titleLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row+4];
|
||||
cell.rankModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = ScaleWidth(144);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
@end
|
||||
55
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionResultView.h
Normal file
55
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionResultView.h
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// QXRoomAuctionResultView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXTimer.h"
|
||||
#import "QXRoomModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomAuctionResultView : UIView
|
||||
@property (nonatomic,strong)QXRoomAuctionUser *user;
|
||||
@property (nonatomic,strong)QXRoomAuctionUser *getUser;
|
||||
-(instancetype)initWithStyle:(BOOL)isSuccess isRealLove:(BOOL)isRealLove;
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
-(void)hide;
|
||||
|
||||
-(void)setResultWithUser:(QXRoomAuctionUser*)user getUser:(QXRoomAuctionUser *)getUser;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomAuctionFailView : UIView
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
-(void)startTimer;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomAuctionSuccessView : UIView
|
||||
-(instancetype)initWithIsRealLove:(BOOL)isRealLove;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *leftHeaderView;
|
||||
@property (nonatomic,strong)UILabel *leftNameLabel;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *rightHeaderView;
|
||||
@property (nonatomic,strong)UILabel *rightNameLabel;
|
||||
|
||||
@property (nonatomic,strong)UILabel *resultLabel;
|
||||
@property (nonatomic,assign)BOOL isRealLove;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
-(void)startTimer;
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
274
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionResultView.m
Normal file
274
QXLive/HomePage(声播)/View/房间/拍卖房/QXRoomAuctionResultView.m
Normal file
@@ -0,0 +1,274 @@
|
||||
//
|
||||
// QXRoomAuctionResultView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/30.
|
||||
//
|
||||
|
||||
#import "QXRoomAuctionResultView.h"
|
||||
@interface QXRoomAuctionResultView()
|
||||
@property (nonatomic,assign)BOOL isSuccess;
|
||||
@property (nonatomic,assign)BOOL isRealLove;
|
||||
@property (nonatomic,strong)QXRoomAuctionFailView *failView;
|
||||
@property (nonatomic,strong)QXRoomAuctionSuccessView *successView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomAuctionResultView
|
||||
|
||||
|
||||
-(instancetype)initWithStyle:(BOOL)isSuccess isRealLove:(BOOL)isRealLove{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.isSuccess = isSuccess;
|
||||
self.isRealLove = isRealLove;
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.4];
|
||||
MJWeakSelf
|
||||
if (self.isSuccess) {
|
||||
self.successView = [[QXRoomAuctionSuccessView alloc] initWithIsRealLove:self.isRealLove];
|
||||
self.successView.alpha = 0;
|
||||
self.successView.closeActionBlock = ^{
|
||||
[weakSelf hide];
|
||||
};
|
||||
[self addSubview:self.successView];
|
||||
}else{
|
||||
self.failView = [[QXRoomAuctionFailView alloc] init];
|
||||
self.failView.closeActionBlock = ^{
|
||||
[weakSelf hide];
|
||||
};
|
||||
[self addSubview:self.failView];
|
||||
}
|
||||
}
|
||||
-(void)setResultWithUser:(QXRoomAuctionUser *)user getUser:(QXRoomAuctionUser *)getUser{
|
||||
[self.successView.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:user.avatar]];
|
||||
self.successView.leftNameLabel.text = user.nickname;
|
||||
[self.successView.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:getUser.avatar]];
|
||||
self.successView.rightNameLabel.text = getUser.nickname;
|
||||
self.successView.resultLabel.text = [NSString stringWithFormat:@"%@签约成功",user.relation_name];
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
if (self.isSuccess) {
|
||||
// self.successView.resultLabel.text = @"";
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.successView.alpha = 1;
|
||||
} completion:^(BOOL finished) {
|
||||
[self.successView startTimer];
|
||||
}];
|
||||
}else{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.failView.y = (SCREEN_HEIGHT-ScaleWidth(238))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
[self.failView startTimer];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
if (self.isSuccess) {
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.successView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}else{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.failView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomAuctionFailView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
CGFloat height = ScaleWidth(238);
|
||||
self.frame = CGRectMake(15, -height, SCREEN_WIDTH-30, height);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_bg"];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, self.width-32, 24)];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
self.titleLabel.text = @"竞拍结束";
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.titleLabel];
|
||||
|
||||
|
||||
self.messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+32, self.width-32, 24)];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.messageLabel.textColor = RGB16(0x333333);
|
||||
self.messageLabel.text = @"本次竞拍已结束,期待您的下次参与";
|
||||
self.messageLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.messageLabel];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, self.height-24-42, self.width-160, 42)];
|
||||
[self.closeBtn addRoundedCornersWithRadius:21];
|
||||
self.closeBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.closeBtn setTitle:QXText(@"知道了") forState:(UIControlStateNormal)];
|
||||
[self.closeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.closeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
}
|
||||
-(void)startTimer{
|
||||
__block int timeCount = 3;
|
||||
MJWeakSelf
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[weakSelf closeAction];
|
||||
}else{
|
||||
[self->_closeBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"知道了"),timeCount] forState:(UIControlStateNormal)];
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)closeAction{
|
||||
[self->_timer invalidate];
|
||||
self->_timer = nil;
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomAuctionSuccessView
|
||||
|
||||
//- (instancetype)init
|
||||
//{
|
||||
// self = [super init];
|
||||
// if (self) {
|
||||
// self.frame = CGRectMake(0, ScaleWidth(219), 372, 306);
|
||||
// [self initSubviews];
|
||||
// }
|
||||
// return self;
|
||||
//}
|
||||
|
||||
- (instancetype)initWithIsRealLove:(BOOL)isRealLove
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_isRealLove = isRealLove;
|
||||
if (isRealLove) {
|
||||
self.frame = CGRectMake(0, ScaleWidth(219), 372, 306);
|
||||
}else{
|
||||
self.frame = CGRectMake(0, ScaleWidth(219), SCREEN_WIDTH, 402);
|
||||
}
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_auction_result_suc"]];
|
||||
self.bgImageView.frame = self.bounds;
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
self.leftHeaderView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 90, 57, 57)];
|
||||
self.leftHeaderView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.leftHeaderView.clipsToBounds = YES;
|
||||
[self.leftHeaderView addRoundedCornersWithRadius:23.5];
|
||||
[self addSubview:self.leftHeaderView];
|
||||
|
||||
self.leftNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 16)];
|
||||
self.leftNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
|
||||
self.leftNameLabel.textColor = RGB16(0xFFE8B0);
|
||||
self.leftNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.leftNameLabel];
|
||||
|
||||
self.rightHeaderView = [[UIImageView alloc] initWithFrame:CGRectMake(self.width-100-57, self.leftHeaderView.top, 57, 57)];
|
||||
self.rightHeaderView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.rightHeaderView.clipsToBounds = YES;
|
||||
[self.rightHeaderView addRoundedCornersWithRadius:23.5];
|
||||
[self addSubview:self.rightHeaderView];
|
||||
|
||||
self.rightNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 16)];
|
||||
self.rightNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
|
||||
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
|
||||
self.rightNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.rightNameLabel];
|
||||
|
||||
self.resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.rightNameLabel.bottom+18, self.width, 17)];
|
||||
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
|
||||
self.resultLabel.textColor = UIColor.whiteColor;
|
||||
// self.resultLabel.transform = CGAffineTransformMakeRotation(-6 * M_PI/180.0);
|
||||
self.resultLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.resultLabel];
|
||||
if (self.isRealLove) {
|
||||
self.bgImageView.frame = self.bounds;
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_suc_real"];
|
||||
self.leftHeaderView.frame = CGRectMake(100, 90, 57, 57);
|
||||
self.rightHeaderView.frame = CGRectMake(self.width-100-57, self.leftHeaderView.top, 57, 57);
|
||||
self.rightNameLabel.frame = CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 16);
|
||||
self.leftNameLabel.frame = CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 16);
|
||||
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
|
||||
self.leftNameLabel.textColor = RGB16(0xFFE8B0);
|
||||
self.rightNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
|
||||
self.leftNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
|
||||
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
|
||||
self.resultLabel.frame = CGRectMake(0, self.rightNameLabel.bottom+18, self.width, 17);
|
||||
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
|
||||
self.resultLabel.textColor = UIColor.whiteColor;
|
||||
[self.rightHeaderView addRoundedCornersWithRadius:23.5];
|
||||
[self.leftHeaderView addRoundedCornersWithRadius:23.5];
|
||||
}else{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_suc"];
|
||||
self.bgImageView.frame = CGRectMake((self.width-302)/2, 0, 302, self.height);
|
||||
self.leftHeaderView.frame = CGRectMake(self.width/2-68, self.height-73-68, 68, 68);
|
||||
self.rightHeaderView.frame = CGRectMake(self.leftHeaderView.right, self.leftHeaderView.top, 68,68);
|
||||
self.rightNameLabel.frame = CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 21);
|
||||
self.leftNameLabel.frame = CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 21);
|
||||
self.rightNameLabel.textColor = RGB16(0xFE435B);
|
||||
self.leftNameLabel.textColor = RGB16(0xFE435B);
|
||||
self.rightNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.leftNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.resultLabel.frame = CGRectMake(0, 19, self.width, 42);
|
||||
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:32];
|
||||
self.resultLabel.textColor = RGB16(0xFFA4C8);
|
||||
[self.rightHeaderView addRoundedCornersWithRadius:34];
|
||||
[self.leftHeaderView addRoundedCornersWithRadius:34];
|
||||
}
|
||||
}
|
||||
-(void)startTimer{
|
||||
__block int timeCount = 3;
|
||||
MJWeakSelf
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[weakSelf closeAction];
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)closeAction{
|
||||
[self->_timer invalidate];
|
||||
self->_timer = nil;
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
31
QXLive/HomePage(声播)/View/房间/拍卖房/QXSelectAuctionInfoView.h
Normal file
31
QXLive/HomePage(声播)/View/房间/拍卖房/QXSelectAuctionInfoView.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXSelectAuctionInfoView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/27.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomRelationModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSelectAuctionInfoView : UIView
|
||||
/// 是否是真爱拍
|
||||
@property (nonatomic,assign)BOOL isRealLove;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
@interface QXSelectAuctionInfoHeaderView : UICollectionReusableView
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@interface QXSelectAuctionInfoCell : UICollectionViewCell
|
||||
@property (nonatomic,strong) QXRoomRelationModel *model;
|
||||
|
||||
@property (nonatomic,strong) QXRoomRelationModel *timeModel;
|
||||
@property (nonatomic,strong) UIButton *selectedBtn;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
428
QXLive/HomePage(声播)/View/房间/拍卖房/QXSelectAuctionInfoView.m
Normal file
428
QXLive/HomePage(声播)/View/房间/拍卖房/QXSelectAuctionInfoView.m
Normal file
@@ -0,0 +1,428 @@
|
||||
//
|
||||
// QXSelectAuctionInfoView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/27.
|
||||
//
|
||||
|
||||
#import "QXSelectAuctionInfoView.h"
|
||||
#import "QXGiftCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
@interface QXSelectAuctionInfoView()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UIGestureRecognizerDelegate>
|
||||
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
//@property (nonatomic,strong)UILabel *contenLabel;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *relationshipArray;
|
||||
@property (nonatomic,strong)NSMutableArray *timeArray;
|
||||
@property (nonatomic,strong)NSMutableArray *giftArray;
|
||||
|
||||
|
||||
@property (nonatomic,strong)QXRoomRelationModel *relationModel;
|
||||
@property (nonatomic,strong)QXRoomRelationModel *timeModel;
|
||||
@property (nonatomic,assign)QXGiftModel *giftModel;
|
||||
@property (nonatomic,assign)NSInteger giftSelctedIndex;
|
||||
@end
|
||||
|
||||
@implementation QXSelectAuctionInfoView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
|
||||
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
// tap.delegate = self;
|
||||
// [self addGestureRecognizer:tap];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
self.titleLabel.textColor = UIColor.whiteColor;
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.text = @"选择内容";
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
// self.contenLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom, self.bgView.width-32, 24)];
|
||||
// self.contenLabel.font = [UIFont systemFontOfSize:14];
|
||||
// self.contenLabel.textColor = UIColor.whiteColor;
|
||||
// [self.bgView addSubview:self.contenLabel];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-12-42, self.bgView.width-76, 42)];
|
||||
[self.commitBtn setTitle:@"确定" forState:(UIControlStateNormal)];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
|
||||
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 12;
|
||||
layout.minimumInteritemSpacing = 12;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom, self.bgView.width, self.commitBtn.top-self.titleLabel.bottom-10) collectionViewLayout:layout];
|
||||
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
|
||||
[self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"];
|
||||
[self.collectionView registerClass:[QXSelectAuctionInfoHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSelectAuctionInfoHeaderView"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.showsVerticalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
|
||||
|
||||
}
|
||||
-(void)commitAction{
|
||||
if (self.relationModel == nil) {
|
||||
showToast(@"请选择关系");
|
||||
return;
|
||||
}
|
||||
if (!self.isRealLove) {
|
||||
if (self.timeModel == nil) {
|
||||
showToast(@"请选择时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (self.giftModel == nil) {
|
||||
showToast(@"请选择礼物");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomAuctionStartWithRoomId:self.roomId user_id:self.userId gift_id:self.giftModel.gift_id relation_id:self.relationModel.relation_id auction_type:self.isRealLove?@"1":@"2" time_day:self.timeModel.relation_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getRelationShipList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomRelationListWithType:self.isRealLove?@"1":@"2" successBlock:^(NSArray<QXRoomRelationModel *> * _Nonnull list) {
|
||||
[weakSelf.relationshipArray removeAllObjects];
|
||||
[weakSelf.relationshipArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getGiftList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork giftListWithLabel:@"99" successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
|
||||
[weakSelf.giftArray removeAllObjects];
|
||||
[weakSelf.giftArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
//-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
// return touch.view == self;
|
||||
//}
|
||||
-(void)setIsRealLove:(BOOL)isRealLove{
|
||||
self.giftModel = nil;
|
||||
self.relationModel = nil;
|
||||
self.timeModel = nil;
|
||||
_timeArray = nil;
|
||||
self.giftSelctedIndex = -1;
|
||||
|
||||
_isRealLove = isRealLove;
|
||||
[self getRelationShipList];
|
||||
[self getGiftList];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
if (self.isRealLove) {
|
||||
return 2;
|
||||
}else{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (section == 0) {
|
||||
return self.relationshipArray.count;
|
||||
}else if(section == 1){
|
||||
if (self.isRealLove) {
|
||||
return self.giftArray.count;
|
||||
}else{
|
||||
return self.timeArray.count;
|
||||
}
|
||||
}else{
|
||||
return self.giftArray.count;
|
||||
}
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
|
||||
cell.model = self.relationshipArray[indexPath.row];
|
||||
return cell;
|
||||
}else if(indexPath.section == 1){
|
||||
if (self.isRealLove) {
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeLive;
|
||||
cell.roomGiftModel = self.giftArray[indexPath.row];
|
||||
if (self.giftSelctedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
}
|
||||
return cell;
|
||||
}else{
|
||||
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
|
||||
cell.model = self.timeArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}else{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeLive;
|
||||
cell.roomGiftModel = self.giftArray[indexPath.row];
|
||||
if (self.giftSelctedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
|
||||
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
|
||||
QXSelectAuctionInfoHeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSelectAuctionInfoHeaderView" forIndexPath:indexPath];
|
||||
if (indexPath.section == 0) {
|
||||
header.titleLabel.text = @"关系";
|
||||
}else if(indexPath.section == 1){
|
||||
if (self.isRealLove) {
|
||||
header.titleLabel.text = @"礼物";
|
||||
}else{
|
||||
header.titleLabel.text = @"时间";
|
||||
}
|
||||
}else{
|
||||
header.titleLabel.text = @"礼物";
|
||||
}
|
||||
return header;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
|
||||
return CGSizeMake(SCREEN_WIDTH, 30);
|
||||
}
|
||||
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
|
||||
return CGSizeMake(width, 44);
|
||||
}else if(indexPath.section == 1){
|
||||
if (self.isRealLove) {
|
||||
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
|
||||
return CGSizeMake(width, ScaleWidth(119));
|
||||
}else{
|
||||
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
|
||||
return CGSizeMake(width, 44);
|
||||
}
|
||||
}else{
|
||||
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
|
||||
return CGSizeMake(width, ScaleWidth(119));
|
||||
}
|
||||
}
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
QXRoomRelationModel *model = self.relationshipArray[indexPath.row];
|
||||
if (model.isSelected) {
|
||||
return;
|
||||
}
|
||||
self.relationModel.isSelected = NO;
|
||||
model.isSelected = YES;
|
||||
self.relationModel = model;
|
||||
[collectionView reloadData];
|
||||
}else if(indexPath.section == 1){
|
||||
if (self.isRealLove) {
|
||||
QXGiftModel *model = self.giftArray[indexPath.row];
|
||||
self.giftSelctedIndex = indexPath.row;
|
||||
self.giftModel = model;
|
||||
[collectionView reloadData];
|
||||
}else{
|
||||
QXRoomRelationModel *model = self.timeArray[indexPath.row];
|
||||
if (model.isSelected) {
|
||||
return;
|
||||
}
|
||||
self.timeModel.isSelected = NO;
|
||||
model.isSelected = YES;
|
||||
self.timeModel = model;
|
||||
[collectionView reloadData];
|
||||
}
|
||||
}else{
|
||||
QXGiftModel *model = self.giftArray[indexPath.row];
|
||||
self.giftSelctedIndex = indexPath.row;
|
||||
self.giftModel = model;
|
||||
[collectionView reloadData];
|
||||
}
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)relationshipArray{
|
||||
if (!_relationshipArray) {
|
||||
_relationshipArray = [NSMutableArray array];
|
||||
}
|
||||
return _relationshipArray;
|
||||
}
|
||||
-(NSMutableArray *)timeArray{
|
||||
if (!_timeArray) {
|
||||
QXRoomRelationModel *md = [[QXRoomRelationModel alloc] init];
|
||||
md.name = @"1天";
|
||||
md.relation_id = @"24";
|
||||
|
||||
QXRoomRelationModel *md1 = [[QXRoomRelationModel alloc] init];
|
||||
md1.name = @"3天";
|
||||
md1.relation_id = @"72";
|
||||
|
||||
QXRoomRelationModel *md2 = [[QXRoomRelationModel alloc] init];
|
||||
md2.name = @"5天";
|
||||
md2.relation_id = @"120";
|
||||
|
||||
QXRoomRelationModel *md3 = [[QXRoomRelationModel alloc] init];
|
||||
md3.name = @"10天";
|
||||
md3.relation_id = @"240";
|
||||
|
||||
QXRoomRelationModel *md4 = [[QXRoomRelationModel alloc] init];
|
||||
md4.name = @"15天";
|
||||
md4.relation_id = @"360";
|
||||
|
||||
QXRoomRelationModel *md5 = [[QXRoomRelationModel alloc] init];
|
||||
md5.name = @"20天";
|
||||
md5.relation_id = @"480";
|
||||
|
||||
QXRoomRelationModel *md6 = [[QXRoomRelationModel alloc] init];
|
||||
md6.name = @"25天";
|
||||
md6.relation_id = @"600";
|
||||
|
||||
QXRoomRelationModel *md7 = [[QXRoomRelationModel alloc] init];
|
||||
md7.name = @"30天";
|
||||
md7.relation_id = @"720";
|
||||
|
||||
_timeArray = [NSMutableArray arrayWithArray:@[
|
||||
md,md1,md2,md3,md4,md5,md6,md7
|
||||
]];
|
||||
}
|
||||
return _timeArray;
|
||||
}
|
||||
-(NSMutableArray *)giftArray{
|
||||
if (!_giftArray) {
|
||||
_giftArray = [NSMutableArray array];
|
||||
}
|
||||
return _giftArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXSelectAuctionInfoHeaderView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 30)];
|
||||
titleLabel.textColor = UIColor.whiteColor;
|
||||
titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
// if (indexPath.section == 0) {
|
||||
// titleLabel.text = @"关系";
|
||||
// }else if(indexPath.section == 1){
|
||||
// if (self.isRealLove) {
|
||||
// titleLabel.text = @"礼物";
|
||||
// }else{
|
||||
// titleLabel.text = @"时间";
|
||||
// }
|
||||
// }else{
|
||||
// titleLabel.text = @"礼物";
|
||||
// }
|
||||
[self addSubview:titleLabel];
|
||||
self.titleLabel = titleLabel;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation QXSelectAuctionInfoCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setModel:(QXRoomRelationModel *)model{
|
||||
_model = model;
|
||||
[self.selectedBtn setTitle:model.name forState:(UIControlStateNormal)];
|
||||
self.selectedBtn.selected = model.isSelected;
|
||||
}
|
||||
-(void)setTimeModel:(QXRoomRelationModel *)timeModel{
|
||||
_timeModel = timeModel;
|
||||
[self.selectedBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateSelected)];
|
||||
[self.selectedBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.selectedBtn setTitle:timeModel.name forState:(UIControlStateNormal)];
|
||||
self.selectedBtn.layer.borderColor = RGB16(0xF1F2F3).CGColor;
|
||||
self.selectedBtn.layer.borderWidth = 1;
|
||||
self.selectedBtn.selected = timeModel.isSelected;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.selectedBtn = [[UIButton alloc] init];
|
||||
[self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
|
||||
[self.selectedBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
|
||||
[self.selectedBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.selectedBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateSelected)];
|
||||
self.selectedBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.selectedBtn addRoundedCornersWithRadius:12];
|
||||
self.selectedBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.selectedBtn];
|
||||
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.right.left.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
// self.titleLabel = [[UILabel alloc] init];
|
||||
// self.titleLabel
|
||||
}
|
||||
|
||||
@end
|
||||
32
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.h
Normal file
32
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// QXRoomRankSubView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomRankSubView : UIView<JXCategoryListContentViewDelegate>
|
||||
@property (nonatomic,strong)NSString*roomId;
|
||||
@property (nonatomic,strong)NSString*type;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomRankTopThreeView :UIView
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
@property (nonatomic,strong)UIImageView *borderImageView;
|
||||
@property (nonatomic,strong)UILabel *onlineLabel;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,strong)UIView *iconBgView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *rankBtn;
|
||||
|
||||
@property (nonatomic,assign)NSInteger number;
|
||||
|
||||
@property (nonatomic,strong)QXRoomOnlineList*md;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
397
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.m
Normal file
397
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.m
Normal file
@@ -0,0 +1,397 @@
|
||||
//
|
||||
// QXRoomRankSubView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomRankSubView.h"
|
||||
#import "QXBlackListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomRankSubView()<UITableViewDataSource,UITableViewDelegate>
|
||||
@property (nonatomic,strong)UIView *topBgView;
|
||||
@property (nonatomic,strong)UIButton *hourBtn;
|
||||
@property (nonatomic,strong)UIButton *dayBtn;
|
||||
@property (nonatomic,strong)UIButton *weekBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
|
||||
@property (nonatomic,strong)UIView *tableHeaderView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *firstView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *secondView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *thirdView;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *topArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
@end
|
||||
@implementation QXRoomRankSubView
|
||||
|
||||
-(UIView *)listView{
|
||||
return self;
|
||||
}
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.page = 1;
|
||||
self.topBgView = [[UIView alloc] initWithFrame:CGRectMake(16, 8, self.width-32, 40)];
|
||||
self.topBgView.backgroundColor = RGB16(0x2B2482);
|
||||
[self.topBgView addRoundedCornersWithRadius:20];
|
||||
[self addSubview:self.topBgView];
|
||||
|
||||
|
||||
self.hourBtn = [[UIButton alloc] init];
|
||||
[self.hourBtn setTitle:QXText(@"小时榜") forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.hourBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.hourBtn addRoundedCornersWithRadius:15];
|
||||
self.hourBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.hourBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
|
||||
[self.topBgView addSubview:self.hourBtn];
|
||||
|
||||
self.dayBtn = [[UIButton alloc] init];
|
||||
[self.dayBtn setTitle:QXText(@"日榜") forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.dayBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.dayBtn addRoundedCornersWithRadius:15];
|
||||
self.dayBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.dayBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.topBgView addSubview:self.dayBtn];
|
||||
|
||||
self.weekBtn = [[UIButton alloc] init];
|
||||
[self.weekBtn setTitle:QXText(@"周榜") forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.weekBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.weekBtn addRoundedCornersWithRadius:15];
|
||||
self.weekBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.weekBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.topBgView addSubview:self.weekBtn];
|
||||
|
||||
CGFloat btnWidth = ScaleWidth(72);
|
||||
|
||||
[self.dayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.topBgView);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
[self.hourBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.dayBtn.mas_left).offset(-16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
[self.weekBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.dayBtn.mas_right).offset(16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topBgView.bottom+38, self.width, 220)];
|
||||
CGFloat itemWidth = (self.width-36)/3;
|
||||
|
||||
|
||||
self.secondView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(18, 50, itemWidth, 135)];
|
||||
self.secondView.number = 2;
|
||||
[self.tableHeaderView addSubview:self.secondView];
|
||||
|
||||
|
||||
self.firstView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.secondView.right, 0, itemWidth, 161)];
|
||||
self.firstView.number = 1;
|
||||
[self.tableHeaderView addSubview:self.firstView];
|
||||
|
||||
self.thirdView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.firstView.right, 50, itemWidth, 135)];
|
||||
self.thirdView.number = 3;
|
||||
[self.tableHeaderView addSubview:self.thirdView];
|
||||
[self addSubview:self.tableHeaderView];
|
||||
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.tableHeaderView.bottom, self.width, self.height-self.tableHeaderView.bottom) style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = 60;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getRankList];
|
||||
}];
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getRankList];
|
||||
}];
|
||||
[self addSubview:self.tableView];
|
||||
|
||||
// self.tableView.tableHeaderView = self.tableHeaderView;
|
||||
|
||||
self.hourBtn.selected = YES;
|
||||
self.selectedBtn = self.hourBtn;
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
self.page = 1;
|
||||
[self getRankList];
|
||||
}
|
||||
-(void)getRankList{
|
||||
NSString *time_type = @"1";
|
||||
if (self.selectedBtn == self.hourBtn) {
|
||||
time_type = @"1";
|
||||
}else if(self.selectedBtn == self.dayBtn){
|
||||
time_type = @"2";
|
||||
}else if(self.selectedBtn == self.weekBtn){
|
||||
time_type = @"3";
|
||||
}
|
||||
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomRankListWithRoomId:self.roomId type:self.type time_type:time_type page:self.page successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
|
||||
if (weakSelf.page == 1) {
|
||||
weakSelf.firstView.md = nil;
|
||||
weakSelf.secondView.md = nil;
|
||||
weakSelf.thirdView.md = nil;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topArray removeAllObjects];
|
||||
for (int i = 0 ; i < list.count; i++) {
|
||||
QXRoomOnlineList*md = list[i];
|
||||
if (i == 0) {
|
||||
// [weakSelf.topArray addObject:md];
|
||||
weakSelf.firstView.md = md;
|
||||
}else if (i == 1) {
|
||||
weakSelf.secondView.md = md;
|
||||
}else if (i == 2) {
|
||||
weakSelf.thirdView.md = md;
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:md];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (list.count == 0) {
|
||||
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)typeAction:(UIButton*)sender{
|
||||
self.selectedBtn.selected = !self.selectedBtn.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.selectedBtn = sender;
|
||||
[self getRankList];
|
||||
}
|
||||
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
cell.cellType = QXBlackListCellTypeRank;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
cell.titleLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row+4];
|
||||
cell.rankModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)topArray{
|
||||
if (!_topArray) {
|
||||
_topArray = [NSMutableArray array];
|
||||
}
|
||||
return _topArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomRankTopThreeView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setNumber:(NSInteger)number{
|
||||
_number = number;
|
||||
if (number == 1) {
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_first"];
|
||||
}else if(number == 2){
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_second"];
|
||||
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
}];
|
||||
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
}else{
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_third"];
|
||||
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
}];
|
||||
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
}
|
||||
}
|
||||
-(void)setMd:(QXRoomOnlineList *)md{
|
||||
_md = md;
|
||||
if (md == nil) {
|
||||
self.headerImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
||||
self.nameLabel.text = @"虚位以待";
|
||||
[self.rankBtn setTitle:@"0" forState:(UIControlStateNormal)];
|
||||
[self.iconBgView removeAllSubviews];
|
||||
return;
|
||||
}
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.nameLabel.text = md.nickname?md.nickname:@"";
|
||||
[self.iconBgView removeAllSubviews];
|
||||
[self.rankBtn setTitle:[NSString stringWithFormat:@" %@",md.total?md.total:md.gift_prices] forState:(UIControlStateNormal)];
|
||||
CGFloat iconWidth = 38;
|
||||
CGFloat iconHeight = 16;
|
||||
CGFloat margin = 6;
|
||||
for (int i = 0 ; i < md.icon.count; i++) {
|
||||
UIImageView *iconImageView = [[UIImageView alloc] init];
|
||||
[iconImageView sd_setImageWithURL:[NSURL URLWithString:md.icon[i]]];
|
||||
[self.iconBgView addSubview:iconImageView];
|
||||
if (md.icon.count == 1) {
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.centerX.equalTo(self.iconBgView);
|
||||
}];
|
||||
}else if(md.icon.count == 2){
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
make.centerX.equalTo(self.iconBgView).offset(-38/2+(margin+iconWidth)*i);
|
||||
}];
|
||||
}else{
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(i*(iconWidth+margin));
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
[self.headerImageView addRoundedCornersWithRadius:32];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self addSubview:self.headerImageView];
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
|
||||
self.borderImageView = [[UIImageView alloc] init];
|
||||
self.borderImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.borderImageView];
|
||||
[self.borderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(80, 80));
|
||||
}];
|
||||
|
||||
self.onlineLabel = [[UILabel alloc] init];
|
||||
self.onlineLabel.textColor = UIColor.whiteColor;
|
||||
self.onlineLabel.font = [UIFont systemFontOfSize:10];
|
||||
self.onlineLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.onlineLabel.backgroundColor = RGB16(0x472ABF);
|
||||
[self.onlineLabel addRoundedCornersWithRadius:7];
|
||||
self.onlineLabel.text = QXText(@"在线");
|
||||
[self addSubview:self.onlineLabel];
|
||||
[self.onlineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.bottom.equalTo(self.borderImageView);
|
||||
make.height.mas_equalTo(14);
|
||||
make.width.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.nameLabel.text = QXText(@"虚位以待");
|
||||
self.nameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(25);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
|
||||
self.iconBgView = [[UIView alloc] init];
|
||||
[self addSubview:self.iconBgView];
|
||||
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self.nameLabel.mas_bottom);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
self.rankBtn = [[UIButton alloc] init];
|
||||
[self.rankBtn setImage:[UIImage imageNamed:@"room_rank_value_icon"] forState:(UIControlStateNormal)];
|
||||
[self.rankBtn setTitle:@" 0" forState:(UIControlStateNormal)];
|
||||
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.rankBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self addSubview:self.rankBtn];
|
||||
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self.iconBgView.mas_bottom);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
17
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.h
Normal file
17
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXRoomRankView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomRankView : UIView
|
||||
@property (nonatomic,strong)NSString*roomId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
105
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.m
Normal file
105
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.m
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// QXRoomRankView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomRankView.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomRankSubView.h"
|
||||
|
||||
@interface QXRoomRankView()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,UIGestureRecognizerDelegate>
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@end
|
||||
@implementation QXRoomRankView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(144))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_rank_bg"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
self.bgImageView.frame = self.bgView.bounds;
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake((self.width-140)/2,0,140, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = @[QXText(@"财富榜"),QXText(@"魅力榜")];
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#ffffff"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#DADADA"];
|
||||
self.categoryView.cellWidth = 66;
|
||||
self.categoryView.cellSpacing = 0;
|
||||
self.categoryView.contentEdgeInsetLeft = 8;
|
||||
// self.categoryView.titleLabelZoomScale = 1.1;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
|
||||
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
||||
// self.categoryView.averageCellSpacingEnabled = YES;
|
||||
// JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
// indicatorView.indicatorImageView.image = [[UIImage imageNamed:@"home_slider"] imageByTintColor:[UIColor whiteColor]];
|
||||
// indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
|
||||
// indicatorView.verticalMargin = 11;
|
||||
// self.categoryView.indicators = @[indicatorView];
|
||||
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
||||
self.containerView.frame = CGRectMake(0, 44, self.width, self.height-ScaleWidth(144)-44);
|
||||
[self.bgView addSubview:self.categoryView];
|
||||
[self.bgView addSubview:self.containerView];
|
||||
self.categoryView.listContainer = self.containerView;
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = ScaleWidth(144);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXRoomRankSubView *vc = [[QXRoomRankSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height-ScaleWidth(144)-44)];
|
||||
if (index == 0) {
|
||||
vc.type = @"1";
|
||||
}else{
|
||||
vc.type = @"2";
|
||||
}
|
||||
vc.roomId = self.roomId;
|
||||
return vc;
|
||||
}
|
||||
@end
|
||||
6
QXLive/HomePage(声播)/View/房间/点歌/QXLive-Bridging-Header.h
Normal file
6
QXLive/HomePage(声播)/View/房间/点歌/QXLive-Bridging-Header.h
Normal file
@@ -0,0 +1,6 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
29
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.h
Normal file
29
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// QXRoomSongListCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXSongListModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomSongListCell : UITableViewCell
|
||||
@property (nonatomic,assign)BOOL isSearch;
|
||||
@property (nonatomic,assign)BOOL isBgMusic;
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,strong) QXSongListModel *model;
|
||||
@property (nonatomic,strong) NSString *roomId;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *songNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *posterLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *endBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *upBtn;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
|
||||
@property (nonatomic,copy)void(^moveSuccessBlock)(void);
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
111
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.m
Normal file
111
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.m
Normal file
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// QXRoomSongListCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomSongListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
|
||||
@implementation QXRoomSongListCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXRoomSongListCell";
|
||||
QXRoomSongListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(void)setIsSearch:(BOOL)isSearch{
|
||||
_isSearch = isSearch;
|
||||
if (self.isBgMusic) {
|
||||
self.upBtn.hidden = YES;
|
||||
}else{
|
||||
self.upBtn.hidden = isSearch;
|
||||
}
|
||||
if (isSearch) {
|
||||
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
if (self.isBgMusic) {
|
||||
self.endBtn.hidden = YES;
|
||||
}else{
|
||||
if (self.isCompere) {
|
||||
self.endBtn.hidden = YES;
|
||||
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
self.endBtn.hidden = YES;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setIsBgMusic:(BOOL)isBgMusic{
|
||||
_isBgMusic = isBgMusic;
|
||||
}
|
||||
- (IBAction)endAction:(id)sender {
|
||||
if (self.isSearch) {
|
||||
if (self.isBgMusic) {
|
||||
showToast(@"点歌成功");
|
||||
[[QXAgoraEngine sharedEngine] addBgMusic:self.model];
|
||||
}else{
|
||||
[QXMineNetwork selectedSongWithRoomId:self.roomId
|
||||
user_id:[QXGlobal shareGlobal].loginModel.user_id
|
||||
song_code:[NSString stringWithFormat:@"%ld",self.model.song_code]
|
||||
song_name:self.model.song_name
|
||||
singer:self.model.singer
|
||||
poster:self.model.poster
|
||||
duration:[NSString stringWithFormat:@"%ld",self.model.duration]
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"点歌成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
}else{
|
||||
[self moveSongIsTop:YES];
|
||||
}
|
||||
}
|
||||
- (IBAction)upAction:(id)sender {
|
||||
[self moveSongIsTop:NO];
|
||||
}
|
||||
-(void)setIsCompere:(BOOL)isCompere{
|
||||
_isCompere = isCompere;
|
||||
// self.upBtn.hidden = !isCompere;
|
||||
// self.endBtn.hidden = !isCompere;
|
||||
}
|
||||
-(void)moveSongIsTop:(BOOL)isTop{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork moveSongWithRoomSongId:self.model.did type:isTop?@"2":@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.moveSuccessBlock) {
|
||||
weakSelf.moveSuccessBlock();
|
||||
}
|
||||
showToast(@"移动成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)setModel:(QXSongListModel *)model{
|
||||
_model = model;
|
||||
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.poster]];
|
||||
NSString *time = [NSString stringWithFormat:@"%02ld:%02ld",model.duration/60,model.duration%60];
|
||||
self.posterLabel.text = [NSString stringWithFormat:@"%@ %@",time,model.singer];
|
||||
self.songNameLabel.text = model.song_name;
|
||||
self.userNameLabel.text = model.nickname;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
126
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.xib
Normal file
126
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListCell.xib
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="163" id="KGk-i7-Jjw" customClass="QXRoomSongListCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="466" height="163"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="466" height="163"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dAY-R1-1Xw">
|
||||
<rect key="frame" x="16" y="55.666666666666657" width="52" height="52"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="52" id="Fmc-qu-edY"/>
|
||||
<constraint firstAttribute="width" constant="52" id="xh7-0d-x9a"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cEo-4m-Uk0">
|
||||
<rect key="frame" x="74" y="59.666666666666657" width="35.333333333333343" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="b1c-op-Skx"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="王富贵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SNA-M2-7Y8">
|
||||
<rect key="frame" x="74" y="85.666666666666671" width="90" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="XKi-Bc-Kyd"/>
|
||||
<constraint firstAttribute="width" constant="90" id="cZF-LW-Eez"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="prN-Cg-NVp">
|
||||
<rect key="frame" x="398" y="66.666666666666671" width="52" height="30"/>
|
||||
<color key="backgroundColor" red="0.050980392156862744" green="1" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="52" id="ErL-3b-xUl"/>
|
||||
<constraint firstAttribute="height" constant="30" id="M8O-GG-Lcl"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="结束">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="15"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="endAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ryq-am-gZg"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nCl-nA-G1H">
|
||||
<rect key="frame" x="353" y="64" width="35" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="bWm-9A-ja7"/>
|
||||
<constraint firstAttribute="width" constant="35" id="l70-bk-etp"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="room_song_up"/>
|
||||
<connections>
|
||||
<action selector="upAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="lXk-rU-fQZ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wAY-Bl-81T">
|
||||
<rect key="frame" x="174" y="94.666666666666671" width="169" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="SNA-M2-7Y8" firstAttribute="leading" secondItem="cEo-4m-Uk0" secondAttribute="leading" id="1ia-Qn-gkV"/>
|
||||
<constraint firstItem="wAY-Bl-81T" firstAttribute="centerY" secondItem="SNA-M2-7Y8" secondAttribute="centerY" id="5fU-Uw-Sf8"/>
|
||||
<constraint firstAttribute="trailing" secondItem="prN-Cg-NVp" secondAttribute="trailing" constant="16" id="DSL-WP-A3K"/>
|
||||
<constraint firstItem="cEo-4m-Uk0" firstAttribute="top" secondItem="dAY-R1-1Xw" secondAttribute="top" constant="4" id="Kno-Zg-rp2"/>
|
||||
<constraint firstItem="SNA-M2-7Y8" firstAttribute="bottom" secondItem="dAY-R1-1Xw" secondAttribute="bottom" constant="-4" id="SXZ-zo-2j2"/>
|
||||
<constraint firstItem="wAY-Bl-81T" firstAttribute="leading" secondItem="SNA-M2-7Y8" secondAttribute="trailing" constant="10" id="VB3-n2-Huh"/>
|
||||
<constraint firstItem="cEo-4m-Uk0" firstAttribute="leading" secondItem="dAY-R1-1Xw" secondAttribute="trailing" constant="6" id="YcA-Ji-ToE"/>
|
||||
<constraint firstItem="nCl-nA-G1H" firstAttribute="leading" secondItem="wAY-Bl-81T" secondAttribute="trailing" constant="10" id="cVf-2A-n8b"/>
|
||||
<constraint firstItem="nCl-nA-G1H" firstAttribute="centerY" secondItem="prN-Cg-NVp" secondAttribute="centerY" id="fbA-GF-fge"/>
|
||||
<constraint firstItem="dAY-R1-1Xw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="vH3-3z-2SL"/>
|
||||
<constraint firstItem="prN-Cg-NVp" firstAttribute="leading" secondItem="nCl-nA-G1H" secondAttribute="trailing" constant="10" id="ze3-qs-gsC"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<constraints>
|
||||
<constraint firstItem="prN-Cg-NVp" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="XhU-js-NUE"/>
|
||||
<constraint firstItem="dAY-R1-1Xw" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="liM-Yh-tyy"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="coverImageView" destination="dAY-R1-1Xw" id="13P-C0-xc8"/>
|
||||
<outlet property="endBtn" destination="prN-Cg-NVp" id="fEr-hy-Kvr"/>
|
||||
<outlet property="posterLabel" destination="SNA-M2-7Y8" id="c1y-Cd-Ze0"/>
|
||||
<outlet property="songNameLabel" destination="cEo-4m-Uk0" id="EIf-pB-ruW"/>
|
||||
<outlet property="upBtn" destination="nCl-nA-G1H" id="e7A-2b-WE7"/>
|
||||
<outlet property="userNameLabel" destination="wAY-Bl-81T" id="jHd-10-kev"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="250.38167938931298" y="40.492957746478872"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="room_song_up" width="16" height="16"/>
|
||||
</resources>
|
||||
</document>
|
||||
22
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListSubView.h
Normal file
22
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListSubView.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// QXRoomSongListSubView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JXCategoryView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomSongListSubView : UIView<JXCategoryListContentViewDelegate>
|
||||
@property (nonatomic,assign)BOOL isSearch;
|
||||
@property (nonatomic,assign)BOOL isBgMusic;
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,strong)NSString* roomId;
|
||||
@property (nonatomic,copy)void(^beiginEditBlock)(void);
|
||||
@property (nonatomic,copy)void(^endEditBlock)(void);
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
196
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListSubView.m
Normal file
196
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListSubView.m
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// QXRoomSongListSubView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomSongListSubView.h"
|
||||
#import "QXRoomSongListCell.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomSongListSubView()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
|
||||
@property (nonatomic,strong)UIView *searchBgView;
|
||||
@property (nonatomic,strong)UIImageView *searchIcon;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
@end
|
||||
|
||||
@implementation QXRoomSongListSubView
|
||||
|
||||
-(UIView *)listView{
|
||||
return self;
|
||||
}
|
||||
-(void)listWillAppear{
|
||||
if (!self.isSearch) {
|
||||
[self getSongList];
|
||||
}
|
||||
}
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.page = 1;
|
||||
self.searchBgView = [[UIView alloc] initWithFrame:CGRectMake(16, 6, self.width-32, 35)];
|
||||
self.searchBgView.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.searchBgView addRoundedCornersWithRadius:17.5];
|
||||
[self addSubview:self.searchBgView];
|
||||
|
||||
self.searchIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_song_search"]];
|
||||
self.searchIcon.frame = CGRectMake(10, 10, 15, 15);
|
||||
[self.searchBgView addSubview:self.searchIcon];
|
||||
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchIcon.right+2, 0, self.width-self.searchIcon.right-2-10, 35)];
|
||||
self.textField.textColor = RGB16(0x333333);
|
||||
self.textField.placeholder = QXText(@"请输入歌名搜索");
|
||||
self.textField.font = [UIFont systemFontOfSize:13];
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:UIControlEventEditingChanged];
|
||||
self.textField.delegate = self;
|
||||
[self.searchBgView addSubview:self.textField];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.searchBgView.bottom+10, self.width, self.height-self.searchBgView.bottom-10) style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = 72;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getSongList];
|
||||
}];
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getSongList];
|
||||
}];
|
||||
[self addSubview:self.tableView];
|
||||
// [self getSongList];
|
||||
}
|
||||
-(void)setIsBgMusic:(BOOL)isBgMusic{
|
||||
_isBgMusic = isBgMusic;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
#pragma mark - UITextFieldDelegate
|
||||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
if (self.beiginEditBlock) {
|
||||
self.beiginEditBlock();
|
||||
}
|
||||
}
|
||||
-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
if (self.endEditBlock) {
|
||||
self.endEditBlock();
|
||||
}
|
||||
}
|
||||
-(void)setIsSearch:(BOOL)isSearch{
|
||||
_isSearch = isSearch;
|
||||
self.searchBgView.hidden = !isSearch;
|
||||
self.tableView.frame = CGRectMake(0, isSearch?self.searchBgView.bottom+10:6, self.width, isSearch?(self.height-self.searchBgView.bottom-10):self.height - 6);
|
||||
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
[self getSongList];
|
||||
}
|
||||
-(void)getSongList{
|
||||
MJWeakSelf
|
||||
if (self.isSearch) {
|
||||
if (self.textField.text.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
[[QXAgoraEngine sharedEngine] searchSongWithKeyword:self.textField.text page:self.page resultBlock:^(NSArray<AgoraMusic *> * _Nonnull songList, BOOL isReload) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (isReload) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
}
|
||||
for (AgoraMusic*music in songList) {
|
||||
if ([music.singer isEqualToString:@"彭丽媛"]) {
|
||||
continue;
|
||||
}
|
||||
QXSongListModel *model = [[QXSongListModel alloc] init];
|
||||
model.song_code = music.songCode;
|
||||
model.song_name = music.name;
|
||||
model.poster = music.poster;
|
||||
model.singer = music.singer;
|
||||
model.duration = music.durationS;
|
||||
[weakSelf.dataArray addObject:model];
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
if (songList.count == 0) {
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
});
|
||||
}];
|
||||
}else{
|
||||
if (self.isBgMusic) {
|
||||
self.dataArray = [NSMutableArray arrayWithArray:[QXAgoraEngine sharedEngine].bgMusicArray];
|
||||
[self.tableView reloadData];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
|
||||
[QXMineNetwork roomSongListWithRoomId:self.roomId successBlock:^(NSArray<QXSongListModel *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-(void)textDidChange:(UITextField*)textField{
|
||||
[self getSongList];
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
MJWeakSelf
|
||||
QXRoomSongListCell *cell = [QXRoomSongListCell cellWithTableView:tableView];
|
||||
cell.isBgMusic = self.isBgMusic;
|
||||
cell.isCompere = self.isCompere;
|
||||
cell.roomId = self.roomId;
|
||||
cell.isSearch = self.isSearch;
|
||||
cell.model = [self.dataArray objectAtIndex:indexPath.row];
|
||||
cell.moveSuccessBlock = ^{
|
||||
[weakSelf getSongList];
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
// QXSongListModel *model = self.dataArray[indexPath.row];
|
||||
// [[QXAgoraEngine sharedEngine] ktv_EndSing];
|
||||
// [[QXAgoraEngine sharedEngine] ktv_StartSing:YES withSong:model];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
19
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.h
Normal file
19
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXRoomSongListView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomSongListView : UIView
|
||||
@property (nonatomic,assign)BOOL isBgMusic;
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
117
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.m
Normal file
117
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.m
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// QXRoomSongListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomSongListView.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomSongListSubView.h"
|
||||
|
||||
@interface QXRoomSongListView()<UIGestureRecognizerDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@end
|
||||
@implementation QXRoomSongListView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake((self.width-150)/2,0,150, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = @[QXText(@"点歌"),QXText(@"已点")];
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#33333"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#999999"];
|
||||
self.categoryView.cellWidth = 51;
|
||||
self.categoryView.cellSpacing = 20;
|
||||
self.categoryView.contentEdgeInsetLeft = 8;
|
||||
// self.categoryView.contentEdgeInsetRight = 8;
|
||||
// self.categoryView.titleLabelZoomScale = 1.1;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
|
||||
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
||||
self.categoryView.averageCellSpacingEnabled = YES;
|
||||
// JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
// indicatorView.indicatorImageView.image = [[UIImage imageNamed:@"home_slider"] imageByTintColor:[UIColor whiteColor]];
|
||||
// indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
|
||||
// indicatorView.verticalMargin = 11;
|
||||
// self.categoryView.indicators = @[indicatorView];
|
||||
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
||||
self.containerView.frame = CGRectMake(0, 44, self.width, self.bgView.height-44);
|
||||
[self.bgView addSubview:self.categoryView];
|
||||
[self.bgView addSubview:self.containerView];
|
||||
self.categoryView.listContainer = self.containerView;
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return 2;
|
||||
}
|
||||
-(void)setIsBgMusic:(BOOL)isBgMusic{
|
||||
_isBgMusic = isBgMusic;
|
||||
}
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXRoomSongListSubView *vc = [[QXRoomSongListSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.bgView.height-44)];
|
||||
vc.isBgMusic = self.isBgMusic;
|
||||
vc.isCompere = self.isCompere;
|
||||
if (index == 0) {
|
||||
vc.isSearch = YES;
|
||||
}else{
|
||||
vc.isSearch = NO;
|
||||
}
|
||||
vc.roomId = self.roomId;
|
||||
vc.beiginEditBlock = ^{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = kSafeAreaTop+90;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
};
|
||||
vc.endEditBlock = ^{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
};
|
||||
|
||||
return vc;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[self.categoryView reloadData];
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
63
QXLive/HomePage(声播)/View/房间/用户信息/QXRoomUserInfoView.h
Normal file
63
QXLive/HomePage(声播)/View/房间/用户信息/QXRoomUserInfoView.h
Normal file
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// QXRoomUserInfoView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 上麦
|
||||
QXRoomUserInfoViewEventTypeUpSeat = 0,
|
||||
/// 下麦
|
||||
QXRoomUserInfoViewEventTypeDownSeat = 1,
|
||||
/// 拉黑
|
||||
QXRoomUserInfoViewEventTypeBlack = 2,
|
||||
/// 举报
|
||||
QXRoomUserInfoViewEventTypeReport ,
|
||||
/// @TA
|
||||
QXRoomUserInfoViewEventTypeAtTA = 301,
|
||||
/// 聊天
|
||||
QXRoomUserInfoViewEventTypeChat ,
|
||||
/// 关注
|
||||
QXRoomUserInfoViewEventTypeAttention ,
|
||||
/// 送礼物
|
||||
QXRoomUserInfoViewEventTypeGift ,
|
||||
///
|
||||
// QXRoomUserInfoViewEventTypeReport ,
|
||||
}QXRoomUserInfoViewEventType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXRoomUserInfoViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/// 麦位号可能为空
|
||||
-(void)didClickEventType:(QXRoomUserInfoViewEventType)evntType userModel:(QXRoomUserInfoModel *)userModel pitNumber:(NSString*)pitNumber;
|
||||
|
||||
@end
|
||||
|
||||
@interface QXRoomUserInfoView : UIView
|
||||
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
/// 是否为主持 查看
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
/// 是否为房主 查看
|
||||
@property (nonatomic,assign)BOOL isOwner;
|
||||
/// 是否为管理 查看
|
||||
@property (nonatomic,assign)BOOL isManager;
|
||||
|
||||
/// 是否是在麦位上而非列表中
|
||||
@property (nonatomic,assign)BOOL isNoTakeOff;
|
||||
/// 是否在麦上
|
||||
//@property (nonatomic,assign)BOOL isUpSeat;
|
||||
/// isPK
|
||||
@property (nonatomic,assign)BOOL isPK;
|
||||
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,strong)NSString *pitNumber;
|
||||
@property (nonatomic,weak)id<QXRoomUserInfoViewDelegate>delegate;
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
878
QXLive/HomePage(声播)/View/房间/用户信息/QXRoomUserInfoView.m
Normal file
878
QXLive/HomePage(声播)/View/房间/用户信息/QXRoomUserInfoView.m
Normal file
@@ -0,0 +1,878 @@
|
||||
//
|
||||
// QXRoomUserInfoView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/10.
|
||||
//
|
||||
|
||||
#import "QXRoomUserInfoView.h"
|
||||
#import "UIButton+QX.h"
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXMenuPopView.h"
|
||||
#import "QXDynamicNetwork.h"
|
||||
#import "QXUserInfoGiftWallView.h"
|
||||
#import "QXReportViewController.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
#import "QXUserInfoRelationTableCell.h"
|
||||
#import "QXUserRelationListView.h"
|
||||
#import "QXUserInfoRelationCardCell.h"
|
||||
#import "QXDirectSetScaleView.h"
|
||||
|
||||
@interface QXRoomUserInfoView()<UIGestureRecognizerDelegate,SDCycleScrollViewDelegate,QXMenuPopViewDelegate,UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
/// 头像
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
/// 昵称
|
||||
@property (nonatomic,strong)UIButton *nameBtn;
|
||||
/// ID
|
||||
@property (nonatomic,strong)UILabel *idLabel;
|
||||
/// 所属公会
|
||||
@property (nonatomic,strong)UILabel *guildLabel;
|
||||
/// 开播
|
||||
@property (nonatomic,strong)UIButton *remindBtn;
|
||||
/// 上下麦
|
||||
@property (nonatomic,strong)UIButton *upSeatBtn;
|
||||
/// 举报
|
||||
@property (nonatomic,strong)UIButton *reportBtn;
|
||||
/// 拉黑
|
||||
@property (nonatomic,strong)UIButton *blackBtn;
|
||||
/// 跟随
|
||||
@property (nonatomic,strong)UIButton *followBtn;
|
||||
/// 更多
|
||||
@property (nonatomic,strong)UIButton *moreBtn;
|
||||
/// iconbgView
|
||||
@property (nonatomic,strong)UIView *iconBgView;
|
||||
/// 简介
|
||||
@property (nonatomic,strong)UILabel *introduceLabel;
|
||||
|
||||
|
||||
/// 礼物图鉴
|
||||
@property (nonatomic,strong)UILabel *giftTitleLabel;
|
||||
/// 更多礼物
|
||||
@property (nonatomic,strong)UIButton *moreGiftBtn;
|
||||
/// 关系列表
|
||||
//@property (nonatomic,strong)SDCycleScrollView *relationshipScrollview;
|
||||
@property (nonatomic,strong)UITableView *relationTableView;
|
||||
|
||||
/// 关系卡 亲密
|
||||
@property (nonatomic,strong)UIButton *relationshipCardBtn;
|
||||
/// 关系位 真爱
|
||||
@property (nonatomic,strong)UIButton *relationshipSeatBtn;
|
||||
@property (nonatomic,assign)BOOL isRealLove;
|
||||
|
||||
/// 工具栏
|
||||
@property (nonatomic,strong)UIView *bottomView;
|
||||
@property (nonatomic,strong)NSArray *toolsArray;
|
||||
|
||||
@property (nonatomic,strong)QXMenuPopView *popView;
|
||||
|
||||
@property (nonatomic,strong) QXRoomUserInfoModel *userModel;
|
||||
|
||||
@property (nonatomic,strong) QXUserInfoGiftWallView *giftWallView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *relationMoreBtn;
|
||||
/// 关系列表
|
||||
@property (nonatomic,strong) QXUserRelationListView *relationView;
|
||||
@property (nonatomic,strong) QXRelationshipList *listModel;
|
||||
@end
|
||||
|
||||
@implementation QXRoomUserInfoView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429+33))];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_user_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(ScaleWidth(24));
|
||||
make.left.right.bottom.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.bgView addSubview:self.headerImageView];
|
||||
[self.headerImageView addRoundedCornersWithRadius:ScaleWidth(33)];
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.centerX.equalTo(self.bgView);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(66), ScaleWidth(66)));
|
||||
}];
|
||||
|
||||
UIButton *headder = [[UIButton alloc] init];
|
||||
[headder addTarget:self action:@selector(toHomePage) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:headder];
|
||||
[headder mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.left.right.top.equalTo(self.headerImageView);
|
||||
}];
|
||||
|
||||
self.nameBtn = [[UIButton alloc] init];
|
||||
self.nameBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.nameBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.nameBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.bgView addSubview:self.nameBtn];
|
||||
[self.nameBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.headerImageView.mas_bottom).offset(2);
|
||||
make.height.mas_equalTo(18);
|
||||
make.centerX.equalTo(self.headerImageView);
|
||||
}];
|
||||
|
||||
self.idLabel = [[UILabel alloc] init];
|
||||
self.idLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.idLabel.textColor = [UIColor whiteColor];
|
||||
[self.bgView addSubview:self.idLabel];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.nameBtn.mas_bottom).offset(2);
|
||||
make.height.mas_equalTo(16);
|
||||
make.centerX.equalTo(self.headerImageView);
|
||||
}];
|
||||
|
||||
self.guildLabel = [[UILabel alloc] init];
|
||||
self.guildLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.guildLabel.textColor = [UIColor whiteColor];
|
||||
[self.bgView addSubview:self.guildLabel];
|
||||
[self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.idLabel.mas_bottom).offset(2);
|
||||
make.height.mas_equalTo(16);
|
||||
make.centerX.equalTo(self.headerImageView);
|
||||
}];
|
||||
|
||||
self.iconBgView = [[UIView alloc] init];
|
||||
[self.bgView addSubview:self.iconBgView];
|
||||
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.guildLabel.mas_bottom).offset(4);
|
||||
make.size.mas_equalTo(CGSizeMake(42, 16));
|
||||
}];
|
||||
|
||||
self.introduceLabel = [[UILabel alloc] init];
|
||||
self.introduceLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.introduceLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.introduceLabel.textColor = RGB16(0x999999);
|
||||
self.introduceLabel.numberOfLines = 2;
|
||||
[self.bgView addSubview:self.introduceLabel];
|
||||
[self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.iconBgView.mas_bottom).offset(8);
|
||||
make.left.mas_equalTo(40);
|
||||
make.right.mas_equalTo(-40);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
self.remindBtn = [[UIButton alloc] init];
|
||||
// [self.remindBtn setImage:[UIImage imageNamed:@"room_up_notice_icon"] forState:(UIControlStateNormal)];
|
||||
[self.remindBtn setTitle:QXText(@"转币") forState:(UIControlStateNormal)];
|
||||
self.remindBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.remindBtn.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
self.remindBtn.hidden = YES;
|
||||
[self.remindBtn addRoundedCornersWithRadius:ScaleWidth(10)];
|
||||
self.remindBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.remindBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.remindBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self.bgView addSubview:self.remindBtn];
|
||||
[self.remindBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(22);
|
||||
make.top.mas_equalTo(ScaleWidth(24)+26);
|
||||
make.height.mas_equalTo(ScaleWidth(20));
|
||||
make.width.mas_greaterThanOrEqualTo(ScaleWidth(66));
|
||||
}];
|
||||
|
||||
|
||||
self.followBtn = [[UIButton alloc] init];
|
||||
self.followBtn.hidden = YES;
|
||||
[self.followBtn setImage:[UIImage imageNamed:@"room_user_follow"] forState:(UIControlStateNormal)];
|
||||
[self.followBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.followBtn];
|
||||
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(22);
|
||||
make.top.equalTo(self.remindBtn.mas_bottom).offset(25);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(70));
|
||||
}];
|
||||
|
||||
self.upSeatBtn = [[UIButton alloc] init];
|
||||
[self.upSeatBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.upSeatBtn setTitle:QXText(@"上麦") forState:(UIControlStateNormal)];
|
||||
// [self.upSeatBtn setTitle:QXText(@"上麦") forState:(UIControlStateHighlighted)];
|
||||
[self.upSeatBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.upSeatBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.upSeatBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.upSeatBtn addRoundedCornersWithRadius:ScaleWidth(12)];
|
||||
[self.bgView addSubview:self.upSeatBtn];
|
||||
[self.upSeatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-ScaleWidth(64));
|
||||
make.centerY.equalTo(self.remindBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(44));
|
||||
}];
|
||||
|
||||
self.moreBtn = [[UIButton alloc] init];
|
||||
[self.moreBtn setImage:[UIImage imageNamed:@"room_user_more"] forState:(UIControlStateNormal)];
|
||||
[self.moreBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.moreBtn];
|
||||
[self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.centerY.equalTo(self.upSeatBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(44));
|
||||
}];
|
||||
|
||||
|
||||
self.reportBtn = [[UIButton alloc] init];
|
||||
[self.reportBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.reportBtn setTitle:[NSString stringWithFormat:@"%@ ",QXText(@"举报")] forState:(UIControlStateNormal)];
|
||||
[self.reportBtn setImage:[UIImage imageNamed:@"room_user_report"] forState:UIControlStateNormal];
|
||||
self.reportBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.reportBtn.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.reportBtn addRoundedCornersWithRadius:ScaleWidth(12)];
|
||||
[self.reportBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.reportBtn];
|
||||
[self.reportBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-ScaleWidth(64));
|
||||
make.centerY.equalTo(self.remindBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(44));
|
||||
}];
|
||||
|
||||
self.blackBtn = [[UIButton alloc] init];
|
||||
[self.blackBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
|
||||
[self.blackBtn setTitle:[NSString stringWithFormat:@"%@ ",QXText(@"拉黑")] forState:(UIControlStateNormal)];
|
||||
[self.blackBtn setImage:[UIImage imageNamed:@"room_user_black"] forState:UIControlStateNormal];
|
||||
self.blackBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.blackBtn.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.blackBtn addRoundedCornersWithRadius:ScaleWidth(12)];
|
||||
[self.blackBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.blackBtn];
|
||||
[self.blackBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.centerY.equalTo(self.remindBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(44));
|
||||
}];
|
||||
|
||||
self.giftTitleLabel = [[UILabel alloc] init];
|
||||
self.giftTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.giftTitleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.giftTitleLabel.textColor = RGB16(0xffffff);
|
||||
self.giftTitleLabel.text = QXText(@"礼物图鉴");
|
||||
[self.bgView addSubview:self.giftTitleLabel];
|
||||
[self.giftTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.introduceLabel.mas_bottom).offset(5);
|
||||
make.left.mas_equalTo(16);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.moreGiftBtn = [[UIButton alloc] init];
|
||||
[self.moreGiftBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
[self.moreGiftBtn setTitle:[NSString localizedStringWithFormat:QXText(@"90天内累计收到%@个礼物"),@"0"] forState:(UIControlStateNormal)];
|
||||
self.moreGiftBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.moreGiftBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:RGB16(0x999999)] forState:(UIControlStateNormal)];
|
||||
[self.moreGiftBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.moreGiftBtn];
|
||||
[self.moreGiftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(self.giftTitleLabel);
|
||||
}];
|
||||
[self.moreGiftBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
|
||||
self.relationshipCardBtn = [[UIButton alloc] init];
|
||||
self.relationshipCardBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
|
||||
[self.relationshipCardBtn setTitle:QXText(@"关系卡") forState:(UIControlStateNormal)];
|
||||
[self.relationshipCardBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
[self.relationshipCardBtn addTarget:self action:@selector(relationSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.bgView addSubview:self.relationshipCardBtn];
|
||||
[self.relationshipCardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10);
|
||||
make.width.mas_equalTo(60);
|
||||
}];
|
||||
|
||||
|
||||
self.relationshipSeatBtn = [[UIButton alloc] init];
|
||||
[self.relationshipSeatBtn setTitle:QXText(@"关系位") forState:(UIControlStateNormal)];
|
||||
[self.relationshipSeatBtn addTarget:self action:@selector(relationSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.relationshipSeatBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.bgView addSubview:self.relationshipSeatBtn];
|
||||
[self.relationshipSeatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.relationshipCardBtn.mas_right).offset(5);
|
||||
make.height.mas_equalTo(30);
|
||||
make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10);
|
||||
make.width.mas_equalTo(65);
|
||||
}];
|
||||
|
||||
self.relationMoreBtn = [[UIButton alloc] init];
|
||||
[self.relationMoreBtn setTitle:QXText(@"更多") forState:(UIControlStateNormal)];
|
||||
[self.relationMoreBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:QXConfig.themeColor] forState:(UIControlStateNormal)];
|
||||
[self.relationMoreBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
|
||||
self.relationMoreBtn.titleLabel.font = [UIFont boldSystemFontOfSize:12];
|
||||
[self.relationMoreBtn addTarget:self action:@selector(relationAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.relationMoreBtn];
|
||||
[self.relationMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.bgView.mas_right).offset(-16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10);
|
||||
make.width.mas_equalTo(65);
|
||||
}];
|
||||
[self.relationMoreBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
|
||||
// self.relationshipScrollview = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage imageNamed:@"room_relationship_card_bg"]];
|
||||
// self.relationshipScrollview.backgroundColor = [UIColor clearColor];
|
||||
// [self.bgView insertSubview:self.relationshipScrollview belowSubview:self.relationshipCardBtn];
|
||||
// [self.relationshipScrollview mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.top.equalTo(self.relationshipSeatBtn.mas_top).offset(4);
|
||||
// make.left.mas_equalTo(6);
|
||||
// make.right.mas_equalTo(-6);
|
||||
// make.height.mas_equalTo(ScaleWidth(141));
|
||||
// }];
|
||||
self.relationTableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
|
||||
self.relationTableView.delegate = self;
|
||||
self.relationTableView.dataSource = self;
|
||||
self.relationTableView.scrollEnabled = NO;
|
||||
self.relationTableView.backgroundColor = [UIColor clearColor];
|
||||
self.relationTableView.rowHeight = ScaleWidth(141);
|
||||
[self.bgView insertSubview:self.relationTableView belowSubview:self.relationshipCardBtn];
|
||||
[self.relationTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.relationshipSeatBtn.mas_top).offset(4);
|
||||
make.left.mas_equalTo(6);
|
||||
make.right.mas_equalTo(-6);
|
||||
make.height.mas_equalTo(ScaleWidth(141));
|
||||
}];
|
||||
|
||||
self.bottomView = [[UIView alloc] init];
|
||||
[self.bgView addSubview:self.bottomView];
|
||||
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
// make.bottom.mas_equalTo(-(kSafeAreaBottom+10));
|
||||
make.top.equalTo(self.relationTableView.mas_bottom).offset(20);
|
||||
make.height.mas_equalTo(35);
|
||||
}];
|
||||
|
||||
self.toolsArray = @[QXText(@"@TA"),QXText(@"聊天"),QXText(@"关注"),QXText(@"送礼物")];
|
||||
CGFloat margin = 5;
|
||||
CGFloat btnWidth = (SCREEN_WIDTH-16*2-margin*3)/self.toolsArray.count;
|
||||
for (int i = 0 ; i < self.toolsArray.count; i++) {
|
||||
NSString *title = self.toolsArray[i];
|
||||
UIButton *btn = [[UIButton alloc] init];
|
||||
btn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
btn.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[btn addRoundedCornersWithRadius:4];
|
||||
btn.tag = 301 + i;
|
||||
[btn addTarget:self action:@selector(btnEventAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[btn setTitle:title forState:(UIControlStateNormal)];
|
||||
[btn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
[self.bottomView addSubview:btn];
|
||||
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(i*(btnWidth+margin));
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.top.bottom.equalTo(self.bottomView);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)relationSelectedAction:(UIButton*)sender{
|
||||
if (sender == self.relationshipSeatBtn) {
|
||||
self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.isRealLove = YES;
|
||||
}else{
|
||||
self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.isRealLove = NO;
|
||||
}
|
||||
[self.relationTableView reloadData];
|
||||
}
|
||||
//-(void)getRelationList{
|
||||
// MJWeakSelf
|
||||
// [QXMineNetwork roomUserRelationWithUserId:self.userId successBlock:^(QXRelationshipList * list) {
|
||||
// weakSelf.listModel = list;
|
||||
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
//
|
||||
// }];
|
||||
//}
|
||||
-(void)relationAction{
|
||||
[self hide];
|
||||
self.relationView.isRealLove = self.isRealLove;
|
||||
self.relationView.userId = self.userId;
|
||||
// self.relationView.list = self.listModel;
|
||||
[self.relationView showInView:self.viewController.view];
|
||||
}
|
||||
|
||||
-(void)toHomePage{
|
||||
[self hide];
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
NSString *userId = self.userId;
|
||||
vc.user_id = userId;
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)setIsPK:(BOOL)isPK{
|
||||
_isPK = isPK;
|
||||
self.followBtn.hidden = !isPK;
|
||||
}
|
||||
-(void)setIsCompere:(BOOL)isCompere{
|
||||
_isCompere = isCompere;
|
||||
}
|
||||
-(void)setIsOwner:(BOOL)isOwner{
|
||||
_isOwner = isOwner;
|
||||
}
|
||||
-(void)setIsNoTakeOff:(BOOL)isNoTakeOff{
|
||||
_isNoTakeOff = isNoTakeOff;
|
||||
}
|
||||
//-(void)setIsUpSeat:(BOOL)isUpSeat{
|
||||
// _isUpSeat = isUpSeat;
|
||||
//
|
||||
//}
|
||||
-(void)setUserId:(NSString *)userId{
|
||||
_userId = userId;
|
||||
[self relationSelectedAction:self.relationshipCardBtn];
|
||||
if (self.isCompere) {
|
||||
// 主持查看别人 显示更多按钮 显示底部 @TA...
|
||||
self.moreBtn.hidden = NO;
|
||||
self.bottomView.hidden = NO;
|
||||
self.upSeatBtn.hidden = NO;
|
||||
self.reportBtn.hidden = YES;
|
||||
self.blackBtn.hidden = YES;
|
||||
}else if (self.isManager){
|
||||
self.moreBtn.hidden = NO;
|
||||
self.reportBtn.hidden = YES;
|
||||
self.blackBtn.hidden = YES;
|
||||
}else if (self.isOwner){
|
||||
self.moreBtn.hidden = NO;
|
||||
self.upSeatBtn.hidden = NO;
|
||||
self.reportBtn.hidden = YES;
|
||||
self.blackBtn.hidden = YES;
|
||||
}else{
|
||||
// 其他人查看其他人 隐藏更多按钮
|
||||
self.moreBtn.hidden = YES;
|
||||
if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
// 非主持麦位上的人查看自己 隐藏举报、拉黑、@Ta... 显示上麦|下麦
|
||||
self.reportBtn.hidden = YES;
|
||||
self.blackBtn.hidden = YES;
|
||||
self.upSeatBtn.hidden = NO;
|
||||
self.bottomView.hidden = YES;
|
||||
}else{
|
||||
// 查看的是别人 显示举报、拉黑、@ta....
|
||||
self.reportBtn.hidden = NO;
|
||||
self.blackBtn.hidden = NO;
|
||||
self.upSeatBtn.hidden = YES;
|
||||
self.bottomView.hidden = NO;
|
||||
}
|
||||
}
|
||||
if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
/// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA....
|
||||
self.moreBtn.hidden = YES;
|
||||
self.bottomView.hidden = YES;
|
||||
self.reportBtn.hidden = YES;
|
||||
self.blackBtn.hidden = YES;
|
||||
// self.remindBtn.hidden = YES;
|
||||
}else{
|
||||
// self.remindBtn.hidden = NO;
|
||||
self.bottomView.hidden = NO;
|
||||
}
|
||||
if (self.isNoTakeOff) {
|
||||
self.upSeatBtn.hidden = YES;
|
||||
}
|
||||
[self getUserInfo];
|
||||
// [self getRelationList];
|
||||
|
||||
}
|
||||
-(void)getUserInfo{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomUserInfoWithUserId:self.userId roomId:self.roomId successBlock:^(QXRoomUserInfoModel * _Nonnull model) {
|
||||
weakSelf.userModel = model;
|
||||
[weakSelf.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
[weakSelf.nameBtn setTitle:model.nickname forState:(UIControlStateNormal)];
|
||||
[weakSelf.nameBtn setImage:model.sex.intValue==1?[UIImage imageNamed:@"user_sex_boy"]:[UIImage imageNamed:@"user_sex_girl"] forState:(UIControlStateNormal)];
|
||||
[weakSelf.nameBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
weakSelf.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code];
|
||||
weakSelf.guildLabel.text = [NSString stringWithFormat:@"%@:%@",QXText(@"所属公会"),model.guild];
|
||||
[weakSelf.upSeatBtn setTitle:model.is_in_pit.intValue==1?QXText(@"下麦"):QXText(@"抱麦") forState:(UIControlStateNormal)];
|
||||
[weakSelf.moreGiftBtn setTitle:[NSString localizedStringWithFormat:QXText(@"90天内累计收到%@个礼物"),model.gift_num] forState:(UIControlStateNormal)];
|
||||
[weakSelf.moreGiftBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
weakSelf.introduceLabel.text = model.profile;
|
||||
[weakSelf.relationTableView reloadData];
|
||||
// if (model.red_status.intValue == 1 && ![weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
// weakSelf.remindBtn.hidden = NO;
|
||||
// }
|
||||
UIButton *followBtn = [self viewWithTag:303];
|
||||
if (model.is_follow.intValue == 1) {
|
||||
[followBtn setTitle:QXText(@"已关注") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
[followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id] && model.is_in_pit.intValue==1) {
|
||||
/// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA....
|
||||
weakSelf.upSeatBtn.hidden = NO;
|
||||
}else{
|
||||
if (weakSelf.isCompere || weakSelf.isOwner || weakSelf.isManager) {
|
||||
weakSelf.upSeatBtn.hidden = NO;
|
||||
}else{
|
||||
weakSelf.upSeatBtn.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (weakSelf.isNoTakeOff) {
|
||||
weakSelf.upSeatBtn.hidden = YES;
|
||||
}
|
||||
if (weakSelf.isOwner) {
|
||||
if (weakSelf.isNoTakeOff) {
|
||||
/// 房主上主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_manager.intValue==0?QXText(@"设为管理"):QXText(@"取消管理"),
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}else{
|
||||
/// 房主上主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_manager.intValue==0?QXText(@"设为管理"):QXText(@"取消管理"),
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
QXText(@"踢出房间"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(weakSelf.isManager){
|
||||
if (model.pohoulong.intValue == 1) {
|
||||
/// 管理上主持麦来查看用户
|
||||
weakSelf.moreBtn.hidden = YES;
|
||||
weakSelf.reportBtn.hidden = NO;
|
||||
weakSelf.blackBtn.hidden = NO;
|
||||
weakSelf.upSeatBtn.hidden = YES;
|
||||
}else if (model.is_manager.intValue == 1){
|
||||
weakSelf.reportBtn.hidden = YES;
|
||||
weakSelf.blackBtn.hidden = YES;
|
||||
weakSelf.upSeatBtn.hidden = NO;
|
||||
weakSelf.moreBtn.hidden = NO;
|
||||
if (weakSelf.isNoTakeOff) {
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}else{
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
QXText(@"踢出房间"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}
|
||||
}else{
|
||||
if (weakSelf.isNoTakeOff) {
|
||||
/// 管理上主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}else{
|
||||
/// 管理上主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"),
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
QXText(@"踢出房间"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}
|
||||
}
|
||||
if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
/// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA....
|
||||
weakSelf.moreBtn.hidden = YES;
|
||||
weakSelf.bottomView.hidden = YES;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(weakSelf.isCompere){
|
||||
if (model.pohoulong.intValue == 1 || model.is_manager.intValue == 1) {
|
||||
/// 管理上主持麦来查看用户
|
||||
weakSelf.moreBtn.hidden = YES;
|
||||
weakSelf.reportBtn.hidden = NO;
|
||||
weakSelf.blackBtn.hidden = NO;
|
||||
weakSelf.upSeatBtn.hidden = YES;
|
||||
}else{
|
||||
weakSelf.moreBtn.hidden = NO;
|
||||
weakSelf.reportBtn.hidden = YES;
|
||||
weakSelf.blackBtn.hidden = YES;
|
||||
|
||||
if (weakSelf.isNoTakeOff) {
|
||||
/// 主持主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
weakSelf.upSeatBtn.hidden = YES;
|
||||
}else{
|
||||
weakSelf.upSeatBtn.hidden = NO;
|
||||
/// 主持主持麦来查看用户
|
||||
weakSelf.popView.dataArray = @[
|
||||
model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"),
|
||||
QXText(@"踢出房间"),
|
||||
model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"),
|
||||
QXText(@"举报"),
|
||||
QXText(@"拉黑")];
|
||||
}
|
||||
}
|
||||
if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
/// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA....
|
||||
weakSelf.moreBtn.hidden = YES;
|
||||
weakSelf.bottomView.hidden = YES;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)didSelectedIndex:(NSInteger)index menuTitle:(NSString *)menuTitle{
|
||||
MJWeakSelf
|
||||
if ([menuTitle isEqualToString:QXText(@"设为管理")]) {
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:2 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
showToast(@"操作成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"取消管理")]) {
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:2 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"取消主持")]) {
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:1 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"设为主持")]) {
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:1 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"禁麦")]) {
|
||||
[QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"开麦")]) {
|
||||
[QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"4" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"禁言")]) {
|
||||
[QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"解除禁言")]) {
|
||||
[QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"3" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"拉黑")]) {
|
||||
[QXMineNetwork addOrRemoveBlackListIsAdd:YES userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"踢出房间")]) {
|
||||
[QXMineNetwork roomTakeOffWithRoomId:self.roomId userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"操作成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if ([menuTitle isEqualToString:QXText(@"举报")]) {
|
||||
[self reprortAction];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-(void)reprortAction{
|
||||
QXReportViewController *reportVC = [[QXReportViewController alloc] init];
|
||||
reportVC.reportType = @"1";
|
||||
reportVC.fromId = self.userId;
|
||||
[self.navigationController pushViewController:reportVC animated:YES];
|
||||
}
|
||||
|
||||
-(void)eventAction:(UIButton*)sender{
|
||||
MJWeakSelf
|
||||
if (sender == self.upSeatBtn) {
|
||||
if ([self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
||||
[QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:self.pitNumber isUpSeat:NO successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else{
|
||||
[QXMineNetwork roomCompereApplyPitWithRoomId:self.roomId pit_number:self.pitNumber user_id:self.userId type:self.userModel.is_in_pit.intValue==1?@"2":@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
}else if(sender == self.moreBtn){
|
||||
[self.popView showInView:self.viewController.view];
|
||||
}else if(sender == self.blackBtn){
|
||||
[QXMineNetwork addOrRemoveBlackListIsAdd:YES userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else if (sender == self.moreGiftBtn){
|
||||
// [self.giftWallView showInView:self.viewController.view];
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
NSString *userId = self.userId;
|
||||
vc.user_id = userId;
|
||||
vc.isGiftWall = YES;
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}else if(sender == self.reportBtn){
|
||||
[self reprortAction];
|
||||
}else if(sender == self.remindBtn){
|
||||
QXDirectSetScaleView *scaleView = [[QXDirectSetScaleView alloc] init];
|
||||
scaleView.userId = self.userId;
|
||||
scaleView.isGiveCoin = YES;
|
||||
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
||||
if ([w isKeyWindow]) {
|
||||
[scaleView showInView:w];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)btnEventAction:(UIButton*)sender{
|
||||
if (self.userModel == nil) {
|
||||
return;
|
||||
}
|
||||
// if (sender.tag == 301) {
|
||||
if (sender.tag == 303) {
|
||||
[QXDynamicNetwork followWithUserId:self.userId type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if ([sender.titleLabel.text isEqualToString:QXText(@"关注")]) {
|
||||
[sender setTitle:QXText(@"已关注") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
[sender setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[self hide];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:userModel:pitNumber:)]) {
|
||||
[self.delegate didClickEventType:sender.tag userModel:self.userModel pitNumber:self.pitNumber];
|
||||
}
|
||||
// }
|
||||
}
|
||||
//-(UINib *)customCollectionViewCellNibForCycleScrollView:(SDCycleScrollView *)view{
|
||||
// UINib *nib = [UINib nibWithNibName:@"QXUserInfoRelationCell" bundle:[NSBundle mainBundle]];
|
||||
// return nib;
|
||||
//}
|
||||
//-(void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view{
|
||||
// QXUserInfoRelationCell *relationCell = (QXUserInfoRelationCell*)cell;
|
||||
//
|
||||
//}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return 1;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (!self.isRealLove) {
|
||||
QXUserInfoRelationCardCell *cell = [QXUserInfoRelationCardCell cellWithTableView:tableView];
|
||||
cell.isList = NO;
|
||||
cell.model = self.userModel.qinmi;
|
||||
return cell;
|
||||
}else{
|
||||
QXUserInfoRelationTableCell *cell = [QXUserInfoRelationTableCell cellWithTableView:tableView];
|
||||
cell.isList = NO;
|
||||
cell.model = self.userModel.zhenai;
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429+33)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(QXMenuPopView *)popView{
|
||||
if (!_popView) {
|
||||
_popView = [[QXMenuPopView alloc] initWithPoint:CGPointMake(self.width-22-88/2, SCREEN_HEIGHT-kSafeAreaBottom-ScaleWidth(429+33)+self.moreBtn.bottom) width:88 height:210+13];
|
||||
_popView.type = QXMenuPopViewTypeArrowTop;
|
||||
_popView.delegate = self;
|
||||
}
|
||||
return _popView;
|
||||
}
|
||||
-(QXUserInfoGiftWallView *)giftWallView{
|
||||
if (!_giftWallView) {
|
||||
_giftWallView = [[QXUserInfoGiftWallView alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
||||
}
|
||||
return _giftWallView;
|
||||
}
|
||||
|
||||
-(QXUserRelationListView *)relationView{
|
||||
if (!_relationView) {
|
||||
_relationView = [[QXUserRelationListView alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
||||
}
|
||||
return _relationView;
|
||||
}
|
||||
|
||||
@end
|
||||
29
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoGiftWallView.h
Normal file
29
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoGiftWallView.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// QXUserInfoGiftWallView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserInfoGiftWallView : UIView
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
@interface QXUserInfoGiftWallCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *giftImageView;
|
||||
@property (nonatomic,strong)UILabel *giftCountLabel;
|
||||
@property (nonatomic,strong)UILabel *giftNameLabel;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UIImageView *userImageView1;
|
||||
@property (nonatomic,strong)UIImageView *userImageView2;
|
||||
@property (nonatomic,strong)UIImageView *userImageView3;
|
||||
@property (nonatomic,strong)UILabel *userCountLabel;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
213
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoGiftWallView.m
Normal file
213
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoGiftWallView.m
Normal file
@@ -0,0 +1,213 @@
|
||||
//
|
||||
// QXUserInfoGiftWallView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/7.
|
||||
//
|
||||
|
||||
#import "QXUserInfoGiftWallView.h"
|
||||
@interface QXUserInfoGiftWallView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *alreadyBtn;
|
||||
@property (nonatomic,strong)UIButton *noBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@end
|
||||
@implementation QXUserInfoGiftWallView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429+33))];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_user_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(ScaleWidth(24));
|
||||
make.left.right.bottom.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
self.alreadyBtn = [[UIButton alloc] init];
|
||||
[self.alreadyBtn setTitle:@"已点亮" forState:(UIControlStateNormal)];
|
||||
[self.alreadyBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateSelected)];
|
||||
[self.alreadyBtn setTitleColor:RGB16A(0xffffff, 0.4) forState:(UIControlStateNormal)];
|
||||
self.alreadyBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.alreadyBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x8A72BE)] forState:(UIControlStateSelected)];
|
||||
[self.alreadyBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x3C276A)] forState:(UIControlStateNormal)];
|
||||
[self addSubview:self.alreadyBtn];
|
||||
self.alreadyBtn.selected = YES;
|
||||
[self.alreadyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.equalTo(self).offset(20);
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.width.mas_equalTo(ScaleWidth(28));
|
||||
}];
|
||||
|
||||
self.noBtn = [[UIButton alloc] init];
|
||||
[self.noBtn setTitle:@"未点亮" forState:(UIControlStateNormal)];
|
||||
[self.noBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateSelected)];
|
||||
[self.noBtn setTitleColor:RGB16A(0xffffff, 0.4) forState:(UIControlStateNormal)];
|
||||
self.noBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.noBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x8A72BE)] forState:(UIControlStateSelected)];
|
||||
[self.noBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x3C276A)] forState:(UIControlStateNormal)];
|
||||
[self addSubview:self.noBtn];
|
||||
[self.noBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.alreadyBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self).offset(20);
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.width.mas_equalTo(ScaleWidth(28));
|
||||
}];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-10*2)/3, ScaleWidth(149));
|
||||
layout.minimumLineSpacing = 10;
|
||||
layout.minimumInteritemSpacing = 10;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXUserInfoGiftWallCell class] forCellWithReuseIdentifier:@"QXUserInfoGiftWallCell"];
|
||||
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.pagingEnabled = YES;
|
||||
self.collectionView.backgroundColor = RGB16(0xf6f6f6);
|
||||
[self addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.top.equalTo(self.alreadyBtn.mas_bottom).offset(22);
|
||||
make.height.mas_equalTo(ScaleWidth(76));
|
||||
make.right.mas_equalTo(-12);
|
||||
}];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
#pragma mark - UITableViewDataSource, UITableViewDelegate
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXUserInfoGiftWallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserInfoGiftWallCell" forIndexPath:indexPath];
|
||||
// cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429+33)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXUserInfoGiftWallCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_giftwall_gray"]];
|
||||
[self.contentView addSubview:self.bgImageView];
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.giftImageView = [[UIImageView alloc] init];
|
||||
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.contentView addSubview:self.giftImageView];
|
||||
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(17);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(60), ScaleWidth(60)));
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
|
||||
self.giftNameLabel = [[UILabel alloc] init];
|
||||
self.giftNameLabel.textColor = UIColor.whiteColor;
|
||||
self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.giftNameLabel];
|
||||
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.giftNameLabel.mas_bottom).offset(1);
|
||||
make.height.mas_equalTo(18);
|
||||
make.left.right.equalTo(self);
|
||||
}];
|
||||
|
||||
self.giftCountLabel = [[UILabel alloc] init];
|
||||
self.giftCountLabel.textColor = UIColor.whiteColor;
|
||||
self.giftCountLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.giftCountLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.giftCountLabel];
|
||||
[self.giftCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.giftNameLabel.mas_bottom).offset(1);
|
||||
make.height.mas_equalTo(18);
|
||||
make.left.right.equalTo(self);
|
||||
}];
|
||||
|
||||
self.userImageView1 = [[UIImageView alloc] init];
|
||||
self.userImageView1.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.contentView addSubview:self.userImageView1];
|
||||
[self.userImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(18);
|
||||
make.bottom.equalTo(self).offset(-7);
|
||||
make.centerX.equalTo(self).offset(-9);
|
||||
}];
|
||||
|
||||
self.userImageView2 = [[UIImageView alloc] init];
|
||||
self.userImageView2.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.contentView addSubview:self.userImageView2];
|
||||
[self.userImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(18);
|
||||
make.bottom.equalTo(self).offset(-7);
|
||||
make.right.equalTo(self.userImageView1.mas_left).offset(-5);
|
||||
}];
|
||||
|
||||
self.userImageView3 = [[UIImageView alloc] init];
|
||||
self.userImageView3.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.contentView addSubview:self.userImageView3];
|
||||
[self.userImageView3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(18);
|
||||
make.bottom.equalTo(self).offset(-7);
|
||||
make.right.equalTo(self.userImageView2.mas_left).offset(-5);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// QXUserInfoRelationCardCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/1.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserInfoRelationCardCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *leftHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *leftNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *rightHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *rightNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *relationLabel;
|
||||
|
||||
|
||||
@property (nonatomic,strong) QXRelationshipListModel *model;
|
||||
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
|
||||
@property (nonatomic,assign) BOOL isList;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
126
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCardCell.m
Normal file
126
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCardCell.m
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// QXUserInfoRelationCardCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/1.
|
||||
//
|
||||
|
||||
#import "QXUserInfoRelationCardCell.h"
|
||||
#import "QXAlertView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXUserInfoRelationCardCell()
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
@end
|
||||
@implementation QXUserInfoRelationCardCell
|
||||
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXUserInfoRelationCardCell";
|
||||
QXUserInfoRelationCardCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
- (IBAction)deleteAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = [NSString stringWithFormat:@"您确定要置顶本关系吗,解除关系需要%@金币",self.model.delete_me_coin];
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf deleteRelation];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
-(void)deleteRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"解除成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)topRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"置顶成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction)topAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = @"您确定要置顶本关系吗";
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf topRelation];
|
||||
};
|
||||
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
|
||||
-(void)setModel:(QXRelationshipListModel *)model{
|
||||
_model = model;
|
||||
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.rightNameLabel.text = model.nickname1;
|
||||
self.leftNameLabel.text = model.nickname2;
|
||||
}else{
|
||||
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.leftNameLabel.text = model.nickname1;
|
||||
self.rightNameLabel.text = model.nickname2;
|
||||
}
|
||||
|
||||
self.relationLabel.text = model.relation_name;
|
||||
|
||||
// NSInteger hour = model.time_day.longLongValue/(60*60);
|
||||
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
long long milliseconds = (long long)(timeInterval);
|
||||
long endTime = model.end_time.longLongValue - milliseconds;
|
||||
if (endTime<=0) {
|
||||
self.dayLabel.text = @"-";
|
||||
}else{
|
||||
NSInteger day = endTime/(60*60*24);
|
||||
NSInteger hour = endTime/3600%24;
|
||||
// NSInteger minutes = weakSelf.startTime%3600/60;
|
||||
// NSInteger second = weakSelf.startTime%60;
|
||||
// weakSelf.timeLabel.text = [NSString stringWithFormat:@"倒计时 %02ld:%02ld:%02ld",hour,minutes,second];
|
||||
self.dayLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
|
||||
}
|
||||
}
|
||||
-(void)setIsList:(BOOL)isList{
|
||||
_isList = isList;
|
||||
self.topBtn.hidden = !isList;
|
||||
self.deleteBtn.hidden = !isList;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
176
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCardCell.xib
Normal file
176
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCardCell.xib
Normal file
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="347" id="yPv-01-K7X" customClass="QXUserInfoRelationCardCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yPv-01-K7X" id="fX3-HF-hoR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_card_bg" translatesAutoresizingMaskIntoConstraints="NO" id="0Zl-GZ-eLT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9ik-tU-uXt">
|
||||
<rect key="frame" x="287" y="118" width="40" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="DQY-p5-KXN"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="relation_no_real_love" translatesAutoresizingMaskIntoConstraints="NO" id="sdH-Ur-m0q">
|
||||
<rect key="frame" x="137" y="54.666666666666657" width="113" height="73"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="73" id="3en-ao-TqD"/>
|
||||
<constraint firstAttribute="width" constant="113" id="bd1-tQ-8xs"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="4rD-CV-21a">
|
||||
<rect key="frame" x="55" y="66" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="UhE-GJ-gaN"/>
|
||||
<constraint firstAttribute="height" constant="50" id="eM1-Km-V8z"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5gj-z4-YWN">
|
||||
<rect key="frame" x="60" y="118" width="40" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="wDg-NY-HRY"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TRU-Cc-HD7">
|
||||
<rect key="frame" x="347.66666666666669" y="46" width="19.333333333333314" height="14"/>
|
||||
<color key="backgroundColor" systemColor="labelColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="7"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0cp-el-flS">
|
||||
<rect key="frame" x="342" y="73.666666666666671" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="25" id="nGj-RS-PKL"/>
|
||||
<constraint firstAttribute="width" constant="25" id="vAb-Jq-YDq"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_top"/>
|
||||
<connections>
|
||||
<action selector="topAction:" destination="yPv-01-K7X" eventType="touchUpInside" id="9hY-YE-Avi"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="lAD-Et-DFy">
|
||||
<rect key="frame" x="282" y="66" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="3wv-kS-OMb"/>
|
||||
<constraint firstAttribute="height" constant="50" id="du5-aC-eQ1"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IcI-hd-X34">
|
||||
<rect key="frame" x="342" y="108" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="25" id="8jG-To-tUP"/>
|
||||
<constraint firstAttribute="width" constant="25" id="oYA-S4-rBq"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_delete"/>
|
||||
<connections>
|
||||
<action selector="deleteAction:" destination="yPv-01-K7X" eventType="touchUpInside" id="khU-de-HAy"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="情人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSN-hL-YdB">
|
||||
<rect key="frame" x="176.66666666666666" y="95" width="34" height="21"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="IcI-hd-X34" firstAttribute="centerX" secondItem="0cp-el-flS" secondAttribute="centerX" id="1De-82-b3K"/>
|
||||
<constraint firstItem="0Zl-GZ-eLT" firstAttribute="leading" secondItem="fX3-HF-hoR" secondAttribute="leading" id="20I-xZ-dHR"/>
|
||||
<constraint firstAttribute="bottom" secondItem="IcI-hd-X34" secondAttribute="bottom" constant="8" id="37Q-ce-UHh"/>
|
||||
<constraint firstItem="0Zl-GZ-eLT" firstAttribute="top" secondItem="fX3-HF-hoR" secondAttribute="top" id="IJP-Kh-uDq"/>
|
||||
<constraint firstItem="0cp-el-flS" firstAttribute="centerY" secondItem="lAD-Et-DFy" secondAttribute="centerY" constant="-5" id="IN6-WZ-u23"/>
|
||||
<constraint firstAttribute="bottom" secondItem="dSN-hL-YdB" secondAttribute="bottom" constant="25" id="KOL-2h-zHw"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lAD-Et-DFy" secondAttribute="trailing" constant="55" id="Ua5-uI-sl0"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4rD-CV-21a" secondAttribute="bottom" constant="25" id="XQE-sj-t8k"/>
|
||||
<constraint firstItem="9ik-tU-uXt" firstAttribute="top" secondItem="lAD-Et-DFy" secondAttribute="bottom" constant="2" id="b9J-Jg-zbL"/>
|
||||
<constraint firstItem="TRU-Cc-HD7" firstAttribute="top" secondItem="lAD-Et-DFy" secondAttribute="top" constant="-20" id="glW-4B-Ibe"/>
|
||||
<constraint firstAttribute="trailing" secondItem="0Zl-GZ-eLT" secondAttribute="trailing" id="h1f-zg-lPW"/>
|
||||
<constraint firstItem="lAD-Et-DFy" firstAttribute="centerY" secondItem="4rD-CV-21a" secondAttribute="centerY" id="hMQ-jW-NDq"/>
|
||||
<constraint firstItem="4rD-CV-21a" firstAttribute="leading" secondItem="fX3-HF-hoR" secondAttribute="leading" constant="55" id="k8y-KS-M49"/>
|
||||
<constraint firstItem="sdH-Ur-m0q" firstAttribute="centerY" secondItem="4rD-CV-21a" secondAttribute="centerY" id="mah-PG-YQz"/>
|
||||
<constraint firstAttribute="bottom" secondItem="0Zl-GZ-eLT" secondAttribute="bottom" id="pMK-fn-kAH"/>
|
||||
<constraint firstItem="5gj-z4-YWN" firstAttribute="centerX" secondItem="4rD-CV-21a" secondAttribute="centerX" id="rmZ-7d-oYw"/>
|
||||
<constraint firstItem="0cp-el-flS" firstAttribute="trailing" secondItem="TRU-Cc-HD7" secondAttribute="trailing" id="sjb-PA-Ayn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="TRU-Cc-HD7" secondAttribute="trailing" constant="20" id="v0o-r2-4Yd"/>
|
||||
<constraint firstItem="9ik-tU-uXt" firstAttribute="centerX" secondItem="lAD-Et-DFy" secondAttribute="centerX" id="vSC-WY-fea"/>
|
||||
<constraint firstItem="5gj-z4-YWN" firstAttribute="top" secondItem="4rD-CV-21a" secondAttribute="bottom" constant="2" id="x7p-KP-4rP"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="y8R-dU-mUQ"/>
|
||||
<constraints>
|
||||
<constraint firstItem="sdH-Ur-m0q" firstAttribute="centerX" secondItem="y8R-dU-mUQ" secondAttribute="centerX" id="cEA-1z-Fvc"/>
|
||||
<constraint firstItem="dSN-hL-YdB" firstAttribute="centerX" secondItem="y8R-dU-mUQ" secondAttribute="centerX" id="rjd-Wk-mcE"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="dayLabel" destination="TRU-Cc-HD7" id="LcA-2L-eVP"/>
|
||||
<outlet property="deleteBtn" destination="IcI-hd-X34" id="OXF-r3-yvQ"/>
|
||||
<outlet property="leftHeaderView" destination="4rD-CV-21a" id="s0z-lh-sgR"/>
|
||||
<outlet property="leftNameLabel" destination="5gj-z4-YWN" id="yTN-FL-lkD"/>
|
||||
<outlet property="relationLabel" destination="dSN-hL-YdB" id="eKd-sn-kUT"/>
|
||||
<outlet property="rightHeaderView" destination="lAD-Et-DFy" id="KrC-MJ-NgZ"/>
|
||||
<outlet property="rightNameLabel" destination="9ik-tU-uXt" id="bEf-zP-skW"/>
|
||||
<outlet property="topBtn" destination="0cp-el-flS" id="9Sy-gG-Rql"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="551.90839694656484" y="213.73239436619718"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="relation_delete" width="22" height="22"/>
|
||||
<image name="relation_no_real_love" width="113" height="73"/>
|
||||
<image name="relation_top" width="22" height="22"/>
|
||||
<image name="room_relationship_card_bg" width="369" height="141"/>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
<systemColor name="labelColor">
|
||||
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
27
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.h
Normal file
27
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// QXUserInfoRelationCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserInfoRelationCell : UICollectionViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userHeader1;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel1;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userHeader2;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel2;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *relationNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
|
||||
@property (nonatomic,strong) QXRelationshipListModel *model;
|
||||
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
100
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.m
Normal file
100
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.m
Normal file
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// QXUserInfoRelationCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/21.
|
||||
//
|
||||
|
||||
#import "QXUserInfoRelationCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAlertView.h"
|
||||
|
||||
@interface QXUserInfoRelationCell()
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
@end
|
||||
|
||||
@implementation QXUserInfoRelationCell
|
||||
-(void)setModel:(QXRelationshipListModel *)model{
|
||||
_model = model;
|
||||
[self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
|
||||
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
[self.userHeader1 sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.userHeader2 sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.userNameLabel1.text = model.nickname1;
|
||||
self.userNameLabel2.text = model.nickname2;
|
||||
}else{
|
||||
[self.userHeader2 sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.userHeader1 sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.userNameLabel2.text = model.nickname1;
|
||||
self.userNameLabel1.text = model.nickname2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
self.relationNameLabel.text = model.relation_name;
|
||||
NSInteger day = model.time_day.longLongValue/(60*60*24);
|
||||
NSInteger hour = model.time_day.longLongValue%(60*60);
|
||||
self.timeLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
// [self.bgImageView addRoundedCornersWithRadius:8];
|
||||
}
|
||||
- (IBAction)deleteAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = @"您确定要置顶本关系吗,解除关系需要50金币";
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf deleteRelation];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
-(void)deleteRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"解除成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)topRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"置顶成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction)topAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = @"您确定要置顶本关系吗";
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf topRelation];
|
||||
};
|
||||
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
|
||||
|
||||
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
@end
|
||||
186
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.xib
Normal file
186
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationCell.xib
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="QXUserInfoRelationCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_card_bg" translatesAutoresizingMaskIntoConstraints="NO" id="hpq-sD-3Ur">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Vd7-Os-9Vc">
|
||||
<rect key="frame" x="48" y="60" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="3OX-ey-3xw"/>
|
||||
<constraint firstAttribute="height" constant="50" id="SvL-j9-daN"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Mcj-e5-lf7">
|
||||
<rect key="frame" x="161" y="63" width="53" height="53"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="53" id="D9w-6H-SPn"/>
|
||||
<constraint firstAttribute="height" constant="53" id="dzh-6Z-zWU"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s0t-Dn-Hkf">
|
||||
<rect key="frame" x="59.666666666666657" y="115" width="27" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="EVb-Fy-ERS"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CPk-xh-jBb">
|
||||
<rect key="frame" x="290.66666666666669" y="115" width="27" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="xQo-X0-Xhe"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ApI-4k-Wxy">
|
||||
<rect key="frame" x="153" y="93" width="69" height="23"/>
|
||||
<color key="backgroundColor" red="0.74117647058823533" green="0.57647058823529407" blue="0.90588235294117647" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="69" id="TMq-Vq-YpU"/>
|
||||
<constraint firstAttribute="height" constant="23" id="iM0-f2-B7D"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="11.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vB1-at-FUD">
|
||||
<rect key="frame" x="279" y="60" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="LNk-m0-F0h"/>
|
||||
<constraint firstAttribute="height" constant="50" id="lrc-Qu-DTs"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wda-vs-0Ps">
|
||||
<rect key="frame" x="345.66666666666669" y="3" width="19.333333333333314" height="16"/>
|
||||
<color key="backgroundColor" systemColor="labelColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="4uk-WQ-FGK"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uuy-XJ-Oz6">
|
||||
<rect key="frame" x="340" y="58" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="25" id="GgS-tC-J2y"/>
|
||||
<constraint firstAttribute="height" constant="25" id="qJC-cX-d3E"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_top"/>
|
||||
<connections>
|
||||
<action selector="topAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="NWp-HU-crS"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rrI-Rj-SKq">
|
||||
<rect key="frame" x="340" y="106" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="25" id="NFz-yH-gOh"/>
|
||||
<constraint firstAttribute="width" constant="25" id="eJE-8v-aTY"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_delete"/>
|
||||
<connections>
|
||||
<action selector="deleteAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="mBw-ws-zgL"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="Wda-vs-0Ps" secondAttribute="trailing" constant="10" id="2y7-aI-PrA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="hpq-sD-3Ur" secondAttribute="bottom" id="8hj-we-AFH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hpq-sD-3Ur" secondAttribute="trailing" id="ACE-0A-M7x"/>
|
||||
<constraint firstItem="rrI-Rj-SKq" firstAttribute="centerX" secondItem="Uuy-XJ-Oz6" secondAttribute="centerX" id="HjS-ba-Rf0"/>
|
||||
<constraint firstItem="s0t-Dn-Hkf" firstAttribute="centerX" secondItem="Vd7-Os-9Vc" secondAttribute="centerX" id="Iv6-zm-BYV"/>
|
||||
<constraint firstItem="CPk-xh-jBb" firstAttribute="centerY" secondItem="s0t-Dn-Hkf" secondAttribute="centerY" id="QSa-ri-fZX"/>
|
||||
<constraint firstItem="Uuy-XJ-Oz6" firstAttribute="centerY" secondItem="hpq-sD-3Ur" secondAttribute="centerY" id="RJ8-tm-CjS"/>
|
||||
<constraint firstItem="CPk-xh-jBb" firstAttribute="centerX" secondItem="vB1-at-FUD" secondAttribute="centerX" id="RZg-MZ-Gic"/>
|
||||
<constraint firstItem="ApI-4k-Wxy" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="ZBw-NG-4VC"/>
|
||||
<constraint firstAttribute="bottom" secondItem="rrI-Rj-SKq" secondAttribute="bottom" constant="10" id="afl-YG-eYt"/>
|
||||
<constraint firstItem="Mcj-e5-lf7" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="dzY-ib-uwm"/>
|
||||
<constraint firstItem="hpq-sD-3Ur" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="fOB-fb-ctX"/>
|
||||
<constraint firstItem="vB1-at-FUD" firstAttribute="centerY" secondItem="Vd7-Os-9Vc" secondAttribute="centerY" id="gbp-N4-J2N"/>
|
||||
<constraint firstItem="Vd7-Os-9Vc" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="48" id="jU0-ni-hd7"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vB1-at-FUD" secondAttribute="trailing" constant="46" id="oid-XS-IFL"/>
|
||||
<constraint firstItem="Mcj-e5-lf7" firstAttribute="bottom" secondItem="ApI-4k-Wxy" secondAttribute="bottom" id="osn-lq-rUu"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ApI-4k-Wxy" secondAttribute="bottom" constant="25" id="q0w-xD-hrK"/>
|
||||
<constraint firstAttribute="bottom" secondItem="s0t-Dn-Hkf" secondAttribute="bottom" constant="11" id="sKr-dc-EdJ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Uuy-XJ-Oz6" secondAttribute="trailing" constant="10" id="ucJ-8r-nDT"/>
|
||||
<constraint firstItem="hpq-sD-3Ur" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="w1d-Go-Nt8"/>
|
||||
<constraint firstItem="s0t-Dn-Hkf" firstAttribute="top" secondItem="Vd7-Os-9Vc" secondAttribute="bottom" constant="5" id="z8x-Mo-EkR"/>
|
||||
<constraint firstItem="Wda-vs-0Ps" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="3" id="zIc-fO-dCy"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="711" height="231"/>
|
||||
<connections>
|
||||
<outlet property="bgImageView" destination="hpq-sD-3Ur" id="JMT-qq-06A"/>
|
||||
<outlet property="deleteBtn" destination="rrI-Rj-SKq" id="xuE-uz-NXc"/>
|
||||
<outlet property="relationNameLabel" destination="ApI-4k-Wxy" id="ZB2-pv-V3D"/>
|
||||
<outlet property="timeLabel" destination="Wda-vs-0Ps" id="p6e-gC-3wg"/>
|
||||
<outlet property="topBtn" destination="Uuy-XJ-Oz6" id="Rb5-UU-aaG"/>
|
||||
<outlet property="userHeader1" destination="Vd7-Os-9Vc" id="Uh0-Ko-wd5"/>
|
||||
<outlet property="userHeader2" destination="vB1-at-FUD" id="Ylz-er-FyL"/>
|
||||
<outlet property="userNameLabel1" destination="s0t-Dn-Hkf" id="3s9-OW-07M"/>
|
||||
<outlet property="userNameLabel2" destination="CPk-xh-jBb" id="Pq8-tS-eQc"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="332.06106870229007" y="-20.422535211267608"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="relation_delete" width="22" height="22"/>
|
||||
<image name="relation_top" width="22" height="22"/>
|
||||
<image name="room_relationship_card_bg" width="369" height="141"/>
|
||||
<systemColor name="labelColor">
|
||||
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// QXUserInfoRelationTableCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/1.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserInfoRelationTableCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *leftHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *leftNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *rightHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *rightNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *relationLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
|
||||
|
||||
@property (nonatomic,strong) QXRelationshipListModel *model;
|
||||
|
||||
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
|
||||
@property (nonatomic,assign) BOOL isList;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
121
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationTableCell.m
Normal file
121
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationTableCell.m
Normal file
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// QXUserInfoRelationTableCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/1.
|
||||
//
|
||||
|
||||
#import "QXUserInfoRelationTableCell.h"
|
||||
#import "QXAlertView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXUserInfoRelationTableCell()
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
@end
|
||||
@implementation QXUserInfoRelationTableCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXUserInfoRelationTableCell";
|
||||
QXUserInfoRelationTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)setModel:(QXRelationshipListModel *)model{
|
||||
_model = model;
|
||||
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.rightNameLabel.text = model.nickname1;
|
||||
self.leftNameLabel.text = model.nickname2;
|
||||
}else{
|
||||
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
|
||||
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
|
||||
self.leftNameLabel.text = model.nickname1;
|
||||
self.rightNameLabel.text = model.nickname2;
|
||||
}
|
||||
|
||||
self.relationLabel.text = model.relation_name;
|
||||
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
long long milliseconds = (long long)(timeInterval);
|
||||
long endTime = model.end_time.longLongValue - milliseconds;
|
||||
if (endTime<=0) {
|
||||
self.dayLabel.text = @"-";
|
||||
}else{
|
||||
NSInteger day = endTime/(60*60*24);
|
||||
NSInteger hour = endTime/3600%24;
|
||||
self.dayLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
|
||||
}
|
||||
}
|
||||
-(void)setIsList:(BOOL)isList{
|
||||
_isList = isList;
|
||||
self.topBtn.hidden = !isList;
|
||||
self.deleteBtn.hidden = !isList;
|
||||
}
|
||||
|
||||
- (IBAction)deleteAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = [NSString stringWithFormat:@"您确定要置顶本关系吗,解除关系需要%@金币",self.model.delete_me_coin];
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf deleteRelation];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
-(void)deleteRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"解除成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)topRelation{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"置顶成功");
|
||||
if (weakSelf.topSuccessBlock) {
|
||||
weakSelf.topSuccessBlock(weakSelf.model);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction)topAction:(id)sender {
|
||||
MJWeakSelf
|
||||
self.alertView.message = @"您确定要置顶本关系吗";
|
||||
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf topRelation];
|
||||
};
|
||||
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
189
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationTableCell.xib
Normal file
189
QXLive/HomePage(声播)/View/房间/用户信息/QXUserInfoRelationTableCell.xib
Normal file
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="347" id="KGk-i7-Jjw" customClass="QXUserInfoRelationTableCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_seat_bg" translatesAutoresizingMaskIntoConstraints="NO" id="iqT-zY-bdo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VWE-MA-oDy">
|
||||
<rect key="frame" x="287" y="118" width="40" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="piG-cg-xSu"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="0.99607843139999996" green="0.2901960784" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="relation_real_love" translatesAutoresizingMaskIntoConstraints="NO" id="v3p-JC-cJG">
|
||||
<rect key="frame" x="100" y="60" width="187" height="62"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="62" id="5e7-n8-EE2"/>
|
||||
<constraint firstAttribute="width" constant="187" id="cXS-sb-Pka"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="0GE-LI-Kkc">
|
||||
<rect key="frame" x="55" y="66" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="eGz-7d-jPm"/>
|
||||
<constraint firstAttribute="width" constant="50" id="g1M-f0-f2U"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9DZ-CN-bNk">
|
||||
<rect key="frame" x="60" y="118" width="40" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="vRa-Vq-qKZ"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="0.99607843137254903" green="0.29019607843137252" blue="0.54509803921568623" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Ua-h1-hNx">
|
||||
<rect key="frame" x="347.66666666666669" y="46" width="19.333333333333314" height="14"/>
|
||||
<color key="backgroundColor" systemColor="labelColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="7"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AZA-Wf-NUm">
|
||||
<rect key="frame" x="342" y="73.666666666666671" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="25" id="81D-lp-SAY"/>
|
||||
<constraint firstAttribute="height" constant="25" id="rog-6m-K2m"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_top"/>
|
||||
<connections>
|
||||
<action selector="topAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ue8-fe-uZt"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="yOX-0y-T2P">
|
||||
<rect key="frame" x="282" y="66" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="2M1-VJ-bhf"/>
|
||||
<constraint firstAttribute="height" constant="50" id="xkP-v6-Q11"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TBG-4p-dIy">
|
||||
<rect key="frame" x="153.66666666666666" y="83.666666666666671" width="80" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="BOJ-jU-bmy"/>
|
||||
<constraint firstAttribute="height" constant="15" id="XKQ-P2-BAI"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="情人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XTi-f5-nlg">
|
||||
<rect key="frame" x="176.66666666666666" y="54.666666666666657" width="34" height="21"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" red="0.99607843139999996" green="0.2901960784" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EXC-vM-Tip">
|
||||
<rect key="frame" x="342" y="108" width="25" height="25"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="25" id="Kkb-fR-XK0"/>
|
||||
<constraint firstAttribute="width" constant="25" id="xMd-n2-qer"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="relation_delete"/>
|
||||
<connections>
|
||||
<action selector="deleteAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="igE-Q8-E8x"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="iqT-zY-bdo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="72T-4O-5wD"/>
|
||||
<constraint firstItem="TBG-4p-dIy" firstAttribute="top" secondItem="XTi-f5-nlg" secondAttribute="bottom" constant="8" id="7Ph-Gs-fxg"/>
|
||||
<constraint firstItem="AZA-Wf-NUm" firstAttribute="trailing" secondItem="9Ua-h1-hNx" secondAttribute="trailing" id="8VF-YC-vFQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iqT-zY-bdo" secondAttribute="trailing" id="B6I-fu-ww0"/>
|
||||
<constraint firstAttribute="bottom" secondItem="iqT-zY-bdo" secondAttribute="bottom" id="EPt-0g-2Us"/>
|
||||
<constraint firstItem="v3p-JC-cJG" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="EpJ-zh-6eW"/>
|
||||
<constraint firstItem="yOX-0y-T2P" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="Fo4-13-xMp"/>
|
||||
<constraint firstItem="iqT-zY-bdo" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="GLa-Ta-mii"/>
|
||||
<constraint firstItem="TBG-4p-dIy" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="Ipj-RA-4El"/>
|
||||
<constraint firstAttribute="bottom" secondItem="0GE-LI-Kkc" secondAttribute="bottom" constant="25" id="Mau-eJ-bfF"/>
|
||||
<constraint firstAttribute="bottom" secondItem="EXC-vM-Tip" secondAttribute="bottom" constant="8" id="Mqq-zh-IER"/>
|
||||
<constraint firstItem="0GE-LI-Kkc" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="55" id="Pnr-C2-F83"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9Ua-h1-hNx" secondAttribute="trailing" constant="20" id="RHB-I4-lSx"/>
|
||||
<constraint firstItem="VWE-MA-oDy" firstAttribute="centerX" secondItem="yOX-0y-T2P" secondAttribute="centerX" id="RTH-61-Afw"/>
|
||||
<constraint firstItem="9DZ-CN-bNk" firstAttribute="centerX" secondItem="0GE-LI-Kkc" secondAttribute="centerX" id="U0D-f7-la0"/>
|
||||
<constraint firstItem="VWE-MA-oDy" firstAttribute="top" secondItem="yOX-0y-T2P" secondAttribute="bottom" constant="2" id="WQ7-9H-ytN"/>
|
||||
<constraint firstItem="9Ua-h1-hNx" firstAttribute="top" secondItem="yOX-0y-T2P" secondAttribute="top" constant="-20" id="XGT-4P-kyO"/>
|
||||
<constraint firstItem="EXC-vM-Tip" firstAttribute="centerX" secondItem="AZA-Wf-NUm" secondAttribute="centerX" id="Xnq-gW-b8x"/>
|
||||
<constraint firstItem="AZA-Wf-NUm" firstAttribute="centerY" secondItem="yOX-0y-T2P" secondAttribute="centerY" constant="-5" id="YUT-bS-ddI"/>
|
||||
<constraint firstItem="TBG-4p-dIy" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="bRy-bN-3Ff"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yOX-0y-T2P" secondAttribute="trailing" constant="55" id="hrP-OT-aoH"/>
|
||||
<constraint firstItem="9DZ-CN-bNk" firstAttribute="top" secondItem="0GE-LI-Kkc" secondAttribute="bottom" constant="2" id="itR-PG-T5i"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<constraints>
|
||||
<constraint firstItem="v3p-JC-cJG" firstAttribute="centerX" secondItem="aW0-zy-SZf" secondAttribute="centerX" id="3h8-di-ALZ"/>
|
||||
<constraint firstItem="XTi-f5-nlg" firstAttribute="centerX" secondItem="aW0-zy-SZf" secondAttribute="centerX" id="IgF-8c-ThM"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="dayLabel" destination="9Ua-h1-hNx" id="muv-y9-BNM"/>
|
||||
<outlet property="deleteBtn" destination="EXC-vM-Tip" id="FRu-rb-0gZ"/>
|
||||
<outlet property="leftHeaderView" destination="0GE-LI-Kkc" id="cNB-HP-fCp"/>
|
||||
<outlet property="leftNameLabel" destination="9DZ-CN-bNk" id="vR1-ez-91H"/>
|
||||
<outlet property="numberLabel" destination="TBG-4p-dIy" id="dck-Jd-exs"/>
|
||||
<outlet property="relationLabel" destination="XTi-f5-nlg" id="3ir-h5-lWY"/>
|
||||
<outlet property="rightHeaderView" destination="yOX-0y-T2P" id="icV-bE-fI6"/>
|
||||
<outlet property="rightNameLabel" destination="VWE-MA-oDy" id="QVT-uB-20j"/>
|
||||
<outlet property="topBtn" destination="AZA-Wf-NUm" id="YdJ-6e-ocy"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="551.90839694656484" y="213.73239436619718"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="relation_delete" width="22" height="22"/>
|
||||
<image name="relation_real_love" width="187" height="62"/>
|
||||
<image name="relation_top" width="22" height="22"/>
|
||||
<image name="room_relationship_seat_bg" width="369" height="141"/>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
<systemColor name="labelColor">
|
||||
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
22
QXLive/HomePage(声播)/View/房间/用户信息/QXUserRelationListView.h
Normal file
22
QXLive/HomePage(声播)/View/房间/用户信息/QXUserRelationListView.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// QXUserRelationListView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXUserModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserRelationListView : UIView
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
|
||||
@property (nonatomic,strong)QXRelationshipList *list;
|
||||
/// 是否为关系卡
|
||||
@property (nonatomic,assign)BOOL isRealLove;
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
196
QXLive/HomePage(声播)/View/房间/用户信息/QXUserRelationListView.m
Normal file
196
QXLive/HomePage(声播)/View/房间/用户信息/QXUserRelationListView.m
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// QXUserRelationListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/21.
|
||||
//
|
||||
|
||||
#import "QXUserRelationListView.h"
|
||||
#import "QXUserInfoRelationCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXUserInfoRelationCardCell.h"
|
||||
#import "QXUserInfoRelationTableCell.h"
|
||||
|
||||
@interface QXUserRelationListView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
@end
|
||||
|
||||
@implementation QXUserRelationListView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429+33))];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_user_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.bottom.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.text = @"关系列表";
|
||||
self.titleLabel.textColor = RGB16(0xffffff);
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(20);
|
||||
make.centerX.equalTo(self.bgView);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
// UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
// layout.itemSize = CGSizeMake(self.width-32, ScaleWidth(100));
|
||||
// layout.minimumLineSpacing = 10;
|
||||
// layout.minimumInteritemSpacing = 10;
|
||||
// layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
// layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
// self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
// [self.collectionView registerNib:[UINib nibWithNibName:@"QXUserInfoRelationCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXUserInfoRelationCell"];
|
||||
//
|
||||
// self.collectionView.delegate = self;
|
||||
// self.collectionView.dataSource = self;
|
||||
// self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
// self.collectionView.bounces = NO;
|
||||
// self.collectionView.pagingEnabled = YES;
|
||||
// self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
// [self.bgView addSubview:self.collectionView];
|
||||
// [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(12);
|
||||
// make.top.equalTo(self.titleLabel.mas_bottom).offset(22);
|
||||
// make.bottom.equalTo(self.bgView);
|
||||
// make.right.mas_equalTo(-12);
|
||||
// }];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
// self.tableView.scrollEnabled = NO;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = ScaleWidth(141);
|
||||
[self.bgView addSubview:self.tableView];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(22);
|
||||
make.bottom.equalTo(self.bgView);
|
||||
make.right.mas_equalTo(-12);
|
||||
}];
|
||||
MJWeakSelf
|
||||
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getRelationList];
|
||||
}];
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getRelationList];
|
||||
}];
|
||||
}
|
||||
-(void)getRelationList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomUserRelationWithUserId:self.userId page:self.page successBlock:^(QXRelationshipList * _Nonnull list) {
|
||||
weakSelf.list = list;
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
-(void)setUserId:(NSString *)userId{
|
||||
self.page = 1;
|
||||
_userId = userId;
|
||||
[self getRelationList];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
//-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
// if (self.isRealLove) {
|
||||
// return self.list.zhenai.count;
|
||||
// }else{
|
||||
// return self.list.qinmi.count;
|
||||
// }
|
||||
//}
|
||||
//- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
// QXUserInfoRelationCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserInfoRelationCell" forIndexPath:indexPath];
|
||||
// QXRelationshipListModel *model;
|
||||
// if (self.isRealLove) {
|
||||
// model = self.list.zhenai[indexPath.row];
|
||||
// }else{
|
||||
// model = self.list.qinmi[indexPath.row];
|
||||
// }
|
||||
// cell.model = model;
|
||||
// return cell;
|
||||
//}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
if (self.isRealLove) {
|
||||
return self.list.zhenai.count;
|
||||
}else{
|
||||
return self.list.qinmi.count;
|
||||
}
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
MJWeakSelf
|
||||
if (!self.isRealLove) {
|
||||
QXUserInfoRelationCardCell *cell = [QXUserInfoRelationCardCell cellWithTableView:tableView];
|
||||
cell.isList = [self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id];
|
||||
cell.model = self.list.qinmi[indexPath.row];;
|
||||
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getRelationList];
|
||||
};
|
||||
return cell;
|
||||
}else{
|
||||
QXUserInfoRelationTableCell *cell = [QXUserInfoRelationTableCell cellWithTableView:tableView];
|
||||
cell.isList = [self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id];
|
||||
cell.model = self.list.zhenai[indexPath.row];;
|
||||
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getRelationList];
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429+33)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
28
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.h
Normal file
28
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// QXAddDirectCell.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXSearchModel.h"
|
||||
#import "QXRoomListModel.h"
|
||||
#import "QXDirectDelegate.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAddDirectCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *IDLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *addBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *levelImageView;
|
||||
@property (nonatomic,strong)QXSearchModel *user;
|
||||
@property (nonatomic,strong)QXRoomListModel *roomModel;
|
||||
@property (nonatomic,weak)id<QXDirectDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
81
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.m
Normal file
81
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.m
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// QXAddDirectCell.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXAddDirectCell.h"
|
||||
|
||||
@implementation QXAddDirectCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXAddDirectCell";
|
||||
QXAddDirectCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.addBtn.layer.borderWidth = 1;
|
||||
cell.addBtn.layer.borderColor = [UIColor colorWithHexString:@"#333333"].CGColor;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)setUser:(QXSearchModel *)user{
|
||||
_user = user;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:user.picture]];
|
||||
self.nameLabel.text = user.name;
|
||||
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",user.code];
|
||||
if (user.icon.count==0) {
|
||||
self.levelImageView.hidden = YES;
|
||||
self.sexImageView.hidden = YES;
|
||||
return;
|
||||
}
|
||||
if (user.icon.count == 1) {
|
||||
self.sexImageView.hidden = NO;
|
||||
self.levelImageView.hidden = YES;
|
||||
NSString *firstIcon = user.icon.firstObject;
|
||||
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.icon.count >= 2) {
|
||||
self.sexImageView.hidden = NO;
|
||||
self.levelImageView.hidden = NO;
|
||||
NSString *firstIcon = user.icon.firstObject;
|
||||
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
|
||||
NSString *secondtIcon = user.icon[1];
|
||||
[self.levelImageView sd_setImageWithURL:[NSURL URLWithString:secondtIcon] placeholderImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setRoomModel:(QXRoomListModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
|
||||
self.nameLabel.text = roomModel.room_name;
|
||||
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",roomModel.room_number];
|
||||
[self.addBtn setTitle:@"邀请PK" forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
- (IBAction)addAction:(id)sender {
|
||||
if (self.roomModel) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(sendPKWithRoomId:)]) {
|
||||
[self.delegate sendPKWithRoomId:self.roomModel.room_id];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(addDirectWithUser:)]) {
|
||||
[self.delegate addDirectWithUser:self.user];
|
||||
}
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
111
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.xib
Normal file
111
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectCell.xib
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="137" id="KGk-i7-Jjw" customClass="QXAddDirectCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="565" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="565" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="aSv-eD-6iI">
|
||||
<rect key="frame" x="16" y="48" width="41" height="41"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="41" id="A4m-xL-NQK"/>
|
||||
<constraint firstAttribute="height" constant="41" id="vYz-zp-WUU"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="20.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZJr-FU-QBy">
|
||||
<rect key="frame" x="63" y="48" width="59.666666666666657" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID:123456789" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lcS-Ly-5FJ">
|
||||
<rect key="frame" x="63.000000000000007" y="73.333333333333329" width="86.666666666666686" height="15.666666666666671"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QZa-JC-MXc">
|
||||
<rect key="frame" x="489" y="55.666666666666657" width="60" height="26"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="26" id="Boa-4d-dg7"/>
|
||||
<constraint firstAttribute="width" constant="60" id="cH3-cv-H4V"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="添加">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="13"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="addAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="0Uf-3S-hbO"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WNp-fx-wB4">
|
||||
<rect key="frame" x="138.66666666666666" y="49" width="42" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="42" id="i4b-No-E9k"/>
|
||||
<constraint firstAttribute="height" constant="16" id="uDz-e7-foq"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mrn-O8-mqZ">
|
||||
<rect key="frame" x="196.66666666666666" y="49" width="42" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="6fq-EJ-3Fu"/>
|
||||
<constraint firstAttribute="width" constant="42" id="gr3-mM-gha"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="QZa-JC-MXc" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="04K-CM-8tf"/>
|
||||
<constraint firstItem="lcS-Ly-5FJ" firstAttribute="bottom" secondItem="aSv-eD-6iI" secondAttribute="bottom" id="ChU-Pd-XEM"/>
|
||||
<constraint firstItem="mrn-O8-mqZ" firstAttribute="leading" secondItem="WNp-fx-wB4" secondAttribute="trailing" constant="16" id="Kya-QG-P70"/>
|
||||
<constraint firstItem="aSv-eD-6iI" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="NfN-kP-rxq"/>
|
||||
<constraint firstItem="ZJr-FU-QBy" firstAttribute="leading" secondItem="aSv-eD-6iI" secondAttribute="trailing" constant="6" id="OGt-a2-IDz"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QZa-JC-MXc" secondAttribute="trailing" constant="16" id="g2W-Nl-QjT"/>
|
||||
<constraint firstItem="mrn-O8-mqZ" firstAttribute="centerY" secondItem="ZJr-FU-QBy" secondAttribute="centerY" id="gmd-D6-1ok"/>
|
||||
<constraint firstItem="lcS-Ly-5FJ" firstAttribute="leading" secondItem="ZJr-FU-QBy" secondAttribute="leading" id="lX5-Zk-G8B"/>
|
||||
<constraint firstItem="aSv-eD-6iI" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="q72-gm-qAb"/>
|
||||
<constraint firstItem="WNp-fx-wB4" firstAttribute="leading" secondItem="ZJr-FU-QBy" secondAttribute="trailing" constant="16" id="rTK-gZ-DeY"/>
|
||||
<constraint firstItem="ZJr-FU-QBy" firstAttribute="top" secondItem="aSv-eD-6iI" secondAttribute="top" id="yZv-Eo-18i"/>
|
||||
<constraint firstItem="WNp-fx-wB4" firstAttribute="centerY" secondItem="ZJr-FU-QBy" secondAttribute="centerY" id="zZo-Eg-hvW"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="IDLabel" destination="lcS-Ly-5FJ" id="uJ5-Vt-bXU"/>
|
||||
<outlet property="addBtn" destination="QZa-JC-MXc" id="NbW-u2-cUi"/>
|
||||
<outlet property="headerImageView" destination="aSv-eD-6iI" id="BAg-8k-e6c"/>
|
||||
<outlet property="levelImageView" destination="mrn-O8-mqZ" id="cmb-8v-pgm"/>
|
||||
<outlet property="nameLabel" destination="ZJr-FU-QBy" id="3ba-hZ-XYa"/>
|
||||
<outlet property="sexImageView" destination="WNp-fx-wB4" id="A6C-fp-C0t"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="325.95419847328242" y="52.464788732394368"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
</resources>
|
||||
</document>
|
||||
18
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectView.h
Normal file
18
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXAddDirectView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAddDirectView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
171
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectView.m
Normal file
171
QXLive/HomePage(声播)/View/房间/设置/QXAddDirectView.m
Normal file
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// QXAddDirectView.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXAddDirectView.h"
|
||||
#import "QXAddDirectCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXAddDirectView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,UITextFieldDelegate,QXDirectDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIView *seachBgView;
|
||||
@property (nonatomic,strong)UIImageView *searchImageView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
|
||||
@property (nonatomic,strong)UITableView*tableView;
|
||||
@property (nonatomic,strong)NSMutableArray*dataArray;
|
||||
@end
|
||||
|
||||
@implementation QXAddDirectView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(429), SCREEN_WIDTH, ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"添加主持";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.seachBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+12, SCREEN_WIDTH-16*2, 35)];
|
||||
self.seachBgView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
|
||||
self.seachBgView.layer.masksToBounds = YES;
|
||||
self.seachBgView.layer.cornerRadius = 17.5;
|
||||
[self.bgView addSubview:self.seachBgView];
|
||||
|
||||
self.searchImageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5.5, 24, 24)];
|
||||
self.searchImageView.image = [UIImage imageNamed:@"room_song_search"];
|
||||
[self.seachBgView addSubview:self.searchImageView];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchImageView.right+6, 0, self.seachBgView.width-self.searchImageView.right-6-8, 35)];
|
||||
self.textField.placeholder = @"请输入ID/用户名搜索";
|
||||
self.textField.font = [UIFont systemFontOfSize:14];
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
self.textField.delegate = self;
|
||||
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.seachBgView addSubview:self.textField];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.seachBgView.bottom+12, self.width, self.bgView.height-12-self.seachBgView.bottom) style:(UITableViewStylePlain)];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(void)textDidChange:(UITextField*)textField{
|
||||
//发起网络请求
|
||||
MJWeakSelf
|
||||
// [self.adpter qx_searchUserWithKeyword:textField.text completion:^(BOOL success, NSArray<SRUserHomeModel *> * _Nullable results) {
|
||||
// [weakSelf.dataArray removeAllObjects];
|
||||
// [weakSelf.dataArray addObjectsFromArray:results];
|
||||
// [weakSelf.tableView reloadData];
|
||||
// }];
|
||||
[QXMineNetwork searchApiWithType:1 search:textField.text successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXSearchModel class] json:dict];
|
||||
[weakSelf.dataArray addObjectsFromArray:arr];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITextFieldDelegate
|
||||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = kSafeAreaTop+90;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - QXAddDirectCellDelegate
|
||||
-(void)addDirectWithUser:(QXSearchModel *)user{
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:1 roomId:self.roomId user_id:user.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"添加成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXAddDirectCell *cell = [QXAddDirectCell cellWithTableView:tableView];
|
||||
QXSearchModel *model = self.dataArray[indexPath.row];
|
||||
cell.user = model;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 52;
|
||||
}
|
||||
|
||||
|
||||
-(void)resetView{
|
||||
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[self resetView];
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.x = 0;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
@end
|
||||
28
QXLive/HomePage(声播)/View/房间/设置/QXDirectDelegate.h
Normal file
28
QXLive/HomePage(声播)/View/房间/设置/QXDirectDelegate.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// QXDirectDelegate.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/17.
|
||||
//
|
||||
//#import "SRUserHomeModel.h"
|
||||
|
||||
#ifndef QXDirectDelegate_h
|
||||
#define QXDirectDelegate_h
|
||||
#import "QXSearchModel.h"
|
||||
@protocol QXDirectDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/// 设置主持人比例
|
||||
-(void)setDirectRatioSuccess;
|
||||
/// 删除主持人
|
||||
-(void)removeDirectSuccess;
|
||||
/// 添加主持人
|
||||
-(void)addDirectWithUser:(QXSearchModel*)user;
|
||||
/// 删除亲密关系
|
||||
-(void)removeRelationshipSuccess;
|
||||
/// 发起pk
|
||||
-(void)sendPKWithRoomId:(NSString*)roomId;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* QXDirectDelegate_h */
|
||||
26
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.h
Normal file
26
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// QXDirectListCell.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
#import "QXDirectSetScaleView.h"
|
||||
#import "QXDirectDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXDirectListCell : UITableViewCell<QXDirectDelegate>
|
||||
@property (weak, nonatomic) IBOutlet UIView *bgView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *scaleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
|
||||
@property (strong, nonatomic) QXRoomOnlineList *model;
|
||||
@property (strong, nonatomic) NSString *roomId;
|
||||
@property (weak, nonatomic)id<QXDirectDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
82
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.m
Normal file
82
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.m
Normal file
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// QXDirectListCell.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXDirectListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXDirectListCell()
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXDirectListCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXDirectListCell";
|
||||
QXDirectListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
- (IBAction)removeAction:(id)sender {
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:1 roomId:self.roomId user_id:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(removeDirectSuccess)]) {
|
||||
[weakSelf.delegate removeDirectSuccess];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
//-(void)setModel:(QXDirectListModel *)model{
|
||||
// _model = model;
|
||||
// self.nameLabel.text = model.user_nickname;
|
||||
// [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.head_picture] placeholderImage:PLACEHOLDER_IMAGE];
|
||||
// self.timeLabel.text = model.online_time;
|
||||
// self.scaleLabel.text = [NSString stringWithFormat:@"%@%%",model.earnings_ratio];
|
||||
// self.priceLabel.text = model.earnings;
|
||||
//}
|
||||
-(void)setModel:(QXRoomOnlineList *)model{
|
||||
_model = model;
|
||||
self.nameLabel.text = model.nickname;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.scaleLabel.text = [NSString stringWithFormat:@"%.2f%%",model.ratio.doubleValue];
|
||||
self.priceLabel.text = [NSString stringWithFormat:@"%.4f%%",model.earnings.doubleValue];
|
||||
}
|
||||
- (IBAction)setScaleAction:(id)sender {
|
||||
QXDirectSetScaleView *scaleView = [[QXDirectSetScaleView alloc] init];
|
||||
scaleView.userId = self.model.user_id;
|
||||
scaleView.roomId = self.roomId;
|
||||
scaleView.delegate = self;
|
||||
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
||||
if ([w isKeyWindow]) {
|
||||
[scaleView showInView:w];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setDirectRatioSuccess{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(setDirectRatioSuccess)]) {
|
||||
[self.delegate setDirectRatioSuccess];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
// Group 7049男性
|
||||
// Group 7050 女性
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
178
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.xib
Normal file
178
QXLive/HomePage(声播)/View/房间/设置/QXDirectListCell.xib
Normal file
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="193" id="KGk-i7-Jjw" customClass="QXDirectListCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="606" height="193"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="606" height="193"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fyv-GJ-MOK">
|
||||
<rect key="frame" x="16" y="6" width="574" height="181"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="yB5-02-7V0">
|
||||
<rect key="frame" x="-6" y="-6" width="586" height="193"/>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="9j4-xg-khE">
|
||||
<rect key="frame" x="12" y="12" width="43" height="43"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="43" id="3Bd-Pm-hFS"/>
|
||||
<constraint firstAttribute="height" constant="43" id="foB-bp-k5X"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="21.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Ns-Wn-8ne">
|
||||
<rect key="frame" x="63" y="12" width="59.666666666666657" height="18"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收益比例:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tpG-r0-TB6">
|
||||
<rect key="frame" x="63" y="38" width="65" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="65" id="ced-P9-eNL"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.49803921569999998" green="0.49803921569999998" blue="0.49803921569999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="20.00" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5SN-gE-KAi">
|
||||
<rect key="frame" x="524.66666666666663" y="38" width="37.333333333333371" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收益" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tlv-bM-4Yi">
|
||||
<rect key="frame" x="527" y="12.666666666666668" width="35" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="35" id="iFz-Q5-lXa"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VQV-kA-f4N">
|
||||
<rect key="frame" x="133" y="38" width="36.666666666666657" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R6z-CR-U6M">
|
||||
<rect key="frame" x="162" y="134" width="400" height="35"/>
|
||||
<color key="backgroundColor" red="0.050980392156862744" green="1" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="dr0-y5-hdV"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="收益比例">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="17.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="setScaleAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="5UG-3x-Cba"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8xh-FH-6or">
|
||||
<rect key="frame" x="12" y="134" width="130" height="35"/>
|
||||
<color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="81x-JT-9hH"/>
|
||||
<constraint firstAttribute="width" constant="130" id="PMh-Nj-WiF"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="移除">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="17.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="removeAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ebt-8r-a5p"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_diamond" translatesAutoresizingMaskIntoConstraints="NO" id="dSa-62-x0n">
|
||||
<rect key="frame" x="502.66666666666663" y="36.666666666666664" width="20" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="20" id="9k7-Ud-Z6z"/>
|
||||
<constraint firstAttribute="height" constant="20" id="VUO-Ol-gH3"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="dSa-62-x0n" firstAttribute="centerY" secondItem="5SN-gE-KAi" secondAttribute="centerY" id="222-AB-wvY"/>
|
||||
<constraint firstItem="yB5-02-7V0" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="-6" id="2hY-ds-bNR"/>
|
||||
<constraint firstItem="VQV-kA-f4N" firstAttribute="centerY" secondItem="tpG-r0-TB6" secondAttribute="centerY" id="4Ms-xc-eXJ"/>
|
||||
<constraint firstItem="8xh-FH-6or" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="12" id="4tq-yD-Eds"/>
|
||||
<constraint firstItem="R6z-CR-U6M" firstAttribute="centerY" secondItem="8xh-FH-6or" secondAttribute="centerY" id="6du-Hx-qjc"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8xh-FH-6or" secondAttribute="bottom" constant="12" id="AuV-57-Lz4"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="centerY" secondItem="tpG-r0-TB6" secondAttribute="centerY" id="DIm-m1-EHb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tlv-bM-4Yi" secondAttribute="trailing" constant="12" id="F2u-bZ-b3F"/>
|
||||
<constraint firstItem="1Ns-Wn-8ne" firstAttribute="top" secondItem="9j4-xg-khE" secondAttribute="top" id="H4h-Jb-JYv"/>
|
||||
<constraint firstItem="tpG-r0-TB6" firstAttribute="bottom" secondItem="9j4-xg-khE" secondAttribute="bottom" id="KLU-gn-U1W"/>
|
||||
<constraint firstAttribute="bottom" secondItem="yB5-02-7V0" secondAttribute="bottom" constant="-6" id="Kbu-qy-RS0"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="leading" secondItem="dSa-62-x0n" secondAttribute="trailing" constant="2" id="Mpa-vx-SNo"/>
|
||||
<constraint firstItem="9j4-xg-khE" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="12" id="Mq3-26-CA4"/>
|
||||
<constraint firstItem="9j4-xg-khE" firstAttribute="top" secondItem="Fyv-GJ-MOK" secondAttribute="top" constant="12" id="UM9-cA-Io6"/>
|
||||
<constraint firstItem="1Ns-Wn-8ne" firstAttribute="leading" secondItem="9j4-xg-khE" secondAttribute="trailing" constant="8" id="ebh-DE-As7"/>
|
||||
<constraint firstItem="yB5-02-7V0" firstAttribute="top" secondItem="Fyv-GJ-MOK" secondAttribute="top" constant="-6" id="etd-V1-iy3"/>
|
||||
<constraint firstItem="R6z-CR-U6M" firstAttribute="leading" secondItem="8xh-FH-6or" secondAttribute="trailing" constant="20" id="j1j-Qu-d19"/>
|
||||
<constraint firstAttribute="trailing" secondItem="R6z-CR-U6M" secondAttribute="trailing" constant="12" id="lkj-tu-4kn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yB5-02-7V0" secondAttribute="trailing" constant="-6" id="nfK-0p-2al"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="trailing" secondItem="tlv-bM-4Yi" secondAttribute="trailing" id="ngH-er-Jvg"/>
|
||||
<constraint firstItem="tpG-r0-TB6" firstAttribute="leading" secondItem="1Ns-Wn-8ne" secondAttribute="leading" id="uwF-q4-5Zu"/>
|
||||
<constraint firstItem="tlv-bM-4Yi" firstAttribute="centerY" secondItem="1Ns-Wn-8ne" secondAttribute="centerY" id="wEB-Vs-DV3"/>
|
||||
<constraint firstItem="VQV-kA-f4N" firstAttribute="leading" secondItem="tpG-r0-TB6" secondAttribute="trailing" constant="5" id="wbr-dY-qZs"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Fyv-GJ-MOK" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="ASn-IQ-z5V"/>
|
||||
<constraint firstItem="Fyv-GJ-MOK" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="SxV-C8-n6s"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Fyv-GJ-MOK" secondAttribute="trailing" constant="16" id="d8e-Gh-ZcC"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Fyv-GJ-MOK" secondAttribute="bottom" constant="6" id="kIe-d4-FNo"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="bgView" destination="Fyv-GJ-MOK" id="tr7-3h-oye"/>
|
||||
<outlet property="headerImageView" destination="9j4-xg-khE" id="2A9-rQ-YNd"/>
|
||||
<outlet property="nameLabel" destination="1Ns-Wn-8ne" id="xCu-CO-9G9"/>
|
||||
<outlet property="priceLabel" destination="5SN-gE-KAi" id="XXL-fG-7lp"/>
|
||||
<outlet property="scaleLabel" destination="VQV-kA-f4N" id="Ix7-Lt-nCA"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="232.06106870229007" y="-41.901408450704224"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
<image name="wallet_diamond" width="28" height="28"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
18
QXLive/HomePage(声播)/View/房间/设置/QXDirectListView.h
Normal file
18
QXLive/HomePage(声播)/View/房间/设置/QXDirectListView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXDirectListView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXDirectListView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
154
QXLive/HomePage(声播)/View/房间/设置/QXDirectListView.m
Normal file
154
QXLive/HomePage(声播)/View/房间/设置/QXDirectListView.m
Normal file
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// QXDirectListView.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXDirectListView.h"
|
||||
#import "QXDirectListCell.h"
|
||||
#import "QXAddDirectView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAlertView.h"
|
||||
|
||||
@interface QXDirectListView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,QXDirectDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *addBtn;
|
||||
|
||||
@property (nonatomic,strong)UITableView*tableView;
|
||||
@property (nonatomic,strong)NSMutableArray*dataArray;
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
|
||||
@end
|
||||
@implementation QXDirectListView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"主持人";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.addBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-75, 5, 60, 40)];
|
||||
[self.addBtn setTitle:@"添加主持" forState:(UIControlStateNormal)];
|
||||
[self.addBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:(UIControlStateNormal)];
|
||||
self.addBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.addBtn addTarget:self action:@selector(addAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.addBtn];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+6, self.width, self.bgView.height-6-self.titleLabel.bottom) style:(UITableViewStylePlain)];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
[self getDirectList];
|
||||
}
|
||||
-(void)getDirectList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomManagerListWithRoomId:self.roomId type:1 successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)addAction{
|
||||
[self hide];
|
||||
QXAddDirectView *v = [[QXAddDirectView alloc] init];
|
||||
v.roomId = self.roomId;
|
||||
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
||||
if ([w isKeyWindow]) {
|
||||
[v showInView:w];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setDirectRatioSuccess{
|
||||
[self getDirectList];
|
||||
}
|
||||
|
||||
-(void)removeDirectSuccess{
|
||||
[self getDirectList];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
//-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
// [self hide];
|
||||
//}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXDirectListCell *cell = [QXDirectListCell cellWithTableView:tableView];
|
||||
QXRoomOnlineList *model = self.dataArray[indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.roomId = self.roomId;
|
||||
cell.model = model;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 126;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
MJWeakSelf
|
||||
_alertView.commitBlock = ^{
|
||||
|
||||
};
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
@end
|
||||
31
QXLive/HomePage(声播)/View/房间/设置/QXDirectSetScaleView.h
Normal file
31
QXLive/HomePage(声播)/View/房间/设置/QXDirectSetScaleView.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXDirectSetScaleView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXDirectDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@interface QXDirectSetScaleView : UIView
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
|
||||
@property (nonatomic,assign)BOOL isGiveCoin;
|
||||
|
||||
/// 头条
|
||||
@property (nonatomic,assign)BOOL isHeadline;
|
||||
/// 分钟
|
||||
@property (nonatomic,strong)NSString* minutes;
|
||||
/// 金币
|
||||
@property (nonatomic,strong)NSString* coin;
|
||||
/// 当前所需金币
|
||||
@property (nonatomic,strong)NSString* now_coin;
|
||||
|
||||
@property (nonatomic,weak)id<QXDirectDelegate>delegate;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user