增加换肤功能

This commit is contained in:
启星
2025-08-14 10:07:49 +08:00
parent f6964c1e89
commit 4f9318d98e
8789 changed files with 978530 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
//
// QXTaskGiftRecordVC.h
// QXLive
//
// Created by 启星 on 2025/7/11.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXTaskGiftRecordVC : QXBaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,127 @@
//
// QXTaskGiftRecordVC.m
// QXLive
//
// Created by on 2025/7/11.
//
#import "QXTaskGiftRecordVC.h"
#import "QXMineNetwork.h"
#import "QXTaskGiftRecordCell.h"
@interface QXTaskGiftRecordVC ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UIView *headerView;
@end
@implementation QXTaskGiftRecordVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationItem.title = @"礼盒";
[self.view addSubview:self.tableView];
[self.view addSubview:self.headerView];
self.page = 1;
[self getHistorySubsidy];
}
-(void)getHistorySubsidy{
MJWeakSelf
[QXMineNetwork dayTaskGiftBoxRecordSuccessBlock:^(NSArray<QXTaskGiftBoxRecordModel *> * _Nonnull list) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
if (list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
[weakSelf.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_footer endRefreshing];
[weakSelf.tableView.mj_header endRefreshing];
showToast(msg)
}];
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXTaskGiftRecordCell *cell = [QXTaskGiftRecordCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
return cell;
}
//-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
// return self.headerView;
//}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 44;
}
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
// return 44;
//}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.headerView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.headerView.bottom) style:(UITableViewStylePlain)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor whiteColor];
_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 getHistorySubsidy];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getHistorySubsidy];
}];
}
return _tableView;
}
-(UIView *)headerView{
if (!_headerView) {
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0,NavContentHeight+18 , SCREEN_WIDTH, 44)];
[_headerView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
_headerView.backgroundColor = [UIColor whiteColor];
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 145, 44)];
timeLabel.text = @"时间";
timeLabel.textColor = [UIColor colorWithHexString:@"#333333"];
timeLabel.font = [UIFont boldSystemFontOfSize:16];
timeLabel.textAlignment = NSTextAlignmentLeft;
[_headerView addSubview:timeLabel];
UILabel *statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.right+15, 0, 75, 44)];
statusLabel.text = @"礼盒名称";
statusLabel.textColor = [UIColor colorWithHexString:@"#333333"];
statusLabel.font = [UIFont boldSystemFontOfSize:16];
statusLabel.textAlignment = NSTextAlignmentLeft;
[_headerView addSubview:statusLabel];
UILabel *subsidyLabel = [[UILabel alloc] initWithFrame:CGRectMake(statusLabel.right+15, 0, SCREEN_WIDTH-statusLabel.right-15-16, 44)];
subsidyLabel.text = @"获取";
subsidyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
subsidyLabel.font = [UIFont boldSystemFontOfSize:16];
subsidyLabel.textAlignment = NSTextAlignmentLeft;
[_headerView addSubview:subsidyLabel];
// UILabel *allWaterLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.right+10, 0, subsidyLabel.left-20-timeLabel.right, 44)];
// allWaterLabel.text = @"累计流水";
// allWaterLabel.textColor = [UIColor colorWithHexString:@"#333333"];
// allWaterLabel.font = [UIFont boldSystemFontOfSize:16];
// allWaterLabel.textAlignment = NSTextAlignmentCenter;
// [_headerView addSubview:allWaterLabel];
}
return _headerView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXTaskViewController.h
// QXLive
//
// Created by 启星 on 2025/5/9.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXTaskViewController : QXBaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,150 @@
//
// QXTaskViewController.m
// QXLive
//
// Created by on 2025/5/9.
//
#import "QXTaskViewController.h"
#import "QXDayTaskTopView.h"
#import "QXDayTaskCell.h"
#import "QXDayTaskRuleView.h"
#import "QXMineNetwork.h"
#import "QXTaskGiftRecordVC.h"
@interface QXTaskViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)QXDayTaskTopView *topView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXDayTaskModel *model;
@end
@implementation QXTaskViewController
- (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];
[self getDayTask];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"每日任务");
UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[recordBtn setTitle:QXText(@"礼盒记录") forState:(UIControlStateNormal)];
[recordBtn setTitleColor:RGB16(0xFF8ACC) forState:(UIControlStateNormal)];
recordBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[recordBtn addTarget:self action:@selector(recordAction) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn];
}
- (void)initSubViews{
self.bgImageHidden = YES;
self.view.backgroundColor = RGB16(0xF8E3C8);
self.tableView.tableHeaderView = self.topView;
[self.view addSubview:self.tableView];
}
-(void)getDayTask{
MJWeakSelf
[QXMineNetwork getDayTaskListSuccessBlock:^(QXDayTaskModel * _Nonnull model) {
weakSelf.model = model;
weakSelf.topView.model = model;
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)recordAction{
QXTaskGiftRecordVC *vc = [[QXTaskGiftRecordVC alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
-(QXDayTaskTopView *)topView{
if (!_topView) {
_topView = [[QXDayTaskTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-32, ScaleWidth(285)+12)];
}
return _topView;
}
#pragma mark - UITableViewDataSource,UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
if (self.model == nil) {
return 0;
}
return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return self.model.tasks.daily_tasks.count;
}else if(section == 1){
return self.model.tasks.daily_tasks_special.count;
}else{
return self.model.tasks.usual_tasks.count;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXDayTaskCell *cell = [QXDayTaskCell cellWithTableView:tableView];
QXDayTaskListModel *model;
if (indexPath.section == 0) {
model = self.model.tasks.daily_tasks[indexPath.row];
}else if(indexPath.section == 1){
model = self.model.tasks.daily_tasks_special[indexPath.row];
}else{
model = self.model.tasks.usual_tasks[indexPath.row];
}
cell.model = model;
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;
if (section == 0) {
titleLabel.text = QXText(@"每日任务");
}else if(section == 1){
titleLabel.text = QXText(@"特殊任务");
}else{
titleLabel.text = QXText(@"平台任务");
}
[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;
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(16, NavContentHeight, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.rowHeight = 60;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
}
return _tableView;
}
@end