小说绘上架版本

This commit is contained in:
xtfei2011
2021-02-07 11:24:08 +08:00
commit ee5c1c8b12
1762 changed files with 115892 additions and 0 deletions
@@ -0,0 +1,19 @@
//
// TFRecordsPageViewController.h
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface TFRecordsPageViewController : TFBasicViewController
@property (nonatomic ,copy) NSString *unit;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,171 @@
//
// TFRecordsPageViewController.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFRecordsPageViewController.h"
#import "TFRecordsTableViewCell.h"
#import "WXYZ_RecordsModel.h"
@interface TFRecordsPageViewController ()<UITableViewDelegate, UITableViewDataSource>
@end
@implementation TFRecordsPageViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self initialize];
[self createSubviews];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self setStatusBarDefaultStyle];
}
- (void)initialize
{
[self hiddenNavigationBar:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:Notification_Login_Success object:nil];
}
- (void)createSubviews
{
self.mainTableView.delegate = self;
self.mainTableView.dataSource = self;
self.mainTableView.contentInset = UIEdgeInsetsMake(0, 0, PUB_TABBAR_OFFSET, 0);
[self.view addSubview:self.mainTableView];
[self.mainTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.top.mas_equalTo(PUB_NAVBAR_HEIGHT + 44);
make.width.mas_equalTo(SCREEN_WIDTH);
make.height.mas_equalTo(SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT - 44);
}];
WS(weakSelf)
self.mainTableView.mj_header = [TFRefreshHeader headerWithRefreshingBlock:^{
weakSelf.currentPageNumber = 1;
[weakSelf netRequest];
}];
[self.mainTableView.mj_header beginRefreshing];
self.mainTableView.mj_footer = [TFRefreshFooter footerWithRefreshingBlock:^{
weakSelf.currentPageNumber ++;
[weakSelf netRequest];
}];
[self createEmptyView];
}
- (void)createEmptyView
{
if (!TFUserInfoManager.isLogin) {
[self setEmptyOnView:self.mainTableView title:TFLocalizedString(@"登录后查看流水记录") buttonTitle:TFLocalizedString(@"立即登录") tapBlock:^{
[TFLoginOptionsViewController presentLoginView:nil];
}];
} else {
[self setEmptyOnView:self.mainTableView title:TFLocalizedString(@"暂无流水记录") buttonTitle:nil tapBlock:^{
}];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.dataSourceArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TFRecordsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TFRecordsTableViewCell"];
if (!cell) {
cell = [[TFRecordsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TFRecordsTableViewCell"];
}
cell.listModel = [self.dataSourceArray objectOrNilAtIndex:indexPath.row];
cell.hiddenEndLine = (indexPath.row == self.dataSourceArray.count - 1);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 65;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 10;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
view.backgroundColor = [UIColor clearColor];
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, PUB_TABBAR_OFFSET == 0 ? 10 : PUB_TABBAR_OFFSET)];
view.backgroundColor = [UIColor clearColor];
return view;
}
- (void)loginSuccess
{
[self netRequest];
self.emptyView = nil;
[self createEmptyView];
}
- (void)netRequest
{
if ([TFNetworkManager networkingStatus] == NO) {
[self.mainTableView xtfei_showEmptyView];
return;
}
WS(weakSelf)
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"unit"] = self.unit;
params[@"page_num"] = [TFUtilsHelper formatStringWithInteger:self.currentPageNumber];
[TFNetworkTools POST:Consumption_Records parameters:params model:WXYZ_RecordsModel.class success:^(BOOL isSuccess, WXYZ_RecordsModel *_Nullable t_model, TFNetworkRequestModel *requestModel) {
[weakSelf.mainTableView endRefreshing];
if (isSuccess) {
if (weakSelf.currentPageNumber == 1) {
[weakSelf.dataSourceArray removeAllObjects];
weakSelf.dataSourceArray = [NSMutableArray arrayWithArray:t_model.list];
} else {
[weakSelf.dataSourceArray addObjectsFromArray:t_model.list];
}
if (t_model.total_page <= t_model.current_page) {
[weakSelf.mainTableView hideRefreshFooter];
}
}
[weakSelf.mainTableView reloadData];
[weakSelf.mainTableView xtfei_endLoading];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[weakSelf.mainTableView endRefreshing];
[weakSelf.mainTableView xtfei_endLoading];
}];
}
@end
@@ -0,0 +1,19 @@
//
// TFRecordsViewController.h
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface TFRecordsViewController : TFBasicViewController
@property (nonatomic ,assign) NSInteger pageIndex;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,75 @@
//
// TFRecordsViewController.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFRecordsViewController.h"
#import "TFRecordsPageViewController.h"
@interface TFRecordsViewController ()<SGPageTitleViewDelegate, SGPageContentCollectionViewDelegate>
@property (nonatomic ,strong) SGPageTitleView *pageTitleView;
@property (nonatomic ,strong) SGPageContentCollectionView *pageContentCollectionView;
@end
@implementation TFRecordsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self initialize];
[self createSubviews];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self setStatusBarDefaultStyle];
}
- (void)initialize
{
[self setNavigationBarTitle:TFLocalizedString(@"流水记录")];
}
- (void)createSubviews
{
TFRecordsPageViewController *vc1 = [[TFRecordsPageViewController alloc] init];
vc1.unit = @"currencyUnit";
TFRecordsPageViewController *vc2 = [[TFRecordsPageViewController alloc] init];
vc2.unit = @"subUnit";
NSArray *titleArr = @[[NSString stringWithFormat:@"%@", TFSystemInfoManager.masterUnit], TFSystemInfoManager.subUnit];
NSArray *childArr = @[vc1, vc2];
self.pageContentCollectionView = [[SGPageContentCollectionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, SCREEN_HEIGHT) parentVC:self childVCs:childArr];
self.pageContentCollectionView.delegatePageContentCollectionView = self;
[self.view addSubview:self.pageContentCollectionView];
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, PUB_NAVBAR_HEIGHT, SCREEN_WIDTH, 44) delegate:self titleNames:titleArr configure:self.pageConfigure];
self.pageTitleView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.pageTitleView];
if (self.pageIndex == 1) {
self.pageTitleView.selectedIndex = 1;
}
}
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex
{
[self.pageContentCollectionView setPageContentCollectionViewCurrentIndex:selectedIndex];
}
- (void)pageContentCollectionView:(SGPageContentCollectionView *)pageContentCollectionView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex
{
[self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}
@end
@@ -0,0 +1,30 @@
//
// WXYZ_RecordsModel.h
// WXReader
//
// Created by Andrew on 2018/7/12.
// Copyright © 2018年 Andrew. All rights reserved.
//
#import <Foundation/Foundation.h>
@class WXBookRecordsListModel, TFPagingModel;
@interface WXYZ_RecordsModel : TFPagingModel
@property (nonatomic, strong) NSArray<WXBookRecordsListModel *> *list; //明细列表
@end
@interface WXBookRecordsListModel : NSObject
@property (nonatomic, copy) NSString *article; //string 明细说明
@property (nonatomic, copy) NSString *detail; //string 明细
@property (nonatomic, assign) NSInteger detail_type; //int 明细类型 1-充值 2-消费
@property (nonatomic, copy) NSString *date; //string 日期
@end
@@ -0,0 +1,19 @@
//
// WXYZ_RecordsModel.m
// WXReader
//
// Created by Andrew on 2018/7/12.
// Copyright © 2018年 Andrew. All rights reserved.
//
#import "WXYZ_RecordsModel.h"
@implementation WXYZ_RecordsModel
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{@"list" : [WXBookRecordsListModel class]};
}
@end
@implementation WXBookRecordsListModel
@end
@@ -0,0 +1,20 @@
//
// TFRecordsTableViewCell.h
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WXYZ_RecordsModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface TFRecordsTableViewCell : TFBasicTableViewCell
@property (nonatomic ,strong) WXBookRecordsListModel *listModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,75 @@
//
// TFRecordsTableViewCell.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/12.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFRecordsTableViewCell.h"
@interface TFRecordsTableViewCell ()
{
UILabel *titleLabel;
UILabel *dateLabel;
UILabel *moneyLabel;
}
@end
@implementation TFRecordsTableViewCell
- (void)createSubviews
{
[super createSubviews];
titleLabel = [[UILabel alloc] init];
titleLabel.textAlignment = NSTextAlignmentLeft;
titleLabel.textColor = kBlackColor;
titleLabel.font = kMainFont;
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(kMargin);
make.bottom.mas_equalTo(self.contentView.mas_centerY).with.offset(- 1);
make.height.mas_equalTo(20);
make.width.mas_equalTo(SCREEN_WIDTH * 2 / 3);
}];
dateLabel = [[UILabel alloc] init];
dateLabel.textAlignment = NSTextAlignmentLeft;
dateLabel.textColor = kGrayTextLightColor;
dateLabel.font = kFont12;
[self.contentView addSubview:dateLabel];
[dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(kMargin);
make.top.mas_equalTo(self.contentView.mas_centerY).with.offset(1);
make.height.mas_equalTo(20);
make.width.mas_equalTo(SCREEN_WIDTH * 2 / 3);
}];
moneyLabel = [[UILabel alloc] init];
moneyLabel.textAlignment = NSTextAlignmentRight;
moneyLabel.textColor = kBlackColor;
moneyLabel.font = kFont13;
[self.contentView addSubview:moneyLabel];
[moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin);
make.centerY.mas_equalTo(self.contentView.mas_centerY);
make.height.mas_equalTo(40);
make.width.mas_equalTo(150);
}];
}
- (void)setListModel:(WXBookRecordsListModel *)listModel
{
titleLabel.text = listModel.article;
dateLabel.text = listModel.date;
if (listModel.detail.length > 0) {
moneyLabel.text = listModel.detail?:@"";
}
}
@end