Commit 827d27f9cdb9118982149cab5373d3e13b9a5af4

Authored by zhangxiaowen
1 parent 6f981b43

no message

Showing 23 changed files with 510 additions and 55 deletions
CNLiveBalanceModule.podspec
... ... @@ -55,6 +55,18 @@ TODO: 网家家-余额模块.
55 55 ss.source_files = 'CNLiveBalanceModule/Classes/Model/*.{h,m}'
56 56 end
57 57  
  58 + # Group 群组余额
  59 + s.subspec 'Group' do |ss|
  60 + ss.source_files = 'CNLiveBalanceModule/Classes/Group/*.{h,m}'
  61 + ss.dependency 'CNLiveBalanceModule/View'
  62 + end
  63 +
  64 + # Personal 个人中心余额
  65 + s.subspec 'Personal' do |ss|
  66 + ss.source_files = 'CNLiveBalanceModule/Classes/Personal/*.{h,m}'
  67 + ss.dependency 'CNLiveBalanceModule/View'
  68 + end
  69 +
58 70 s.resource_bundles = {
59 71 'CNLiveBalanceModule' => ['CNLiveBalanceModule/Assets/CNLiveBalanceModule.xcassets']
60 72 }
... ... @@ -68,6 +80,7 @@ TODO: 网家家-余额模块.
68 80 s.dependency 'CNLiveTripartiteManagement/Masonry'
69 81 s.dependency 'CNLiveTripartiteManagement/MJExtension'
70 82 s.dependency 'CNLiveTripartiteManagement/PGDatePicker'
  83 + s.dependency 'JXCategoryView'
71 84  
72 85 # 服务层
73 86 s.dependency 'CNLiveServices'
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveBalanceController.m
... ... @@ -20,6 +20,7 @@
20 20 #import "CNLiveBalanceNavigationBar.h"
21 21 #import "CNLiveBalanceView.h"
22 22 #import "CNLivePayCenterController.h"
  23 +#import "CNLiveBalanceDetailController.h"
23 24  
24 25 @interface CNLiveBalanceController ()<CNLiveBalanceNavigationBarDelegate>
25 26 @property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
... ... @@ -126,7 +127,9 @@
126 127 [self.navigationController pushViewController:vc animated:YES];
127 128  
128 129 } else if ([self.type isEqualToString:@"2"]) { // 明细
129   -
  130 + CNLiveBalanceDetailController *vc = [CNLiveBalanceDetailController new];
  131 + vc.ID = self.ID;
  132 + [self.navigationController pushViewController:vc animated:YES];
130 133 }
131 134  
132 135 }
... ...
CNLiveBalanceModule/Classes/Group/CNLiveBalanceDetailBaseController.h 0 → 100644
  1 +//
  2 +// CNLiveBalanceDetailBaseController.h
  3 +// CNLiveBalanceModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 明细子类
  11 + */
  12 +
  13 +#import <UIKit/UIKit.h>
  14 +#import "CNCommonViewController.h"
  15 +#import "JXCategoryListContainerView.h"
  16 +
  17 +NS_ASSUME_NONNULL_BEGIN
  18 +
  19 +@interface CNLiveBalanceDetailBaseController : CNCommonViewController <JXCategoryListContentViewDelegate>
  20 +// 群组ID
  21 +@property (nonatomic, copy) NSString *ID;
  22 +
  23 +// 0全部 1收入 2支出
  24 +@property (nonatomic, assign) NSInteger type;
  25 +
  26 +@end
  27 +
  28 +NS_ASSUME_NONNULL_END
... ...
CNLiveBalanceModule/Classes/Group/CNLiveBalanceDetailBaseController.m 0 → 100644
  1 +//
  2 +// CNLiveBalanceDetailBaseController.m
  3 +// CNLiveBalanceModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBalanceDetailBaseController.h"
  10 +#import "QMUIKit.h"
  11 +#import "MJExtension.h"
  12 +#import "CNLiveBaseKit.h"
  13 +#import "CNLiveCategory.h"
  14 +#import "CNLiveRefreshHeader.h"
  15 +#import "CNLiveRefreshFooter.h"
  16 +
  17 +#import "CNLiveBalanceRequest.h"
  18 +#import "CNLiveTradingRecordCell.h"
  19 +#import "CNLiveTradingRecordModel.h"
  20 +
  21 +@interface CNLiveBalanceDetailBaseController ()<UITableViewDelegate, UITableViewDataSource>
  22 +@property (nonatomic, strong) UITableView *tableView;
  23 +@property (nonatomic, strong) NSMutableArray *data;
  24 +
  25 +@property (nonatomic, assign) NSInteger pageNo;
  26 +@property (nonatomic, assign) NSInteger pageSize;
  27 +@property (nonatomic, assign) BOOL isRefreshing;
  28 +
  29 +@end
  30 +
  31 +@implementation CNLiveBalanceDetailBaseController
  32 +static const CGFloat height = 44;
  33 +#pragma mark - 加载数据
  34 +- (void)loadData {
  35 + [CNLiveBalanceRequest getTradingRecordWithID:self.ID type:[NSString stringWithFormat:@"%ld",self.type] pageNo:self.pageNo pageSize:self.pageSize block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) {
  36 +
  37 + [self.tableView.mj_header endRefreshing];
  38 + [self.tableView.mj_footer endRefreshing];
  39 + if (error) {
  40 + [self.data removeAllObjects];
  41 + [self.tableView reloadData];
  42 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:error.localizedDescription detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)];
  43 + [self setCNAPIErrorEmptyView];
  44 + self.emptyView.verticalOffset = -(NavigationContentTop+height);
  45 + return;
  46 + }
  47 +
  48 + if (isSuccess) {
  49 + if(self.pageNo == 1 && self.data.count>0){
  50 + [self.data removeAllObjects];
  51 + }
  52 + self.pageNo++;
  53 + CNLiveTradingRecordModel *model = [CNLiveTradingRecordModel mj_objectWithKeyValues:data];
  54 + if (model.list.count < self.pageSize) {
  55 + [self.tableView.mj_footer endRefreshingWithNoMoreData];
  56 +
  57 + } else {
  58 + [self.tableView.mj_footer endRefreshing];
  59 +
  60 + }
  61 + [self.data addObjectsFromArray:model.list];
  62 + [self.tableView reloadData];
  63 +
  64 +
  65 + }
  66 + self.tableView.mj_footer.hidden = self.data.count == 0;
  67 + self.isRefreshing = NO;
  68 +
  69 + }];
  70 +
  71 +}
  72 +
  73 +- (void)loadMoreData{
  74 + if(!_isRefreshing){
  75 + _isRefreshing = YES;
  76 + [self loadData];
  77 + }
  78 +}
  79 +
  80 +#pragma mark - 生命周期
  81 +- (void)viewWillAppear:(BOOL)animated{
  82 + [super viewWillAppear:animated];
  83 + self.navigationController.navigationBarHidden = YES;
  84 +}
  85 +
  86 +- (void)viewDidLoad {
  87 + [super viewDidLoad];
  88 + self.view.backgroundColor = [UIColor whiteColor];
  89 + if (@available(iOS 11, *)) {
  90 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  91 + }
  92 + else {
  93 + self.automaticallyAdjustsScrollViewInsets = NO;
  94 + }
  95 +
  96 + self.pageNo = 1;
  97 + self.pageSize = 20;
  98 + self.isRefreshing = NO;
  99 +
  100 + [self createSubViews];
  101 + [self.tableView.mj_header beginRefreshing];
  102 +
  103 +}
  104 +
  105 +- (void)createSubViews {
  106 + [self.view addSubview:self.tableView];
  107 +}
  108 +
  109 +#pragma mark - UITableViewDelegate
  110 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  111 + return 80.0;
  112 +}
  113 +
  114 +#pragma mark - UITableViewDataSource
  115 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  116 + return self.data.count;
  117 +}
  118 +
  119 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  120 + CNLiveTradingRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveTradingRecordCell];
  121 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  122 + cell.model = self.data[indexPath.row];
  123 + return cell;
  124 +}
  125 +
  126 +#pragma mark - JXCategoryListContentViewDelegate
  127 +- (UIView *)listView {
  128 + return self.view;
  129 +}
  130 +
  131 +#pragma mark - 懒加
  132 +- (NSMutableArray *)data{
  133 + if (!_data) {
  134 + _data = [NSMutableArray array];
  135 + }
  136 + return _data;
  137 +}
  138 +
  139 +- (UITableView *)tableView{
  140 + if(!_tableView){
  141 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop-height) style:UITableViewStylePlain];
  142 + _tableView.delegate = self;
  143 + _tableView.dataSource = self;
  144 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  145 + _tableView.backgroundColor = [UIColor whiteColor];
  146 + _tableView.estimatedRowHeight = 0;
  147 + _tableView.estimatedSectionHeaderHeight = 0;
  148 + _tableView.estimatedSectionFooterHeight = 0;
  149 + [_tableView registerClass:[CNLiveTradingRecordCell class] forCellReuseIdentifier:kCNLiveTradingRecordCell];
  150 + __weak __typeof(self)weakSelf = self;
  151 + _tableView.mj_header = [CNLiveRefreshHeader headerWithRefreshingBlock:^{
  152 + weakSelf.pageNo = 1;
  153 + [weakSelf loadData];
  154 + }];
  155 + _tableView.mj_footer = [CNLiveRefreshFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
  156 +
  157 + }
  158 + return _tableView;
  159 +}
  160 +
  161 +@end
... ...
CNLiveBalanceModule/Classes/Group/CNLiveBalanceDetailController.h 0 → 100644
  1 +//
  2 +// CNLiveBalanceDetailController.h
  3 +// CNLiveBalanceModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 明细
  11 + */
  12 +
  13 +#import <UIKit/UIKit.h>
  14 +#import "CNCommonViewController.h"
  15 +
  16 +NS_ASSUME_NONNULL_BEGIN
  17 +
  18 +@interface CNLiveBalanceDetailController : CNCommonViewController
  19 +// 群组ID
  20 +@property (nonatomic, copy) NSString *ID;
  21 +
  22 +@end
  23 +
  24 +NS_ASSUME_NONNULL_END
... ...
CNLiveBalanceModule/Classes/Group/CNLiveBalanceDetailController.m 0 → 100644
  1 +//
  2 +// CNLiveBalanceDetailController.m
  3 +// CNLiveBalanceModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBalanceDetailController.h"
  10 +#import "QMUIKit.h"
  11 +
  12 +#import "CNLiveBaseKit.h"
  13 +#import "CNLiveCategory.h"
  14 +#import "JXCategoryView.h"
  15 +
  16 +#import "CNLiveBalanceNavigationBar.h"
  17 +#import "CNLiveBalanceDetailBaseController.h"
  18 +
  19 +@interface CNLiveBalanceDetailController ()<CNLiveBalanceNavigationBarDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  20 +@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  21 +@property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
  22 +@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
  23 +@property (nonatomic, strong) NSArray *titles;
  24 +
  25 +@property (nonatomic, strong) UIView *tline;
  26 +@property (nonatomic, strong) UIView *bline;
  27 +
  28 +@end
  29 +
  30 +@implementation CNLiveBalanceDetailController
  31 +static const CGFloat height = 44;
  32 +
  33 +#pragma mark - 生命周期
  34 +- (void)viewWillAppear:(BOOL)animated{
  35 + [super viewWillAppear:animated];
  36 + self.navigationController.navigationBarHidden = YES;
  37 +}
  38 +
  39 +- (void)viewDidLoad {
  40 + [super viewDidLoad];
  41 + self.view.backgroundColor = [UIColor whiteColor];
  42 + if (@available(iOS 11, *)) {
  43 + }
  44 + else {
  45 + self.automaticallyAdjustsScrollViewInsets = NO;
  46 + }
  47 +
  48 + [self createSubViews];
  49 +
  50 +}
  51 +
  52 +- (void)createSubViews {
  53 + [self.view addSubview:self.navigationBar];
  54 + [self.view addSubview:self.tline];
  55 + [self.view addSubview:self.titleCategoryView];
  56 + [self.view addSubview:self.bline];
  57 + [self.view addSubview:self.listContainerView];
  58 + _titleCategoryView.listContainer = self.listContainerView;
  59 +
  60 +}
  61 +
  62 +#pragma mark - 懒加载
  63 +- (CNLiveBalanceNavigationBar *)navigationBar {
  64 + if (!_navigationBar) {
  65 + _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
  66 + _navigationBar.backgroundColor = [UIColor whiteColor];
  67 + _navigationBar.delegate = self;
  68 + _navigationBar.title.text = @"明细";
  69 + _navigationBar.title.textColor = [UIColor blackColor];
  70 + UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
  71 + [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  72 + _navigationBar.right = nil;
  73 + }
  74 + return _navigationBar;
  75 +}
  76 +
  77 +#pragma mark - 响应方法
  78 +- (void)goBack {
  79 + if (self.presentingViewController != nil) {
  80 + [self dismissViewControllerAnimated:YES completion:nil];
  81 + }
  82 + else {
  83 + [self.navigationController popViewControllerAnimated:YES];
  84 + }
  85 +}
  86 +
  87 +#pragma mark - CNLiveBalanceNavigationBarDelegate
  88 +- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
  89 + if ([actionEvents isEqualToString:@"1"]) {
  90 + [self goBack];
  91 +
  92 + }
  93 +}
  94 +#pragma mark - JXCategoryViewDelegate
  95 +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
  96 + //侧滑手势处理
  97 +
  98 +}
  99 +
  100 +#pragma mark - JXCategoryListContainerViewDelegate
  101 +- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
  102 + CNLiveBalanceDetailBaseController *list = [[CNLiveBalanceDetailBaseController alloc] init];
  103 + list.type = index;
  104 + list.ID = self.ID;
  105 + return list;
  106 +}
  107 +
  108 +- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
  109 + return self.titles.count;
  110 +}
  111 +
  112 +#pragma mark - 懒加载
  113 +- (UIView *)tline {
  114 + if (!_tline) {
  115 + _tline = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, self.view.bounds.size.width, 0.5)];
  116 + _tline.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  117 + }
  118 + return _tline;
  119 +}
  120 +- (JXCategoryTitleView *)titleCategoryView{
  121 + if (!_titleCategoryView) {
  122 + _titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(0, _tline.bottom, self.view.bounds.size.width, height)];
  123 + _titleCategoryView.titles = self.titles;
  124 + _titleCategoryView.delegate = self;
  125 + _titleCategoryView.titleColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
  126 + _titleCategoryView.titleSelectedColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  127 + _titleCategoryView.titleFont = [UIFont systemFontOfSize:16];
  128 + _titleCategoryView.titleLabelZoomScale = 1.0;
  129 + _titleCategoryView.collectionView.scrollEnabled = NO;
  130 + _titleCategoryView.titleLabelZoomEnabled = YES;
  131 + _titleCategoryView.titleColorGradientEnabled = YES;
  132 + JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
  133 + lineView.indicatorColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  134 + lineView.indicatorWidth = 40;
  135 + _titleCategoryView.indicators = @[lineView];
  136 + }
  137 + return _titleCategoryView;
  138 +}
  139 +
  140 +- (UIView *)bline {
  141 + if (!_bline) {
  142 + _bline = [[UIView alloc] initWithFrame:CGRectMake(0, _titleCategoryView.bottom, self.view.bounds.size.width, 0.5)];
  143 + _bline.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  144 + }
  145 + return _bline;
  146 +}
  147 +
  148 +- (JXCategoryListContainerView *)listContainerView {
  149 + if (_listContainerView == nil) {
  150 + _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
  151 + _listContainerView.frame = CGRectMake(0, _bline.bottom, self.view.bounds.size.width, self.view.bounds.size.height-_bline.bottom);
  152 + }
  153 + return _listContainerView;
  154 +}
  155 +
  156 +- (NSArray *)titles{
  157 + if (!_titles) {
  158 + _titles = [NSArray arrayWithObjects:@"全部", @"收入", @"支出", nil];
  159 + }
  160 + return _titles;
  161 +}
  162 +
  163 +@end
... ...
CNLiveBalanceModule/Classes/Model/CNLiveBalanceRequest.h
... ... @@ -10,7 +10,7 @@
10 10  
11 11 NS_ASSUME_NONNULL_BEGIN
12 12 typedef void(^GetBalanceBlock)(BOOL isSuccess, NSString *number);
13   -typedef void(^GetTradingRecordBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
  13 +typedef void(^GetTradingRecordBlock)(BOOL isSuccess, NSDictionary * __nullable data, NSError *error);
14 14 typedef void(^GetCodeBlock)(BOOL isSuccess, NSMutableAttributedString *string);
15 15  
16 16 @interface CNLiveBalanceRequest : NSObject
... ... @@ -18,14 +18,17 @@ typedef void(^GetCodeBlock)(BOOL isSuccess, NSMutableAttributedString *string);
18 18 // 获取余额
19 19 + (void)getBalance:(NSString *)type ID:(NSString *)ID block:(GetBalanceBlock)block;
20 20  
21   -// 获取交易记录
22   -+ (void)getTradingRecordWithType:(NSString *)type startTime:(NSString *)startTime endTime:(NSString *)endTime block:(GetTradingRecordBlock)block;
  21 +// 个人中心交易记录
  22 ++ (void)getTradingRecordWithID:(NSString *)ID type:(NSString *)type startTime:(NSString * __nullable)startTime endTime:(NSString * __nullable)endTime block:(GetTradingRecordBlock)block;
  23 +
  24 +// 群组交易记录
  25 ++ (void)getTradingRecordWithID:(NSString *)ID type:(NSString *)type pageNo:(NSInteger)pageNo pageSize:(NSInteger)pageSize block:(GetTradingRecordBlock)block;
23 26  
24 27 + (NSArray *)getMonthFirstAndLastDayWithDate:(NSDate *)date;
25 28  
26   -// 获取验证码
27   -+ (void)getCodeWithTaskId:(NSString *)taskId signatureId:(NSString *)signatureId block:(GetCodeBlock)block;
28 29  
  30 +// 修改密码->获取验证码
  31 ++ (void)getCodeWithTaskId:(NSString *)taskId signatureId:(NSString *)signatureId block:(GetCodeBlock)block;
29 32  
30 33 @end
31 34  
... ...
CNLiveBalanceModule/Classes/Model/CNLiveBalanceRequest.m
... ... @@ -35,9 +35,10 @@
35 35 }];
36 36 }
37 37  
38   -+ (void)getTradingRecordWithType:(NSString *)type startTime:(NSString *)startTime endTime:(NSString *)endTime block:(GetTradingRecordBlock)block{
  38 +// 个人中心交易记录
  39 ++ (void)getTradingRecordWithID:(NSString *)ID type:(NSString *)type startTime:(NSString * __nullable)startTime endTime:(NSString * __nullable)endTime block:(GetTradingRecordBlock)block{
39 40 NSDictionary *params = @{@"appId":AppId,
40   - @"targetId":CNUserShareModel.uid?CNUserShareModel.uid:@"",
  41 + @"targetId":ID?ID:@"",
41 42 @"type":type?type:@"0",//0全部(默认) 1收入 2支出
42 43 @"startTime":startTime?startTime:@"",
43 44 @"endTime":endTime?endTime:@"",
... ... @@ -60,6 +61,32 @@
60 61  
61 62 }
62 63  
  64 +// 群组交易记录
  65 ++ (void)getTradingRecordWithID:(NSString *)ID type:(NSString *)type pageNo:(NSInteger)pageNo pageSize:(NSInteger)pageSize block:(GetTradingRecordBlock)block{
  66 + NSDictionary *params = @{@"appId":AppId,
  67 + @"targetId":ID?ID:@"",
  68 + @"startTime":@"",
  69 + @"endTime":@"",
  70 + @"type":type?type:@"0",//0全部(默认) 1收入 2支出
  71 + @"pageSize":[NSString stringWithFormat:@"%ld", (long)pageSize],
  72 + @"pageNo":[NSString stringWithFormat:@"%ld", (long)pageNo]
  73 + };
  74 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  75 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGetTradingRecordUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  76 + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]] && responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
  77 + NSString *errorCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]];
  78 + NSDictionary *data = responseObject[@"data"];
  79 + block?block([errorCode isEqualToString:@"0"], data, error):@"";
  80 +
  81 + }else{
  82 + block?block(NO, nil, error):@"";
  83 +
  84 + }
  85 +
  86 + }];
  87 +
  88 +}
  89 +
63 90 + (NSArray *)getMonthFirstAndLastDayWithDate:(NSDate *)date{
64 91 double interval = 0;
65 92 NSDate *firstDateOut = nil;
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveChangePayPasswordController.h renamed to CNLiveBalanceModule/Classes/Personal/CNLiveChangePayPasswordController.h
... ... @@ -12,10 +12,12 @@
12 12  
13 13 #import <UIKit/UIKit.h>
14 14 #import "CNCommonViewController.h"
  15 +#import "CNLiveChangePayPasswordView.h"
15 16  
16 17 NS_ASSUME_NONNULL_BEGIN
17 18  
18 19 @interface CNLiveChangePayPasswordController : CNCommonViewController
  20 +- (instancetype)initWithType:(CNLiveChangePayPasswordType)type;
19 21  
20 22 @end
21 23  
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveChangePayPasswordController.m renamed to CNLiveBalanceModule/Classes/Personal/CNLiveChangePayPasswordController.m
... ... @@ -18,24 +18,22 @@
18 18  
19 19 #import "CNLiveBalanceRequest.h"
20 20 #import "CNLiveBalanceNavigationBar.h"
21   -#import "CNLiveChangePayPasswordView.h"
22 21 #import "CNLivePayCenterController.h"
23 22  
24 23 @interface CNLiveChangePayPasswordController ()<CNLiveBalanceNavigationBarDelegate>
25 24 @property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
26 25 @property (nonatomic, strong) CNLiveChangePayPasswordView *changePayPasswordView;
27 26  
  27 +@property (nonatomic, assign) CNLiveChangePayPasswordType type;
28 28  
29 29 @end
30 30  
31 31 @implementation CNLiveChangePayPasswordController
32   -#pragma mark - 加载数据
33   -- (void)loadData {
34   -// [CNLiveBalanceRequest getBalance:self.type ID:self.ID block:^(BOOL isSuccess, NSString * _Nonnull number) {
35   -// if(isSuccess){
36   -// self.balanceView.number = number;
37   -// }
38   -// }];
  32 +- (instancetype)initWithType:(CNLiveChangePayPasswordType)type{
  33 + if(self = [super init]){
  34 + self.type = type;
  35 + }
  36 + return self;
39 37 }
40 38  
41 39 #pragma mark - 生命周期
... ... @@ -54,7 +52,6 @@
54 52 }
55 53  
56 54 [self createSubViews];
57   - [self loadData];
58 55  
59 56 }
60 57  
... ... @@ -80,7 +77,7 @@
80 77  
81 78 - (CNLiveChangePayPasswordView *)changePayPasswordView{
82 79 if(!_changePayPasswordView){
83   - _changePayPasswordView = [[CNLiveChangePayPasswordView alloc]initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, 170)];
  80 + _changePayPasswordView = [[CNLiveChangePayPasswordView alloc]initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, 170) type:self.type];
84 81 }
85 82 return _changePayPasswordView;
86 83 }
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveMonthBillController.h renamed to CNLiveBalanceModule/Classes/Personal/CNLiveMonthBillController.h
CNLiveBalanceModule/Classes/Controller/CNLiveMonthBillController.m renamed to CNLiveBalanceModule/Classes/Personal/CNLiveMonthBillController.m
... ... @@ -53,7 +53,7 @@ static const CGFloat height = 60;
53 53 }
54 54 #pragma mark - 加载数据
55 55 - (void)loadData {
56   - [CNLiveBalanceRequest getTradingRecordWithType:self.type startTime:self.startTime endTime:self.endTime block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) {
  56 + [CNLiveBalanceRequest getTradingRecordWithID:CNUserShareModel.uid type:self.type startTime:self.startTime endTime:self.endTime block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) {
57 57 [self.tableView.mj_header endRefreshing];
58 58 [self.tableView.mj_footer endRefreshing];
59 59 self.monthBillView.interactionEnabled = YES;
... ...
CNLiveBalanceModule/Classes/Controller/CNLivePayCenterController.h renamed to CNLiveBalanceModule/Classes/Personal/CNLivePayCenterController.h
CNLiveBalanceModule/Classes/Controller/CNLivePayCenterController.m renamed to CNLiveBalanceModule/Classes/Personal/CNLivePayCenterController.m
CNLiveBalanceModule/Classes/Controller/CNLivePayManagerController.h renamed to CNLiveBalanceModule/Classes/Personal/CNLivePayManagerController.h
CNLiveBalanceModule/Classes/Controller/CNLivePayManagerController.m renamed to CNLiveBalanceModule/Classes/Personal/CNLivePayManagerController.m
... ... @@ -91,7 +91,7 @@
91 91  
92 92 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
93 93 if(indexPath.row == 0){// 修改密码
94   - CNLiveChangePayPasswordController *vc = [[CNLiveChangePayPasswordController alloc]init];
  94 + CNLiveChangePayPasswordController *vc = [[CNLiveChangePayPasswordController alloc]initWithType:CNLiveChangePayPasswordTypeNote];
95 95 [self.navigationController pushViewController:vc animated:YES];
96 96 }
97 97 }
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveTradingRecordController.h renamed to CNLiveBalanceModule/Classes/Personal/CNLiveTradingRecordController.h
CNLiveBalanceModule/Classes/Controller/CNLiveTradingRecordController.m renamed to CNLiveBalanceModule/Classes/Personal/CNLiveTradingRecordController.m
... ... @@ -46,7 +46,7 @@ static const CGFloat height = 80;
46 46  
47 47 #pragma mark - 加载数据
48 48 - (void)loadData {
49   - [CNLiveBalanceRequest getTradingRecordWithType:@"0" startTime:self.startTime endTime:self.endTime block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) {
  49 + [CNLiveBalanceRequest getTradingRecordWithID:CNUserShareModel.uid type:@"0" startTime:self.startTime endTime:self.endTime block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) {
50 50 [self.tableView.mj_header endRefreshing];
51 51 [self.tableView.mj_footer endRefreshing];
52 52  
... ...
CNLiveBalanceModule/Classes/View/CNLiveChangePayPasswordView.h
... ... @@ -9,6 +9,12 @@
9 9 #import <UIKit/UIKit.h>
10 10  
11 11 NS_ASSUME_NONNULL_BEGIN
  12 +typedef enum {
  13 + CNLiveChangePayPasswordTypeSetting = 0, //设置密码
  14 + CNLiveChangePayPasswordTypeNote, //修改密码短信
  15 + CNLiveChangePayPasswordTypeConfirm //再次确认密码
  16 +} CNLiveChangePayPasswordType;
  17 +
12 18 @class CNLiveChangePayPasswordView;
13 19  
14 20 @protocol CNLiveChangePayPasswordViewDelegate <NSObject>
... ... @@ -17,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
17 23  
18 24 @interface CNLiveChangePayPasswordView : UIView
19 25 @property (nonatomic, weak) id<CNLiveChangePayPasswordViewDelegate> delegate;
  26 +- (instancetype)initWithFrame:(CGRect)frame type:(CNLiveChangePayPasswordType)type;
20 27  
21 28 @end
22 29  
... ...
CNLiveBalanceModule/Classes/View/CNLiveChangePayPasswordView.m
... ... @@ -24,6 +24,8 @@
24 24 @property (nonatomic, strong) CNLiveCountDownButton *code;
25 25 @property (nonatomic, strong) UIView *line;
26 26  
  27 +@property (nonatomic, assign) CNLiveChangePayPasswordType type;
  28 +
27 29 @end
28 30  
29 31 @implementation CNLiveChangePayPasswordView
... ... @@ -31,22 +33,23 @@ static const NSInteger timeValue = 1.5;
31 33 static const NSInteger margin = 10;
32 34 static const CGFloat height = 50;
33 35  
34   -- (instancetype)initWithFrame:(CGRect)frame{
35   - self = [super initWithFrame:frame];
36   - if(self){
37   - self.userInteractionEnabled = YES;
38   - self.backgroundColor = [UIColor clearColor];
  36 +- (instancetype)initWithFrame:(CGRect)frame type:(CNLiveChangePayPasswordType)type{
  37 + if(self = [super initWithFrame:frame]){
  38 + self.type = type;
39 39 [self createSubViews];
40 40 }
41 41 return self;
42 42 }
  43 +
43 44 - (void)dealloc{
44 45 [_code releaseTimer];
45 46 }
46 47 - (void)createSubViews {
47 48 [self addSubview:self.tips];
48 49 [self addSubview:self.tel];
49   - [self addSubview:self.code];
  50 + if (self.type == CNLiveChangePayPasswordTypeNote) {
  51 + [self addSubview:self.code];
  52 + }
50 53 [self addSubview:self.line];
51 54  
52 55 [_tips mas_updateConstraints:^(MASConstraintMaker *make) {
... ... @@ -95,15 +98,21 @@ static const CGFloat height = 50;
95 98 _tips.textAlignment = NSTextAlignmentCenter;
96 99 _tips.font = [UIFont fontWithName:@"PingFangSC-Regular" size:17.0f];
97 100 _tips.textColor = RGB(119, 119, 119);
  101 +
  102 + if (self.type == CNLiveChangePayPasswordTypeNote) {
  103 + NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:@"请发送 验证码 到您的手机"];
  104 + [AttributedStr addAttribute:NSFontAttributeName
  105 + value:[UIFont fontWithName:@"PingFangSC-Medium" size:17.0]
  106 + range:NSMakeRange(4, 3)];
  107 + [AttributedStr addAttribute:NSForegroundColorAttributeName
  108 + value:KBlack51Color
  109 + range:NSMakeRange(4, 3)];
  110 + _tips.attributedText = AttributedStr;
  111 +
  112 + } else {
  113 + _tips.text = @"设置输入支付密码";
  114 + }
98 115  
99   - NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:@"请发送 验证码 到您的手机"];
100   - [AttributedStr addAttribute:NSFontAttributeName
101   - value:[UIFont fontWithName:@"PingFangSC-Medium" size:17.0]
102   - range:NSMakeRange(4, 3)];
103   - [AttributedStr addAttribute:NSForegroundColorAttributeName
104   - value:KBlack51Color
105   - range:NSMakeRange(4, 3)];
106   - _tips.attributedText = AttributedStr;
107 116 }
108 117 return _tips;
109 118 }
... ... @@ -114,10 +123,28 @@ static const CGFloat height = 50;
114 123 [_tel setFont:UIFontCNMake(15.0)];
115 124 _tel.textColor = [UIColor blackColor];
116 125 _tel.textAlignment = NSTextAlignmentCenter;
117   - NSMutableString *phone = [[NSMutableString alloc] initWithString:CNUserShareModel.mobile];
118   - [phone replaceCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
119   - _tel.text = phone;
120   - _tel.font = [UIFont fontWithName:@"PingFangHK-Medium" size:23.0f];
  126 +
  127 + if (self.type == CNLiveChangePayPasswordTypeNote) {
  128 + _tel.font = [UIFont fontWithName:@"PingFangHK-Medium" size:23.0f];
  129 + NSMutableString *phone = nil;
  130 + if (!CNUserShareModel.mobile||[CNUserShareModel.mobile isEqualToString:@""]) {
  131 + phone = [[NSMutableString alloc] initWithString:@"未绑定手机号"];
  132 + } else if (CNUserShareModel.mobile.length != 11) {
  133 + phone = [[NSMutableString alloc] initWithString:@"无效手机号"];
  134 + } else {
  135 + phone = [[NSMutableString alloc] initWithString:CNUserShareModel.mobile];
  136 + [phone replaceCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
  137 + }
  138 + _tel.text = phone;
  139 +
  140 + } else if (self.type == CNLiveChangePayPasswordTypeSetting) {
  141 + _tel.font = [UIFont fontWithName:@"PingFangHK-Medium" size:17.0f];
  142 + _tel.text = @"设置6位支付密码,用于支付验证";
  143 +
  144 + } else if (self.type == CNLiveChangePayPasswordTypeConfirm) {
  145 + _tel.font = [UIFont fontWithName:@"PingFangHK-Medium" size:17.0f];
  146 + _tel.text = @"请再次输入密码以确认";
  147 + }
121 148 }
122 149 return _tel;
123 150 }
... ...
Example/CNLiveBalanceModule.xcodeproj/project.pbxproj
... ... @@ -43,7 +43,7 @@
43 43 30F156994057ED8021431DB3 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
44 44 432CFD031D2A7EC351964F12 /* Pods_CNLiveBalanceModule_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveBalanceModule_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45 45 4DC72AC450DE6C4A8C30BF29 /* CNLiveBalanceModule.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveBalanceModule.podspec; path = ../CNLiveBalanceModule.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
46   - 6003F58A195388D20070C39A /* CNLiveBalanceModule_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveBalanceModule_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
  46 + 6003F58A195388D20070C39A /* 余额模块.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "余额模块.app"; sourceTree = BUILT_PRODUCTS_DIR; };
47 47 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
48 48 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
49 49 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
... ... @@ -121,7 +121,7 @@
121 121 6003F58B195388D20070C39A /* Products */ = {
122 122 isa = PBXGroup;
123 123 children = (
124   - 6003F58A195388D20070C39A /* CNLiveBalanceModule_Example.app */,
  124 + 6003F58A195388D20070C39A /* 余额模块.app */,
125 125 6003F5AE195388D20070C39A /* CNLiveBalanceModule_Tests.xctest */,
126 126 );
127 127 name = Products;
... ... @@ -216,7 +216,7 @@
216 216 );
217 217 name = CNLiveBalanceModule_Example;
218 218 productName = CNLiveBalanceModule;
219   - productReference = 6003F58A195388D20070C39A /* CNLiveBalanceModule_Example.app */;
  219 + productReference = 6003F58A195388D20070C39A /* 余额模块.app */;
220 220 productType = "com.apple.product-type.application";
221 221 };
222 222 6003F5AD195388D20070C39A /* CNLiveBalanceModule_Tests */ = {
... ... @@ -317,6 +317,7 @@
317 317 "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework",
318 318 "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework",
319 319 "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework",
  320 + "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework",
320 321 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
321 322 "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework",
322 323 "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
... ... @@ -339,6 +340,7 @@
339 340 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework",
340 341 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework",
341 342 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework",
  343 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework",
342 344 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
343 345 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework",
344 346 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
... ... @@ -557,8 +559,8 @@
557 559 GCC_PREFIX_HEADER = "CNLiveBalanceModule/CNLiveBalanceModule-Prefix.pch";
558 560 INFOPLIST_FILE = "CNLiveBalanceModule/CNLiveBalanceModule-Info.plist";
559 561 MODULE_NAME = ExampleApp;
560   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
561   - PRODUCT_NAME = "$(TARGET_NAME)";
  562 + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveBalanceModule;
  563 + PRODUCT_NAME = "余额模块";
562 564 SWIFT_VERSION = 4.0;
563 565 WRAPPER_EXTENSION = app;
564 566 };
... ... @@ -574,8 +576,8 @@
574 576 GCC_PREFIX_HEADER = "CNLiveBalanceModule/CNLiveBalanceModule-Prefix.pch";
575 577 INFOPLIST_FILE = "CNLiveBalanceModule/CNLiveBalanceModule-Info.plist";
576 578 MODULE_NAME = ExampleApp;
577   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
578   - PRODUCT_NAME = "$(TARGET_NAME)";
  579 + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveBalanceModule;
  580 + PRODUCT_NAME = "余额模块";
579 581 SWIFT_VERSION = 4.0;
580 582 WRAPPER_EXTENSION = app;
581 583 };
... ...
Example/CNLiveBalanceModule/CNLIVEAppDelegate.m
... ... @@ -62,7 +62,7 @@
62 62 }];
63 63 [[NSUserDefaults standardUserDefaults] setObject:@"RkFYeLkl/u5S7tW8UcOkT3rfLTP/Ua8NIkdEsKlcolvl/yxTMNbAYXmmJyhKGpkj" forKey:@"CNLiveAuthToken"];
64 64  
65   - CNLiveBalanceController *vc = [[CNLiveBalanceController alloc] initWithType:@"1" ID:CNUserShareModel.uid];
  65 + CNLiveBalanceController *vc = [[CNLiveBalanceController alloc] initWithType:@"2" ID:CNUserShareModel.uid];
66 66 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
67 67 self.window.rootViewController = nav;//设置根视图控制器
68 68 [self.window makeKeyAndVisible];
... ...
Example/CNLiveBalanceModule/CNLiveBalanceModule-Info.plist
... ... @@ -2,15 +2,10 @@
2 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 3 <plist version="1.0">
4 4 <dict>
5   - <key>NSAppTransportSecurity</key>
6   - <dict>
7   - <key>NSAllowsArbitraryLoads</key>
8   - <true/>
9   - </dict>
10 5 <key>CFBundleDevelopmentRegion</key>
11 6 <string>en</string>
12 7 <key>CFBundleDisplayName</key>
13   - <string>${PRODUCT_NAME}</string>
  8 + <string>$(PRODUCT_NAME)</string>
14 9 <key>CFBundleExecutable</key>
15 10 <string>${EXECUTABLE_NAME}</string>
16 11 <key>CFBundleIdentifier</key>
... ... @@ -29,6 +24,11 @@
29 24 <string>1.0</string>
30 25 <key>LSRequiresIPhoneOS</key>
31 26 <true/>
  27 + <key>NSAppTransportSecurity</key>
  28 + <dict>
  29 + <key>NSAllowsArbitraryLoads</key>
  30 + <true/>
  31 + </dict>
32 32 <key>UILaunchStoryboardName</key>
33 33 <string>LaunchScreen</string>
34 34 <key>UIMainStoryboardFile</key>
... ... @@ -40,8 +40,6 @@
40 40 <key>UISupportedInterfaceOrientations</key>
41 41 <array>
42 42 <string>UIInterfaceOrientationPortrait</string>
43   - <string>UIInterfaceOrientationLandscapeLeft</string>
44   - <string>UIInterfaceOrientationLandscapeRight</string>
45 43 </array>
46 44 <key>UISupportedInterfaceOrientations~ipad</key>
47 45 <array>
... ...