This commit is contained in:
启星
2025-11-21 16:17:05 +08:00
parent 7ac937ddbf
commit 8913ea6f48
283 changed files with 8474 additions and 800 deletions

View File

@@ -0,0 +1,16 @@
//
// QXHeartBeatSpaceViewController.h
// QXLive
//
// Created by 启星 on 2025/11/21.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXHeartBeatSpaceViewController : QXBaseViewController
@property (nonatomic,strong)NSString *userId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
//
// QXHeartBeatSpaceViewController.m
// QXLive
//
// Created by on 2025/11/21.
//
#import "QXHeartBeatSpaceViewController.h"
@interface QXHeartBeatSpaceViewController ()
@end
@implementation QXHeartBeatSpaceViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXIntimateViewController.h
// QXLive
//
// Created by 启星 on 2025/11/20.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXIntimateViewController : QXBaseViewController
@property (nonatomic,strong)NSString *userId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,242 @@
//
// QXIntimateViewController.m
// QXLive
//
// Created by on 2025/11/20.
//
#import "QXIntimateViewController.h"
#import "QXIntimateCpCell.h"
#import "QXIntimateListCell.h"
#import "QXIntimateNoCpCell.h"
#import "QXMineNetwork.h"
#import "QXButton.h"
#import "QXMoreIntimateViewController.h"
#import "QXIntimateMoreListCell.h"
#import "QXHeartBeatSpaceViewController.h"
@interface QXIntimateViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXRoomBestFriendModel *model;
@end
@implementation QXIntimateViewController
- (void)viewDidLoad {
self.isNoChangeBgImage = YES;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
}
- (void)initSubViews{
self.page = 1;
[self updateBgImage:@"mine_intimate_bg"];
[self updateBackImage:[UIImage imageNamed:@"mine_intimate_back"]];
UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_img"]];
[self.view addSubview:titleImageView];
[titleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.width.mas_equalTo(ScaleWidth(178));
make.height.mas_equalTo(ScaleWidth(68));
make.top.mas_equalTo(NavContentHeight);
}];
[self.view addSubview:self.tableView];
}
-(void)setUserId:(NSString *)userId{
_userId = userId;
self.page = 1;
[self getList];
}
-(void)getList{
MJWeakSelf
[QXMineNetwork userBestFriendsListWithUserId:self.userId page:self.page successBlock:^(QXRoomBestFriendModel * _Nonnull model) {
weakSelf.model = model;
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:model.no_cp];
[weakSelf.tableView reloadData];
if (model.no_cp.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)moreAction:(QXButton*)btn{
QXRoomBestFriendListModel *md = btn.object;
QXMoreIntimateViewController *vc = [[QXMoreIntimateViewController alloc] init];
vc.userId = self.userId;
vc.relation_id = md.relation_list.firstObject.relation_id;
[self.navigationController pushViewController:vc animated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
if (self.model == nil) {
return 0;
}else{
return 1+self.dataArray.count;
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
if (self.model.cp) {
QXIntimateCpCell *cell = [QXIntimateCpCell cellWithTableView:tableView];
cell.model = self.model.cp;
return cell;
}else{
QXIntimateNoCpCell *cell = [QXIntimateNoCpCell cellWithTableView:tableView];
return cell;
}
}else{
QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1];
if (md.relation_list.count > 1) {
QXIntimateListCell*cell = [QXIntimateListCell cellWithTableView:tableView];
if (self.dataArray.count>0) {
QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1];
cell.model = md;
}
return cell;
}else{
MJWeakSelf
QXIntimateMoreListCell *cell = [QXIntimateMoreListCell cellWithTableView:tableView];
QXRoomBestFriendListModel *md = self.dataArray.firstObject;
cell.model = md.relation_list.firstObject;
cell.deleteSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
weakSelf.page = 1;
[weakSelf getList];
};
return cell;
}
}
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 50)];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_bg"]];
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.font = [UIFont boldSystemFontOfSize:16];
titleLabel.textColor = RGB16(0xffffff);
QXButton *btn = [[QXButton alloc] init];
[btn setTitle:@"更多>>" forState:(UIControlStateNormal)];
[btn setTitleColor:RGB16(0xE973FC) forState:(UIControlStateNormal)];
btn.titleLabel.font = [UIFont systemFontOfSize:12];
[btn addTarget:self action:@selector(moreAction:) forControlEvents:(UIControlEventTouchUpInside)];
[header addSubview:btn];
[header addSubview:imageView];
[header addSubview:titleLabel];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(132);
make.height.mas_equalTo(36);
make.centerX.centerY.equalTo(header);
}];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(header);
make.centerY.equalTo(header).offset(2);
}];
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-23);
make.top.bottom.equalTo(header);
make.width.mas_equalTo(40);
}];
if (section == 0) {
titleLabel.text = @"心动";
btn.hidden = YES;
}else{
QXRoomBestFriendListModel *md = self.dataArray[section-1];
titleLabel.text = md.relation_name;
if (md.relation_list.count>1) {
btn.hidden = NO;
btn.object = md;
}else{
btn.hidden = YES;
}
}
return header;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 50;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
if (self.model.cp) {
return ScaleWidth(100);
}else{
return ScaleWidth(36);
}
}else{
QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1];
if (md.relation_list.count > 1) {
return ScaleWidth(92)+18;
}else{
if (md.relation_list.count == 0) {
return 0;
}else{
return ScaleWidth(100)+16;
}
}
}
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 15)];
return footer;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 15;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
if (self.model.cp) {
QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init];
vc.userId = self.userId;
[self.navigationController pushViewController:vc animated:YES];
}
}
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+ScaleWidth(68), SCREEN_WIDTH, SCREEN_HEIGHT -NavContentHeight-ScaleWidth(68)) style:(UITableViewStyleGrouped)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getList];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getList];
}];
}
return _tableView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXMoreIntimateViewController.h
// QXLive
//
// Created by 启星 on 2025/11/20.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXMoreIntimateViewController : QXBaseViewController
@property (nonatomic,strong)NSString *userId;
@property (nonatomic,strong)NSString *relation_id;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,76 @@
//
// QXMoreIntimateViewController.m
// QXLive
//
// Created by on 2025/11/20.
//
#import "QXMoreIntimateViewController.h"
#import "QXMineNetwork.h"
#import "QXIntimateMoreListCell.h"
@interface QXMoreIntimateViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation QXMoreIntimateViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)setUserId:(NSString *)userId{
_userId = userId;
}
-(void)setRelation_id:(NSString *)relation_id{
_relation_id = relation_id;
if (self.userId) {
[self getList];
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXIntimateMoreListCell *cell = [QXIntimateMoreListCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
MJWeakSelf
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
[weakSelf getList];
};
cell.deleteSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
[weakSelf getList];
};
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return ScaleWidth(92)+16;
}
-(void)getList{
MJWeakSelf
[QXMineNetwork userBestFriendsMoreListWithUserId:self.userId relation_id:self.relation_id successBlock:^(NSArray<QXRelationshipListModel *> * _Nonnull model) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:model];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+ScaleWidth(68), SCREEN_WIDTH, SCREEN_HEIGHT -NavContentHeight-ScaleWidth(68)) style:(UITableViewStyleGrouped)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
}
return _tableView;
}
@end