Commit ffa6d1fa82be26df819fb46080532d7d3d0cb646

Authored by yanglingyu
1 parent 0a4eaeb4

0.0.4

CNLiveCServiceModule.podspec
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 Pod::Spec.new do |s| 9 Pod::Spec.new do |s|
10 s.name = 'CNLiveCServiceModule' 10 s.name = 'CNLiveCServiceModule'
11 - s.version = '0.0.3' 11 + s.version = '0.0.4'
12 s.summary = '我的服务内容' 12 s.summary = '我的服务内容'
13 13
14 # This description is used to generate tags and improve search results. 14 # This description is used to generate tags and improve search results.
CNLiveCServiceModule/Classes/Manager/CNLiveCServiceManagerBridge.h
@@ -9,8 +9,7 @@ @@ -9,8 +9,7 @@
9 9
10 typedef NS_ENUM(NSInteger , CNCServiceJumpType) { 10 typedef NS_ENUM(NSInteger , CNCServiceJumpType) {
11 CNCServiceJumpTypeService, //服务内容跳转逻辑 11 CNCServiceJumpTypeService, //服务内容跳转逻辑
12 - CNCServiceJumpTypeGoods, //商品详情页  
13 - CNCServiceJumpTypeVideo , //音频文件 12 + CNCServiceJumpTypeGetPage, //getpage获取内容
14 CNCServiceJumpTypeWebVC //电商h5页面 13 CNCServiceJumpTypeWebVC //电商h5页面
15 }; 14 };
16 @protocol CNLiveCServiceProtocol <NSObject> 15 @protocol CNLiveCServiceProtocol <NSObject>
@@ -55,17 +54,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -55,17 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
55 + (void)jumpViewControllerType:(CNCServiceJumpType)type 54 + (void)jumpViewControllerType:(CNCServiceJumpType)type
56 param:(NSDictionary *)param 55 param:(NSDictionary *)param
57 controller:(UIViewController *)controller; 56 controller:(UIViewController *)controller;
58 -/**  
59 - *服务号跳转  
60 - *@param goodsId 商品id  
61 - */  
62 -+ (void)jumpGoodsViewController:(NSString *)goodsId  
63 - controller:(UIViewController *)controller;  
64 -/**  
65 - *服务号跳转  
66 - *@param contentId 服务id  
67 - */  
68 -+ (void)jumpGetPageOtherVC:(NSString *)contentId controller:(UIViewController *)controller; 57 +
69 /** 58 /**
70 *服务号跳转 59 *服务号跳转
71 *@param urlStr 网页地址 60 *@param urlStr 网页地址
CNLiveCServiceModule/Classes/Manager/CNLiveCServiceManagerBridge.m
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 30
31 + (void)jumpServiceController:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller 31 + (void)jumpServiceController:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller
32 { 32 {
  33 + [CNLiveServicePresent usedServiceWithServingId:serviceId];
33 [CNLiveCServiceManagerBridge jumpServiceType:CNCServiceJumpTypeService service:serviceId type:type to:to shopType:shopType controller:controller]; 34 [CNLiveCServiceManagerBridge jumpServiceType:CNCServiceJumpTypeService service:serviceId type:type to:to shopType:shopType controller:controller];
34 } 35 }
35 + (void)jumpServiceType:(CNCServiceJumpType)jumpType service:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller{ 36 + (void)jumpServiceType:(CNCServiceJumpType)jumpType service:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller{
@@ -41,22 +42,6 @@ @@ -41,22 +42,6 @@
41 }; 42 };
42 [CNLiveCServiceManagerBridge jumpViewControllerType:jumpType param:param controller:controller]; 43 [CNLiveCServiceManagerBridge jumpViewControllerType:jumpType param:param controller:controller];
43 } 44 }
44 -+ (void)jumpGoodsViewController:(NSString *)goodsId controller:(UIViewController *)controller  
45 -{  
46 - NSDictionary *param = @{  
47 - @"goodsId":goodsId?goodsId:@"",  
48 - };  
49 - [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGoods param:param controller:controller];  
50 -}  
51 -+ (void)jumpGetPageOtherVC:(NSString *)contentId controller:(UIViewController *)controller{  
52 - [QMUITips showLoadingInView:controller.view];  
53 - [CNLiveServicePresent loadServiceInfoServiceId:contentId result:^(CNLiveSearchModel * _Nonnull model) {  
54 - [QMUITips hideAllTips];  
55 - [CNLiveCServiceManagerBridge jumpServiceController:model.id type:model.type to:model.to shopType:model.shopType controller:controller];  
56 - } error:^{  
57 - [QMUITips hideAllTips];  
58 - }];  
59 -}  
60 45
61 + (void)jumpWebVCWithUrl:(NSString *)urlStr controller:(UIViewController *)controller{ 46 + (void)jumpWebVCWithUrl:(NSString *)urlStr controller:(UIViewController *)controller{
62 NSDictionary *param = @{ 47 NSDictionary *param = @{
CNLiveCServiceModule/Classes/Model/CNLiveServiceModel.h
@@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
98 ///布局 98 ///布局
99 @property (nonatomic, strong) CNLiveLayoutModel *layout; 99 @property (nonatomic, strong) CNLiveLayoutModel *layout;
100 @property (nonatomic, assign) CGFloat cellHeight; 100 @property (nonatomic, assign) CGFloat cellHeight;
101 -@property (nonatomic, strong) NSArray <CnLivePageContentModel *> *rightLists; 101 +@property (nonatomic, strong) NSArray *rightLists;
102 102
103 @property (nonatomic, copy) NSString *blockId; 103 @property (nonatomic, copy) NSString *blockId;
104 @property (nonatomic, copy) NSString *blockName; 104 @property (nonatomic, copy) NSString *blockName;
CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.h
@@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
38 /** 38 /**
39 请求我的服务数据 39 请求我的服务数据
40 */ 40 */
41 -+ (void)loadMyServicepage:(NSString *)page result:(void (^) (NSArray * dataArray)) succeed error:(void(^)(void))failure; 41 ++ (void)loadMyServicepage:(NSString *)page result:(void (^) (NSArray * dataArray , BOOL isLastPage)) succeed error:(void(^)(void))failure;
42 42
43 /** 43 /**
44 * 添加最近使用服务号 44 * 添加最近使用服务号
CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.m
@@ -258,7 +258,7 @@ static const CGFloat margin = 15; @@ -258,7 +258,7 @@ static const CGFloat margin = 15;
258 }]; 258 }];
259 } 259 }
260 260
261 -+ (void)loadMyServicepage:(NSString *)page result:(void (^)(NSArray * _Nonnull))succeed error:(void (^)(void))failure{ 261 ++ (void)loadMyServicepage:(NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(nonnull void (^)(void))failure{
262 NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"", 262 NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"",
263 @"pageSize":@"10", 263 @"pageSize":@"10",
264 @"type":@"2", 264 @"type":@"2",
@@ -271,15 +271,18 @@ static const CGFloat margin = 15; @@ -271,15 +271,18 @@ static const CGFloat margin = 15;
271 [CNLiveNetworking setupShowResult:YES]; 271 [CNLiveNetworking setupShowResult:YES];
272 272
273 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/servingList") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { 273 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/servingList") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
274 - CNLiveServiceModel * model = [CNLiveServiceModel mj_objectWithKeyValues:responseObject[@"data"]]; 274 + NSDictionary * dic = responseObject[@"data"];
275 NSMutableArray *array = [NSMutableArray array]; 275 NSMutableArray *array = [NSMutableArray array];
276 - for (NSDictionary *dic in model.categories) {  
277 - CNLiveSearchModel *searchModel = [CNLiveSearchModel mj_objectWithKeyValues:dic];  
278 - [array addObject:searchModel]; 276 + if (dic[@"list"]&&[dic[@"list"] isKindOfClass:[NSArray class]]) {
  277 + NSArray *list = dic[@"list"];
  278 + for (NSDictionary *dict in list) {
  279 + CNLiveSearchModel *searchModel = [CNLiveSearchModel mj_objectWithKeyValues:dict];
  280 + [array addObject:searchModel];
  281 + }
279 } 282 }
280 -  
281 - if (model) {  
282 - !succeed?:succeed(array.copy); 283 + if (dic) {
  284 + NSString *lastPage = dic[@"isLastPage"];
  285 + !succeed?:succeed(array.copy,lastPage);
283 }else{ 286 }else{
284 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; 287 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3];
285 !failure?:failure(); 288 !failure?:failure();
@@ -300,13 +303,15 @@ static const CGFloat margin = 15; @@ -300,13 +303,15 @@ static const CGFloat margin = 15;
300 } 303 }
301 304
302 + (void)removeMyServiceResult:(void (^) (void)) succeed{ 305 + (void)removeMyServiceResult:(void (^) (void)) succeed{
303 - NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @""}; 306 + NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"",
  307 + @"id":@""
  308 + };
304 309
305 [CNLiveNetworking setAllowRequestDefaultArgument:YES]; 310 [CNLiveNetworking setAllowRequestDefaultArgument:YES];
306 [CNLiveNetworking setupShowDataResult:NO]; 311 [CNLiveNetworking setupShowDataResult:NO];
307 [CNLiveNetworking setupShowResult:YES]; 312 [CNLiveNetworking setupShowResult:YES];
308 313
309 - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/removeMyNewest") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { 314 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:cn_API_Classify(@"/servingApi/removeMyNewest") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
310 if (!error) { 315 if (!error) {
311 succeed(); 316 succeed();
312 }else{ 317 }else{
@@ -331,10 +336,10 @@ static const CGFloat margin = 15; @@ -331,10 +336,10 @@ static const CGFloat margin = 15;
331 if (dic[@"list"]&&[dic[@"list"] isKindOfClass:[NSArray class]]) { 336 if (dic[@"list"]&&[dic[@"list"] isKindOfClass:[NSArray class]]) {
332 NSArray *list = dic[@"list"]; 337 NSArray *list = dic[@"list"];
333 338
334 - for (NSDictionary *dic in list) { 339 + for (NSDictionary *dict in list) {
335 NSDictionary *dictionary = @{ 340 NSDictionary *dictionary = @{
336 - @"title":dic[@"title"],  
337 - @"lists":dic[@"list"], 341 + @"title":dict[@"title"],
  342 + @"lists":dict[@"list"],
338 @"layout":@{ 343 @"layout":@{
339 @"width":@((SCREEN_WIDTH-4*margin-3*margin)/4.0), 344 @"width":@((SCREEN_WIDTH-4*margin-3*margin)/4.0),
340 @"height":@(70) 345 @"height":@(70)
@@ -370,7 +375,7 @@ static const CGFloat margin = 15; @@ -370,7 +375,7 @@ static const CGFloat margin = 15;
370 if (model) { 375 if (model) {
371 !succeed?:succeed(model); 376 !succeed?:succeed(model);
372 }else{ 377 }else{
373 - [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; 378 + [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:2];
374 !failure?:failure(); 379 !failure?:failure();
375 } 380 }
376 }]; 381 }];
CNLiveCServiceModule/Classes/View/CNLiveCycleActiveCell.m
@@ -42,8 +42,7 @@ @@ -42,8 +42,7 @@
42 } 42 }
43 #pragma mark - SDCycleScrollViewDelegate 43 #pragma mark - SDCycleScrollViewDelegate
44 - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{ 44 - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
45 - CnLivePageContentModel *pageModel = [CnLivePageContentModel mj_objectWithKeyValues:_model.contents[index]];  
46 - [CNLiveCServiceManagerBridge jumpGetPageOtherVC:pageModel.contentId controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]]; 45 + [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGetPage param:_model.contents[index] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
47 } 46 }
48 #pragma mark - Setting&&Getting 47 #pragma mark - Setting&&Getting
49 48
CNLiveCServiceModule/Classes/View/CNLiveCycleCell.m
@@ -55,8 +55,7 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;; @@ -55,8 +55,7 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;;
55 [CNLiveCServiceManagerBridge jumpServiceController:searchModel.id type:searchModel.type to:searchModel.to shopType:searchModel.shopType controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]]; 55 [CNLiveCServiceManagerBridge jumpServiceController:searchModel.id type:searchModel.type to:searchModel.to shopType:searchModel.shopType controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
56 } 56 }
57 if ([model isKindOfClass:[CnLivePageContentModel class]]) { 57 if ([model isKindOfClass:[CnLivePageContentModel class]]) {
58 - CnLivePageContentModel *pageModel = (CnLivePageContentModel *)model;  
59 - [CNLiveCServiceManagerBridge jumpGetPageOtherVC:pageModel.contentId controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]]; 58 + [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGetPage param:[model mj_keyValues] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
60 } 59 }
61 } 60 }
62 61
@@ -133,8 +132,6 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;; @@ -133,8 +132,6 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;;
133 { 132 {
134 if (!_listCollectionView) { 133 if (!_listCollectionView) {
135 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 134 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
136 - layout.sectionFootersPinToVisibleBounds = YES;  
137 - layout.sectionHeadersPinToVisibleBounds = YES;  
138 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 135 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
139 _listCollectionView.scrollEnabled = NO; 136 _listCollectionView.scrollEnabled = NO;
140 _listCollectionView.backgroundColor = kWhiteColor; 137 _listCollectionView.backgroundColor = kWhiteColor;
CNLiveCServiceModule/Classes/View/CNLiveRecommendCell.m
@@ -29,12 +29,8 @@ static NSString *CNVideoRecommendCellID = @&quot;CNLiveVideoRecommendCell&quot;; @@ -29,12 +29,8 @@ static NSString *CNVideoRecommendCellID = @&quot;CNLiveVideoRecommendCell&quot;;
29 } 29 }
30 #pragma mark - UICollectionViewDelegate 30 #pragma mark - UICollectionViewDelegate
31 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ 31 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
32 - if ([_model.blockName isEqualToString:@"精品音频"]){  
33 - [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeVideo param:self.model.contents[indexPath.row] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];  
34 - }else{  
35 - CnLivePageContentModel *model = [CnLivePageContentModel mj_objectWithKeyValues:self.model.contents[indexPath.row]];  
36 - [CNLiveCServiceManagerBridge jumpGoodsViewController:model.contentId controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];  
37 - } 32 + [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGetPage param:self.model.contents[indexPath.row] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
  33 +
38 } 34 }
39 #pragma mark - UICollectionViewDataSource 35 #pragma mark - UICollectionViewDataSource
40 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 36 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
@@ -75,8 +71,6 @@ static NSString *CNVideoRecommendCellID = @&quot;CNLiveVideoRecommendCell&quot;; @@ -75,8 +71,6 @@ static NSString *CNVideoRecommendCellID = @&quot;CNLiveVideoRecommendCell&quot;;
75 { 71 {
76 if (!_listCollectionView) { 72 if (!_listCollectionView) {
77 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 73 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
78 - layout.sectionFootersPinToVisibleBounds = NO;  
79 - layout.sectionHeadersPinToVisibleBounds = NO;  
80 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 74 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
81 _listCollectionView.backgroundColor = kWhiteColor; 75 _listCollectionView.backgroundColor = kWhiteColor;
82 _listCollectionView.collectionViewLayout = layout; 76 _listCollectionView.collectionViewLayout = layout;
CNLiveCServiceModule/Classes/View/CNLiveServiceEpiCell.m
@@ -68,13 +68,11 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;; @@ -68,13 +68,11 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;;
68 #pragma mark - Action 68 #pragma mark - Action
69 - (void)ButtonClick:(UIButton *)sender 69 - (void)ButtonClick:(UIButton *)sender
70 { 70 {
71 - CnLivePageContentModel *pageModel = [CnLivePageContentModel mj_objectWithKeyValues:_model.rightLists[sender.tag - 1000]];  
72 - [CNLiveCServiceManagerBridge jumpGetPageOtherVC:pageModel.contentId controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]]; 71 + [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGetPage param:_model.rightLists[sender.tag - 1000] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
73 } 72 }
74 #pragma mark - UICollectionViewDelegate 73 #pragma mark - UICollectionViewDelegate
75 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ 74 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
76 - CnLivePageContentModel *model = [CnLivePageContentModel mj_objectWithKeyValues:self.model.contents[indexPath.row]];  
77 - [CNLiveCServiceManagerBridge jumpGetPageOtherVC:model.contentId controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]]; 75 + [CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGetPage param:self.model.contents[indexPath.row] controller:[CNLiveCServiceManagerBridge viewControllerFromView:self]];
78 } 76 }
79 #pragma mark - UICollectionViewDataSource 77 #pragma mark - UICollectionViewDataSource
80 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 78 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
@@ -149,8 +147,6 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;; @@ -149,8 +147,6 @@ static NSString *CNServiceOrLookID = @&quot;CNLiveServiceOrLookCell&quot;;
149 { 147 {
150 if (!_listCollectionView) { 148 if (!_listCollectionView) {
151 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 149 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
152 - layout.sectionFootersPinToVisibleBounds = YES;  
153 - layout.sectionHeadersPinToVisibleBounds = YES;  
154 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 150 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
155 _listCollectionView.backgroundColor = kWhiteColor; 151 _listCollectionView.backgroundColor = kWhiteColor;
156 _listCollectionView.collectionViewLayout = layout; 152 _listCollectionView.collectionViewLayout = layout;
CNLiveCServiceModule/Classes/ViewController/CNLiveAllServiceVC.m
@@ -36,16 +36,25 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;; @@ -36,16 +36,25 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;;
36 return vc; 36 return vc;
37 } 37 }
38 - (void)requestService{ 38 - (void)requestService{
  39 + if (self.page == 1) {
  40 + self.dataSource = @[];
  41 + [self.listCollectionView reloadData];
  42 + }
39 if (![CNLiveNetworking isNetworking]) { 43 if (![CNLiveNetworking isNetworking]) {
40 self.listCollectionView.mj_footer.hidden = YES; 44 self.listCollectionView.mj_footer.hidden = YES;
  45 + if (self.dataSource.count>0) {
  46 + return;
  47 + }
41 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(requestService)]; 48 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(requestService)];
42 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); 49 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop);
43 [self setCNAPIErrorEmptyView]; 50 [self setCNAPIErrorEmptyView];
44 return; 51 return;
45 } 52 }
  53 + [QMUITips showLoadingInView:self.view];
46 weakself 54 weakself
47 [CNLiveServicePresent loadAllServiceWithServiceId:_serviceId page:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray * _Nonnull dataArray, BOOL isLastPage) { 55 [CNLiveServicePresent loadAllServiceWithServiceId:_serviceId page:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray * _Nonnull dataArray, BOOL isLastPage) {
48 strongself 56 strongself
  57 + [QMUITips hideAllTipsInView:self.view];
49 [self.listCollectionView.mj_footer endRefreshing]; 58 [self.listCollectionView.mj_footer endRefreshing];
50 self.listCollectionView.mj_footer.hidden = NO; 59 self.listCollectionView.mj_footer.hidden = NO;
51 60
@@ -53,10 +62,19 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;; @@ -53,10 +62,19 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;;
53 [self.listCollectionView.mj_footer endRefreshingWithNoMoreData]; 62 [self.listCollectionView.mj_footer endRefreshingWithNoMoreData];
54 } 63 }
55 [self removeEmptyView]; 64 [self removeEmptyView];
56 - self.dataSource = dataArray; 65 + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.dataSource];
  66 + for (id object in dataArray) {
  67 + [array addObject:object];
  68 + }
  69 +
  70 + self.dataSource = array.copy;
57 [self.listCollectionView reloadData]; 71 [self.listCollectionView reloadData];
58 }error:^{ 72 }error:^{
59 strongself 73 strongself
  74 + [QMUITips hideAllTipsInView:self.view];
  75 + if (self.dataSource.count > 0) {
  76 + return;
  77 + }
60 [self.listCollectionView.mj_footer endRefreshing]; 78 [self.listCollectionView.mj_footer endRefreshing];
61 self.listCollectionView.mj_footer.hidden = YES; 79 self.listCollectionView.mj_footer.hidden = YES;
62 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; 80 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)];
@@ -172,8 +190,6 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;; @@ -172,8 +190,6 @@ static NSString *HistoryFootID = @&quot;UICollectionFooterView&quot;;
172 { 190 {
173 if (!_listCollectionView) { 191 if (!_listCollectionView) {
174 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 192 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
175 - layout.sectionFootersPinToVisibleBounds = YES;  
176 - layout.sectionHeadersPinToVisibleBounds = YES;  
177 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 193 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
178 _listCollectionView.backgroundColor = kWhiteColor; 194 _listCollectionView.backgroundColor = kWhiteColor;
179 _listCollectionView.collectionViewLayout = layout; 195 _listCollectionView.collectionViewLayout = layout;
CNLiveCServiceModule/Classes/ViewController/CNLiveMyServicesVC.m
@@ -27,18 +27,30 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;; @@ -27,18 +27,30 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;;
27 return myService; 27 return myService;
28 } 28 }
29 - (void)myServiceData{ 29 - (void)myServiceData{
  30 + if (self.page == 1) {
  31 + self.dataSource = @[];
  32 + [self.listCollectionView reloadData];
  33 + }
30 if (![CNLiveNetworking isNetworking]) { 34 if (![CNLiveNetworking isNetworking]) {
31 self.listCollectionView.mj_footer.hidden = YES; 35 self.listCollectionView.mj_footer.hidden = YES;
  36 + if (self.dataSource.count > 0) {
  37 + return;
  38 + }
32 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(myServiceData)]; 39 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(myServiceData)];
33 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); 40 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop);
34 [self setCNAPIErrorEmptyView]; 41 [self setCNAPIErrorEmptyView];
35 return; 42 return;
36 } 43 }
  44 + [QMUITips showLoadingInView:self.view];
37 weakself 45 weakself
38 - [CNLiveServicePresent loadMyServicepage:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray * _Nonnull dataArray) { 46 + [CNLiveServicePresent loadMyServicepage:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray * _Nonnull dataArray, BOOL isLastPage) {
39 strongself 47 strongself
40 [self.listCollectionView.mj_footer endRefreshing]; 48 [self.listCollectionView.mj_footer endRefreshing];
  49 + [QMUITips hideAllTipsInView:self.view];
41 if (!dataArray||dataArray.count <= 0) { 50 if (!dataArray||dataArray.count <= 0) {
  51 + if (self.dataSource.count > 0) {
  52 + return;
  53 + }
42 self.listCollectionView.mj_footer.hidden = YES; 54 self.listCollectionView.mj_footer.hidden = YES;
43 self.navigationBar.right.hidden = YES; 55 self.navigationBar.right.hidden = YES;
44 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noMsg"] text:@"暂无内容" detailText:nil buttonTitle:NULL buttonAction:NULL]; 56 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noMsg"] text:@"暂无内容" detailText:nil buttonTitle:NULL buttonAction:NULL];
@@ -47,15 +59,21 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;; @@ -47,15 +59,21 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;;
47 }else{ 59 }else{
48 self.listCollectionView.mj_footer.hidden = NO; 60 self.listCollectionView.mj_footer.hidden = NO;
49 [self removeEmptyView]; 61 [self removeEmptyView];
50 - if (dataArray.count < 10) { 62 + if (isLastPage) {
51 [self.listCollectionView.mj_footer endRefreshingWithNoMoreData]; 63 [self.listCollectionView.mj_footer endRefreshingWithNoMoreData];
52 - 64 + }else{
  65 + [self.listCollectionView.mj_footer endRefreshing];
53 } 66 }
54 self.navigationBar.right.hidden = NO; 67 self.navigationBar.right.hidden = NO;
55 - self.dataSource = dataArray; 68 + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.dataSource];
  69 + for (id object in dataArray) {
  70 + [array addObject:object];
  71 + }
  72 + self.dataSource = array.copy;
56 [self.listCollectionView reloadData]; 73 [self.listCollectionView reloadData];
57 } 74 }
58 } error:^{ 75 } error:^{
  76 + [QMUITips hideAllTipsInView:self.view];
59 [self.listCollectionView.mj_footer endRefreshing]; 77 [self.listCollectionView.mj_footer endRefreshing];
60 self.listCollectionView.mj_footer.hidden = YES; 78 self.listCollectionView.mj_footer.hidden = YES;
61 strongself 79 strongself
@@ -120,8 +138,6 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;; @@ -120,8 +138,6 @@ static NSString *HotListCellID = @&quot;HotListCellID&quot;;
120 { 138 {
121 if (!_listCollectionView) { 139 if (!_listCollectionView) {
122 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 140 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
123 - layout.sectionFootersPinToVisibleBounds = YES;  
124 - layout.sectionHeadersPinToVisibleBounds = YES;  
125 layout.itemSize = CGSizeMake((SCREEN_WIDTH-4*15-3*15)/4.0, 80); 141 layout.itemSize = CGSizeMake((SCREEN_WIDTH-4*15-3*15)/4.0, 80);
126 layout.sectionInset = UIEdgeInsetsMake(15, 15, 15, 15); 142 layout.sectionInset = UIEdgeInsetsMake(15, 15, 15, 15);
127 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 143 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceSearchVC.m
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 #import "CNLiveSearchHotsFooterView.h" 16 #import "CNLiveSearchHotsFooterView.h"
17 #import "CNLiveSearchHeaderView.h" 17 #import "CNLiveSearchHeaderView.h"
18 18
19 -@interface CNLiveServiceSearchVC ()<UITableViewDelegate,UITableViewDataSource, UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout> 19 +@interface CNLiveServiceSearchVC ()<UITableViewDelegate,UITableViewDataSource, UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,UIScrollViewDelegate>
20 20
21 @property (nonatomic, strong) CNLiveMainSearch *searchView;//搜索框 21 @property (nonatomic, strong) CNLiveMainSearch *searchView;//搜索框
22 @property (nonatomic, strong) UIButton *cancelBtn; //取消按钮 22 @property (nonatomic, strong) UIButton *cancelBtn; //取消按钮
@@ -45,32 +45,48 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;; @@ -45,32 +45,48 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;;
45 return search; 45 return search;
46 } 46 }
47 - (void)searchRequese{ 47 - (void)searchRequese{
  48 + if (self.page == 1) {
  49 + self.dataListArr = @[];
  50 + [self.listTableView reloadData];
  51 + }
48 if (![CNLiveNetworking isNetworking]) { 52 if (![CNLiveNetworking isNetworking]) {
  53 + if (self.dataListArr.count > 0) {
  54 + return;
  55 + }
49 self.listCollectionView.mj_footer.hidden = YES; 56 self.listCollectionView.mj_footer.hidden = YES;
50 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(searchRequese)]; 57 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(searchRequese)];
51 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); 58 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop);
52 [self setCNAPIErrorEmptyView]; 59 [self setCNAPIErrorEmptyView];
53 return; 60 return;
54 } 61 }
  62 + [QMUITips showLoadingInView:self.view];
55 weakself 63 weakself
56 [CNLiveServicePresent searchServiceList:_searchStr page:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray<CNLiveSearchModel *> * _Nonnull dataArray, BOOL isLastPage) { 64 [CNLiveServicePresent searchServiceList:_searchStr page:[NSString stringWithFormat:@"%ld",_page] result:^(NSArray<CNLiveSearchModel *> * _Nonnull dataArray, BOOL isLastPage) {
57 weakSelf.listCollectionView.hidden = YES; 65 weakSelf.listCollectionView.hidden = YES;
  66 + [QMUITips hideAllTipsInView:self.view];
58 strongself 67 strongself
59 if (!dataArray||dataArray.count <= 0) { 68 if (!dataArray||dataArray.count <= 0) {
  69 + if (self.dataListArr.count > 0) {
  70 + return;
  71 + }
60 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noMsg"] text:@"暂无内容" detailText:nil buttonTitle:NULL buttonAction:@selector(searchRequese)]; 72 [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noMsg"] text:@"暂无内容" detailText:nil buttonTitle:NULL buttonAction:@selector(searchRequese)];
61 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); 73 self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop);
62 [self setCNAPIErrorEmptyView]; 74 [self setCNAPIErrorEmptyView];
63 }else{ 75 }else{
  76 + [QMUITips hideAllTipsInView:self.view];
64 [self removeEmptyView]; 77 [self removeEmptyView];
65 self.listTableView.mj_footer.hidden = NO; 78 self.listTableView.mj_footer.hidden = NO;
66 if (isLastPage) { 79 if (isLastPage) {
67 [self.listTableView.mj_footer endRefreshingWithNoMoreData]; 80 [self.listTableView.mj_footer endRefreshingWithNoMoreData];
68 }else{ 81 }else{
69 - self.page ++; 82 + [self.listTableView.mj_footer endRefreshing];
70 } 83 }
71 self.listTableView.hidden = NO; 84 self.listTableView.hidden = NO;
72 -  
73 - self.dataListArr = dataArray; 85 + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.dataListArr];
  86 + for (id object in dataArray) {
  87 + [array addObject:object];
  88 + }
  89 + self.dataListArr = array.copy;
74 [self.listTableView reloadData]; 90 [self.listTableView reloadData];
75 } 91 }
76 } error:^{ 92 } error:^{
@@ -156,9 +172,13 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;; @@ -156,9 +172,13 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;;
156 [self.navigationController popViewControllerAnimated:YES]; 172 [self.navigationController popViewControllerAnimated:YES];
157 } 173 }
158 #pragma mark - UIScrollViewDelegate 174 #pragma mark - UIScrollViewDelegate
159 -- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ 175 +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
160 [self.view endEditing:YES]; 176 [self.view endEditing:YES];
161 } 177 }
  178 +- (BOOL)shouldHideKeyboardWhenTouchInView:(UIView *)view
  179 +{
  180 + return YES;
  181 +}
162 #pragma mark - UITableViewDelegate 182 #pragma mark - UITableViewDelegate
163 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 183 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
164 return 75; 184 return 75;
@@ -305,7 +325,12 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;; @@ -305,7 +325,12 @@ static NSString *HistoryFootID = @&quot;HistoryFootID&quot;;
305 _listTableView.dataSource = self; 325 _listTableView.dataSource = self;
306 _listTableView.delegate = self; 326 _listTableView.delegate = self;
307 [_listTableView registerClass:[CNLiveSearchListCell class] forCellReuseIdentifier:SearchListCellID]; 327 [_listTableView registerClass:[CNLiveSearchListCell class] forCellReuseIdentifier:SearchListCellID];
308 - _listTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(searchRequese)]; 328 + weakself
  329 + _listTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
  330 + strongself
  331 + self.page ++;
  332 + [self searchRequese];
  333 + }];
309 _listTableView.hidden = YES; 334 _listTableView.hidden = YES;
310 } 335 }
311 return _listTableView; 336 return _listTableView;
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceVC.m
@@ -246,8 +246,6 @@ static NSString *CNGoodsOrVideoheaderID = @&quot;CNLiveGoodsOrVideoHeaderView&quot;; @@ -246,8 +246,6 @@ static NSString *CNGoodsOrVideoheaderID = @&quot;CNLiveGoodsOrVideoHeaderView&quot;;
246 { 246 {
247 if (!_listCollectionView) { 247 if (!_listCollectionView) {
248 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 248 UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
249 - layout.sectionFootersPinToVisibleBounds = YES;  
250 - layout.sectionHeadersPinToVisibleBounds = YES;  
251 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; 249 _listCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
252 _listCollectionView.backgroundColor = kWhiteColor; 250 _listCollectionView.backgroundColor = kWhiteColor;
253 _listCollectionView.collectionViewLayout = layout; 251 _listCollectionView.collectionViewLayout = layout;