This commit is contained in:
启星
2025-12-17 11:44:25 +08:00
parent 999bf3d804
commit ba4fd658a9
37 changed files with 450 additions and 82 deletions

View File

@@ -49,6 +49,7 @@
@property (nonatomic,strong)QXUserModel *userModel;
@property (nonatomic,strong)NSMutableArray *bannerArry;
@property (nonatomic,strong)NSString *cancelCode;
@property (nonatomic,strong)NSString *taskNum;
@end
@implementation QXMineViewController
@@ -106,6 +107,16 @@
weakSelf.tableHeaderView.earnings = earnings;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
[self getTaskCount];
}
-(void)getTaskCount{
MJWeakSelf
[QXMineNetwork appTaskWaitDrawSuccessBlock:^(NSString * _Nonnull num) {
weakSelf.taskNum = num;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - QXMineServiceCellDelegate
@@ -323,6 +334,7 @@
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXMineServiceCell *cell = [QXMineServiceCell cellWithTableView:tableView];
cell.taskNumber = self.taskNum;
cell.delegate = self;
cell.singerIsAuth = self.userModel.singer_status.intValue==1;
if (indexPath.row == 0) {

View File

@@ -13,4 +13,9 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface QXTaskTypeCell : UICollectionViewCell
@property (nonatomic,strong)QXDayTaskTypeModel *model;
@property (nonatomic,strong)UIButton *titleBtn;
@property (nonatomic,strong)UIButton *lockImageBtn;
@end
NS_ASSUME_NONNULL_END

View File

@@ -18,11 +18,16 @@
#import "QXRechargeViewcController.h"
#import "QXSignInAppView.h"
#import "QXCreatPhotosViewController.h"
#import "QXCreateRoomViewController.h"
@interface QXTaskViewController ()<UITableViewDataSource,UITableViewDelegate,QXDayTaskCellDelegate>
@interface QXTaskViewController ()<UITableViewDataSource,UITableViewDelegate,QXDayTaskCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property (nonatomic,strong)QXDayTaskTopView *topView;
@property (nonatomic,strong)UIView *bottomView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)QXDayTaskModel *model;
@property (nonatomic,strong)QXDayTaskTypeModel *typeModel;
@property (nonatomic,strong)UIImageView *nodataView;
@end
@implementation QXTaskViewController
@@ -50,25 +55,54 @@
- (void)initSubViews{
self.bgImageHidden = YES;
self.view.backgroundColor = RGB16(0xE3FAE4);
self.tableView.tableHeaderView = self.topView;
[self.view addSubview:self.tableView];
[self.view addSubview:self.topView];
self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(16, self.topView.bottom, SCREEN_WIDTH-32, SCREEN_HEIGHT-self.topView.bottom-kSafeAreaBottom)];
self.bottomView.backgroundColor = RGB16(0xffffff);
[self.bottomView addRoundedCornersWithRadius:16];
self.tableView.frame = CGRectMake(0, 48, self.bottomView.width, self.bottomView.height-48);
[self.bottomView addSubview:self.tableView];
[self.view addSubview:self.bottomView];
self.nodataView = [[UIImageView alloc] initWithFrame:self.tableView.frame];
self.nodataView.hidden = YES;
[self.bottomView addSubview:self.nodataView];
[self createTaskTypeView];
}
-(void)createTaskTypeView{
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 20;
layout.sectionInset = UIEdgeInsetsMake(0, 14, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.collectionView registerClass:[QXTaskTypeCell class] forCellWithReuseIdentifier:@"QXTaskTypeCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.pagingEnabled = NO;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.bottomView addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.top.mas_equalTo(0);
make.right.mas_equalTo(0);
make.height.mas_equalTo(48);
}];
}
-(void)getDayTask{
MJWeakSelf
[QXMineNetwork getDayTaskListSuccessBlock:^(QXDayTaskModel * _Nonnull model) {
weakSelf.model = model;
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:model.tasks];
for (int i = 0 ; i < model.tasks.count; i++) {
QXDayTaskTypeModel*md = model.tasks[i];
if (md.task_list.count == 0) {
[weakSelf.dataArray removeObjectAtIndex:i];
}
}
weakSelf.model.tasks = weakSelf.dataArray;
weakSelf.topView.model = model;
[weakSelf.tableView reloadData];
weakSelf.typeModel = model.tasks.firstObject;
if (weakSelf.typeModel) {
weakSelf.typeModel.isSelected = YES;
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:weakSelf.typeModel.task_list];
[weakSelf.tableView reloadData];
}
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
@@ -80,7 +114,7 @@
}
-(QXDayTaskTopView *)topView{
if (!_topView) {
_topView = [[QXDayTaskTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-32, ScaleWidth(285)+12)];
_topView = [[QXDayTaskTopView alloc] initWithFrame:CGRectMake(16, NavContentHeight, SCREEN_WIDTH-32, ScaleWidth(285))];
}
return _topView;
}
@@ -143,7 +177,9 @@
[self.navigationController pushViewController:vc animated:YES];
return;
}else if (taskModel.jump_type.intValue == 7) {
QXCreateRoomViewController *vc = [[QXCreateRoomViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
return;
}
}else if (taskModel.task_status.intValue == 2) {
@@ -156,53 +192,64 @@
}];
}
}
#pragma mark - UITableViewDataSource,UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
if (self.model == nil) {
return 0;
}
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.model.tasks.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXTaskTypeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXTaskTypeCell" forIndexPath:indexPath];
cell.model = self.model.tasks[indexPath.row];
return cell;
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
QXDayTaskTypeModel *model = self.model.tasks[indexPath.row];
CGFloat itemWidth = [model.task_type_name widthForFont:[UIFont boldSystemFontOfSize:16]];
if (model.is_lock.intValue == 1) {
itemWidth += 21;
}
itemWidth += 5;
return CGSizeMake(itemWidth, 48);
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXDayTaskTypeModel *model = self.model.tasks[indexPath.row];
if (model == self.typeModel) {
return;
}
if (self.typeModel) {
self.typeModel.isSelected = NO;
}
model.isSelected = YES;
self.typeModel = model;
[collectionView reloadData];
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:model.task_list];
[self.tableView reloadData];
if (model.is_lock.intValue == 1) {
if ([model.task_type_name containsString:@"情侣"]) {
self.nodataView.hidden = NO;
self.nodataView.image = [UIImage imageNamed:@"task_cp_no_data"];
}else if ([model.task_type_name containsString:@"师徒"]) {
self.nodataView.hidden = NO;
self.nodataView.image = [UIImage imageNamed:@"task_master_no_data"];
}else{
self.nodataView.hidden = YES;
}
}else{
self.nodataView.hidden = YES;
}
}
#pragma mark - UITableViewDataSource,UITableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
QXDayTaskTypeModel *model = self.model.tasks[section];
return model.task_list.count;
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXDayTaskCell *cell = [QXDayTaskCell cellWithTableView:tableView];
QXDayTaskTypeModel *model = self.model.tasks[indexPath.section];
QXDayTaskListModel *taskModel = model.task_list[indexPath.row];
QXDayTaskListModel *taskModel = self.dataArray[indexPath.row];
cell.model = taskModel;
cell.delegate = self;
return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-32, 35)];
header.backgroundColor = [UIColor whiteColor];
[header addRoundedCornersWithRadius:17.5 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, SCREEN_WIDTH-32*2, 23)];
titleLabel.font = [UIFont boldSystemFontOfSize:16];
titleLabel.textColor = QXConfig.textColor;
QXDayTaskTypeModel *model = self.model.tasks[section];
titleLabel.text = model.task_type_name;
[header addSubview:titleLabel];
return header;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 35;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-32, 35)];
footer.backgroundColor = [UIColor clearColor];
UIView *roundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-32, 25)];
roundView.backgroundColor = [UIColor whiteColor];
[roundView addRoundedCornersWithRadius:17.5 byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight)];
[footer addSubview:roundView];
return footer;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 35;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXDayTaskTypeModel *model = self.model.tasks[indexPath.section];
QXDayTaskListModel *taskModel = model.task_list[indexPath.row];
@@ -215,7 +262,7 @@
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(16, NavContentHeight, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)];
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(16, self.topView.bottom+12, SCREEN_WIDTH-32, SCREEN_HEIGHT-self.topView.bottom-12) style:(UITableViewStylePlain)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
@@ -231,3 +278,64 @@
return _tableView;
}
@end
@implementation QXTaskTypeCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXDayTaskTypeModel *)model{
_model = model;
[self.titleBtn setTitle:model.task_type_name forState:(UIControlStateNormal)];
if (model.is_lock.intValue == 1) {
[self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self);
make.right.equalTo(self.lockImageBtn.mas_left);
}];
self.lockImageBtn.hidden = NO;
}else{
self.lockImageBtn.hidden = YES;
[self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self);
make.right.equalTo(self.lockImageBtn.mas_right);
}];
}
if (model.isSelected) {
self.titleBtn.selected = YES;
self.lockImageBtn.selected = YES;
}else{
self.titleBtn.selected = NO;
self.lockImageBtn.selected = NO;
}
}
-(void)initSubviews{
self.lockImageBtn = [[UIButton alloc] init];
[self.lockImageBtn setImage:[UIImage imageNamed:@"task_lock_icon_nor"] forState:(UIControlStateNormal)];
[self.lockImageBtn setImage:[UIImage imageNamed:@"task_lock_icon_sel"] forState:(UIControlStateSelected)];
[self addSubview:self.lockImageBtn];
[self.lockImageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self);
make.height.width.mas_equalTo(21);
make.centerY.equalTo(self);
}];
self.lockImageBtn.userInteractionEnabled = NO;
self.titleBtn = [[UIButton alloc] init];
[self.titleBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateSelected)];
[self.titleBtn setTitleColor:RGB16A(0x000000,0.45) forState:(UIControlStateNormal)];
self.titleBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self addSubview:self.titleBtn];
[self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self);
make.right.equalTo(self.lockImageBtn.mas_left);
}];
self.titleBtn.userInteractionEnabled = NO;
}
@end

View File

@@ -323,10 +323,10 @@
[QXMineNetwork postRealNameResultWithOrderNo:faceVerifyResult.orderNo successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}else{
showToast(@"实名认证失败");
showToast(@"人脸认证失败");
}
}

View File

@@ -51,7 +51,11 @@ NS_ASSUME_NONNULL_BEGIN
//@property(nonatomic,strong)NSArray <QXDayTaskListModel*>*teacher_tasks;
@property(nonatomic,strong)NSString *task_type_name;
@property(nonatomic,strong)NSString *task_type_id;
///1 锁 0 开
@property(nonatomic,strong)NSString *is_lock;
@property(nonatomic,strong)NSArray<QXDayTaskListModel*>*task_list;
@property(nonatomic,assign)BOOL isSelected;
@end
@interface QXDayTaskListModel : NSObject

View File

@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign)NSInteger type;
@property (nonatomic,strong)NSString* icon;
@property (nonatomic,strong)NSString* unreadNumber;
@end
NS_ASSUME_NONNULL_END

View File

@@ -516,6 +516,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
+(void)nextSongWithRoomId:(NSString*)room_id
now_did:(NSString*)now_did
is_auto_next:(NSString*)is_auto_next
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
@@ -1395,7 +1396,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
在线
*/
+(void)appKeepAliveWithRoomId:(NSString*)room_id;
+(void)appKeepAliveWithRoomId:(NSString*)room_id
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
签约房间主持邀请上签约麦用户拒绝
@@ -1429,6 +1432,13 @@ NS_ASSUME_NONNULL_BEGIN
+(void)appSignTaskStatusSuccessBlock:(void (^)(NSString* status))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
每日任务未领取数量
*/
+(void)appTaskWaitDrawSuccessBlock:(void (^)(NSString* num))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
@end

View File

@@ -1052,10 +1052,11 @@
failBlock(error,msg);
}];
}
+(void)nextSongWithRoomId:(NSString *)room_id now_did:(NSString *)now_did successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
+(void)nextSongWithRoomId:(NSString *)room_id now_did:(NSString *)now_did is_auto_next:(NSString*)is_auto_next successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"room_id":room_id,
@"now_did":now_did?now_did:@"",
@"is_auto_next":is_auto_next?:@""
};
[[QXRequset shareInstance] postWithUrl:QXRoomNextSong parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
@@ -2804,11 +2805,15 @@
}];
}
+(void)appKeepAliveWithRoomId:(NSString *)room_id{
+(void)appKeepAliveWithRoomId:(NSString *)room_id
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
[[QXRequset shareInstance] getWithUrl:QXKeepAlive parameters:@{@"room_id":room_id?:@""} needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
@@ -2885,5 +2890,18 @@
}];
}
/**
*/
+(void)appTaskWaitDrawSuccessBlock:(void (^)(NSString* num))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
[[QXRequset shareInstance] getWithUrl:QXAppTaskWaitDraw parameters:@{} needCache:NO success:^(id responseObject) {
if (successBlock) {
NSString *num = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"num"]];
successBlock(num);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
@end

View File

@@ -44,14 +44,16 @@ typedef NS_ENUM(NSInteger) {
@property (nonatomic,weak)id<QXMineServiceCellDelegate>delegate;
@property (nonatomic,assign)BOOL isMore;
@property (nonatomic,assign)BOOL singerIsAuth;
@property (nonatomic,strong)NSString *taskNumber;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
@interface QXMineServiceSubCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *unreadLabel;
@property (nonatomic,strong)QXServiceModel *model;
@property (nonatomic,strong)NSString *unreadNum;
@end

View File

@@ -17,6 +17,7 @@
@property (nonatomic,strong)QXServiceModel *inviteModel;
@property (nonatomic,strong)QXServiceModel *singerAuthModel;
@property (nonatomic,strong)QXServiceModel *songListModel;
@property (nonatomic,strong)QXServiceModel *taskModel;
@end
@implementation QXMineServiceCell
@@ -145,6 +146,11 @@
_singerIsAuth = singerIsAuth;
}
-(void)setTaskNumber:(NSString *)taskNumber{
_taskNumber = taskNumber;
self.taskModel.unreadNumber = taskNumber;
[self.collectionView reloadData];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.isMore?self.moreArray.count:self.serviceArray.count;
}
@@ -214,6 +220,7 @@
md2.title = @"每日任务";
md2.icon = @"service_task";
md2.type = QXMineServiceTypeDayTask;
self.taskModel = md2;
QXServiceModel *md3 = [[QXServiceModel alloc] init];
md3.title = @"意见反馈";
@@ -309,6 +316,13 @@
_model = model;
self.imageView.image = [UIImage imageNamed:model.icon];
self.titleLabel.text = model.title;
if (model.unreadNumber.integerValue <= 0) {
self.unreadLabel.text = @"0";
self.unreadLabel.hidden = YES;
}else{
self.unreadLabel.text = model.unreadNumber;
self.unreadLabel.hidden = NO;
}
}
-(void)initSubviews{
UIImageView *imageView = [[UIImageView alloc] init];
@@ -329,6 +343,32 @@
make.centerX.equalTo(self.contentView);
make.height.mas_equalTo(17);
}];
self.unreadLabel = [[UILabel alloc] init];
self.unreadLabel.font = [UIFont systemFontOfSize:10];
self.unreadLabel.textAlignment = NSTextAlignmentCenter;
// self.unreadLabel.text = @"99";
self.unreadLabel.hidden = YES;
self.unreadLabel.textColor = RGB16(0xffffff);
self.unreadLabel.backgroundColor = RGB(255, 19, 55);
[self.unreadLabel addRoundedCornersWithRadius:10];
[self.contentView addSubview:self.unreadLabel];
[self.unreadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(0);
make.right.mas_equalTo(-25);
make.width.mas_equalTo(18);
make.height.mas_equalTo(18);
}];
}
-(void)setUnreadNum:(NSString *)unreadNum{
_unreadNum = unreadNum;
if (unreadNum.integerValue <= 0) {
self.unreadLabel.text = @"0";
self.unreadLabel.hidden = YES;
}else{
self.unreadLabel.text = unreadNum;
self.unreadLabel.hidden = NO;
}
}
@end