Commit 2807acabbe282989f9161b718ed1798da06f5c41
1 parent
400e23ab
0.0.1增加售后
Showing
37 changed files
with
1301 additions
and
566 deletions
CNLiveMyOrderModule.podspec
| @@ -68,9 +68,9 @@ TODO: Add long description of the pod here. | @@ -68,9 +68,9 @@ TODO: Add long description of the pod here. | ||
| 68 | #用户库 | 68 | #用户库 |
| 69 | s.dependency 'CNLiveUserManagement' | 69 | s.dependency 'CNLiveUserManagement' |
| 70 | #IM | 70 | #IM |
| 71 | - # s.dependency 'CNLiveIMBaseSDK' | 71 | + s.dependency 'CNLiveIMBaseSDK' |
| 72 | #相册 | 72 | #相册 |
| 73 | -# s.dependency 'CNLiveImagePickerController' | 73 | + s.dependency 'CNLiveImagePickerController' |
| 74 | #网络请求 | 74 | #网络请求 |
| 75 | s.dependency 'CNLiveRequestBastKit' | 75 | s.dependency 'CNLiveRequestBastKit' |
| 76 | #三方库 | 76 | #三方库 |
| @@ -81,6 +81,8 @@ TODO: Add long description of the pod here. | @@ -81,6 +81,8 @@ TODO: Add long description of the pod here. | ||
| 81 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' | 81 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' |
| 82 | s.dependency 'CNLiveTripartiteManagement/MJRefresh' | 82 | s.dependency 'CNLiveTripartiteManagement/MJRefresh' |
| 83 | s.dependency 'JXCategoryView' | 83 | s.dependency 'JXCategoryView' |
| 84 | + s.dependency 'DSCnliveShopSDK' | ||
| 85 | + s.dependency 'CNLiveManager' | ||
| 84 | s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' | 86 | s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' |
| 85 | } | 87 | } |
| 86 | s.resource_bundles = { | 88 | s.resource_bundles = { |
| @@ -90,4 +92,5 @@ TODO: Add long description of the pod here. | @@ -90,4 +92,5 @@ TODO: Add long description of the pod here. | ||
| 90 | # s.public_header_files = 'Pod/Classes/**/*.h' | 92 | # s.public_header_files = 'Pod/Classes/**/*.h' |
| 91 | s.frameworks = 'UIKit', 'Foundation' | 93 | s.frameworks = 'UIKit', 'Foundation' |
| 92 | # s.dependency 'AFNetworking', '~> 2.3' | 94 | # s.dependency 'AFNetworking', '~> 2.3' |
| 95 | + s.static_framework = true | ||
| 93 | end | 96 | end |
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/dd_wlcw@2x.png
0 → 100644
11.1 KB
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/dd_wlcw@3x.png
0 → 100644
34.1 KB
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/wufalianjie@2x.png
0 → 100644
13.3 KB
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/wufalianjie@3x.png
0 → 100644
25.6 KB
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/zhuangtai_kong@2x.png
0 → 100644
20.7 KB
CNLiveMyOrderModule/Assets/CNLiveMyOrderModule.bundle/zhuangtai_kong@3x.png
0 → 100644
41.3 KB
CNLiveMyOrderModule/Classes/CNLiveApplyRefundController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveApplyRefundController.h | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/26. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <CNLiveCommonClass/CNLiveCommonClass.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveApplyRefundController : CNCommonViewController | ||
| 13 | + | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/CNLiveApplyRefundController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveApplyRefundController.m | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/26. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveApplyRefundController.h" | ||
| 9 | + | ||
| 10 | +@interface CNLiveApplyRefundController () | ||
| 11 | + | ||
| 12 | +@end | ||
| 13 | + | ||
| 14 | +@implementation CNLiveApplyRefundController | ||
| 15 | + | ||
| 16 | +- (void)viewDidLoad { | ||
| 17 | + [super viewDidLoad]; | ||
| 18 | + | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +@end |
CNLiveMyOrderModule/Classes/Controller/CNLiveApplyRefundController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveApplyRefundController.h | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/27. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <CNLiveCommonClass/CNLiveCommonClass.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveApplyRefundController : CNCommonViewController | ||
| 13 | + | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/Controller/CNLiveApplyRefundController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveApplyRefundController.m | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/27. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveApplyRefundController.h" | ||
| 9 | +#import "CNLiveMineOrderView.h" | ||
| 10 | +@interface CNLiveApplyRefundController () | ||
| 11 | + | ||
| 12 | +@end | ||
| 13 | + | ||
| 14 | +@implementation CNLiveApplyRefundController | ||
| 15 | + | ||
| 16 | +- (void)viewDidLoad { | ||
| 17 | + [super viewDidLoad]; | ||
| 18 | + // Do any additional setup after loading the view. | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +@end |
CNLiveMyOrderModule/Classes/Controller/CNLiveEvaluateController.m
| @@ -31,6 +31,15 @@ | @@ -31,6 +31,15 @@ | ||
| 31 | - (void)dealloc { | 31 | - (void)dealloc { |
| 32 | NSLog(@"评论晒单走了dealloc了吗"); | 32 | NSLog(@"评论晒单走了dealloc了吗"); |
| 33 | } | 33 | } |
| 34 | + | ||
| 35 | +- (void)viewWillAppear:(BOOL)animated { | ||
| 36 | + [super viewWillAppear:animated]; | ||
| 37 | + self.navigationController.navigationBarHidden = NO; | ||
| 38 | +} | ||
| 39 | +- (void)viewDidAppear:(BOOL)animated { | ||
| 40 | + [super viewDidAppear:animated]; | ||
| 41 | + self.navigationController.navigationBarHidden = NO; | ||
| 42 | +} | ||
| 34 | - (void)viewDidLoad { | 43 | - (void)viewDidLoad { |
| 35 | [super viewDidLoad]; | 44 | [super viewDidLoad]; |
| 36 | self.title = @"评论晒单"; | 45 | self.title = @"评论晒单"; |
CNLiveMyOrderModule/Classes/Controller/CNLiveMyOrderController.h
| @@ -10,7 +10,9 @@ | @@ -10,7 +10,9 @@ | ||
| 10 | NS_ASSUME_NONNULL_BEGIN | 10 | NS_ASSUME_NONNULL_BEGIN |
| 11 | 11 | ||
| 12 | @interface CNLiveMyOrderController : CNCommonViewController | 12 | @interface CNLiveMyOrderController : CNCommonViewController |
| 13 | -- (void)getOrderType:(NSInteger)type; | 13 | +//- (void)getOrderType:(NSInteger)type; |
| 14 | +@property (nonatomic, assign) NSInteger status; | ||
| 15 | + | ||
| 14 | @end | 16 | @end |
| 15 | 17 | ||
| 16 | NS_ASSUME_NONNULL_END | 18 | NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/Controller/CNLiveMyOrderController.m
| @@ -12,12 +12,18 @@ | @@ -12,12 +12,18 @@ | ||
| 12 | #import "CNLiveDefinesHeader.h" | 12 | #import "CNLiveDefinesHeader.h" |
| 13 | #import <Masonry/Masonry.h> | 13 | #import <Masonry/Masonry.h> |
| 14 | #import "CNLiveServiceOrderController.h" | 14 | #import "CNLiveServiceOrderController.h" |
| 15 | +#import <DSCnliveShopSDK/DSOrderListViewController.h> | ||
| 16 | +#import <DSCnliveShopSDK/DSROrderListViewController.h> | ||
| 15 | static const CGFloat KCategoryViewHeight = 44; | 17 | static const CGFloat KCategoryViewHeight = 44; |
| 16 | @interface CNLiveMyOrderController ()<JXCategoryViewDelegate,UIScrollViewDelegate> | 18 | @interface CNLiveMyOrderController ()<JXCategoryViewDelegate,UIScrollViewDelegate> |
| 17 | @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView; | 19 | @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView; |
| 18 | @property (nonatomic, strong) NSArray *titles; | 20 | @property (nonatomic, strong) NSArray *titles; |
| 19 | @property (nonatomic, strong) UIScrollView *scrollView; | 21 | @property (nonatomic, strong) UIScrollView *scrollView; |
| 20 | -@property (nonatomic, assign) NSInteger status; | 22 | +@property (nonatomic, strong) DSOrderListViewController *orderVc; //商品订单 |
| 23 | +@property (nonatomic, strong) DSROrderListViewController *foodVc; //餐饮订单 | ||
| 24 | +@property (nonatomic, strong) CNLiveServiceOrderController *serviveVc; //服务订单 | ||
| 25 | +@property (nonatomic, strong) JXCategoryIndicatorLineView *lineView; | ||
| 26 | +@property (nonatomic, assign) NSInteger index; | ||
| 21 | 27 | ||
| 22 | @end | 28 | @end |
| 23 | 29 | ||
| @@ -27,6 +33,10 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -27,6 +33,10 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 27 | [super viewWillAppear:animated]; | 33 | [super viewWillAppear:animated]; |
| 28 | self.navigationController.navigationBarHidden = NO; | 34 | self.navigationController.navigationBarHidden = NO; |
| 29 | } | 35 | } |
| 36 | +- (void)viewDidAppear:(BOOL)animated { | ||
| 37 | + [super viewDidAppear:animated]; | ||
| 38 | + self.navigationController.navigationBarHidden = NO; | ||
| 39 | +} | ||
| 30 | #pragma mark - 前一个页面传过来点击哪个 | 40 | #pragma mark - 前一个页面传过来点击哪个 |
| 31 | - (void)getOrderType:(NSInteger)type { | 41 | - (void)getOrderType:(NSInteger)type { |
| 32 | self.status = type; | 42 | self.status = type; |
| @@ -43,17 +53,73 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -43,17 +53,73 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 43 | - (void)viewDidLayoutSubviews { | 53 | - (void)viewDidLayoutSubviews { |
| 44 | [super viewDidLayoutSubviews]; | 54 | [super viewDidLayoutSubviews]; |
| 45 | self.titleCategoryView.frame = CGRectMake(60, kVerticalStatusHeight, KScreenWidth -120 , KCategoryViewHeight); | 55 | self.titleCategoryView.frame = CGRectMake(60, kVerticalStatusHeight, KScreenWidth -120 , KCategoryViewHeight); |
| 56 | + NSLog(@"打印看看这里的status%d",kVerticalStatusHeight); | ||
| 57 | +} | ||
| 58 | +- (JXCategoryTitleView *)myCategoryView { | ||
| 59 | + return (JXCategoryTitleView *)self.titleCategoryView; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +- (JXCategoryBaseView *)preferredCategoryView { | ||
| 63 | + return [[JXCategoryTitleView alloc] init]; | ||
| 46 | } | 64 | } |
| 47 | #pragma mark - JXCategoryDelegate | 65 | #pragma mark - JXCategoryDelegate |
| 48 | - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index | 66 | - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index |
| 49 | { | 67 | { |
| 50 | - | 68 | + self.index = index; |
| 69 | + switch (index) { | ||
| 70 | + case 0:{ | ||
| 71 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"333333"); | ||
| 72 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 73 | + [self.scrollView addSubview:self.serviveVc.view]; | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + break; | ||
| 77 | + case 1:{ | ||
| 78 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 79 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 80 | + [self.scrollView addSubview:_orderVc.view]; | ||
| 81 | + } | ||
| 82 | + break; | ||
| 83 | + case 2:{ | ||
| 84 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 85 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 86 | + [self.scrollView addSubview:self.foodVc.view]; | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + break; | ||
| 90 | + | ||
| 91 | + default: | ||
| 92 | + break; | ||
| 93 | + } | ||
| 94 | +} | ||
| 95 | +- (void)setIndex:(NSInteger)index { | ||
| 96 | + _index = index; | ||
| 97 | + switch (index) { | ||
| 98 | + case 0:{ | ||
| 99 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"333333"); | ||
| 100 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 101 | + } | ||
| 102 | + break; | ||
| 103 | + case 1:{ | ||
| 104 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 105 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 106 | + } | ||
| 107 | + break; | ||
| 108 | + case 2:{ | ||
| 109 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 110 | + self.titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"#FF725C"); | ||
| 111 | + } | ||
| 112 | + break; | ||
| 113 | + default: | ||
| 114 | + break; | ||
| 115 | + } | ||
| 51 | } | 116 | } |
| 52 | #pragma mark - 懒加载 | 117 | #pragma mark - 懒加载 |
| 53 | 118 | ||
| 54 | - (JXCategoryTitleView *)titleCategoryView{ | 119 | - (JXCategoryTitleView *)titleCategoryView{ |
| 55 | if (!_titleCategoryView) { | 120 | if (!_titleCategoryView) { |
| 56 | _titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(60, kVerticalStatusHeight, KScreenWidth -120 , KCategoryViewHeight)]; | 121 | _titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(60, kVerticalStatusHeight, KScreenWidth -120 , KCategoryViewHeight)]; |
| 122 | + NSLog(@"打印看看这里的category高度%d",kVerticalStatusHeight); | ||
| 57 | _titleCategoryView.titles = self.titles; | 123 | _titleCategoryView.titles = self.titles; |
| 58 | _titleCategoryView.delegate = self; | 124 | _titleCategoryView.delegate = self; |
| 59 | _titleCategoryView.titleColor = CNLiveColorWithHexString(@"333333"); | 125 | _titleCategoryView.titleColor = CNLiveColorWithHexString(@"333333"); |
| @@ -62,13 +128,13 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -62,13 +128,13 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 62 | _titleCategoryView.titleLabelZoomScale = 1.0; | 128 | _titleCategoryView.titleLabelZoomScale = 1.0; |
| 63 | _titleCategoryView.collectionView.scrollEnabled = NO; | 129 | _titleCategoryView.collectionView.scrollEnabled = NO; |
| 64 | _titleCategoryView.titleLabelZoomEnabled = NO; | 130 | _titleCategoryView.titleLabelZoomEnabled = NO; |
| 131 | + _titleCategoryView.defaultSelectedIndex = 0; | ||
| 65 | _titleCategoryView.cellWidth = 60; | 132 | _titleCategoryView.cellWidth = 60; |
| 66 | _titleCategoryView.collectionView.frame = _titleCategoryView.bounds; | 133 | _titleCategoryView.collectionView.frame = _titleCategoryView.bounds; |
| 67 | -// _titleCategoryView.selectedIndex = 0 | ||
| 68 | - JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; | ||
| 69 | - lineView.indicatorColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 70 | - lineView.indicatorWidth = JXCategoryViewAutomaticDimension; | ||
| 71 | - _titleCategoryView.indicators = @[lineView]; | 134 | + self.lineView = [[JXCategoryIndicatorLineView alloc] init]; |
| 135 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 136 | + self.lineView.indicatorWidth = JXCategoryViewAutomaticDimension; | ||
| 137 | + _titleCategoryView.indicators = @[self.lineView]; | ||
| 72 | _titleCategoryView.contentScrollView = self.scrollView; | 138 | _titleCategoryView.contentScrollView = self.scrollView; |
| 73 | self.navigationItem.titleView = self.titleCategoryView; | 139 | self.navigationItem.titleView = self.titleCategoryView; |
| 74 | } | 140 | } |
| @@ -79,6 +145,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -79,6 +145,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 79 | if (!_scrollView) { | 145 | if (!_scrollView) { |
| 80 | CGFloat scrollW = KScreenWidth; | 146 | CGFloat scrollW = KScreenWidth; |
| 81 | CGFloat scrollH = KScreenHeight - kNavigationBarHeight; | 147 | CGFloat scrollH = KScreenHeight - kNavigationBarHeight; |
| 148 | + NSLog(@"打印看看这里的导航栏高度%d",kNavigationBarHeight); | ||
| 82 | _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,kNavigationBarHeight,scrollW, scrollH)]; | 149 | _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,kNavigationBarHeight,scrollW, scrollH)]; |
| 83 | _scrollView.contentSize = CGSizeMake(scrollW *3, scrollH); | 150 | _scrollView.contentSize = CGSizeMake(scrollW *3, scrollH); |
| 84 | _scrollView.backgroundColor = [UIColor whiteColor]; | 151 | _scrollView.backgroundColor = [UIColor whiteColor]; |
| @@ -88,21 +155,19 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -88,21 +155,19 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 88 | _scrollView.scrollEnabled = NO; | 155 | _scrollView.scrollEnabled = NO; |
| 89 | _scrollView.delegate = self; | 156 | _scrollView.delegate = self; |
| 90 | CNLiveServiceOrderController *serviceVc = [[CNLiveServiceOrderController alloc]init]; | 157 | CNLiveServiceOrderController *serviceVc = [[CNLiveServiceOrderController alloc]init]; |
| 91 | - [self addChildViewController:serviceVc]; | ||
| 92 | serviceVc.view.frame = CGRectMake(0, 0, scrollW, scrollH); | 158 | serviceVc.view.frame = CGRectMake(0, 0, scrollW, scrollH); |
| 93 | serviceVc.status = self.status; | 159 | serviceVc.status = self.status; |
| 94 | -// serviceVc.view.backgroundColor = [UIColor cyanColor]; | 160 | + self.serviveVc = serviceVc; |
| 95 | [_scrollView addSubview:serviceVc.view]; | 161 | [_scrollView addSubview:serviceVc.view]; |
| 96 | - CNLiveServiceOrderController *goodsVc = [[CNLiveServiceOrderController alloc]init]; | ||
| 97 | - [self addChildViewController:goodsVc]; | ||
| 98 | - goodsVc.view.frame = CGRectMake(scrollW, 0, scrollW, scrollH); | ||
| 99 | -// goodsVc.view.backgroundColor = [UIColor greenColor]; | ||
| 100 | - [_scrollView addSubview:goodsVc.view]; | ||
| 101 | - CNLiveServiceOrderController *foodVc = [[CNLiveServiceOrderController alloc]init]; | ||
| 102 | - [self addChildViewController:foodVc]; | ||
| 103 | - foodVc.view.frame = CGRectMake(scrollW *2, 0, scrollW, scrollH); | ||
| 104 | -// foodVc.view.backgroundColor = [UIColor purpleColor]; | ||
| 105 | - [_scrollView addSubview:foodVc.view]; | 162 | + DSOrderListViewController *orderVc = [[DSOrderListViewController alloc]init]; |
| 163 | + orderVc.view.frame = CGRectMake(KScreenWidth, 0, scrollW, scrollH); | ||
| 164 | + orderVc.display = DSOrderListDisplayTotal; | ||
| 165 | + orderVc.isNeedNavigationBar = NO; | ||
| 166 | + self.orderVc = orderVc; | ||
| 167 | + DSROrderListViewController *foofVc = [[DSROrderListViewController alloc]init]; | ||
| 168 | + foofVc.view.frame = CGRectMake(KScreenWidth *2, 0, scrollW, scrollH); | ||
| 169 | + foofVc.isNeedNavigationBar = NO; | ||
| 170 | + self.foodVc = foofVc; | ||
| 106 | 171 | ||
| 107 | } | 172 | } |
| 108 | return _scrollView; | 173 | return _scrollView; |
CNLiveMyOrderModule/Classes/Controller/CNLiveOrderDetailController.m
| @@ -16,16 +16,17 @@ | @@ -16,16 +16,17 @@ | ||
| 16 | #import "Masonry.h" | 16 | #import "Masonry.h" |
| 17 | #import "CNLiveErrorOrNoNetView.h" | 17 | #import "CNLiveErrorOrNoNetView.h" |
| 18 | #import "CNLiveOrderEventHandle.h" | 18 | #import "CNLiveOrderEventHandle.h" |
| 19 | -//#import "TIMAdapter.h" | ||
| 20 | -//#import "CommonLibrary.h" | 19 | +#import "TIMAdapter.h" |
| 20 | +#import "CommonLibrary.h" | ||
| 21 | #import "CNLiveCommonCategory.h" | 21 | #import "CNLiveCommonCategory.h" |
| 22 | #import "CNLiveAddPopFuncView.h" | 22 | #import "CNLiveAddPopFuncView.h" |
| 23 | #import "CNLiveOrderDetailContentView.h" | 23 | #import "CNLiveOrderDetailContentView.h" |
| 24 | #import "CNLiveOrderViewModel.h" | 24 | #import "CNLiveOrderViewModel.h" |
| 25 | #import "CNLiveEvaluateController.h" | 25 | #import "CNLiveEvaluateController.h" |
| 26 | +#import <DSCnliveShopSDK/DSCnliveShopSDK.h> | ||
| 26 | #define Default_H 45 | 27 | #define Default_H 45 |
| 27 | #define OrderIdKey @"OrderIdKey" //订单号 | 28 | #define OrderIdKey @"OrderIdKey" //订单号 |
| 28 | -@interface CNLiveOrderDetailController ()<CNLiveRefundVoucherViewDelegate,CNAddPopFuncViewDelegate> | 29 | +@interface CNLiveOrderDetailController ()<CNLiveRefundVoucherViewDelegate,CNAddPopFuncViewDelegate,CNLiveAddressViewDelegate> |
| 29 | @property (nonatomic, strong) UIScrollView *scrollView; | 30 | @property (nonatomic, strong) UIScrollView *scrollView; |
| 30 | @property (strong, nonatomic) UIPageControl * pageControl; | 31 | @property (strong, nonatomic) UIPageControl * pageControl; |
| 31 | @property (nonatomic, strong) CNLiveAddPopFuncView *popFunItemView; | 32 | @property (nonatomic, strong) CNLiveAddPopFuncView *popFunItemView; |
| @@ -91,6 +92,10 @@ | @@ -91,6 +92,10 @@ | ||
| 91 | [super viewWillAppear:animated]; | 92 | [super viewWillAppear:animated]; |
| 92 | self.navigationController.navigationBarHidden = NO; | 93 | self.navigationController.navigationBarHidden = NO; |
| 93 | } | 94 | } |
| 95 | +- (void)viewDidAppear:(BOOL)animated { | ||
| 96 | + [super viewDidAppear:animated]; | ||
| 97 | + self.navigationController.navigationBarHidden = NO; | ||
| 98 | +} | ||
| 94 | - (void)viewDidLoad { | 99 | - (void)viewDidLoad { |
| 95 | [super viewDidLoad]; | 100 | [super viewDidLoad]; |
| 96 | self.title = @"订单详情"; | 101 | self.title = @"订单详情"; |
| @@ -106,7 +111,7 @@ | @@ -106,7 +111,7 @@ | ||
| 106 | [self requestData:self.orderId]; | 111 | [self requestData:self.orderId]; |
| 107 | // [self loadData]; | 112 | // [self loadData]; |
| 108 | //底部工具栏响应事件 | 113 | //底部工具栏响应事件 |
| 109 | -// [self bottomFuncEvent]; | 114 | + [self bottomFuncEvent]; |
| 110 | } | 115 | } |
| 111 | - (void)addSubViews { | 116 | - (void)addSubViews { |
| 112 | [self.scrollView addSubview:self.statusView]; | 117 | [self.scrollView addSubview:self.statusView]; |
| @@ -446,6 +451,7 @@ | @@ -446,6 +451,7 @@ | ||
| 446 | if (!strongSelf) { | 451 | if (!strongSelf) { |
| 447 | return ; | 452 | return ; |
| 448 | } | 453 | } |
| 454 | + strongSelf.moreBtn.hidden = NO; | ||
| 449 | [QMUITips hideAllToastInView:strongSelf.view animated:YES]; | 455 | [QMUITips hideAllToastInView:strongSelf.view animated:YES]; |
| 450 | CNLiveOrderListOrderItem *orderItem = list.orderItem; | 456 | CNLiveOrderListOrderItem *orderItem = list.orderItem; |
| 451 | CNLiveOrderRefundItem *refundItem = list.refundMsg; | 457 | CNLiveOrderRefundItem *refundItem = list.refundMsg; |
| @@ -529,6 +535,11 @@ | @@ -529,6 +535,11 @@ | ||
| 529 | else { | 535 | else { |
| 530 | strongSelf.addressView.list = list; | 536 | strongSelf.addressView.list = list; |
| 531 | } | 537 | } |
| 538 | + | ||
| 539 | + | ||
| 540 | + [DSAddressRequest postMyFirstAddressWithUid:[IMAPlatform sharedInstance].host.userId storeId:nil result:^(DSAddressModel * _Nonnull addressModel, NSString * _Nonnull errorMessage) { | ||
| 541 | + [strongSelf.addressView updateFirstAddress:addressModel]; | ||
| 542 | + }]; | ||
| 532 | } | 543 | } |
| 533 | if (orderItem.status == 7) { | 544 | if (orderItem.status == 7) { |
| 534 | strongSelf.voucherView.hidden = YES; | 545 | strongSelf.voucherView.hidden = YES; |
| @@ -555,7 +566,7 @@ | @@ -555,7 +566,7 @@ | ||
| 555 | 566 | ||
| 556 | } failure:^(NSError * _Nonnull error) { | 567 | } failure:^(NSError * _Nonnull error) { |
| 557 | if (error.code == -1009 || error.code == -1001) { | 568 | if (error.code == -1009 || error.code == -1001) { |
| 558 | - [weakSelf showErrorRetryType:RetryTypeNoNet noNet:YES]; | 569 | + [weakSelf showErrorRetryType:OrderRetryTypeNoNet noNet:YES]; |
| 559 | }else if (error.code == 405) { | 570 | }else if (error.code == 405) { |
| 560 | weakSelf.scrollView.backgroundColor = kWhiteColor; | 571 | weakSelf.scrollView.backgroundColor = kWhiteColor; |
| 561 | weakSelf.moreBtn.hidden = YES; | 572 | weakSelf.moreBtn.hidden = YES; |
| @@ -564,12 +575,12 @@ | @@ -564,12 +575,12 @@ | ||
| 564 | weakSelf.scrollView.backgroundColor = kWhiteColor; | 575 | weakSelf.scrollView.backgroundColor = kWhiteColor; |
| 565 | [weakSelf showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"个人订单" detailText:@"该订单不是您的个人订单" buttonTitle:@"点击退出" buttonAction:@selector(exitOrderDetail:)]; | 576 | [weakSelf showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"个人订单" detailText:@"该订单不是您的个人订单" buttonTitle:@"点击退出" buttonAction:@selector(exitOrderDetail:)]; |
| 566 | }else { | 577 | }else { |
| 567 | - [weakSelf showErrorRetryType:RetryTypeError noNet:NO]; | 578 | + [weakSelf showErrorRetryType:OrderRetryTypeError noNet:NO]; |
| 568 | } | 579 | } |
| 569 | }]; | 580 | }]; |
| 570 | } | 581 | } |
| 571 | #pragma mark -展示错误页 | 582 | #pragma mark -展示错误页 |
| 572 | -- (void)showErrorRetryType:(RetryType)type noNet:(BOOL)noNet { | 583 | +- (void)showErrorRetryType:(OrderRetryType)type noNet:(BOOL)noNet { |
| 573 | [CNLiveErrorOrNoNetView showErrorByType:type view:self.view hidenRetry:NO handle:^{ | 584 | [CNLiveErrorOrNoNetView showErrorByType:type view:self.view hidenRetry:NO handle:^{ |
| 574 | // [self requestData:self.orderId]; | 585 | // [self requestData:self.orderId]; |
| 575 | }]; | 586 | }]; |
| @@ -808,7 +819,7 @@ | @@ -808,7 +819,7 @@ | ||
| 808 | return ; | 819 | return ; |
| 809 | } | 820 | } |
| 810 | 821 | ||
| 811 | - [CNLiveOrderEventHandle submitOrder:weakSelf.list address:weakSelf.addressView.addressModel superView:weakSelf.view complete:^(BOOL ret) { | 822 | + [CNLiveOrderEventHandle submitOrder:weakSelf.list address:weakSelf.addressView. addressModel superView:weakSelf.view complete:^(BOOL ret) { |
| 812 | if (ret) { | 823 | if (ret) { |
| 813 | if (ret) { | 824 | if (ret) { |
| 814 | [weakSelf.navigationController popViewControllerAnimated:YES]; | 825 | [weakSelf.navigationController popViewControllerAnimated:YES]; |
| @@ -842,7 +853,7 @@ | @@ -842,7 +853,7 @@ | ||
| 842 | 853 | ||
| 843 | case CNLiveMineOrderButtonItemTypeContactDaRen: { //联系达人 | 854 | case CNLiveMineOrderButtonItemTypeContactDaRen: { //联系达人 |
| 844 | [CNLiveOrderEventHandle contactUser:weakSelf.list pop:weakSelf.fromChat jumpBlock:^(BOOL isPop) { | 855 | [CNLiveOrderEventHandle contactUser:weakSelf.list pop:weakSelf.fromChat jumpBlock:^(BOOL isPop) { |
| 845 | - | 856 | +#pragma mark - TOTO联系达人 |
| 846 | }]; | 857 | }]; |
| 847 | } | 858 | } |
| 848 | break; | 859 | break; |
| @@ -850,14 +861,14 @@ | @@ -850,14 +861,14 @@ | ||
| 850 | case CNLiveMineOrderButtonItemTypePay: { //去付款 | 861 | case CNLiveMineOrderButtonItemTypePay: { //去付款 |
| 851 | // [CNOrderEventHandle pay:weakSelf.list payBlock:nil]; | 862 | // [CNOrderEventHandle pay:weakSelf.list payBlock:nil]; |
| 852 | [CNLiveOrderEventHandle pay:weakSelf.list payBlock:^(int code) { | 863 | [CNLiveOrderEventHandle pay:weakSelf.list payBlock:^(int code) { |
| 853 | - | 864 | +#pragma mark - 去付款 |
| 854 | }]; | 865 | }]; |
| 855 | } | 866 | } |
| 856 | break; | 867 | break; |
| 857 | 868 | ||
| 858 | case CNLiveMineOrderButtonItemTypeReminder: { //催单 | 869 | case CNLiveMineOrderButtonItemTypeReminder: { //催单 |
| 859 | [CNLiveOrderEventHandle reminderOrder:weakSelf.list superView:weakSelf.view complete:^(NSString *msg) { | 870 | [CNLiveOrderEventHandle reminderOrder:weakSelf.list superView:weakSelf.view complete:^(NSString *msg) { |
| 860 | -// [[HUDHelper sharedInstance] tipMessage:msg]; | 871 | + [[HUDHelper sharedInstance] tipMessage:msg]; |
| 861 | }]; | 872 | }]; |
| 862 | 873 | ||
| 863 | } | 874 | } |
| @@ -902,11 +913,27 @@ | @@ -902,11 +913,27 @@ | ||
| 902 | 913 | ||
| 903 | }; | 914 | }; |
| 904 | } | 915 | } |
| 916 | +#pragma mark - CNAddressViewDelegate | ||
| 917 | +- (void)selectedAddressComplete { | ||
| 918 | + [self.scrollView layoutSubviews]; | ||
| 919 | + self.scrollView.contentSize = CGSizeMake(KScreenWidth, self.funcView.bottom); | ||
| 920 | +} | ||
| 905 | #pragma mark - CNAddPopFuncViewDelegate | 921 | #pragma mark - CNAddPopFuncViewDelegate |
| 906 | - (void)popFuncView:(CNLiveAddPopFuncView *)popView indexPath:(NSInteger)row | 922 | - (void)popFuncView:(CNLiveAddPopFuncView *)popView indexPath:(NSInteger)row |
| 907 | { | 923 | { |
| 908 | 924 | ||
| 909 | } | 925 | } |
| 926 | +#pragma mark -通知 | ||
| 927 | +- (void)evaluateSuccess { | ||
| 928 | + [self requestData:self.orderId]; | ||
| 929 | +} | ||
| 930 | +- (void)applyRefundSuccess { | ||
| 931 | + [self requestData:self.orderId]; | ||
| 932 | +} | ||
| 933 | +- (void)deleteDefaultAddress { | ||
| 934 | + _addressView.addressModel = nil; | ||
| 935 | + _addressView.allowEdit = YES; | ||
| 936 | +} | ||
| 910 | #pragma mark - | 937 | #pragma mark - |
| 911 | #pragma mark - Getter | 938 | #pragma mark - Getter |
| 912 | - (UIScrollView *)scrollView | 939 | - (UIScrollView *)scrollView |
| @@ -946,7 +973,7 @@ | @@ -946,7 +973,7 @@ | ||
| 946 | { | 973 | { |
| 947 | if (!_addressView) { | 974 | if (!_addressView) { |
| 948 | _addressView = [[CNLiveAddressView alloc] init]; | 975 | _addressView = [[CNLiveAddressView alloc] init]; |
| 949 | -// _addressView.delegate = self; | 976 | + _addressView.delegate = self; |
| 950 | } | 977 | } |
| 951 | return _addressView; | 978 | return _addressView; |
| 952 | } | 979 | } |
CNLiveMyOrderModule/Classes/Controller/CNLiveRefundController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveRefundController.h | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/25. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <CNLiveCommonClass/CNLiveCommonClass.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveRefundController : CNCommonViewController | ||
| 13 | + | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/Controller/CNLiveRefundController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveRefundController.m | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/25. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveRefundController.h" | ||
| 9 | +#import "CNLiveMineOrderTableViewCell.h" | ||
| 10 | +#import "CNLiveOrderModel.h" | ||
| 11 | +#import "CNLiveOrderDetailController.h" | ||
| 12 | +#import "CNLiveNoOrderView.h" | ||
| 13 | +#import "UIColor+CNLiveExtension.h" | ||
| 14 | +#import <DSCnliveShopSDK/DSAfterSaleListViewController.h> | ||
| 15 | +#import "CNLiveOrderViewModel.h" | ||
| 16 | +#import "CNLiveNetworking.h" | ||
| 17 | +#import "JXCategoryTitleView.h" | ||
| 18 | +#import "JXCategoryIndicatorLineView.h" | ||
| 19 | +#import "CNLiveDefinesHeader.h" | ||
| 20 | +#import "UIColor+CNLiveExtension.h" | ||
| 21 | +#import "MJRefresh.h" | ||
| 22 | +#import "CNLiveOrderEventHandle.h" | ||
| 23 | +#import "CNLiveCommonCategory.h" | ||
| 24 | +#import <DSCnliveShopSDK/DSAfterSaleListViewController.h> | ||
| 25 | +//#import "TIMAdapter.h" | ||
| 26 | +//#import "CommonLibrary.h" | ||
| 27 | +#import "CNLiveRefreshHeader.h" | ||
| 28 | +#import "HUDHelper.h" | ||
| 29 | +#import "CNLiveErrorOrNoNetView.h" | ||
| 30 | +static const CGFloat KCategoryViewHeight = 44; | ||
| 31 | +@interface CNLiveRefundController ()<UITableViewDelegate,UITableViewDataSource,CNLiveMineOrderTableViewCellDelegate,JXCategoryViewDelegate> | ||
| 32 | +{ | ||
| 33 | + | ||
| 34 | +} | ||
| 35 | +@property (nonatomic, weak) UIView *line; | ||
| 36 | +@property (nonatomic, strong) NSMutableArray *titleLists; | ||
| 37 | +@property (nonatomic, strong) NSMutableArray *listArr; //数据源 | ||
| 38 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 39 | +@property (nonatomic, strong) CNLiveNoOrderView *noDataView; | ||
| 40 | +@property (nonatomic, assign) NSInteger page; | ||
| 41 | +@property (nonatomic, assign) BOOL next; | ||
| 42 | +@property (nonatomic, strong) NSArray *titles; | ||
| 43 | +@property (nonatomic, strong) JXCategoryTitleView *titleCategoryView; | ||
| 44 | +@property (nonatomic, strong) JXCategoryIndicatorLineView *lineView; | ||
| 45 | +@property (nonatomic, strong) UIScrollView *scrollView; | ||
| 46 | +@property (nonatomic, assign) NSInteger index; | ||
| 47 | +@property (nonatomic, strong) DSAfterSaleListViewController *listVc; | ||
| 48 | +@end | ||
| 49 | + | ||
| 50 | +@implementation CNLiveRefundController | ||
| 51 | + | ||
| 52 | +- (void)dealloc { | ||
| 53 | + NSLog(@"退款/售后走了dealloc吗"); | ||
| 54 | +} | ||
| 55 | +- (void)viewWillAppear:(BOOL)animated { | ||
| 56 | + [super viewWillAppear:animated]; | ||
| 57 | + self.navigationController.navigationBarHidden = NO; | ||
| 58 | +} | ||
| 59 | +- (void)viewDidAppear:(BOOL)animated { | ||
| 60 | + [super viewDidAppear:animated]; | ||
| 61 | + self.navigationController.navigationBarHidden = NO; | ||
| 62 | +} | ||
| 63 | +- (void)viewDidLoad { | ||
| 64 | + [super viewDidLoad]; | ||
| 65 | +// self.title = @"退款/售后"; | ||
| 66 | + self.titles = @[@"服务售后",@"商品售后"]; | ||
| 67 | + _listArr = [NSMutableArray array]; | ||
| 68 | + _page = 1; | ||
| 69 | + self.index = 0; | ||
| 70 | + UIBarButtonItem *callItem = [[UIBarButtonItem alloc]initWithImage:[UIImage cnLive_getImageNameWithBundle:@"dd_dianhua" bundle:@"CNLiveMyOrderModule.bundle/CNLiveMyOrderModule" targetClass:[self class]] style:UIBarButtonItemStylePlain target:self action:@selector(callItemAction)]; | ||
| 71 | + self.navigationItem.rightBarButtonItem = callItem; | ||
| 72 | +// [self.view addSubview:self.tableView]; | ||
| 73 | + [self.view addSubview:self.scrollView]; | ||
| 74 | + [self requestRefundDataWithPage:_page]; | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +} | ||
| 78 | +- (void)viewDidLayoutSubviews { | ||
| 79 | + [super viewDidLayoutSubviews]; | ||
| 80 | + self.titleCategoryView.frame = CGRectMake(60, kVerticalStatusHeight, KScreenWidth - 160 , KCategoryViewHeight); | ||
| 81 | +} | ||
| 82 | +- (JXCategoryTitleView *)myCategoryView { | ||
| 83 | + return (JXCategoryTitleView *)self.titleCategoryView; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +- (JXCategoryBaseView *)preferredCategoryView { | ||
| 87 | + return [[JXCategoryTitleView alloc] init]; | ||
| 88 | +} | ||
| 89 | +#pragma mark -打电话 | ||
| 90 | +- (void)callItemAction { | ||
| 91 | + NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@",@"010-65832485"]; | ||
| 92 | + // 大于等于10.0系统使用此openURL方法 | ||
| 93 | + if (@available(iOS 10.0, *)) { | ||
| 94 | + [[UIApplication sharedApplication]openURL:[NSURL URLWithString:callPhone] options:@{} completionHandler:nil]; | ||
| 95 | + } else { | ||
| 96 | + [[UIApplication sharedApplication]openURL:[NSURL URLWithString:callPhone]]; | ||
| 97 | + } | ||
| 98 | +} | ||
| 99 | +#pragma mark - 请求数据 | ||
| 100 | +- (void)requestRefundDataWithPage:(NSInteger)page { | ||
| 101 | + if (![CNLiveNetworking isNetworking]) { | ||
| 102 | + [QMUITips showError:@"网络不给力" inView:self.view hideAfterDelay:1.5f]; | ||
| 103 | + return; | ||
| 104 | + } | ||
| 105 | + __weak typeof(self) weakSelf = self; | ||
| 106 | +// [QMUITips showLoadingInView:self.view]; | ||
| 107 | + [CNLiveOrderViewModel requestRefundDataWithPage:page success:^(NSMutableArray * _Nonnull array, BOOL haveNext) { | ||
| 108 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 109 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 110 | + if (!strongSelf) { | ||
| 111 | + return ; | ||
| 112 | + } | ||
| 113 | + if ([strongSelf.tableView.mj_header isRefreshing]) { | ||
| 114 | + [strongSelf.tableView.mj_header endRefreshing]; | ||
| 115 | + } | ||
| 116 | + if ([strongSelf.tableView.mj_footer isRefreshing]) { | ||
| 117 | + [strongSelf.tableView.mj_footer endRefreshing]; | ||
| 118 | + } | ||
| 119 | + self.next = haveNext; | ||
| 120 | + strongSelf.tableView.mj_footer.hidden = !strongSelf.next; | ||
| 121 | + if (haveNext) { | ||
| 122 | + strongSelf.page ++; | ||
| 123 | + }else { | ||
| 124 | + [strongSelf.tableView.mj_footer endRefreshingWithNoMoreData]; | ||
| 125 | + } | ||
| 126 | + [strongSelf.listArr addObjectsFromArray:array]; | ||
| 127 | + if (strongSelf.listArr.count == 0) { | ||
| 128 | + [strongSelf.view addSubview:self.noDataView]; | ||
| 129 | + }else { | ||
| 130 | + [strongSelf.noDataView removeFromSuperview]; | ||
| 131 | + [strongSelf.tableView reloadData]; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + } failure:^(NSError * _Nonnull error) { | ||
| 135 | + weakSelf.tableView.mj_footer.hidden = YES; | ||
| 136 | + [weakSelf.tableView.mj_footer endRefreshing]; | ||
| 137 | + [weakSelf.tableView.mj_header endRefreshing]; | ||
| 138 | + if (weakSelf.listArr.count > 0) { | ||
| 139 | + [QMUITips showWithText:error.localizedDescription inView:self.view hideAfterDelay:1.5f]; | ||
| 140 | + } else { | ||
| 141 | + if (error.code == -1009 || error.code == -1001) { | ||
| 142 | + [self showErrorRetryType:OrderRetryTypeNoNet noNet:YES]; | ||
| 143 | + } else { | ||
| 144 | + [self showErrorRetryType:OrderRetryTypeError noNet:NO]; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + } | ||
| 148 | + }]; | ||
| 149 | +} | ||
| 150 | +#pragma mark -显示错误页 | ||
| 151 | +- (void)showErrorRetryType:(OrderRetryType)type noNet:(BOOL)noNet { | ||
| 152 | + [CNLiveErrorOrNoNetView showErrorByType:type view:self.view hidenRetry:self.listArr.count > 0 handle:^{ | ||
| 153 | + [self retryLoadData]; | ||
| 154 | + }]; | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +#pragma mark - 下拉刷新 | ||
| 158 | +-(void)refreshData { | ||
| 159 | + _page = 1; | ||
| 160 | + if (self.listArr.count > 0) { | ||
| 161 | + [self.listArr removeAllObjects]; | ||
| 162 | + } | ||
| 163 | + [self requestRefundDataWithPage:_page]; | ||
| 164 | +} | ||
| 165 | +#pragma mark - 上拉加载更多 | ||
| 166 | +- (void)loadMoreData { | ||
| 167 | + [self requestRefundDataWithPage:_page]; | ||
| 168 | +} | ||
| 169 | +#pragma mark - 重试 | ||
| 170 | +- (void)retryLoadData { | ||
| 171 | + _page = 1; | ||
| 172 | + if (self.listArr.count > 0) { | ||
| 173 | + [self.listArr removeAllObjects]; | ||
| 174 | + } | ||
| 175 | + [self requestRefundDataWithPage:_page]; | ||
| 176 | +} | ||
| 177 | +#pragma mark -JXCategoryViewDelegate | ||
| 178 | +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { | ||
| 179 | + self.index = index; | ||
| 180 | + switch (index) { | ||
| 181 | + case 0:{ | ||
| 182 | + [self.tableView reloadData]; | ||
| 183 | + } | ||
| 184 | + break; | ||
| 185 | + case 1:{ | ||
| 186 | + [self.scrollView addSubview:self.listVc.view]; | ||
| 187 | + } | ||
| 188 | + break; | ||
| 189 | + | ||
| 190 | + default: | ||
| 191 | + break; | ||
| 192 | + } | ||
| 193 | +} | ||
| 194 | +#pragma mark - CNMineOrderTableViewCellDelegate | ||
| 195 | +- (void)cellWithOrderModel:(CNLiveOrderList *)model type:(CNLiveMineOrderButtonItemType)type { | ||
| 196 | + switch (type) { | ||
| 197 | + case CNLiveMineOrderButtonItemTypeContactDaRen: | ||
| 198 | + { | ||
| 199 | +#pragma mark -TODO联系达人(这里需要)CNChatViewController还没有封装 | ||
| 200 | + | ||
| 201 | + } | ||
| 202 | + break; | ||
| 203 | + case CNLiveMineOrderButtonItemTypeRefundDetail: { | ||
| 204 | + [CNLiveOrderEventHandle refundDetail:model jumpBlock:^(NSString * _Nonnull orderId) { | ||
| 205 | + CNLiveOrderDetailController *vc = [[CNLiveOrderDetailController alloc]init]; | ||
| 206 | + vc.orderId = orderId; | ||
| 207 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 208 | + }]; | ||
| 209 | + } | ||
| 210 | + break; | ||
| 211 | + case CNLiveMineOrderButtonItemTypeReminder:{ | ||
| 212 | + [CNLiveOrderEventHandle reminderOrder:model superView:self.view complete:^(NSString * _Nonnull msg) { | ||
| 213 | + [[HUDHelper sharedInstance]tipMessage:msg]; | ||
| 214 | + }]; | ||
| 215 | + } | ||
| 216 | + break; | ||
| 217 | + case CNLiveMineOrderButtonItemTypeRefund:{ | ||
| 218 | +#pragma mark -申请退款 | ||
| 219 | + } | ||
| 220 | + break; | ||
| 221 | + case CNLiveMineOrderButtonItemTypeConfirmReceipt: { //确认收货 | ||
| 222 | + [CNLiveOrderEventHandle confirmRecv:model itemId:@"" superView:self.view complete:^(BOOL ret) { | ||
| 223 | + if (ret) { | ||
| 224 | +#pragma mark -这里要在看看,为什么传0呢 | ||
| 225 | + [self requestRefundDataWithPage:0]; | ||
| 226 | + } | ||
| 227 | + }]; | ||
| 228 | + } | ||
| 229 | + break; | ||
| 230 | + default: | ||
| 231 | + break; | ||
| 232 | + } | ||
| 233 | +} | ||
| 234 | +#pragma mark - UITableViewDelegate,UITableViewDataSource | ||
| 235 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 236 | + return self.listArr.count; | ||
| 237 | +} | ||
| 238 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 239 | + static NSString *cellId = @"CNMineOrderTableViewCell"; | ||
| 240 | + CNLiveMineOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | ||
| 241 | + if (!cell) { | ||
| 242 | + cell = [[CNLiveMineOrderTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; | ||
| 243 | + } | ||
| 244 | + CNLiveOrderList *model = self.listArr[indexPath.row]; | ||
| 245 | + cell.delegate = self; | ||
| 246 | + [cell configOrderList:model delegate:self]; | ||
| 247 | + return cell; | ||
| 248 | +} | ||
| 249 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 250 | + CNLiveOrderList *model = self.listArr[indexPath.row]; | ||
| 251 | + return [model.orderItem cellHeight]; | ||
| 252 | +} | ||
| 253 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 254 | + [self.tableView qmui_clearsSelection]; | ||
| 255 | + CNLiveMineOrderTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | ||
| 256 | + [CNLiveOrderEventHandle orderDetail:cell.list orderBlock:^(NSString * _Nonnull orderId) { | ||
| 257 | + CNLiveOrderDetailController *vc= [[CNLiveOrderDetailController alloc]init]; | ||
| 258 | + vc.orderId = orderId; | ||
| 259 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 260 | + }]; | ||
| 261 | +} | ||
| 262 | +#pragma mark - lazy | ||
| 263 | +- (JXCategoryTitleView *)titleCategoryView{ | ||
| 264 | + if (!_titleCategoryView) { | ||
| 265 | + _titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(60, kVerticalStatusHeight, KScreenWidth -160 , KCategoryViewHeight)]; | ||
| 266 | + _titleCategoryView.titles = self.titles; | ||
| 267 | + _titleCategoryView.delegate = self; | ||
| 268 | + _titleCategoryView.titleColor = CNLiveColorWithHexString(@"333333"); | ||
| 269 | + _titleCategoryView.titleSelectedColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 270 | + _titleCategoryView.titleFont = [UIFont systemFontOfSize:16]; | ||
| 271 | + _titleCategoryView.titleLabelZoomScale = 1.0; | ||
| 272 | + _titleCategoryView.collectionView.scrollEnabled = NO; | ||
| 273 | + _titleCategoryView.titleLabelZoomEnabled = NO; | ||
| 274 | + _titleCategoryView.defaultSelectedIndex = 0; | ||
| 275 | + _titleCategoryView.cellWidth = 60; | ||
| 276 | + _titleCategoryView.collectionView.frame = _titleCategoryView.bounds; | ||
| 277 | + self.lineView = [[JXCategoryIndicatorLineView alloc] init]; | ||
| 278 | + self.lineView.indicatorColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 279 | + self.lineView.indicatorWidth = JXCategoryViewAutomaticDimension; | ||
| 280 | + _titleCategoryView.indicators = @[self.lineView]; | ||
| 281 | + _titleCategoryView.contentScrollView = self.scrollView; | ||
| 282 | + self.navigationItem.titleView = self.titleCategoryView; | ||
| 283 | + } | ||
| 284 | + return _titleCategoryView; | ||
| 285 | +} | ||
| 286 | +- (UIScrollView *)scrollView { | ||
| 287 | + | ||
| 288 | + if (!_scrollView) { | ||
| 289 | + CGFloat scrollW = KScreenWidth; | ||
| 290 | + CGFloat scrollH = KScreenHeight - kNavigationBarHeight; | ||
| 291 | + _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,kNavigationBarHeight,scrollW, scrollH)]; | ||
| 292 | + _scrollView.contentSize = CGSizeMake(scrollW *2, scrollH); | ||
| 293 | + _scrollView.backgroundColor = [UIColor whiteColor]; | ||
| 294 | + _scrollView.showsHorizontalScrollIndicator = NO; | ||
| 295 | + _scrollView.showsVerticalScrollIndicator = NO; | ||
| 296 | + _scrollView.pagingEnabled = NO; | ||
| 297 | + _scrollView.scrollEnabled = NO; | ||
| 298 | + _scrollView.delegate = self; | ||
| 299 | + [_scrollView addSubview:self.tableView]; | ||
| 300 | + } | ||
| 301 | + return _scrollView; | ||
| 302 | +} | ||
| 303 | +- (UITableView *)tableView { | ||
| 304 | + if (!_tableView) { | ||
| 305 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight-kNavigationBarHeight) style:UITableViewStylePlain]; | ||
| 306 | + _tableView.backgroundColor = [UIColor whiteColor]; | ||
| 307 | + _tableView.delegate = self; | ||
| 308 | + _tableView.dataSource = self; | ||
| 309 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 310 | + _tableView.mj_header = [CNLiveRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshData)]; | ||
| 311 | + _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)]; | ||
| 312 | + } | ||
| 313 | + return _tableView; | ||
| 314 | +} | ||
| 315 | +- (DSAfterSaleListViewController *)listVc{ | ||
| 316 | + if (!_listVc) { | ||
| 317 | + _listVc = [[DSAfterSaleListViewController alloc]init]; | ||
| 318 | + _listVc.view.frame = CGRectMake(KScreenWidth, 0, KScreenWidth, KScreenHeight - kNavigationBarHeight); | ||
| 319 | + _listVc.isNeedNavigationBar = YES; | ||
| 320 | + } | ||
| 321 | + return _listVc; | ||
| 322 | +} | ||
| 323 | +- (CNLiveNoOrderView *)noDataView { | ||
| 324 | + if (!_noDataView) { | ||
| 325 | + _noDataView = [[CNLiveNoOrderView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - kNavigationBarHeight)]; | ||
| 326 | + [_noDataView setImageName:[UIImage cnLive_getImageNameWithBundle:@"dd_wutuikuan" bundle:@"CNLiveMyOrderModule.bundle/CNLiveMyOrderModule" targetClass:[self class]] title:@"您还没有相关退款的订单" customTopH:109]; | ||
| 327 | + } | ||
| 328 | + return _noDataView; | ||
| 329 | +} | ||
| 330 | + | ||
| 331 | +@end |
CNLiveMyOrderModule/Classes/Controller/CNLiveServiceOrderController.m
| @@ -34,15 +34,36 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -34,15 +34,36 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 34 | - (void)dealloc { | 34 | - (void)dealloc { |
| 35 | NSLog(@"订单页面dealloc走了吗"); | 35 | NSLog(@"订单页面dealloc走了吗"); |
| 36 | } | 36 | } |
| 37 | +- (void)viewWillAppear:(BOOL)animated { | ||
| 38 | + [super viewWillAppear:animated]; | ||
| 39 | + self.navigationController.navigationBarHidden = NO; | ||
| 40 | +} | ||
| 41 | +- (void)viewDidAppear:(BOOL)animated { | ||
| 42 | + [super viewDidAppear:animated]; | ||
| 43 | + self.navigationController.navigationBarHidden = NO; | ||
| 44 | +} | ||
| 37 | - (void)viewDidLoad { | 45 | - (void)viewDidLoad { |
| 38 | [super viewDidLoad]; | 46 | [super viewDidLoad]; |
| 39 | self.titles = @[@"全部",@"待付款",@"待收货",@"待评价"]; | 47 | self.titles = @[@"全部",@"待付款",@"待收货",@"待评价"]; |
| 40 | [self addSubViews]; | 48 | [self addSubViews]; |
| 41 | - [self.allTblView refreshData:self.status]; | ||
| 42 | - [self cellDidSelected]; | ||
| 43 | - [self evaluateOrderAction]; | ||
| 44 | } | 49 | } |
| 45 | - | 50 | +- (void)setStatus:(NSInteger)status { |
| 51 | + _status = status; | ||
| 52 | + _categoryView.defaultSelectedIndex = status; | ||
| 53 | + if (self.status == 0) { | ||
| 54 | + [self.allTblView refreshData:0]; | ||
| 55 | + [self allJumpAction]; | ||
| 56 | + }else if (self.status == 1) { | ||
| 57 | + [self.payTblView refreshData:1]; | ||
| 58 | + [self allJumpAction]; | ||
| 59 | + }else if (self.status == 2) { | ||
| 60 | + [self.goodsTblView refreshData:2]; | ||
| 61 | + [self allJumpAction]; | ||
| 62 | + }else if (self.status == 3){ | ||
| 63 | + [self.evaluateTblView refreshData:3]; | ||
| 64 | + [self allJumpAction]; | ||
| 65 | + } | ||
| 66 | +} | ||
| 46 | #pragma mark - initView | 67 | #pragma mark - initView |
| 47 | - (void)addSubViews { | 68 | - (void)addSubViews { |
| 48 | [self.view addSubview:self.scrollView]; | 69 | [self.view addSubview:self.scrollView]; |
| @@ -61,6 +82,11 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -61,6 +82,11 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 61 | make.height.mas_equalTo(1); | 82 | make.height.mas_equalTo(1); |
| 62 | }]; | 83 | }]; |
| 63 | } | 84 | } |
| 85 | +#pragma mark -各种跳转 | ||
| 86 | +- (void)allJumpAction { | ||
| 87 | + [self cellDidSelected]; | ||
| 88 | + [self evaluateOrderAction]; | ||
| 89 | +} | ||
| 64 | #pragma mark -CategoryViewDelegate | 90 | #pragma mark -CategoryViewDelegate |
| 65 | - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { | 91 | - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { |
| 66 | self.status = index; | 92 | self.status = index; |
| @@ -69,29 +95,25 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -69,29 +95,25 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 69 | { | 95 | { |
| 70 | //全部订单 | 96 | //全部订单 |
| 71 | [_allTblView refreshData:0]; | 97 | [_allTblView refreshData:0]; |
| 72 | - [self cellDidSelected]; | ||
| 73 | - [self evaluateOrderAction]; | 98 | + [self allJumpAction]; |
| 74 | } | 99 | } |
| 75 | break; | 100 | break; |
| 76 | case 1:{ | 101 | case 1:{ |
| 77 | //待付款 | 102 | //待付款 |
| 78 | [_payTblView refreshData:1]; | 103 | [_payTblView refreshData:1]; |
| 79 | - [self cellDidSelected]; | ||
| 80 | - [self evaluateOrderAction]; | 104 | + [self allJumpAction]; |
| 81 | } | 105 | } |
| 82 | break; | 106 | break; |
| 83 | case 2:{ | 107 | case 2:{ |
| 84 | //待收货 | 108 | //待收货 |
| 85 | [_goodsTblView refreshData:2]; | 109 | [_goodsTblView refreshData:2]; |
| 86 | - [self cellDidSelected]; | ||
| 87 | - [self evaluateOrderAction]; | 110 | + [self allJumpAction]; |
| 88 | } | 111 | } |
| 89 | break; | 112 | break; |
| 90 | case 3:{ | 113 | case 3:{ |
| 91 | //待评价 | 114 | //待评价 |
| 92 | [_evaluateTblView refreshData:3]; | 115 | [_evaluateTblView refreshData:3]; |
| 93 | - [self cellDidSelected]; | ||
| 94 | - [self evaluateOrderAction]; | 116 | + [self allJumpAction]; |
| 95 | } | 117 | } |
| 96 | break; | 118 | break; |
| 97 | default: | 119 | default: |
| @@ -191,6 +213,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -191,6 +213,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 191 | _categoryView.collectionView.frame = _categoryView.bounds; | 213 | _categoryView.collectionView.frame = _categoryView.bounds; |
| 192 | _categoryView.separatorLineShowEnabled = YES; | 214 | _categoryView.separatorLineShowEnabled = YES; |
| 193 | // _titleCategoryView.selectedIndex = 0 | 215 | // _titleCategoryView.selectedIndex = 0 |
| 216 | + _categoryView.defaultSelectedIndex = self.status; | ||
| 194 | JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; | 217 | JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; |
| 195 | lineView.indicatorColor = CNLiveColorWithHexString(@"23D41E"); | 218 | lineView.indicatorColor = CNLiveColorWithHexString(@"23D41E"); |
| 196 | lineView.indicatorWidth = JXCategoryViewAutomaticDimension; | 219 | lineView.indicatorWidth = JXCategoryViewAutomaticDimension; |
CNLiveMyOrderModule/Classes/Model/DSAddressModel.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// DSAddressModel.h | ||
| 3 | -// CNLiveMyOrder | ||
| 4 | -// | ||
| 5 | -// Created by 殷巧娟 on 2019/6/13. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#import <Foundation/Foundation.h> | ||
| 9 | - | ||
| 10 | -NS_ASSUME_NONNULL_BEGIN | ||
| 11 | - | ||
| 12 | -@interface DSAddressModel : NSObject | ||
| 13 | -/** | ||
| 14 | - 地址id | ||
| 15 | -*/ | ||
| 16 | -@property (nonatomic,copy) NSString * id; | ||
| 17 | -/** | ||
| 18 | - 名称 | ||
| 19 | -*/ | ||
| 20 | -@property (nonatomic,copy) NSString * name; | ||
| 21 | -/** | ||
| 22 | - 联系电话 | ||
| 23 | -*/ | ||
| 24 | -@property (nonatomic,copy) NSString * phone; | ||
| 25 | -/** | ||
| 26 | - 用户填写的详细地址 | ||
| 27 | -*/ | ||
| 28 | -@property (nonatomic,copy) NSString * write_address; | ||
| 29 | -/** | ||
| 30 | - 详细地址 | ||
| 31 | -*/ | ||
| 32 | -@property (nonatomic,copy) NSString * address; | ||
| 33 | -/** | ||
| 34 | - 省id 0为没选择 | ||
| 35 | -*/ | ||
| 36 | -@property (nonatomic,copy) NSString * province_id; | ||
| 37 | -/** | ||
| 38 | - 市id 0为没选择 | ||
| 39 | -*/ | ||
| 40 | -@property (nonatomic,copy) NSString * city_id; | ||
| 41 | -/** | ||
| 42 | - 区县id 0为没选择 | ||
| 43 | -*/ | ||
| 44 | -@property (nonatomic,copy) NSString * area_id; | ||
| 45 | -/** | ||
| 46 | - 2为默认地址 其他为普通 | ||
| 47 | -*/ | ||
| 48 | -@property (nonatomic,assign) NSUInteger state; | ||
| 49 | -/** | ||
| 50 | - 用户id | ||
| 51 | - */ | ||
| 52 | -@property (nonatomic,copy) NSString * uid; | ||
| 53 | -/** | ||
| 54 | - 省市县名称 | ||
| 55 | -*/ | ||
| 56 | -@property (nonatomic,copy) NSString * city_name; | ||
| 57 | -@end | ||
| 58 | - | ||
| 59 | -NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/Model/DSAddressModel.m deleted
100644 → 0
CNLiveMyOrderModule/Classes/Module/CNLiveOrderModule.h
| @@ -6,10 +6,8 @@ | @@ -6,10 +6,8 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import <Foundation/Foundation.h> | 8 | #import <Foundation/Foundation.h> |
| 9 | -#import <CNLiveBeeHive/BeeHive.h> | ||
| 10 | NS_ASSUME_NONNULL_BEGIN | 9 | NS_ASSUME_NONNULL_BEGIN |
| 11 | - | ||
| 12 | -@interface CNLiveOrderModule : NSObject<BHModuleProtocol> | 10 | +@interface CNLiveOrderModule : NSObject |
| 13 | 11 | ||
| 14 | @end | 12 | @end |
| 15 | 13 |
CNLiveMyOrderModule/Classes/Module/CNLiveOrderModule.m
| @@ -6,7 +6,12 @@ | @@ -6,7 +6,12 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import "CNLiveOrderModule.h" | 8 | #import "CNLiveOrderModule.h" |
| 9 | +#import "BeeHive.h" | ||
| 10 | +@BeeHiveMod(CNLiveOrderModule) | ||
| 9 | 11 | ||
| 12 | +@interface CNLiveOrderModule ()<BHModuleProtocol> | ||
| 13 | + | ||
| 14 | +@end | ||
| 10 | @implementation CNLiveOrderModule | 15 | @implementation CNLiveOrderModule |
| 11 | 16 | ||
| 12 | - (void)modSetUp:(BHContext *)context { | 17 | - (void)modSetUp:(BHContext *)context { |
CNLiveMyOrderModule/Classes/Service/CNLiveOrderService.m
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | #import "CNLiveOrderService.h" | 8 | #import "CNLiveOrderService.h" |
| 9 | #import "CNLiveOrderServiceProtocol.h" | 9 | #import "CNLiveOrderServiceProtocol.h" |
| 10 | #import "CNLiveMyOrderController.h" | 10 | #import "CNLiveMyOrderController.h" |
| 11 | +#import "CNLiveRefundController.h" | ||
| 11 | #import <CNLiveBeeHive/BeeHive.h> | 12 | #import <CNLiveBeeHive/BeeHive.h> |
| 12 | #import <UIKit/UIKit.h> | 13 | #import <UIKit/UIKit.h> |
| 13 | @interface CNLiveOrderService ()<CNLiveOrderServiceProtocol> | 14 | @interface CNLiveOrderService ()<CNLiveOrderServiceProtocol> |
| @@ -23,9 +24,20 @@ | @@ -23,9 +24,20 @@ | ||
| 23 | #pragma mark -跳转到订单页面 | 24 | #pragma mark -跳转到订单页面 |
| 24 | - (void)pushToOrderViewController:(NSInteger)index { | 25 | - (void)pushToOrderViewController:(NSInteger)index { |
| 25 | CNLiveMyOrderController *orderVc = [[CNLiveMyOrderController alloc]init]; | 26 | CNLiveMyOrderController *orderVc = [[CNLiveMyOrderController alloc]init]; |
| 26 | - [orderVc getOrderType:index]; | 27 | + orderVc.status = index; |
| 28 | +// [orderVc getOrderType:index]; | ||
| 27 | [[self navigationViewController]pushViewController:orderVc animated:YES]; | 29 | [[self navigationViewController]pushViewController:orderVc animated:YES]; |
| 28 | } | 30 | } |
| 31 | +#pragma mark - 获取售后控制器 | ||
| 32 | +- (UIViewController *)getRefundViewController { | ||
| 33 | + CNLiveRefundController *refundVc = [[CNLiveRefundController alloc]init]; | ||
| 34 | + return refundVc; | ||
| 35 | +} | ||
| 36 | +#pragma mark - 跳转到售后页面 | ||
| 37 | +- (void)pushToRefundViewController:(NSInteger)index { | ||
| 38 | + CNLiveRefundController *refundVc = [[CNLiveRefundController alloc]init]; | ||
| 39 | + [[self navigationViewController]pushViewController:refundVc animated:YES]; | ||
| 40 | +} | ||
| 29 | #pragma mark -获取当前导航栏 | 41 | #pragma mark -获取当前导航栏 |
| 30 | - (UINavigationController *)navigationViewController { | 42 | - (UINavigationController *)navigationViewController { |
| 31 | 43 |
CNLiveMyOrderModule/Classes/View/CNLiveErrorOrNoNetView.h
| @@ -8,16 +8,16 @@ | @@ -8,16 +8,16 @@ | ||
| 8 | #import <UIKit/UIKit.h> | 8 | #import <UIKit/UIKit.h> |
| 9 | typedef void(^RetryHandle)(void); | 9 | typedef void(^RetryHandle)(void); |
| 10 | 10 | ||
| 11 | -typedef NS_ENUM(NSUInteger, RetryType) { | ||
| 12 | - RetryTypeError = 0, | ||
| 13 | - RetryTypeNoNet, | 11 | +typedef NS_ENUM(NSUInteger, OrderRetryType) { |
| 12 | + OrderRetryTypeError = 0, | ||
| 13 | + OrderRetryTypeNoNet, | ||
| 14 | }; | 14 | }; |
| 15 | NS_ASSUME_NONNULL_BEGIN | 15 | NS_ASSUME_NONNULL_BEGIN |
| 16 | 16 | ||
| 17 | @interface CNLiveErrorOrNoNetView : UIView | 17 | @interface CNLiveErrorOrNoNetView : UIView |
| 18 | -+ (CNLiveErrorOrNoNetView *)showErrorByType:(RetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle; | 18 | ++ (CNLiveErrorOrNoNetView *)showErrorByType:(OrderRetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle; |
| 19 | 19 | ||
| 20 | -+ (CNLiveErrorOrNoNetView *)showErrorByType:(RetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle frame:(CGRect)frame; | 20 | ++ (CNLiveErrorOrNoNetView *)showErrorByType:(OrderRetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle frame:(CGRect)frame; |
| 21 | @end | 21 | @end |
| 22 | 22 | ||
| 23 | NS_ASSUME_NONNULL_END | 23 | NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/View/CNLiveErrorOrNoNetView.m
| @@ -26,7 +26,7 @@ static const char retryKey; | @@ -26,7 +26,7 @@ static const char retryKey; | ||
| 26 | NSLog(@"CNLiveErrorOrNoNetView dealloc"); | 26 | NSLog(@"CNLiveErrorOrNoNetView dealloc"); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | -- (instancetype)initWithView:(UIView *)view type:(RetryType)type | 29 | +- (instancetype)initWithView:(UIView *)view type:(OrderRetryType)type |
| 30 | { | 30 | { |
| 31 | self = [super initWithFrame:view.bounds]; | 31 | self = [super initWithFrame:view.bounds]; |
| 32 | if (self) { | 32 | if (self) { |
| @@ -36,7 +36,7 @@ static const char retryKey; | @@ -36,7 +36,7 @@ static const char retryKey; | ||
| 36 | [self addSubview:self.tipLab]; | 36 | [self addSubview:self.tipLab]; |
| 37 | [self addSubview:self.retryBtn]; | 37 | [self addSubview:self.retryBtn]; |
| 38 | 38 | ||
| 39 | - if (type == RetryTypeError) { | 39 | + if (type == OrderRetryTypeError) { |
| 40 | self.errorLab.text = @"接口请求错误"; | 40 | self.errorLab.text = @"接口请求错误"; |
| 41 | } else { | 41 | } else { |
| 42 | self.errorLab.text = @"无法连接网络"; | 42 | self.errorLab.text = @"无法连接网络"; |
| @@ -47,10 +47,10 @@ static const char retryKey; | @@ -47,10 +47,10 @@ static const char retryKey; | ||
| 47 | return self; | 47 | return self; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | -+ (CNLiveErrorOrNoNetView *)showErrorByType:(RetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle { | 50 | ++ (CNLiveErrorOrNoNetView *)showErrorByType:(OrderRetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle { |
| 51 | 51 | ||
| 52 | if (hidenRetry) { | 52 | if (hidenRetry) { |
| 53 | - if (type == RetryTypeError) { | 53 | + if (type == OrderRetryTypeError) { |
| 54 | [QMUITips showError:@"接口请求失败,请稍后再试!" inView:view hideAfterDelay:1.5]; | 54 | [QMUITips showError:@"接口请求失败,请稍后再试!" inView:view hideAfterDelay:1.5]; |
| 55 | } else { | 55 | } else { |
| 56 | [QMUITips showError:@"网络连接失败,请稍后再试!" inView:view hideAfterDelay:1.5]; | 56 | [QMUITips showError:@"网络连接失败,请稍后再试!" inView:view hideAfterDelay:1.5]; |
| @@ -84,10 +84,10 @@ static const char retryKey; | @@ -84,10 +84,10 @@ static const char retryKey; | ||
| 84 | 84 | ||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | -+ (CNLiveErrorOrNoNetView *)showErrorByType:(RetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle frame:(CGRect)frame { | 87 | ++ (CNLiveErrorOrNoNetView *)showErrorByType:(OrderRetryType)type view:(UIView *)view hidenRetry:(BOOL)hidenRetry handle:(RetryHandle)handle frame:(CGRect)frame { |
| 88 | 88 | ||
| 89 | if (hidenRetry) { | 89 | if (hidenRetry) { |
| 90 | - if (type == RetryTypeError) { | 90 | + if (type == OrderRetryTypeError) { |
| 91 | [QMUITips showError:@"接口请求失败,请稍后再试!" inView:view hideAfterDelay:1.5]; | 91 | [QMUITips showError:@"接口请求失败,请稍后再试!" inView:view hideAfterDelay:1.5]; |
| 92 | } else { | 92 | } else { |
| 93 | [QMUITips showError:@"网络连接失败,请稍后再试!" inView:view hideAfterDelay:1.5]; | 93 | [QMUITips showError:@"网络连接失败,请稍后再试!" inView:view hideAfterDelay:1.5]; |
| @@ -108,7 +108,7 @@ static const char retryKey; | @@ -108,7 +108,7 @@ static const char retryKey; | ||
| 108 | return tipView; | 108 | return tipView; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | -- (instancetype)initWithView:(UIView *)view type:(RetryType)type frame:(CGRect)frame | 111 | +- (instancetype)initWithView:(UIView *)view type:(OrderRetryType)type frame:(CGRect)frame |
| 112 | { | 112 | { |
| 113 | self = [super initWithFrame:frame]; | 113 | self = [super initWithFrame:frame]; |
| 114 | if (self) { | 114 | if (self) { |
| @@ -118,7 +118,7 @@ static const char retryKey; | @@ -118,7 +118,7 @@ static const char retryKey; | ||
| 118 | [self addSubview:self.tipLab]; | 118 | [self addSubview:self.tipLab]; |
| 119 | [self addSubview:self.retryBtn]; | 119 | [self addSubview:self.retryBtn]; |
| 120 | 120 | ||
| 121 | - if (type == RetryTypeError) { | 121 | + if (type == OrderRetryTypeError) { |
| 122 | self.errorLab.text = @"接口请求错误"; | 122 | self.errorLab.text = @"接口请求错误"; |
| 123 | } else { | 123 | } else { |
| 124 | self.errorLab.text = @"无法连接网络"; | 124 | self.errorLab.text = @"无法连接网络"; |
CNLiveMyOrderModule/Classes/View/CNLiveMineOrderView.m
| @@ -12,12 +12,13 @@ | @@ -12,12 +12,13 @@ | ||
| 12 | #import <QMUIKit/QMUIKit.h> | 12 | #import <QMUIKit/QMUIKit.h> |
| 13 | #import "CNLiveCommonCategory.h" | 13 | #import "CNLiveCommonCategory.h" |
| 14 | #import "CNLiveBaseKit.h" | 14 | #import "CNLiveBaseKit.h" |
| 15 | -//#import "TIMAdapter.h" | 15 | +#import "TIMAdapter.h" |
| 16 | #import <SDWebImage/SDWebImage.h> | 16 | #import <SDWebImage/SDWebImage.h> |
| 17 | -#import "DSAddressModel.h" | 17 | +#import <DSCnliveShopSDK/DSCnliveShopSDK.h> |
| 18 | #import "CNLiveSelectRefundButton.h" | 18 | #import "CNLiveSelectRefundButton.h" |
| 19 | #import "CNLiveMineOrderItem.h" | 19 | #import "CNLiveMineOrderItem.h" |
| 20 | #import "CNLiveOrderList.h" | 20 | #import "CNLiveOrderList.h" |
| 21 | +#import "HUDHelper.h" | ||
| 21 | #define Large_Font [UIFont systemFontOfSize:15.0f] | 22 | #define Large_Font [UIFont systemFontOfSize:15.0f] |
| 22 | #define Default_Font [UIFont systemFontOfSize:15.0f] | 23 | #define Default_Font [UIFont systemFontOfSize:15.0f] |
| 23 | #define Small_Font [UIFont systemFontOfSize:14.0f] | 24 | #define Small_Font [UIFont systemFontOfSize:14.0f] |
| @@ -882,7 +883,6 @@ | @@ -882,7 +883,6 @@ | ||
| 882 | } | 883 | } |
| 883 | @end | 884 | @end |
| 884 | #pragma mark - CNLiveAddressView | 885 | #pragma mark - CNLiveAddressView |
| 885 | -#import "DSAddressModel.h" | ||
| 886 | @interface CNLiveAddressView () | 886 | @interface CNLiveAddressView () |
| 887 | @property (nonatomic, strong) QMUILabel *nameLab; | 887 | @property (nonatomic, strong) QMUILabel *nameLab; |
| 888 | @property (nonatomic, strong) QMUILabel *phoneLab; | 888 | @property (nonatomic, strong) QMUILabel *phoneLab; |
| @@ -1438,8 +1438,8 @@ | @@ -1438,8 +1438,8 @@ | ||
| 1438 | 1438 | ||
| 1439 | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; | 1439 | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; |
| 1440 | pasteboard.string = orderItem.orderId; | 1440 | pasteboard.string = orderItem.orderId; |
| 1441 | -// [[HUDHelper sharedInstance] tipMessage:@"复制成功且可以粘贴对应编号"]; | ||
| 1442 | - [QMUITips showWithText:@"复制成功且可以粘贴对应编号" inView:self hideAfterDelay:1.5f]; | 1441 | + [[HUDHelper sharedInstance] tipMessage:@"复制成功且可以粘贴对应编号"]; |
| 1442 | +// [QMUITips showWithText:@"复制成功且可以粘贴对应编号" inView:self hideAfterDelay:1.5f]; | ||
| 1443 | } | 1443 | } |
| 1444 | - (void)updateCutdown:(NSInteger)seconds { | 1444 | - (void)updateCutdown:(NSInteger)seconds { |
| 1445 | 1445 |
CNLiveMyOrderModule/Classes/View/CNLiveOrderListCommonView.m
| @@ -18,10 +18,11 @@ | @@ -18,10 +18,11 @@ | ||
| 18 | #import "MJExtension.h" | 18 | #import "MJExtension.h" |
| 19 | #import "CNUserInfoManager.h" | 19 | #import "CNUserInfoManager.h" |
| 20 | //#import "TIMAdapter.h" | 20 | //#import "TIMAdapter.h" |
| 21 | -//#import "CommonLibrary.h" | 21 | +#import "HUDHelper.h" |
| 22 | #import "CNLiveCommonCategory.h" | 22 | #import "CNLiveCommonCategory.h" |
| 23 | #import "CNLiveOrderViewModel.h" | 23 | #import "CNLiveOrderViewModel.h" |
| 24 | #import "CNLiveOrderList.h" | 24 | #import "CNLiveOrderList.h" |
| 25 | +#import "CNLiveRefreshHeader.h" | ||
| 25 | static const CGFloat KCategoryViewHeight = 44; | 26 | static const CGFloat KCategoryViewHeight = 44; |
| 26 | @interface CNLiveOrderListCommonView ()<UITableViewDelegate,UITableViewDataSource,CNLiveMineOrderTableViewCellDelegate> | 27 | @interface CNLiveOrderListCommonView ()<UITableViewDelegate,UITableViewDataSource,CNLiveMineOrderTableViewCellDelegate> |
| 27 | @property (nonatomic, strong) NSMutableArray *listArr; //数据源 | 28 | @property (nonatomic, strong) NSMutableArray *listArr; //数据源 |
| @@ -67,6 +68,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -67,6 +68,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 67 | } | 68 | } |
| 68 | if (dataSource.count > 0) { | 69 | if (dataSource.count > 0) { |
| 69 | [strongSelf.noDataView removeFromSuperview]; | 70 | [strongSelf.noDataView removeFromSuperview]; |
| 71 | + strongSelf.isHaveNext = isHaveNet; | ||
| 70 | strongSelf.tableView.mj_footer.hidden = !strongSelf.isHaveNext; | 72 | strongSelf.tableView.mj_footer.hidden = !strongSelf.isHaveNext; |
| 71 | [self.listArr addObjectsFromArray:dataSource]; | 73 | [self.listArr addObjectsFromArray:dataSource]; |
| 72 | if (strongSelf.isHaveNext) { | 74 | if (strongSelf.isHaveNext) { |
| @@ -77,7 +79,6 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -77,7 +79,6 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 77 | } else { | 79 | } else { |
| 78 | [strongSelf.tableView addSubview:strongSelf.noDataView]; | 80 | [strongSelf.tableView addSubview:strongSelf.noDataView]; |
| 79 | } | 81 | } |
| 80 | - strongSelf.isHaveNext = isHaveNet; | ||
| 81 | strongSelf.tableView.mj_footer.hidden = !strongSelf.isHaveNext; | 82 | strongSelf.tableView.mj_footer.hidden = !strongSelf.isHaveNext; |
| 82 | [strongSelf.tableView reloadData]; | 83 | [strongSelf.tableView reloadData]; |
| 83 | 84 | ||
| @@ -88,9 +89,9 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -88,9 +89,9 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 88 | [QMUITips showError:error.localizedDescription inView:self hideAfterDelay:1.5f]; | 89 | [QMUITips showError:error.localizedDescription inView:self hideAfterDelay:1.5f]; |
| 89 | } else { | 90 | } else { |
| 90 | if (error.code == -1009 || error.code == -1001) { | 91 | if (error.code == -1009 || error.code == -1001) { |
| 91 | - [weakSelf showErrorRetryType:RetryTypeNoNet]; | 92 | + [weakSelf showErrorRetryType:OrderRetryTypeNoNet]; |
| 92 | }else { | 93 | }else { |
| 93 | - [weakSelf showErrorRetryType:RetryTypeError]; | 94 | + [weakSelf showErrorRetryType:OrderRetryTypeError]; |
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| 96 | }]; | 97 | }]; |
| @@ -145,7 +146,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -145,7 +146,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 145 | } | 146 | } |
| 146 | } | 147 | } |
| 147 | #pragma mark - 展示错误页 | 148 | #pragma mark - 展示错误页 |
| 148 | -- (void)showErrorRetryType:(RetryType)type { | 149 | +- (void)showErrorRetryType:(OrderRetryType)type { |
| 149 | __weak typeof(self) weakSelf = self; | 150 | __weak typeof(self) weakSelf = self; |
| 150 | [CNLiveErrorOrNoNetView showErrorByType:type view:self hidenRetry:self.listArr.count > 0 handle:^{ | 151 | [CNLiveErrorOrNoNetView showErrorByType:type view:self hidenRetry:self.listArr.count > 0 handle:^{ |
| 151 | [weakSelf loadMoreData]; | 152 | [weakSelf loadMoreData]; |
| @@ -211,7 +212,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -211,7 +212,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 211 | 212 | ||
| 212 | case CNLiveMineOrderButtonItemTypeReminder: { //催单 | 213 | case CNLiveMineOrderButtonItemTypeReminder: { //催单 |
| 213 | [CNLiveOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { | 214 | [CNLiveOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { |
| 214 | -// [[HUDHelper sharedInstance] tipMessage:msg]; | 215 | + [[HUDHelper sharedInstance] tipMessage:msg]; |
| 215 | }]; | 216 | }]; |
| 216 | } | 217 | } |
| 217 | break; | 218 | break; |
| @@ -277,7 +278,6 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -277,7 +278,6 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 277 | 278 | ||
| 278 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | 279 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| 279 | [self.tableView qmui_clearsSelection]; | 280 | [self.tableView qmui_clearsSelection]; |
| 280 | - | ||
| 281 | CNLiveMineOrderTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | 281 | CNLiveMineOrderTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; |
| 282 | [CNLiveOrderEventHandle orderDetail:cell.list orderBlock:^(NSString * _Nonnull orderId) { | 282 | [CNLiveOrderEventHandle orderDetail:cell.list orderBlock:^(NSString * _Nonnull orderId) { |
| 283 | if (self.orderDetaielCellDidSelectedBlock) { | 283 | if (self.orderDetaielCellDidSelectedBlock) { |
| @@ -295,7 +295,7 @@ static const CGFloat KCategoryViewHeight = 44; | @@ -295,7 +295,7 @@ static const CGFloat KCategoryViewHeight = 44; | ||
| 295 | _tableView.dataSource = self; | 295 | _tableView.dataSource = self; |
| 296 | _tableView.tableFooterView = [UIView new]; | 296 | _tableView.tableFooterView = [UIView new]; |
| 297 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | 297 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
| 298 | - _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshList)]; | 298 | + _tableView.mj_header = [CNLiveRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshList)]; |
| 299 | _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(refreshMoreData)]; | 299 | _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(refreshMoreData)]; |
| 300 | } | 300 | } |
| 301 | return _tableView; | 301 | return _tableView; |
CNLiveMyOrderModule/Classes/View/CNLiveSelectedRefundReasonView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveSelectedRefundReasonView.h | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/27. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <UIKit/UIKit.h> | ||
| 9 | +NS_ASSUME_NONNULL_BEGIN | ||
| 10 | +typedef void(^ReasonBlock)(NSString *reason); | ||
| 11 | +@interface CNLiveSelectedRefundReasonView : UIView | ||
| 12 | +-(instancetype)initWithFrame:(CGRect)frame completionBlock:(ReasonBlock)completion; | ||
| 13 | +- (void)show; | ||
| 14 | +- (void)dismiss; | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +@interface CNLiveSelectedRefundReasonCell : UITableViewCell | ||
| 18 | +@property (nonatomic, strong) NSString *text; | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/View/CNLiveSelectedRefundReasonView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveSelectedRefundReasonView.m | ||
| 3 | +// CNLiveMyOrderModule | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/11/27. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveSelectedRefundReasonView.h" | ||
| 9 | +#define Cell_H 55 | ||
| 10 | + | ||
| 11 | +@interface CNLiveSelectedRefundReasonView ()<UITableViewDelegate,UITableViewDataSource> | ||
| 12 | +@property (nonatomic, strong) NSMutableArray *listArr; | ||
| 13 | +@property (nonatomic, assign) CGFloat height; | ||
| 14 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 15 | +@property (nonatomic, copy) ReasonBlock reasonBlock; | ||
| 16 | +@property (nonatomic, strong) UIButton *closeBtn; | ||
| 17 | +@property (nonatomic, strong) UIView *bgView; | ||
| 18 | +@end | ||
| 19 | + | ||
| 20 | +@implementation CNLiveSelectedRefundReasonView | ||
| 21 | + | ||
| 22 | +- (instancetype)initWithFrame:(CGRect)frame completionBlock:(ReasonBlock)completion | ||
| 23 | +{ | ||
| 24 | + self = [super initWithFrame:frame]; | ||
| 25 | + if (self) { | ||
| 26 | + | ||
| 27 | + } | ||
| 28 | + return self; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +@end |
CNLiveMyOrderModule/Classes/View/CNLiveUploadVoucher.m
| @@ -6,34 +6,34 @@ | @@ -6,34 +6,34 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import "CNLiveUploadVoucher.h" | 8 | #import "CNLiveUploadVoucher.h" |
| 9 | -//#import <CNLiveImagePickerController/TZImagePickerController.h> | ||
| 10 | -//#import "TZImageManager.h" | ||
| 11 | -//#import "LxGridViewFlowLayout.h" | ||
| 12 | -//#import "TZTestCell.h" | ||
| 13 | -//#import <AssetsLibrary/AssetsLibrary.h> | ||
| 14 | -//#import <Photos/Photos.h> | ||
| 15 | -//#import <YYKit/YYKit.h> | ||
| 16 | -//#import "CNImagePickerController.h" | ||
| 17 | -//#import "CNLiveBaseKit.h" | ||
| 18 | -//#import <QMUIKit/QMUIKit.h> | ||
| 19 | -//#import <Masonry/Masonry.h> | ||
| 20 | -//#import "CNLiveCommonCategory.h" | ||
| 21 | -@interface CNLiveUploadVoucher ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UIActionSheetDelegate>{ | 9 | +#import <CNLiveImagePickerController/TZImagePickerController.h> |
| 10 | +#import "TZImageManager.h" | ||
| 11 | +#import "LxGridViewFlowLayout.h" | ||
| 12 | +#import "TZTestCell.h" | ||
| 13 | +#import <AssetsLibrary/AssetsLibrary.h> | ||
| 14 | +#import <Photos/Photos.h> | ||
| 15 | +#import <YYKit/YYKit.h> | ||
| 16 | +#import "CNImagePickerController.h" | ||
| 17 | +#import "CNLiveBaseKit.h" | ||
| 18 | +#import <QMUIKit/QMUIKit.h> | ||
| 19 | +#import <Masonry/Masonry.h> | ||
| 20 | +#import "CNLiveCommonCategory.h" | ||
| 21 | +@interface CNLiveUploadVoucher ()<TZImagePickerControllerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UIActionSheetDelegate>{ | ||
| 22 | } | 22 | } |
| 23 | -//@property (nonatomic, strong) UIImagePickerController *imagePickerVc; | ||
| 24 | -// | ||
| 25 | -//@property (nonatomic, strong) UILabel *titleLab; | ||
| 26 | -//@property (nonatomic, strong) UICollectionView *collectionView; | ||
| 27 | -//@property (nonatomic, strong) LxGridViewFlowLayout *layout; | ||
| 28 | -//@property (nonatomic, strong) CLLocation *location; | ||
| 29 | -//@property (nonatomic, strong) NSMutableArray *selectedPhotos; | ||
| 30 | -//@property (nonatomic, strong) NSMutableArray *selectedAssets; | ||
| 31 | -//@property (nonatomic, assign) BOOL isSelectOriginalPhoto; | ||
| 32 | -//@property (nonatomic, assign) CGFloat itemWH; | ||
| 33 | -//@property (nonatomic, assign) CGFloat margin; | ||
| 34 | -//@property (nonatomic, assign) CGFloat collHeight; | ||
| 35 | -//@property (nonatomic, assign) CGFloat add; //是否隐藏加号 | ||
| 36 | -//@property (nonatomic, assign) CGFloat colTop; //collectionView 距离顶部坐标 | 23 | +@property (nonatomic, strong) UIImagePickerController *imagePickerVc; |
| 24 | + | ||
| 25 | +@property (nonatomic, strong) UILabel *titleLab; | ||
| 26 | +@property (nonatomic, strong) UICollectionView *collectionView; | ||
| 27 | +@property (nonatomic, strong) LxGridViewFlowLayout *layout; | ||
| 28 | +@property (nonatomic, strong) CLLocation *location; | ||
| 29 | +@property (nonatomic, strong) NSMutableArray *selectedPhotos; | ||
| 30 | +@property (nonatomic, strong) NSMutableArray *selectedAssets; | ||
| 31 | +@property (nonatomic, assign) BOOL isSelectOriginalPhoto; | ||
| 32 | +@property (nonatomic, assign) CGFloat itemWH; | ||
| 33 | +@property (nonatomic, assign) CGFloat margin; | ||
| 34 | +@property (nonatomic, assign) CGFloat collHeight; | ||
| 35 | +@property (nonatomic, assign) CGFloat add; //是否隐藏加号 | ||
| 36 | +@property (nonatomic, assign) CGFloat colTop; //collectionView 距离顶部坐标 | ||
| 37 | @end | 37 | @end |
| 38 | @implementation CNLiveUploadVoucher | 38 | @implementation CNLiveUploadVoucher |
| 39 | #pragma clang diagnostic push | 39 | #pragma clang diagnostic push |
| @@ -47,9 +47,9 @@ | @@ -47,9 +47,9 @@ | ||
| 47 | self = [super initWithFrame:frame]; | 47 | self = [super initWithFrame:frame]; |
| 48 | if (self) { | 48 | if (self) { |
| 49 | self.backgroundColor = [UIColor whiteColor]; | 49 | self.backgroundColor = [UIColor whiteColor]; |
| 50 | -// _add = 1; | ||
| 51 | -// _selectedPhotos = [[NSMutableArray alloc] init]; | ||
| 52 | -// _selectedAssets = [[NSMutableArray alloc] init]; | 50 | + _add = 1; |
| 51 | + _selectedPhotos = [[NSMutableArray alloc] init]; | ||
| 52 | + _selectedAssets = [[NSMutableArray alloc] init]; | ||
| 53 | [self configCollectionView]; | 53 | [self configCollectionView]; |
| 54 | } | 54 | } |
| 55 | return self; | 55 | return self; |
| @@ -57,386 +57,386 @@ | @@ -57,386 +57,386 @@ | ||
| 57 | #pragma mark - 添加collectionView | 57 | #pragma mark - 添加collectionView |
| 58 | - (void)configCollectionView { | 58 | - (void)configCollectionView { |
| 59 | // 如不需要长按排序效果,将LxGridViewFlowLayout类改成UICollectionViewFlowLayout即可 | 59 | // 如不需要长按排序效果,将LxGridViewFlowLayout类改成UICollectionViewFlowLayout即可 |
| 60 | -// _layout = [[LxGridViewFlowLayout alloc] init]; | ||
| 61 | -// _margin = 8; | ||
| 62 | -// _itemWH = (KScreenWidth - 20 - 2 * _margin - 4) / 3 - _margin; | ||
| 63 | -// _layout.itemSize = CGSizeMake(_itemWH, _itemWH); | ||
| 64 | -// _layout.minimumInteritemSpacing = _margin; | ||
| 65 | -// _layout.minimumLineSpacing = _margin; | ||
| 66 | -// _colTop = 20; | ||
| 67 | -// if (self.titleLabel) { | ||
| 68 | -// _colTop += self.titleLabel.height+15; | ||
| 69 | -// [self addSubview:self.titleLabel]; | ||
| 70 | -// } | ||
| 71 | -// _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, _colTop, KScreenWidth-20, _itemWH+10) collectionViewLayout:_layout]; | ||
| 72 | -// _collectionView.alwaysBounceVertical = YES; | ||
| 73 | -// _collectionView.backgroundColor = [UIColor whiteColor]; | ||
| 74 | -// _collectionView.contentInset = UIEdgeInsetsMake(4, 4, 4, 4); | ||
| 75 | -// _collectionView.dataSource = self; | ||
| 76 | -// _collectionView.delegate = self; | ||
| 77 | -// _collectionView.scrollEnabled = NO; | ||
| 78 | -// _collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag; | ||
| 79 | -// [self addSubview:_collectionView]; | ||
| 80 | -// [_collectionView registerClass:[TZTestCell class] forCellWithReuseIdentifier:@"TZTestCell"]; | 60 | + _layout = [[LxGridViewFlowLayout alloc] init]; |
| 61 | + _margin = 8; | ||
| 62 | + _itemWH = (KScreenWidth - 20 - 2 * _margin - 4) / 3 - _margin; | ||
| 63 | + _layout.itemSize = CGSizeMake(_itemWH, _itemWH); | ||
| 64 | + _layout.minimumInteritemSpacing = _margin; | ||
| 65 | + _layout.minimumLineSpacing = _margin; | ||
| 66 | + _colTop = 20; | ||
| 67 | + if (self.titleLabel) { | ||
| 68 | + _colTop += self.titleLabel.height+15; | ||
| 69 | + [self addSubview:self.titleLabel]; | ||
| 70 | + } | ||
| 71 | + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, _colTop, KScreenWidth-20, _itemWH+10) collectionViewLayout:_layout]; | ||
| 72 | + _collectionView.alwaysBounceVertical = YES; | ||
| 73 | + _collectionView.backgroundColor = [UIColor whiteColor]; | ||
| 74 | + _collectionView.contentInset = UIEdgeInsetsMake(4, 4, 4, 4); | ||
| 75 | + _collectionView.dataSource = self; | ||
| 76 | + _collectionView.delegate = self; | ||
| 77 | + _collectionView.scrollEnabled = NO; | ||
| 78 | + _collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag; | ||
| 79 | + [self addSubview:_collectionView]; | ||
| 80 | + [_collectionView registerClass:[TZTestCell class] forCellWithReuseIdentifier:@"TZTestCell"]; | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | #pragma mark - Action | 83 | #pragma mark - Action |
| 84 | #pragma mark - Action | 84 | #pragma mark - Action |
| 85 | -//- (void)deleteBtnClik:(UIButton *)sender { | ||
| 86 | -// __weak typeof(self) weakSelf = self; | ||
| 87 | -// [_selectedPhotos removeObjectAtIndex:sender.tag]; | ||
| 88 | -// [_selectedAssets removeObjectAtIndex:sender.tag]; | ||
| 89 | -// [_collectionView performBatchUpdates:^{ | ||
| 90 | -// NSIndexPath *indexPath = [NSIndexPath indexPathForItem:sender.tag inSection:0]; | ||
| 91 | -// [weakSelf.collectionView deleteItemsAtIndexPaths:@[indexPath]]; | ||
| 92 | -// } completion:^(BOOL finished) { | ||
| 93 | -// weakSelf.add = 1; | ||
| 94 | -// [weakSelf updateHeight]; | ||
| 95 | -// }]; | ||
| 96 | -// | ||
| 97 | -//} | ||
| 98 | -// | ||
| 99 | -//#pragma mark - UICollectionViewdelegate | ||
| 100 | -// | ||
| 101 | -//- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | ||
| 102 | -// return self.selectedPhotos.count + self.add; | ||
| 103 | -//} | ||
| 104 | -//- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 105 | -// TZTestCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZTestCell" forIndexPath:indexPath]; | ||
| 106 | -// cell.videoImageView.hidden = YES; | ||
| 107 | -// cell.gifLable.hidden = YES; | ||
| 108 | -// | ||
| 109 | -// if (indexPath.row == _selectedPhotos.count) { | ||
| 110 | -// cell.imageView.image = [UIImage cnLive_getImageNameWithBundle:@"pj_tianjiazhaopian" bundle:@"CNLiveMyOrderModule.bundle/CNLiveMyOrderModule" targetClass:[self class]]; | ||
| 111 | -// cell.deleteBtn.hidden = YES; | ||
| 112 | -// } else { | ||
| 113 | -// cell.imageView.image = _selectedPhotos[indexPath.row]; | ||
| 114 | -// cell.asset = _selectedAssets[indexPath.row]; | ||
| 115 | -// cell.deleteBtn.hidden = NO; | ||
| 116 | -// } | ||
| 117 | -// | ||
| 118 | -// cell.deleteBtn.tag = indexPath.row; | ||
| 119 | -// [cell.deleteBtn addTarget:self action:@selector(deleteBtnClik:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 120 | -// return cell; | ||
| 121 | -//} | ||
| 122 | -// | ||
| 123 | -//- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 124 | -// __weak typeof(self) weakSelf = self; | ||
| 125 | -// if (indexPath.row == _selectedPhotos.count) { | ||
| 126 | -// | ||
| 127 | -// [self createAlertViewTitleArray:@[@"拍照",@"从相册选取"] textColor:KTextBlackColor font:UIFontMake(15) actionBlock:^(UIButton *button, NSInteger didRow) { | ||
| 128 | -// | ||
| 129 | -// switch (didRow) { | ||
| 130 | -// case 0: { | ||
| 131 | -// [self takePhoto]; | ||
| 132 | -// } | ||
| 133 | -// break; | ||
| 134 | -// | ||
| 135 | -// case 1: { | ||
| 136 | -// [self pushTZImagePickerController]; | ||
| 137 | -// } | ||
| 138 | -// break; | ||
| 139 | -// | ||
| 140 | -// default: | ||
| 141 | -// break; | ||
| 142 | -// } | ||
| 143 | -// | ||
| 144 | -// }]; | ||
| 145 | -// | ||
| 146 | -// } else { //预览照片 | ||
| 147 | -// CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.row]; | ||
| 148 | -// [imagePickerVc configTZImagePicker]; | ||
| 149 | -// imagePickerVc.maxImagesCount = 9; | ||
| 150 | -// imagePickerVc.allowPickingGif = NO; | ||
| 151 | -// imagePickerVc.allowPickingOriginalPhoto = YES; | ||
| 152 | -// imagePickerVc.allowPickingMultipleVideo = NO; | ||
| 153 | -// imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; | ||
| 154 | -// [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | ||
| 155 | -// weakSelf.selectedPhotos = [NSMutableArray arrayWithArray:photos]; | ||
| 156 | -// weakSelf.selectedAssets = [NSMutableArray arrayWithArray:assets]; | ||
| 157 | -// weakSelf.isSelectOriginalPhoto = isSelectOriginalPhoto; | ||
| 158 | -// [weakSelf.collectionView reloadData]; | ||
| 159 | -// weakSelf.collectionView.contentSize = CGSizeMake(0, ((weakSelf.selectedPhotos.count + 2) / 3 ) * (weakSelf.margin + weakSelf.itemWH)); | ||
| 160 | -// }]; | ||
| 161 | -// [self.viewController presentViewController:imagePickerVc animated:YES completion:nil]; | ||
| 162 | -// | ||
| 163 | -// } | ||
| 164 | -//} | ||
| 165 | -//#pragma mark - LxGridViewDataSource | ||
| 166 | -///// 以下三个方法为长按排序相关代码 | ||
| 167 | -//- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 168 | -// return indexPath.item < _selectedPhotos.count; | ||
| 169 | -//} | ||
| 170 | -// | ||
| 171 | -//- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)sourceIndexPath canMoveToIndexPath:(NSIndexPath *)destinationIndexPath { | ||
| 172 | -// return (sourceIndexPath.item < _selectedPhotos.count && destinationIndexPath.item < _selectedPhotos.count); | ||
| 173 | -//} | ||
| 174 | -// | ||
| 175 | -//- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)sourceIndexPath didMoveToIndexPath:(NSIndexPath *)destinationIndexPath { | ||
| 176 | -// UIImage *image = _selectedPhotos[sourceIndexPath.item]; | ||
| 177 | -// [_selectedPhotos removeObjectAtIndex:sourceIndexPath.item]; | ||
| 178 | -// [_selectedPhotos insertObject:image atIndex:destinationIndexPath.item]; | ||
| 179 | -// | ||
| 180 | -// id asset = _selectedAssets[sourceIndexPath.item]; | ||
| 181 | -// [_selectedAssets removeObjectAtIndex:sourceIndexPath.item]; | ||
| 182 | -// [_selectedAssets insertObject:asset atIndex:destinationIndexPath.item]; | ||
| 183 | -// | ||
| 184 | -// [_collectionView reloadData]; | ||
| 185 | -// | ||
| 186 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(updateImages:)]) { | ||
| 187 | -// [self.delegate updateImages:_selectedAssets]; | ||
| 188 | -// } | ||
| 189 | -//} | ||
| 190 | -// | ||
| 191 | -//#pragma mark - UIImagePickerController | ||
| 192 | -//- (void)takePhoto { | ||
| 193 | -// AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | ||
| 194 | -// if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) && iOS7Later) { | ||
| 195 | -// // 无相机权限 做一个友好的提示 | ||
| 196 | -// if (iOS8Later) { | ||
| 197 | -// UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的“设置-隐私-相机“中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];//设置 | ||
| 198 | -// | ||
| 199 | -// [alert show]; | ||
| 200 | -// } | ||
| 201 | -// } else if (authStatus == AVAuthorizationStatusNotDetermined) { | ||
| 202 | -// // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏 | ||
| 203 | -// if (iOS7Later) { | ||
| 204 | -// [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { | ||
| 205 | -// if (granted) { | ||
| 206 | -// dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 207 | -// [self takePhoto]; | ||
| 208 | -// }); | ||
| 209 | -// } | ||
| 210 | -// }]; | ||
| 211 | -// } else { | ||
| 212 | -// [self takePhoto]; | ||
| 213 | -// } | ||
| 214 | -// // 拍照之前还需要检查相册权限 | ||
| 215 | -// } else if ([TZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 | ||
| 216 | -// if (iOS8Later) { | ||
| 217 | -// UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的“设置-隐私-相册“中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];//设置 | ||
| 218 | -// [alert show]; | ||
| 219 | -// } | ||
| 220 | -// } else if ([TZImageManager authorizationStatus] == 0) { // 未请求过相册权限 | ||
| 221 | -// [[TZImageManager manager] requestAuthorizationWithCompletion:^{ | ||
| 222 | -// [self takePhoto]; | ||
| 223 | -// }]; | ||
| 224 | -// } else { | ||
| 225 | -// [self pushImagePickerController]; | ||
| 226 | -// } | ||
| 227 | -//} | ||
| 228 | -//// 调用相机 | ||
| 229 | -//- (void)pushImagePickerController { | ||
| 230 | -// UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; | ||
| 231 | -// if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { | ||
| 232 | -// self.imagePickerVc.sourceType = sourceType; | ||
| 233 | -// if(iOS8Later) { | ||
| 234 | -// _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext; | ||
| 235 | -// } | ||
| 236 | -// [self.viewController presentViewController:_imagePickerVc animated:YES completion:nil]; | ||
| 237 | -// } else { | ||
| 238 | -// NSLog(@"模拟器中无法打开照相机,请在真机中使用"); | ||
| 239 | -// } | ||
| 240 | -//} | ||
| 241 | -//#pragma mark - TZImagePickerController | ||
| 242 | -////- (void)pushTZImagePickerController { | ||
| 243 | -//// CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc]initWithMaxImagesCount:9 columnNumber:4 delegate:self pushPhotoPickerVc:YES]; | ||
| 244 | -//// [imagePickerVc configTZImagePicker];//配置 | ||
| 245 | -////#pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 | ||
| 246 | -//// imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; | ||
| 247 | -//// | ||
| 248 | -//// imagePickerVc.selectedAssets = _selectedAssets; //目前已经选中的图片数组 | ||
| 249 | -//// imagePickerVc.allowTakePicture = NO; //在内部显示拍照按钮 | ||
| 250 | -//// imagePickerVc.allowPickingVideo = NO; //是否允许选择视频 | ||
| 251 | -//// imagePickerVc.allowPickingImage = YES; //是否允许选择图片 | ||
| 252 | -//// imagePickerVc.allowPickingOriginalPhoto = YES; //选择原图 | ||
| 253 | -//// imagePickerVc.allowPickingGif = NO; //选择Gif | ||
| 254 | -//// imagePickerVc.allowPickingMultipleVideo = NO; // 是否可以多选视频 | ||
| 255 | -//// imagePickerVc.sortAscendingByModificationDate = YES;//排序 | ||
| 256 | -//// imagePickerVc.showSelectBtn = NO; | ||
| 257 | -//// imagePickerVc.allowCrop = NO; //是否允许裁剪 | ||
| 258 | -//// imagePickerVc.needCircleCrop = NO; //是否使用圆形裁剪 | ||
| 259 | -//// | ||
| 260 | -//// // 你可以通过block或者代理,来得到用户选择的照片. | ||
| 261 | -//// [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | ||
| 262 | -//// | ||
| 263 | -//// }]; | ||
| 264 | -//// [self.viewController presentViewController:imagePickerVc animated:YES completion:nil]; | ||
| 265 | -////} | ||
| 266 | -//- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { | ||
| 267 | -// [picker dismissViewControllerAnimated:YES completion:nil]; | ||
| 268 | -// NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; | ||
| 269 | -// if ([type isEqualToString:@"public.image"]) { | ||
| 270 | -// TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | ||
| 271 | -// tzImagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | ||
| 272 | -// tzImagePickerVc.sortAscendingByModificationDate = YES; | ||
| 273 | -// [tzImagePickerVc showProgressHUD]; | ||
| 274 | -// UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; | ||
| 275 | -// | ||
| 276 | -// // save photo and get asset / 保存图片,获取到asset | ||
| 277 | -// [[TZImageManager manager] savePhotoWithImage:image location:nil completion:^(NSError *error){ | ||
| 278 | -// [tzImagePickerVc hideProgressHUD]; | ||
| 279 | -// if (error) { | ||
| 280 | -// [tzImagePickerVc hideProgressHUD]; | ||
| 281 | -// NSLog(@"图片保存失败 %@",error); | ||
| 282 | -// } else { | ||
| 283 | -// [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(TZAlbumModel *model) { | ||
| 284 | -// [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) { | ||
| 285 | -// [tzImagePickerVc hideProgressHUD]; | ||
| 286 | -// TZAssetModel *assetModel = [models firstObject]; | ||
| 287 | -// if (tzImagePickerVc.sortAscendingByModificationDate) { | ||
| 288 | -// assetModel = [models lastObject]; | ||
| 289 | -// } | ||
| 290 | -// | ||
| 291 | -// [self refreshCollectionViewWithAddedAsset:assetModel.asset image:image]; | ||
| 292 | -// | ||
| 293 | -// }]; | ||
| 294 | -// }]; | ||
| 295 | -// } | ||
| 296 | -// }]; | ||
| 297 | -// } | ||
| 298 | -//} | ||
| 299 | -// | ||
| 300 | -//- (void)refreshCollectionViewWithAddedAsset:(id)asset image:(UIImage *)image { | ||
| 301 | -// [_selectedAssets addObject:asset]; | ||
| 302 | -// [_selectedPhotos addObject:image]; | ||
| 303 | -// [_collectionView reloadData]; | ||
| 304 | -// | ||
| 305 | -// if (_selectedPhotos.count == 9) { | ||
| 306 | -// _add = 0; | ||
| 307 | -// } else { | ||
| 308 | -// _add = 1; | ||
| 309 | -// } | ||
| 310 | -// | ||
| 311 | -// [self updateHeight]; | ||
| 312 | -// | ||
| 313 | -//} | ||
| 314 | -//- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { | ||
| 315 | -// if ([picker isKindOfClass:[UIImagePickerController class]]) { | ||
| 316 | -// [picker dismissViewControllerAnimated:YES completion:nil]; | ||
| 317 | -// } | ||
| 318 | -//} | ||
| 319 | -// | ||
| 320 | -//#pragma mark - UIActionSheetDelegate | ||
| 321 | -// | ||
| 322 | -//- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { | ||
| 323 | -// if (buttonIndex == 0) { // take photo / 去拍照 | ||
| 324 | -// [self takePhoto]; | ||
| 325 | -// } else if (buttonIndex == 1) { | ||
| 326 | -// [self pushTZImagePickerController]; | ||
| 327 | -// } | ||
| 328 | -//} | ||
| 329 | -// | ||
| 330 | -//#pragma mark - UIAlertViewDelegate | ||
| 331 | -//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { | ||
| 332 | -// if (buttonIndex == 1) { // 去设置界面,开启相机访问权限 | ||
| 333 | -// if (iOS8Later) { | ||
| 334 | -// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; | ||
| 335 | -// } | ||
| 336 | -// } | ||
| 337 | -//} | ||
| 338 | -// | ||
| 339 | -//#pragma mark - TZImagePickerControllerDelegate | ||
| 340 | -//- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker { | ||
| 341 | -// // NSLog(@"cancel"); | ||
| 342 | -//} | ||
| 343 | -// | ||
| 344 | -//- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos { | ||
| 345 | -// _selectedPhotos = [NSMutableArray arrayWithArray:photos]; | ||
| 346 | -// _selectedAssets = [NSMutableArray arrayWithArray:assets]; | ||
| 347 | -// _isSelectOriginalPhoto = isSelectOriginalPhoto; | ||
| 348 | -// | ||
| 349 | -// if (_selectedPhotos.count == 9) { | ||
| 350 | -// _add = 0; | ||
| 351 | -// } else { | ||
| 352 | -// _add = 1; | ||
| 353 | -// } | ||
| 354 | -// | ||
| 355 | -// [self updateHeight]; | ||
| 356 | -// | ||
| 357 | -//} | ||
| 358 | -// | ||
| 359 | -////更新自身高度 | ||
| 360 | -//- (void)updateHeight { | ||
| 361 | -// | ||
| 362 | -// NSInteger num = 0; | ||
| 363 | -// if (_selectedAssets.count == 9) { | ||
| 364 | -// num = 9; | ||
| 365 | -// } else { | ||
| 366 | -// num = _selectedAssets.count+1; | ||
| 367 | -// } | ||
| 368 | -// | ||
| 369 | -// NSInteger integer = num/3; | ||
| 370 | -// NSInteger remainder = num%3; | ||
| 371 | -// | ||
| 372 | -// if (remainder > 0) { | ||
| 373 | -// integer += 1; | ||
| 374 | -// } | ||
| 375 | -// | ||
| 376 | -// _collectionView.frame = CGRectMake(10, _colTop, KScreenWidth-20, _itemWH*integer + integer*_margin +10); | ||
| 377 | -// [_collectionView reloadData]; | ||
| 378 | -// | ||
| 379 | -// CGFloat h = _collectionView.height + integer*_margin + 60; | ||
| 380 | -// [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 381 | -// make.height.mas_equalTo(h); | ||
| 382 | -// }]; | ||
| 383 | -// | ||
| 384 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(updateImages:)]) { | ||
| 385 | -// [self.delegate updateImages:_selectedPhotos]; | ||
| 386 | -// } | ||
| 387 | -// | ||
| 388 | -//} | ||
| 389 | -// | ||
| 390 | -// | ||
| 391 | -//// Decide album show or not't | ||
| 392 | -//// 决定相册显示与否 | ||
| 393 | -//- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(id)result { | ||
| 394 | -// return YES; | ||
| 395 | -//} | ||
| 396 | -// | ||
| 397 | -//// Decide asset show or not't | ||
| 398 | -//// 决定asset显示与否 | ||
| 399 | -//- (BOOL)isAssetCanSelect:(id)asset { | ||
| 400 | -// return YES; | ||
| 401 | -//} | ||
| 402 | -// | ||
| 403 | -//#pragma mark - | ||
| 404 | -//#pragma mark - Getter | ||
| 405 | -//- (UILabel *)titleLab | ||
| 406 | -//{ | ||
| 407 | -// if (!_titleLab) { | ||
| 408 | -// _titleLab = [[UILabel alloc] init]; | ||
| 409 | -// _titleLab.font = [UIFont systemFontOfSize:15]; | ||
| 410 | -// _titleLab.text = @"上传照片"; | ||
| 411 | -// } | ||
| 412 | -// return _titleLab; | ||
| 413 | -//} | ||
| 414 | -// | ||
| 415 | -//- (UIImagePickerController *)imagePickerVc { | ||
| 416 | -// if (_imagePickerVc == nil) { | ||
| 417 | -// _imagePickerVc = [[UIImagePickerController alloc] init]; | ||
| 418 | -// _imagePickerVc.delegate = self; | ||
| 419 | -// // set appearance / 改变相册选择页的导航栏外观 | ||
| 420 | -// if (iOS7Later) { | ||
| 421 | -// _imagePickerVc.navigationBar.barTintColor = self.viewController.navigationController.navigationBar.barTintColor; | ||
| 422 | -// } | ||
| 423 | -// _imagePickerVc.navigationBar.tintColor = self.viewController.navigationController.navigationBar.tintColor; | ||
| 424 | -// UIBarButtonItem *tzBarItem, *BarItem; | ||
| 425 | -// if (iOS9Later) { | ||
| 426 | -// tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; | ||
| 427 | -// BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; | ||
| 428 | -// } else { | ||
| 429 | -// tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; | ||
| 430 | -// BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil]; | ||
| 431 | -// } | ||
| 432 | -// NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; | ||
| 433 | -// [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; | ||
| 434 | -// | ||
| 435 | -// } | ||
| 436 | -// return _imagePickerVc; | ||
| 437 | -//} | ||
| 438 | -// | ||
| 439 | -//#pragma clang diagnostic pop | 85 | +- (void)deleteBtnClik:(UIButton *)sender { |
| 86 | + __weak typeof(self) weakSelf = self; | ||
| 87 | + [_selectedPhotos removeObjectAtIndex:sender.tag]; | ||
| 88 | + [_selectedAssets removeObjectAtIndex:sender.tag]; | ||
| 89 | + [_collectionView performBatchUpdates:^{ | ||
| 90 | + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:sender.tag inSection:0]; | ||
| 91 | + [weakSelf.collectionView deleteItemsAtIndexPaths:@[indexPath]]; | ||
| 92 | + } completion:^(BOOL finished) { | ||
| 93 | + weakSelf.add = 1; | ||
| 94 | + [weakSelf updateHeight]; | ||
| 95 | + }]; | ||
| 96 | + | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +#pragma mark - UICollectionViewdelegate | ||
| 100 | + | ||
| 101 | +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | ||
| 102 | + return self.selectedPhotos.count + self.add; | ||
| 103 | +} | ||
| 104 | +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 105 | + TZTestCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZTestCell" forIndexPath:indexPath]; | ||
| 106 | + cell.videoImageView.hidden = YES; | ||
| 107 | + cell.gifLable.hidden = YES; | ||
| 108 | + | ||
| 109 | + if (indexPath.row == _selectedPhotos.count) { | ||
| 110 | + cell.imageView.image = [UIImage cnLive_getImageNameWithBundle:@"pj_tianjiazhaopian" bundle:@"CNLiveMyOrderModule.bundle/CNLiveMyOrderModule" targetClass:[self class]]; | ||
| 111 | + cell.deleteBtn.hidden = YES; | ||
| 112 | + } else { | ||
| 113 | + cell.imageView.image = _selectedPhotos[indexPath.row]; | ||
| 114 | + cell.asset = _selectedAssets[indexPath.row]; | ||
| 115 | + cell.deleteBtn.hidden = NO; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + cell.deleteBtn.tag = indexPath.row; | ||
| 119 | + [cell.deleteBtn addTarget:self action:@selector(deleteBtnClik:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 120 | + return cell; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 124 | + __weak typeof(self) weakSelf = self; | ||
| 125 | + if (indexPath.row == _selectedPhotos.count) { | ||
| 126 | + | ||
| 127 | + [self createAlertViewTitleArray:@[@"拍照",@"从相册选取"] textColor:KTextBlackColor font:UIFontMake(15) actionBlock:^(UIButton *button, NSInteger didRow) { | ||
| 128 | + | ||
| 129 | + switch (didRow) { | ||
| 130 | + case 0: { | ||
| 131 | + [self takePhoto]; | ||
| 132 | + } | ||
| 133 | + break; | ||
| 134 | + | ||
| 135 | + case 1: { | ||
| 136 | + [self pushTZImagePickerController]; | ||
| 137 | + } | ||
| 138 | + break; | ||
| 139 | + | ||
| 140 | + default: | ||
| 141 | + break; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + }]; | ||
| 145 | + | ||
| 146 | + } else { //预览照片 | ||
| 147 | + CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.row]; | ||
| 148 | + [imagePickerVc configTZImagePicker]; | ||
| 149 | + imagePickerVc.maxImagesCount = 9; | ||
| 150 | + imagePickerVc.allowPickingGif = NO; | ||
| 151 | + imagePickerVc.allowPickingOriginalPhoto = YES; | ||
| 152 | + imagePickerVc.allowPickingMultipleVideo = NO; | ||
| 153 | + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; | ||
| 154 | + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | ||
| 155 | + weakSelf.selectedPhotos = [NSMutableArray arrayWithArray:photos]; | ||
| 156 | + weakSelf.selectedAssets = [NSMutableArray arrayWithArray:assets]; | ||
| 157 | + weakSelf.isSelectOriginalPhoto = isSelectOriginalPhoto; | ||
| 158 | + [weakSelf.collectionView reloadData]; | ||
| 159 | + weakSelf.collectionView.contentSize = CGSizeMake(0, ((weakSelf.selectedPhotos.count + 2) / 3 ) * (weakSelf.margin + weakSelf.itemWH)); | ||
| 160 | + }]; | ||
| 161 | + [self.viewController presentViewController:imagePickerVc animated:YES completion:nil]; | ||
| 162 | + | ||
| 163 | + } | ||
| 164 | +} | ||
| 165 | +#pragma mark - LxGridViewDataSource | ||
| 166 | +/// 以下三个方法为长按排序相关代码 | ||
| 167 | +- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath { | ||
| 168 | + return indexPath.item < _selectedPhotos.count; | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)sourceIndexPath canMoveToIndexPath:(NSIndexPath *)destinationIndexPath { | ||
| 172 | + return (sourceIndexPath.item < _selectedPhotos.count && destinationIndexPath.item < _selectedPhotos.count); | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)sourceIndexPath didMoveToIndexPath:(NSIndexPath *)destinationIndexPath { | ||
| 176 | + UIImage *image = _selectedPhotos[sourceIndexPath.item]; | ||
| 177 | + [_selectedPhotos removeObjectAtIndex:sourceIndexPath.item]; | ||
| 178 | + [_selectedPhotos insertObject:image atIndex:destinationIndexPath.item]; | ||
| 179 | + | ||
| 180 | + id asset = _selectedAssets[sourceIndexPath.item]; | ||
| 181 | + [_selectedAssets removeObjectAtIndex:sourceIndexPath.item]; | ||
| 182 | + [_selectedAssets insertObject:asset atIndex:destinationIndexPath.item]; | ||
| 183 | + | ||
| 184 | + [_collectionView reloadData]; | ||
| 185 | + | ||
| 186 | + if (self.delegate && [self.delegate respondsToSelector:@selector(updateImages:)]) { | ||
| 187 | + [self.delegate updateImages:_selectedAssets]; | ||
| 188 | + } | ||
| 189 | +} | ||
| 190 | + | ||
| 191 | +#pragma mark - UIImagePickerController | ||
| 192 | +- (void)takePhoto { | ||
| 193 | + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | ||
| 194 | + if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) && iOS7Later) { | ||
| 195 | + // 无相机权限 做一个友好的提示 | ||
| 196 | + if (iOS8Later) { | ||
| 197 | + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的“设置-隐私-相机“中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];//设置 | ||
| 198 | + | ||
| 199 | + [alert show]; | ||
| 200 | + } | ||
| 201 | + } else if (authStatus == AVAuthorizationStatusNotDetermined) { | ||
| 202 | + // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏 | ||
| 203 | + if (iOS7Later) { | ||
| 204 | + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { | ||
| 205 | + if (granted) { | ||
| 206 | + dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 207 | + [self takePhoto]; | ||
| 208 | + }); | ||
| 209 | + } | ||
| 210 | + }]; | ||
| 211 | + } else { | ||
| 212 | + [self takePhoto]; | ||
| 213 | + } | ||
| 214 | + // 拍照之前还需要检查相册权限 | ||
| 215 | + } else if ([TZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 | ||
| 216 | + if (iOS8Later) { | ||
| 217 | + UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的“设置-隐私-相册“中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];//设置 | ||
| 218 | + [alert show]; | ||
| 219 | + } | ||
| 220 | + } else if ([TZImageManager authorizationStatus] == 0) { // 未请求过相册权限 | ||
| 221 | + [[TZImageManager manager] requestAuthorizationWithCompletion:^{ | ||
| 222 | + [self takePhoto]; | ||
| 223 | + }]; | ||
| 224 | + } else { | ||
| 225 | + [self pushImagePickerController]; | ||
| 226 | + } | ||
| 227 | +} | ||
| 228 | +// 调用相机 | ||
| 229 | +- (void)pushImagePickerController { | ||
| 230 | + UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; | ||
| 231 | + if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { | ||
| 232 | + self.imagePickerVc.sourceType = sourceType; | ||
| 233 | + if(iOS8Later) { | ||
| 234 | + _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext; | ||
| 235 | + } | ||
| 236 | + [self.viewController presentViewController:_imagePickerVc animated:YES completion:nil]; | ||
| 237 | + } else { | ||
| 238 | + NSLog(@"模拟器中无法打开照相机,请在真机中使用"); | ||
| 239 | + } | ||
| 240 | +} | ||
| 241 | +#pragma mark - TZImagePickerController | ||
| 242 | +- (void)pushTZImagePickerController { | ||
| 243 | + CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc]initWithMaxImagesCount:9 columnNumber:4 delegate:self pushPhotoPickerVc:YES]; | ||
| 244 | + [imagePickerVc configTZImagePicker];//配置 | ||
| 245 | +#pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 | ||
| 246 | + imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; | ||
| 247 | + | ||
| 248 | + imagePickerVc.selectedAssets = _selectedAssets; //目前已经选中的图片数组 | ||
| 249 | + imagePickerVc.allowTakePicture = NO; //在内部显示拍照按钮 | ||
| 250 | + imagePickerVc.allowPickingVideo = NO; //是否允许选择视频 | ||
| 251 | + imagePickerVc.allowPickingImage = YES; //是否允许选择图片 | ||
| 252 | + imagePickerVc.allowPickingOriginalPhoto = YES; //选择原图 | ||
| 253 | + imagePickerVc.allowPickingGif = NO; //选择Gif | ||
| 254 | + imagePickerVc.allowPickingMultipleVideo = NO; // 是否可以多选视频 | ||
| 255 | + imagePickerVc.sortAscendingByModificationDate = YES;//排序 | ||
| 256 | + imagePickerVc.showSelectBtn = NO; | ||
| 257 | + imagePickerVc.allowCrop = NO; //是否允许裁剪 | ||
| 258 | + imagePickerVc.needCircleCrop = NO; //是否使用圆形裁剪 | ||
| 259 | + | ||
| 260 | + // 你可以通过block或者代理,来得到用户选择的照片. | ||
| 261 | + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | ||
| 262 | + | ||
| 263 | + }]; | ||
| 264 | + [self.viewController presentViewController:imagePickerVc animated:YES completion:nil]; | ||
| 265 | +} | ||
| 266 | +- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { | ||
| 267 | + [picker dismissViewControllerAnimated:YES completion:nil]; | ||
| 268 | + NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; | ||
| 269 | + if ([type isEqualToString:@"public.image"]) { | ||
| 270 | + TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | ||
| 271 | + tzImagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | ||
| 272 | + tzImagePickerVc.sortAscendingByModificationDate = YES; | ||
| 273 | + [tzImagePickerVc showProgressHUD]; | ||
| 274 | + UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; | ||
| 275 | + | ||
| 276 | + // save photo and get asset / 保存图片,获取到asset | ||
| 277 | + [[TZImageManager manager] savePhotoWithImage:image location:nil completion:^(NSError *error){ | ||
| 278 | + [tzImagePickerVc hideProgressHUD]; | ||
| 279 | + if (error) { | ||
| 280 | + [tzImagePickerVc hideProgressHUD]; | ||
| 281 | + NSLog(@"图片保存失败 %@",error); | ||
| 282 | + } else { | ||
| 283 | + [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(TZAlbumModel *model) { | ||
| 284 | + [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) { | ||
| 285 | + [tzImagePickerVc hideProgressHUD]; | ||
| 286 | + TZAssetModel *assetModel = [models firstObject]; | ||
| 287 | + if (tzImagePickerVc.sortAscendingByModificationDate) { | ||
| 288 | + assetModel = [models lastObject]; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + [self refreshCollectionViewWithAddedAsset:assetModel.asset image:image]; | ||
| 292 | + | ||
| 293 | + }]; | ||
| 294 | + }]; | ||
| 295 | + } | ||
| 296 | + }]; | ||
| 297 | + } | ||
| 298 | +} | ||
| 299 | + | ||
| 300 | +- (void)refreshCollectionViewWithAddedAsset:(id)asset image:(UIImage *)image { | ||
| 301 | + [_selectedAssets addObject:asset]; | ||
| 302 | + [_selectedPhotos addObject:image]; | ||
| 303 | + [_collectionView reloadData]; | ||
| 304 | + | ||
| 305 | + if (_selectedPhotos.count == 9) { | ||
| 306 | + _add = 0; | ||
| 307 | + } else { | ||
| 308 | + _add = 1; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + [self updateHeight]; | ||
| 312 | + | ||
| 313 | +} | ||
| 314 | +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { | ||
| 315 | + if ([picker isKindOfClass:[UIImagePickerController class]]) { | ||
| 316 | + [picker dismissViewControllerAnimated:YES completion:nil]; | ||
| 317 | + } | ||
| 318 | +} | ||
| 319 | + | ||
| 320 | +#pragma mark - UIActionSheetDelegate | ||
| 321 | + | ||
| 322 | +- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { | ||
| 323 | + if (buttonIndex == 0) { // take photo / 去拍照 | ||
| 324 | + [self takePhoto]; | ||
| 325 | + } else if (buttonIndex == 1) { | ||
| 326 | + [self pushTZImagePickerController]; | ||
| 327 | + } | ||
| 328 | +} | ||
| 329 | + | ||
| 330 | +#pragma mark - UIAlertViewDelegate | ||
| 331 | +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { | ||
| 332 | + if (buttonIndex == 1) { // 去设置界面,开启相机访问权限 | ||
| 333 | + if (iOS8Later) { | ||
| 334 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; | ||
| 335 | + } | ||
| 336 | + } | ||
| 337 | +} | ||
| 338 | + | ||
| 339 | +#pragma mark - TZImagePickerControllerDelegate | ||
| 340 | +- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker { | ||
| 341 | + // NSLog(@"cancel"); | ||
| 342 | +} | ||
| 343 | + | ||
| 344 | +- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos { | ||
| 345 | + _selectedPhotos = [NSMutableArray arrayWithArray:photos]; | ||
| 346 | + _selectedAssets = [NSMutableArray arrayWithArray:assets]; | ||
| 347 | + _isSelectOriginalPhoto = isSelectOriginalPhoto; | ||
| 348 | + | ||
| 349 | + if (_selectedPhotos.count == 9) { | ||
| 350 | + _add = 0; | ||
| 351 | + } else { | ||
| 352 | + _add = 1; | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + [self updateHeight]; | ||
| 356 | + | ||
| 357 | +} | ||
| 358 | + | ||
| 359 | +//更新自身高度 | ||
| 360 | +- (void)updateHeight { | ||
| 361 | + | ||
| 362 | + NSInteger num = 0; | ||
| 363 | + if (_selectedAssets.count == 9) { | ||
| 364 | + num = 9; | ||
| 365 | + } else { | ||
| 366 | + num = _selectedAssets.count+1; | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + NSInteger integer = num/3; | ||
| 370 | + NSInteger remainder = num%3; | ||
| 371 | + | ||
| 372 | + if (remainder > 0) { | ||
| 373 | + integer += 1; | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + _collectionView.frame = CGRectMake(10, _colTop, KScreenWidth-20, _itemWH*integer + integer*_margin +10); | ||
| 377 | + [_collectionView reloadData]; | ||
| 378 | + | ||
| 379 | + CGFloat h = _collectionView.height + integer*_margin + 60; | ||
| 380 | + [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 381 | + make.height.mas_equalTo(h); | ||
| 382 | + }]; | ||
| 383 | + | ||
| 384 | + if (self.delegate && [self.delegate respondsToSelector:@selector(updateImages:)]) { | ||
| 385 | + [self.delegate updateImages:_selectedPhotos]; | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | +} | ||
| 389 | + | ||
| 390 | + | ||
| 391 | +// Decide album show or not't | ||
| 392 | +// 决定相册显示与否 | ||
| 393 | +- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(id)result { | ||
| 394 | + return YES; | ||
| 395 | +} | ||
| 396 | + | ||
| 397 | +// Decide asset show or not't | ||
| 398 | +// 决定asset显示与否 | ||
| 399 | +- (BOOL)isAssetCanSelect:(id)asset { | ||
| 400 | + return YES; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | +#pragma mark - | ||
| 404 | +#pragma mark - Getter | ||
| 405 | +- (UILabel *)titleLab | ||
| 406 | +{ | ||
| 407 | + if (!_titleLab) { | ||
| 408 | + _titleLab = [[UILabel alloc] init]; | ||
| 409 | + _titleLab.font = [UIFont systemFontOfSize:15]; | ||
| 410 | + _titleLab.text = @"上传照片"; | ||
| 411 | + } | ||
| 412 | + return _titleLab; | ||
| 413 | +} | ||
| 414 | + | ||
| 415 | +- (UIImagePickerController *)imagePickerVc { | ||
| 416 | + if (_imagePickerVc == nil) { | ||
| 417 | + _imagePickerVc = [[UIImagePickerController alloc] init]; | ||
| 418 | + _imagePickerVc.delegate = self; | ||
| 419 | + // set appearance / 改变相册选择页的导航栏外观 | ||
| 420 | + if (iOS7Later) { | ||
| 421 | + _imagePickerVc.navigationBar.barTintColor = self.viewController.navigationController.navigationBar.barTintColor; | ||
| 422 | + } | ||
| 423 | + _imagePickerVc.navigationBar.tintColor = self.viewController.navigationController.navigationBar.tintColor; | ||
| 424 | + UIBarButtonItem *tzBarItem, *BarItem; | ||
| 425 | + if (iOS9Later) { | ||
| 426 | + tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; | ||
| 427 | + BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; | ||
| 428 | + } else { | ||
| 429 | + tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; | ||
| 430 | + BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil]; | ||
| 431 | + } | ||
| 432 | + NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; | ||
| 433 | + [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; | ||
| 434 | + | ||
| 435 | + } | ||
| 436 | + return _imagePickerVc; | ||
| 437 | +} | ||
| 438 | + | ||
| 439 | +#pragma clang diagnostic pop | ||
| 440 | 440 | ||
| 441 | 441 | ||
| 442 | 442 |
CNLiveMyOrderModule/Classes/ViewModel/CNLiveOrderEventHandle.m
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | #import "CNLiveOrderListOrderItem.h" | 9 | #import "CNLiveOrderListOrderItem.h" |
| 10 | #import "QMUIKit.h" | 10 | #import "QMUIKit.h" |
| 11 | #import "MJExtension.h" | 11 | #import "MJExtension.h" |
| 12 | -#import "DSAddressModel.h" | 12 | +#import <DSCnliveShopSDK/DSCnliveShopSDK.h> |
| 13 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> | 13 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> |
| 14 | #import "CNLiveEnvironment.h" | 14 | #import "CNLiveEnvironment.h" |
| 15 | #import "CNUserInfoManager.h" | 15 | #import "CNUserInfoManager.h" |
CNLiveMyOrderModule/Classes/ViewModel/CNLiveOrderViewModel.h
| @@ -32,6 +32,12 @@ NS_ASSUME_NONNULL_BEGIN | @@ -32,6 +32,12 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 32 | /// @param success 成功 | 32 | /// @param success 成功 |
| 33 | /// @param failure 失败 | 33 | /// @param failure 失败 |
| 34 | + (void)uploadEvaluationwithDarenId:(NSString *)darenId orderId:(NSString *)orderId score:(NSInteger)score comment:(NSString *)comment images:(NSArray *)images success:(void (^)(NSString *success))success failure:(void (^)(NSError *error))failure; | 34 | + (void)uploadEvaluationwithDarenId:(NSString *)darenId orderId:(NSString *)orderId score:(NSInteger)score comment:(NSString *)comment images:(NSArray *)images success:(void (^)(NSString *success))success failure:(void (^)(NSError *error))failure; |
| 35 | + | ||
| 36 | +/// 申请退款请求 | ||
| 37 | +/// @param page 页码 | ||
| 38 | +/// @param success 成功 | ||
| 39 | +/// @param failure 失败 | ||
| 40 | ++ (void)requestRefundDataWithPage:(NSInteger)page success:(void (^)(NSMutableArray *array, BOOL haveNext))success failure:(void (^)(NSError *error))failure; | ||
| 35 | @end | 41 | @end |
| 36 | 42 | ||
| 37 | NS_ASSUME_NONNULL_END | 43 | NS_ASSUME_NONNULL_END |
CNLiveMyOrderModule/Classes/ViewModel/CNLiveOrderViewModel.m
| @@ -77,7 +77,7 @@ | @@ -77,7 +77,7 @@ | ||
| 77 | @"sid":@"10511059", | 77 | @"sid":@"10511059", |
| 78 | @"darenId":darenId, | 78 | @"darenId":darenId, |
| 79 | @"orderId":orderId, | 79 | @"orderId":orderId, |
| 80 | - @"grade":[NSString stringWithFormat:@"%d",score], | 80 | + @"grade":[NSString stringWithFormat:@"%ld",score], |
| 81 | @"comment":comment, | 81 | @"comment":comment, |
| 82 | @"plat":@"i" | 82 | @"plat":@"i" |
| 83 | }; | 83 | }; |
| @@ -115,4 +115,38 @@ | @@ -115,4 +115,38 @@ | ||
| 115 | 115 | ||
| 116 | }]; | 116 | }]; |
| 117 | } | 117 | } |
| 118 | +#pragma mark -申请退款接口 | ||
| 119 | ++ (void)requestRefundDataWithPage:(NSInteger)page success:(void (^)(NSMutableArray *array, BOOL haveNext))success failure:(void (^)(NSError *error))failure { | ||
| 120 | + NSDictionary *param = @{ | ||
| 121 | + @"appId":AppId, | ||
| 122 | + @"plat":@"i", | ||
| 123 | + @"sid":@"10511059", | ||
| 124 | + @"status":@"4", | ||
| 125 | + @"pageNo":[NSString stringWithFormat:@"%ld", (long)page], | ||
| 126 | + @"pageSize":@"15" | ||
| 127 | + }; | ||
| 128 | + | ||
| 129 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 130 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 131 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGetOrderListUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 132 | + if (!error) { | ||
| 133 | + NSMutableArray *array = [NSMutableArray array]; | ||
| 134 | + | ||
| 135 | + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]]) { | ||
| 136 | + NSString *errorCode = [responseObject objectForKey:@"errorCode"]; | ||
| 137 | + if ([errorCode isEqualToString:@"0"]) { | ||
| 138 | + NSDictionary *data = [responseObject objectForKey:@"data"]; | ||
| 139 | + CNLiveOrderModel *model = [CNLiveOrderModel mj_objectWithKeyValues:data]; | ||
| 140 | + for (CNLiveOrderList *orderList in model.orderList) { | ||
| 141 | + [array addObject:orderList]; | ||
| 142 | + } | ||
| 143 | + !success ? :success(array,model.hasNext); | ||
| 144 | + | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + }else { | ||
| 148 | + !failure ? :failure(error); | ||
| 149 | + } | ||
| 150 | + }]; | ||
| 151 | +} | ||
| 118 | @end | 152 | @end |
Example/CNLiveMyOrderModule.xcodeproj/project.pbxproj
| @@ -7,6 +7,8 @@ | @@ -7,6 +7,8 @@ | ||
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| 10 | + 4EBA88F62389368D009C36CF /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EBA88F52389368D009C36CF /* CoreMotion.framework */; }; | ||
| 11 | + 4EBA88F72389369C009C36CF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | ||
| 10 | 5848D8B58D0419A91C38A5BF /* Pods_CNLiveMyOrderModule_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5DB9FD5E2848D814B8D85B9 /* Pods_CNLiveMyOrderModule_Example.framework */; }; | 12 | 5848D8B58D0419A91C38A5BF /* Pods_CNLiveMyOrderModule_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5DB9FD5E2848D814B8D85B9 /* Pods_CNLiveMyOrderModule_Example.framework */; }; |
| 11 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; | 13 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; |
| 12 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | 14 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; |
| @@ -41,6 +43,11 @@ | @@ -41,6 +43,11 @@ | ||
| 41 | 1DA79A6989B0B8955B2D49F4 /* Pods-CNLiveMyOrderModule_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveMyOrderModule_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveMyOrderModule_Tests/Pods-CNLiveMyOrderModule_Tests.debug.xcconfig"; sourceTree = "<group>"; }; | 43 | 1DA79A6989B0B8955B2D49F4 /* Pods-CNLiveMyOrderModule_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveMyOrderModule_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveMyOrderModule_Tests/Pods-CNLiveMyOrderModule_Tests.debug.xcconfig"; sourceTree = "<group>"; }; |
| 42 | 3326D32649FED325F629D45F /* CNLiveMyOrderModule.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveMyOrderModule.podspec; path = ../CNLiveMyOrderModule.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; | 44 | 3326D32649FED325F629D45F /* CNLiveMyOrderModule.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveMyOrderModule.podspec; path = ../CNLiveMyOrderModule.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; |
| 43 | 4E6714822F5F5131320B5EDF /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; | 45 | 4E6714822F5F5131320B5EDF /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; |
| 46 | + 4EBA88F32389365E009C36CF /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; | ||
| 47 | + 4EBA88F42389366D009C36CF /* libc.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libc.tbd; path = usr/lib/libc.tbd; sourceTree = SDKROOT; }; | ||
| 48 | + 4EBA88F52389368D009C36CF /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; | ||
| 49 | + 4EBA88F8238936B1009C36CF /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; }; | ||
| 50 | + 4EBA88F9238936C1009C36CF /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; | ||
| 44 | 6003F58A195388D20070C39A /* CNLiveMyOrderModule_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveMyOrderModule_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 51 | 6003F58A195388D20070C39A /* CNLiveMyOrderModule_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveMyOrderModule_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 45 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; | 52 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; |
| 46 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; | 53 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; |
| @@ -74,9 +81,11 @@ | @@ -74,9 +81,11 @@ | ||
| 74 | isa = PBXFrameworksBuildPhase; | 81 | isa = PBXFrameworksBuildPhase; |
| 75 | buildActionMask = 2147483647; | 82 | buildActionMask = 2147483647; |
| 76 | files = ( | 83 | files = ( |
| 84 | + 4EBA88F72389369C009C36CF /* CoreGraphics.framework in Frameworks */, | ||
| 77 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, | 85 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, |
| 78 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, | 86 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, |
| 79 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, | 87 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, |
| 88 | + 4EBA88F62389368D009C36CF /* CoreMotion.framework in Frameworks */, | ||
| 80 | 5848D8B58D0419A91C38A5BF /* Pods_CNLiveMyOrderModule_Example.framework in Frameworks */, | 89 | 5848D8B58D0419A91C38A5BF /* Pods_CNLiveMyOrderModule_Example.framework in Frameworks */, |
| 81 | ); | 90 | ); |
| 82 | runOnlyForDeploymentPostprocessing = 0; | 91 | runOnlyForDeploymentPostprocessing = 0; |
| @@ -119,6 +128,11 @@ | @@ -119,6 +128,11 @@ | ||
| 119 | 6003F58C195388D20070C39A /* Frameworks */ = { | 128 | 6003F58C195388D20070C39A /* Frameworks */ = { |
| 120 | isa = PBXGroup; | 129 | isa = PBXGroup; |
| 121 | children = ( | 130 | children = ( |
| 131 | + 4EBA88F9238936C1009C36CF /* libsqlite3.tbd */, | ||
| 132 | + 4EBA88F8238936B1009C36CF /* libsqlite3.0.tbd */, | ||
| 133 | + 4EBA88F52389368D009C36CF /* CoreMotion.framework */, | ||
| 134 | + 4EBA88F42389366D009C36CF /* libc.tbd */, | ||
| 135 | + 4EBA88F32389365E009C36CF /* libc++.tbd */, | ||
| 122 | 6003F58D195388D20070C39A /* Foundation.framework */, | 136 | 6003F58D195388D20070C39A /* Foundation.framework */, |
| 123 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, | 137 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, |
| 124 | 6003F591195388D20070C39A /* UIKit.framework */, | 138 | 6003F591195388D20070C39A /* UIKit.framework */, |
| @@ -208,6 +222,7 @@ | @@ -208,6 +222,7 @@ | ||
| 208 | 6003F587195388D20070C39A /* Frameworks */, | 222 | 6003F587195388D20070C39A /* Frameworks */, |
| 209 | 6003F588195388D20070C39A /* Resources */, | 223 | 6003F588195388D20070C39A /* Resources */, |
| 210 | 845F81D6903EC723010F3D5B /* [CP] Embed Pods Frameworks */, | 224 | 845F81D6903EC723010F3D5B /* [CP] Embed Pods Frameworks */, |
| 225 | + 614BDD3EBE6EF20995FDFDF3 /* [CP] Copy Pods Resources */, | ||
| 211 | ); | 226 | ); |
| 212 | buildRules = ( | 227 | buildRules = ( |
| 213 | ); | 228 | ); |
| @@ -320,6 +335,24 @@ | @@ -320,6 +335,24 @@ | ||
| 320 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | 335 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; |
| 321 | showEnvVarsInLog = 0; | 336 | showEnvVarsInLog = 0; |
| 322 | }; | 337 | }; |
| 338 | + 614BDD3EBE6EF20995FDFDF3 /* [CP] Copy Pods Resources */ = { | ||
| 339 | + isa = PBXShellScriptBuildPhase; | ||
| 340 | + buildActionMask = 2147483647; | ||
| 341 | + files = ( | ||
| 342 | + ); | ||
| 343 | + inputPaths = ( | ||
| 344 | + "${PODS_ROOT}/Target Support Files/Pods-CNLiveMyOrderModule_Example/Pods-CNLiveMyOrderModule_Example-resources.sh", | ||
| 345 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveMyOrderModule/CNLiveMyOrderModule.bundle", | ||
| 346 | + ); | ||
| 347 | + name = "[CP] Copy Pods Resources"; | ||
| 348 | + outputPaths = ( | ||
| 349 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveMyOrderModule.bundle", | ||
| 350 | + ); | ||
| 351 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 352 | + shellPath = /bin/sh; | ||
| 353 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMyOrderModule_Example/Pods-CNLiveMyOrderModule_Example-resources.sh\"\n"; | ||
| 354 | + showEnvVarsInLog = 0; | ||
| 355 | + }; | ||
| 323 | 845F81D6903EC723010F3D5B /* [CP] Embed Pods Frameworks */ = { | 356 | 845F81D6903EC723010F3D5B /* [CP] Embed Pods Frameworks */ = { |
| 324 | isa = PBXShellScriptBuildPhase; | 357 | isa = PBXShellScriptBuildPhase; |
| 325 | buildActionMask = 2147483647; | 358 | buildActionMask = 2147483647; |
| @@ -328,43 +361,83 @@ | @@ -328,43 +361,83 @@ | ||
| 328 | inputPaths = ( | 361 | inputPaths = ( |
| 329 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveMyOrderModule_Example/Pods-CNLiveMyOrderModule_Example-frameworks.sh", | 362 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveMyOrderModule_Example/Pods-CNLiveMyOrderModule_Example-frameworks.sh", |
| 330 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", | 363 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", |
| 364 | + "${BUILT_PRODUCTS_DIR}/BKCycleScrollView/BKCycleScrollView.framework", | ||
| 365 | + "${BUILT_PRODUCTS_DIR}/BKPickerView/BKPickerView.framework", | ||
| 366 | + "${BUILT_PRODUCTS_DIR}/BKTimer/BKTimer.framework", | ||
| 331 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", | 367 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", |
| 368 | + "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", | ||
| 332 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", | 369 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 370 | + "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", | ||
| 371 | + "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework", | ||
| 333 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", | 372 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 334 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", | 373 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", |
| 335 | "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework", | 374 | "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework", |
| 336 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", | 375 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| 337 | - "${BUILT_PRODUCTS_DIR}/CNLiveMyOrderModule/CNLiveMyOrderModule.framework", | 376 | + "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework", |
| 377 | + "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", | ||
| 338 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", | 378 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", |
| 379 | + "${PODS_ROOT}/CNLiveSDKs/CNLiveSDKs/Classes/CNLivePaySDK.framework", | ||
| 339 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", | 380 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", |
| 381 | + "${BUILT_PRODUCTS_DIR}/CNLiveUploadManager/CNLiveUploadManager.framework", | ||
| 340 | "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", | 382 | "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", |
| 383 | + "${PODS_ROOT}/DSCnliveShopSDK/DSCnliveShopSDK/Classes/DSCnliveShopSDK.framework", | ||
| 384 | + "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", | ||
| 385 | + "${BUILT_PRODUCTS_DIR}/GPUImage/GPUImage.framework", | ||
| 386 | + "${BUILT_PRODUCTS_DIR}/HappyDNS/HappyDNS.framework", | ||
| 387 | + "${BUILT_PRODUCTS_DIR}/IQKeyboardManager/IQKeyboardManager.framework", | ||
| 341 | "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework", | 388 | "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework", |
| 389 | + "${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework", | ||
| 342 | "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", | 390 | "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", |
| 343 | "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", | 391 | "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", |
| 344 | "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", | 392 | "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", |
| 393 | + "${PODS_ROOT}/PLPlayerKit/Pod/Library/PLPlayerKit.framework", | ||
| 345 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", | 394 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", |
| 395 | + "${BUILT_PRODUCTS_DIR}/Qiniu/Qiniu.framework", | ||
| 396 | + "${BUILT_PRODUCTS_DIR}/SAMKeychain/SAMKeychain.framework", | ||
| 397 | + "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", | ||
| 346 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", | 398 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 399 | + "${PODS_ROOT}/TXIMSDK_iOS/ImSDK.framework", | ||
| 347 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", | 400 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", |
| 348 | ); | 401 | ); |
| 349 | name = "[CP] Embed Pods Frameworks"; | 402 | name = "[CP] Embed Pods Frameworks"; |
| 350 | outputPaths = ( | 403 | outputPaths = ( |
| 351 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", | 404 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", |
| 405 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BKCycleScrollView.framework", | ||
| 406 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BKPickerView.framework", | ||
| 407 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BKTimer.framework", | ||
| 352 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", | 408 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", |
| 409 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", | ||
| 353 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", | 410 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 411 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", | ||
| 412 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework", | ||
| 354 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", | 413 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 355 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", | 414 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", |
| 356 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework", | 415 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework", |
| 357 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", | 416 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
| 358 | - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveMyOrderModule.framework", | 417 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework", |
| 418 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", | ||
| 359 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", | 419 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", |
| 420 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLivePaySDK.framework", | ||
| 360 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", | 421 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", |
| 422 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUploadManager.framework", | ||
| 361 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", | 423 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", |
| 424 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DSCnliveShopSDK.framework", | ||
| 425 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", | ||
| 426 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GPUImage.framework", | ||
| 427 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HappyDNS.framework", | ||
| 428 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardManager.framework", | ||
| 362 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework", | 429 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework", |
| 430 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework", | ||
| 363 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", | 431 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", |
| 364 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", | 432 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", |
| 365 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", | 433 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", |
| 434 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PLPlayerKit.framework", | ||
| 366 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", | 435 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", |
| 436 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qiniu.framework", | ||
| 437 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SAMKeychain.framework", | ||
| 438 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", | ||
| 367 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", | 439 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 440 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImSDK.framework", | ||
| 368 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", | 441 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", |
| 369 | ); | 442 | ); |
| 370 | runOnlyForDeploymentPostprocessing = 0; | 443 | runOnlyForDeploymentPostprocessing = 0; |
Example/CNLiveMyOrderModule/CNLIVEAppDelegate.m
| @@ -8,6 +8,11 @@ | @@ -8,6 +8,11 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLIVEAppDelegate.h" | 9 | #import "CNLIVEAppDelegate.h" |
| 10 | #import "CNLIVEViewController.h" | 10 | #import "CNLIVEViewController.h" |
| 11 | +#import <CommonCrypto/CommonDigest.h> | ||
| 12 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 13 | +#import "CNLiveEnvironment.h" | ||
| 14 | +#import <DSCnliveShopSDK/DSCnliveShopSDK.h> | ||
| 15 | +static NSString * uuid; | ||
| 11 | @implementation CNLIVEAppDelegate | 16 | @implementation CNLIVEAppDelegate |
| 12 | 17 | ||
| 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| @@ -18,9 +23,60 @@ | @@ -18,9 +23,60 @@ | ||
| 18 | UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc]; | 23 | UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc]; |
| 19 | self.window.rootViewController = nav; | 24 | self.window.rootViewController = nav; |
| 20 | [self.window makeKeyAndVisible]; | 25 | [self.window makeKeyAndVisible]; |
| 26 | + [self networkParamAction]; | ||
| 21 | return YES; | 27 | return YES; |
| 22 | } | 28 | } |
| 29 | +- (void)networkParamAction { | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; | ||
| 33 | + [mDict setValue:@"10511059" forKey:@"loginSid"]; | ||
| 34 | + if (TestEnvironment) { | ||
| 35 | + [mDict setValue:@"com.cnlive.CNLiveNetAdd.debug"forKey:@"platform_id"]; | ||
| 36 | + }else{ | ||
| 37 | + [mDict setValue:@"com.cnlive.CNLiveNetAdd"forKey:@"platform_id"]; | ||
| 38 | + } | ||
| 39 | + [mDict setValue:[self appUUIDString] forKey:@"uuid"]; | ||
| 40 | + [mDict setValue:@"i" forKey:@"plat"]; | ||
| 41 | + [mDict setValue:@"1.7.8.19.10.30.15"forKey:@"ver"]; | ||
| 42 | + [mDict setObject:AppId forKey:@"appId"]; | ||
| 43 | + [CNLiveNetworking setupDefaultParam:mDict]; | ||
| 44 | + [CNLiveNetworking setupShowResult:NO]; | ||
| 45 | + [CNLiveNetworking setupSignKey:APPKey]; | ||
| 46 | + NSLog(@"打印appkey%@",APPKey); | ||
| 47 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 48 | + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; | ||
| 49 | + [[DSCnliveShopSDKManager sharedManager] loginUser:@"10511059"]; | ||
| 50 | + [[DSCnliveShopSDKManager sharedManager]initWithAppId:AppId appKey:APPKey isDebug:TestEnvironment]; | ||
| 51 | +} | ||
| 52 | +- (NSString *)appUUIDString | ||
| 53 | + { | ||
| 54 | + static dispatch_once_t onceToken; | ||
| 55 | + dispatch_once(&onceToken, ^{ | ||
| 56 | + uuid = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""]; | ||
| 57 | + }); | ||
| 58 | + return uuid; | ||
| 59 | + } | ||
| 23 | 60 | ||
| 61 | + + (NSString*)sha1:(NSString *)string | ||
| 62 | + { | ||
| 63 | + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 64 | + | ||
| 65 | + uint8_t digest[CC_SHA1_DIGEST_LENGTH]; | ||
| 66 | + | ||
| 67 | + CC_SHA1(data.bytes, (unsigned int)data.length, digest); | ||
| 68 | + | ||
| 69 | + NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; | ||
| 70 | + | ||
| 71 | + for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) | ||
| 72 | + [output appendFormat:@"%02x", digest[i]]; | ||
| 73 | + | ||
| 74 | + while ([[output substringToIndex:1] isEqualToString:@"0"]) { | ||
| 75 | + output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]]; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + return output; | ||
| 79 | + } | ||
| 24 | - (void)applicationWillResignActive:(UIApplication *)application | 80 | - (void)applicationWillResignActive:(UIApplication *)application |
| 25 | { | 81 | { |
| 26 | 82 |
Example/CNLiveMyOrderModule/CNLIVEViewController.m
| @@ -8,6 +8,8 @@ | @@ -8,6 +8,8 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLIVEViewController.h" | 9 | #import "CNLIVEViewController.h" |
| 10 | #import "CNLiveMyOrderController.h" | 10 | #import "CNLiveMyOrderController.h" |
| 11 | +#import "CNLiveOrderServiceProtocol.h" | ||
| 12 | +#import "CNLiveRefundController.h" | ||
| 11 | @interface CNLIVEViewController () | 13 | @interface CNLIVEViewController () |
| 12 | @end | 14 | @end |
| 13 | 15 | ||
| @@ -16,16 +18,27 @@ | @@ -16,16 +18,27 @@ | ||
| 16 | - (void)viewDidLoad | 18 | - (void)viewDidLoad |
| 17 | { | 19 | { |
| 18 | [super viewDidLoad]; | 20 | [super viewDidLoad]; |
| 19 | - UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 20 | - button.frame = CGRectMake(100, 100, 100, 100); | ||
| 21 | - button.backgroundColor = [UIColor cyanColor]; | ||
| 22 | - [button addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside]; | ||
| 23 | - [self.view addSubview:button]; | ||
| 24 | - // Do any additional setup after loading the view, typically from a nib. | 21 | + NSArray *array = @[@"订单",@"待付款",@"待收货",@"待评价",@"售后退款"]; |
| 22 | + for (int i = 0; i <5; i++) { | ||
| 23 | + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 24 | + button.frame = CGRectMake((10+70)*i, 100, 70, 40); | ||
| 25 | + button.tag = 100 + i; | ||
| 26 | + button.titleLabel.font = [UIFont systemFontOfSize:15.0f]; | ||
| 27 | + [button setTitle:array[i] forState:UIControlStateNormal]; | ||
| 28 | + button.backgroundColor = [UIColor cyanColor]; | ||
| 29 | + [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 30 | + [self.view addSubview:button]; | ||
| 31 | + } | ||
| 25 | } | 32 | } |
| 26 | -- (void)buttonClicked { | ||
| 27 | - CNLiveMyOrderController *vc = [[CNLiveMyOrderController alloc]init]; | ||
| 28 | - [self.navigationController pushViewController:vc animated:nil]; | 33 | +- (void)buttonClicked:(UIButton *)button { |
| 34 | + if ((button.tag - 100) == 4) { | ||
| 35 | + CNLiveRefundController *refundVc = [[CNLiveRefundController alloc]init]; | ||
| 36 | + [self.navigationController pushViewController:refundVc animated:YES]; | ||
| 37 | + }else { | ||
| 38 | + id<CNLiveOrderServiceProtocol> service = [[BeeHive shareInstance]createService:@protocol(CNLiveOrderServiceProtocol)]; | ||
| 39 | + [service pushToOrderViewController:button.tag - 100]; | ||
| 40 | + } | ||
| 41 | + | ||
| 29 | } | 42 | } |
| 30 | 43 | ||
| 31 | - (void)didReceiveMemoryWarning | 44 | - (void)didReceiveMemoryWarning |
Example/Podfile
| @@ -13,6 +13,9 @@ target 'CNLiveMyOrderModule_Example' do | @@ -13,6 +13,9 @@ target 'CNLiveMyOrderModule_Example' do | ||
| 13 | # pod 'CNLiveUserManagement' | 13 | # pod 'CNLiveUserManagement' |
| 14 | # pod 'CNLiveEnvironment' | 14 | # pod 'CNLiveEnvironment' |
| 15 | # pod 'CNLiveRequestBastKit' | 15 | # pod 'CNLiveRequestBastKit' |
| 16 | + pod 'CNLiveBeeHive' | ||
| 17 | + pod 'CNLiveServices' | ||
| 18 | + pod 'CNLiveEnvironment' | ||
| 16 | pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} | 19 | pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} |
| 17 | end | 20 | end |
| 18 | target 'CNLiveMyOrderModule_Tests' do | 21 | target 'CNLiveMyOrderModule_Tests' do |