小说绘上架版本
This commit is contained in:
+19
@@ -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
|
||||
+171
@@ -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
|
||||
+19
@@ -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
|
||||
+75
@@ -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
|
||||
Reference in New Issue
Block a user