Commit 968eeddbf59f54be2f3eb0a8d1e201fcb02be936
1 parent
37481026
修复云测bug
Showing
28 changed files
with
120 additions
and
131 deletions
CNLiveCServiceModule.podspec
CNLiveCServiceModule/Classes/Category/UIImage+CNBundleOrGredient.h
| ... | ... | @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 12 | 12 | @interface UIImage (CNBundleOrGredient) |
| 13 | 13 | |
| 14 | 14 | // 创建一张渐变色图片 |
| 15 | -+ (UIImage *)gradientImageWithColors:(NSArray *)colors rect:(CGRect)rect; | |
| 15 | ++ (UIImage *)gradientVerticalImageWithColors:(NSArray *)colors rect:(CGRect)rect; | |
| 16 | 16 | +(UIImage *)loadCServiceBundle:(NSString *)imageName; |
| 17 | 17 | |
| 18 | 18 | @end | ... | ... |
CNLiveCServiceModule/Classes/Category/UIImage+CNBundleOrGredient.m
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | return image; |
| 18 | 18 | } |
| 19 | 19 | // 创建一张渐变色图片 |
| 20 | -+ (UIImage *)gradientImageWithColors:(NSArray *)colors rect:(CGRect)rect{ | |
| 20 | ++ (UIImage *)gradientVerticalImageWithColors:(NSArray *)colors rect:(CGRect)rect{ | |
| 21 | 21 | if (!colors.count || CGRectEqualToRect(rect, CGRectZero)) { |
| 22 | 22 | return nil; |
| 23 | 23 | } | ... | ... |
CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.m
| ... | ... | @@ -42,7 +42,7 @@ static const CGFloat margin = 15; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | }else{ |
| 45 | - [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; | |
| 45 | + [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:2]; | |
| 46 | 46 | !failure?:failure(); |
| 47 | 47 | } |
| 48 | 48 | }]; |
| ... | ... | @@ -174,7 +174,7 @@ static const CGFloat margin = 15; |
| 174 | 174 | model = [CNLiveSearchModel mj_objectWithKeyValues:dic]; |
| 175 | 175 | } |
| 176 | 176 | [categories addObject:model]; |
| 177 | - if (num != 0 && (i != 0 || array.count == 1) &&(i%(num-1) == 0 || i == array.count - 1)) { | |
| 177 | + if (num != 0 && (i != 0 || array.count == 1) &&((i + 1)%num == 0 || i == array.count - 1)) { | |
| 178 | 178 | NSDictionary *category = @{ |
| 179 | 179 | @"title":title, |
| 180 | 180 | @"lists":categories.copy, |
| ... | ... | @@ -323,7 +323,8 @@ static const CGFloat margin = 15; |
| 323 | 323 | + (void)loadAllServiceWithServiceId:(NSString *)serviceId page:(nonnull NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(void (^)(void))failure |
| 324 | 324 | { |
| 325 | 325 | NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"", |
| 326 | - @"categoryId":serviceId?serviceId:@"" | |
| 326 | + @"categoryId":serviceId?serviceId:@"", | |
| 327 | + @"page":page?page:@"" | |
| 327 | 328 | }; |
| 328 | 329 | |
| 329 | 330 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ... | ... |
CNLiveCServiceModule/Classes/View/CNLIveCategoryCell.m
| ... | ... | @@ -23,12 +23,12 @@ |
| 23 | 23 | [self.contentView addSubview:self.titleLabel]; |
| 24 | 24 | [self.contentView addSubview:self.subTitle]; |
| 25 | 25 | [self.contentView addSubview:self.rightImage]; |
| 26 | + [self makeSubViewsLayout]; | |
| 26 | 27 | } |
| 27 | 28 | return self; |
| 28 | 29 | } |
| 29 | --(void)layoutSubviews | |
| 30 | +-(void)makeSubViewsLayout | |
| 30 | 31 | { |
| 31 | - [super layoutSubviews]; | |
| 32 | 32 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 33 | 33 | make.left.equalTo(self.contentView).offset(15); |
| 34 | 34 | make.centerY.equalTo(self.contentView); |
| ... | ... | @@ -59,7 +59,6 @@ |
| 59 | 59 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 60 | 60 | self.titleLabel.text = model.title; |
| 61 | 61 | self.subTitle.text = model.desc; |
| 62 | - [self layoutSubviews]; | |
| 63 | 62 | } |
| 64 | 63 | - (UIImageView *)logoView{ |
| 65 | 64 | if (!_logoView) { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveAlertTipView.m
| ... | ... | @@ -123,7 +123,7 @@ |
| 123 | 123 | [_sureBtn setTitleColor:kWhiteColor forState:UIControlStateNormal]; |
| 124 | 124 | _sureBtn.layer.cornerRadius = 21; |
| 125 | 125 | _sureBtn.titleLabel.font = UIFontMake(16); |
| 126 | - _sureBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[CNLiveColorWithHexString(@"#FFAA4A"),CNLiveColorWithHexString(@"#EC5645")] rect:CGRectMake(0, 0, 120, 39)]]; | |
| 126 | + _sureBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[CNLiveColorWithHexString(@"#FFAA4A"),CNLiveColorWithHexString(@"#EC5645")] rect:CGRectMake(0, 0, 120, 39)]]; | |
| 127 | 127 | } |
| 128 | 128 | return _sureBtn; |
| 129 | 129 | } | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveChineServiceCell.m
| ... | ... | @@ -21,12 +21,12 @@ |
| 21 | 21 | [self.contentView addSubview:self.logoView]; |
| 22 | 22 | [self.contentView addSubview:self.titleLabel]; |
| 23 | 23 | [self.contentView addSubview:self.subTitle]; |
| 24 | + [self makeSubViewsLayout]; | |
| 24 | 25 | } |
| 25 | 26 | return self; |
| 26 | 27 | } |
| 27 | --(void)layoutSubviews | |
| 28 | +-(void)makeSubViewsLayout | |
| 28 | 29 | { |
| 29 | - [super layoutSubviews]; | |
| 30 | 30 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 31 | 31 | make.left.equalTo(self.contentView).offset(15); |
| 32 | 32 | make.centerY.equalTo(self.contentView); |
| ... | ... | @@ -51,7 +51,6 @@ |
| 51 | 51 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 52 | 52 | self.titleLabel.text = model.title; |
| 53 | 53 | self.subTitle.text = model.desc; |
| 54 | - [self layoutSubviews]; | |
| 55 | 54 | } |
| 56 | 55 | - (UIImageView *)logoView{ |
| 57 | 56 | if (!_logoView) { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveCycleActiveCell.m
| ... | ... | @@ -19,10 +19,11 @@ |
| 19 | 19 | if (self) { |
| 20 | 20 | [self.contentView addSubview:self.cycleView]; |
| 21 | 21 | self.collectionView.layer.cornerRadius = 9; |
| 22 | + [self makeSubViewsLayout]; | |
| 22 | 23 | } |
| 23 | 24 | return self; |
| 24 | 25 | } |
| 25 | -- (void)layoutSubviews | |
| 26 | +-(void)makeSubViewsLayout | |
| 26 | 27 | { |
| 27 | 28 | [super layoutSubviews]; |
| 28 | 29 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { |
| ... | ... | @@ -60,6 +61,7 @@ |
| 60 | 61 | _cycleView.infiniteLoop = YES; |
| 61 | 62 | _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated; |
| 62 | 63 | _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter; |
| 64 | + _cycleView.contentMode = UIViewContentModeScaleAspectFit; | |
| 63 | 65 | _cycleView.hidesForSinglePage = YES; |
| 64 | 66 | _cycleView.pageControlDotSize = CGSizeMake(4, 4); |
| 65 | 67 | } | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveCycleCell.m
| ... | ... | @@ -28,10 +28,11 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; |
| 28 | 28 | self = [super initWithFrame:frame]; |
| 29 | 29 | if (self) { |
| 30 | 30 | [self.contentView addSubview:self.listCollectionView]; |
| 31 | + [self makeSubViewsLayout]; | |
| 31 | 32 | } |
| 32 | 33 | return self; |
| 33 | 34 | } |
| 34 | -- (void)layoutSubviews | |
| 35 | +-(void)makeSubViewsLayout | |
| 35 | 36 | { |
| 36 | 37 | [super layoutSubviews]; |
| 37 | 38 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveCycleView.m
| ... | ... | @@ -20,17 +20,13 @@ static NSString *CNCycleCellID = @"CNCycleCellID"; |
| 20 | 20 | if (self) { |
| 21 | 21 | self.backgroundColor = kClearColor; |
| 22 | 22 | self.collectionView.dataSource = self; |
| 23 | + [self makeSubViewsLayout]; | |
| 23 | 24 | } |
| 24 | 25 | return self; |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | -- (void)layoutSubviews | |
| 28 | +-(void)makeSubViewsLayout | |
| 28 | 29 | { |
| 29 | - [super layoutSubviews]; | |
| 30 | - if ([_model.title isEqualToString:@""]) { | |
| 31 | - return; | |
| 32 | - } | |
| 33 | - | |
| 34 | 30 | self.collectionView.frame = CGRectMake(0, 0, self.width, self.height - 20); |
| 35 | 31 | } |
| 36 | 32 | #pragma mark - UICollectionViewDataSource | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveGoodsOrVideoHeaderView.m
| ... | ... | @@ -24,12 +24,12 @@ |
| 24 | 24 | [self addSubview:self.titlelabel]; |
| 25 | 25 | [self addSubview:self.subTitle]; |
| 26 | 26 | [self addSubview:self.moreBtn]; |
| 27 | + [self makeSubViewsLayout]; | |
| 27 | 28 | } |
| 28 | 29 | return self; |
| 29 | 30 | } |
| 30 | -- (void)layoutSubviews | |
| 31 | +-(void)makeSubViewsLayout | |
| 31 | 32 | { |
| 32 | - [super layoutSubviews]; | |
| 33 | 33 | |
| 34 | 34 | [self.LogoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 35 | 35 | make.left.equalTo(self).offset(15); |
| ... | ... | @@ -37,11 +37,7 @@ |
| 37 | 37 | make.width.height.offset(16.5); |
| 38 | 38 | }]; |
| 39 | 39 | [self.titlelabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| 40 | - if (!self.LogoImage.isHidden) { | |
| 41 | - make.left.equalTo(_LogoImage.mas_right).offset(5); | |
| 42 | - }else{ | |
| 43 | - make.left.equalTo(self).offset(15); | |
| 44 | - } | |
| 40 | + make.left.equalTo(self).offset(15); | |
| 45 | 41 | make.centerY.equalTo(self); |
| 46 | 42 | }]; |
| 47 | 43 | [self.subTitle mas_makeConstraints:^(MASConstraintMaker *make) { |
| ... | ... | @@ -73,8 +69,12 @@ |
| 73 | 69 | self.LogoImage.hidden = NO; |
| 74 | 70 | self.subTitle.hidden = NO; |
| 75 | 71 | UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1"); |
| 76 | - self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; | |
| 72 | + self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; | |
| 77 | 73 | self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256"); |
| 74 | + [self.titlelabel mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 75 | + make.left.equalTo(self.LogoImage.mas_right).offset(5); | |
| 76 | + make.centerY.equalTo(self); | |
| 77 | + }]; | |
| 78 | 78 | }else{ |
| 79 | 79 | if ([pageModel.blockName isEqualToString:@"精品音频"]) { |
| 80 | 80 | self.moreBtn.hidden = YES; |
| ... | ... | @@ -85,8 +85,11 @@ |
| 85 | 85 | self.subTitle.hidden = YES; |
| 86 | 86 | self.backgroundColor = kWhiteColor; |
| 87 | 87 | _titlelabel.textColor = CNLiveColorWithHexString(@"#333333"); |
| 88 | + [self.titlelabel mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 89 | + make.left.equalTo(self).offset(15); | |
| 90 | + make.centerY.equalTo(self); | |
| 91 | + }]; | |
| 88 | 92 | } |
| 89 | - [self setNeedsLayout]; | |
| 90 | 93 | } |
| 91 | 94 | - (UIImageView *)LogoImage |
| 92 | 95 | { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveHotSaleCell.h deleted
100644 → 0
CNLiveCServiceModule/Classes/View/CNLiveHotSaleCell.m deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveHotSaleCell.m | |
| 3 | -// CNLiveCServiceModule | |
| 4 | -// | |
| 5 | -// Created by CNLive on 2021/11/27. | |
| 6 | -// | |
| 7 | - | |
| 8 | -#import "CNLiveHotSaleCell.h" | |
| 9 | - | |
| 10 | -@implementation CNLiveHotSaleCell | |
| 11 | - | |
| 12 | -- (void)awakeFromNib { | |
| 13 | - [super awakeFromNib]; | |
| 14 | - // Initialization code | |
| 15 | -} | |
| 16 | - | |
| 17 | -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | |
| 18 | - [super setSelected:selected animated:animated]; | |
| 19 | - | |
| 20 | - // Configure the view for the selected state | |
| 21 | -} | |
| 22 | - | |
| 23 | -@end |
CNLiveCServiceModule/Classes/View/CNLiveRecommendCell.m
| ... | ... | @@ -17,12 +17,12 @@ static NSString *CNVideoRecommendCellID = @"CNLiveVideoRecommendCell"; |
| 17 | 17 | self = [super initWithFrame:frame]; |
| 18 | 18 | if (self) { |
| 19 | 19 | [self.contentView addSubview:self.listCollectionView]; |
| 20 | + [self makeSubViewsLayout]; | |
| 20 | 21 | } |
| 21 | 22 | return self; |
| 22 | 23 | } |
| 23 | -- (void)layoutSubviews | |
| 24 | +- (void)makeSubViewsLayout | |
| 24 | 25 | { |
| 25 | - [super layoutSubviews]; | |
| 26 | 26 | [self.listCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 27 | 27 | make.left.right.top.bottom.equalTo(self); |
| 28 | 28 | }]; | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchHeaderView.m
| ... | ... | @@ -20,13 +20,12 @@ |
| 20 | 20 | self.backgroundColor = kWhiteColor; |
| 21 | 21 | [self addSubview:self.lineView]; |
| 22 | 22 | [self addSubview:self.titlelabel]; |
| 23 | - | |
| 23 | + [self makeSubViewsLayout]; | |
| 24 | 24 | } |
| 25 | 25 | return self; |
| 26 | 26 | } |
| 27 | -- (void)layoutSubviews | |
| 27 | +- (void)makeSubViewsLayout | |
| 28 | 28 | { |
| 29 | - [super layoutSubviews]; | |
| 30 | 29 | [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 31 | 30 | make.left.equalTo(self); |
| 32 | 31 | make.centerY.equalTo(self); |
| ... | ... | @@ -55,7 +54,7 @@ |
| 55 | 54 | _model = model; |
| 56 | 55 | if (_type == CNServiceHeaderTypeCategoryId) { |
| 57 | 56 | self.lineView.hidden = NO; |
| 58 | - self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[CNLiveColorWithHexString(@"#FEF2E0"),kWhiteColor] rect:self.bounds]]; | |
| 57 | + self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[CNLiveColorWithHexString(@"#FEF2E0"),kWhiteColor] rect:self.bounds]]; | |
| 59 | 58 | NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@/正在使用",model.title]]; |
| 60 | 59 | [string addAttribute:NSFontAttributeName value:UIFontMake(12) range:NSMakeRange(0, string.length)]; |
| 61 | 60 | [string addAttribute:NSFontAttributeName value:UIFontMake(17) range:NSMakeRange(0, model.title.length)]; |
| ... | ... | @@ -67,7 +66,6 @@ |
| 67 | 66 | self.titlelabel.text = model.title; |
| 68 | 67 | } |
| 69 | 68 | [self.titlelabel sizeToFit]; |
| 70 | - [self setNeedsLayout]; | |
| 71 | 69 | } |
| 72 | 70 | - (UIView *)lineView |
| 73 | 71 | { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchHistoryCell.m
| ... | ... | @@ -18,15 +18,16 @@ |
| 18 | 18 | if (self) { |
| 19 | 19 | self.contentView.backgroundColor = CNLiveColorWithHexString(@"#F9F9F9"); |
| 20 | 20 | [self.contentView addSubview:self.history]; |
| 21 | + [self makeSubViewsLayout]; | |
| 21 | 22 | } |
| 22 | 23 | return self; |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | --(void)layoutSubviews | |
| 26 | +- (void)makeSubViewsLayout | |
| 26 | 27 | { |
| 27 | - [super layoutSubviews]; | |
| 28 | 28 | [self.history mas_makeConstraints:^(MASConstraintMaker *make) { |
| 29 | 29 | make.center.equalTo(self.contentView); |
| 30 | + make.left.right.equalTo(self); | |
| 30 | 31 | }]; |
| 31 | 32 | } |
| 32 | 33 | |
| ... | ... | @@ -34,8 +35,6 @@ |
| 34 | 35 | - (void)setModel:(CNLiveHistoryModel *)model |
| 35 | 36 | { |
| 36 | 37 | self.history.text = model.title; |
| 37 | - [self.history sizeToFit]; | |
| 38 | - [self setNeedsLayout]; | |
| 39 | 38 | } |
| 40 | 39 | - (UILabel *)history |
| 41 | 40 | { |
| ... | ... | @@ -43,6 +42,7 @@ |
| 43 | 42 | _history = [[UILabel alloc] init]; |
| 44 | 43 | _history.font = UIFontMake(12); |
| 45 | 44 | _history.textColor = CNLiveColorWithHexString(@"#4A4A4A"); |
| 45 | + _history.textAlignment = NSTextAlignmentCenter; | |
| 46 | 46 | } |
| 47 | 47 | return _history; |
| 48 | 48 | } | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchHotsCell.m
| ... | ... | @@ -18,12 +18,12 @@ |
| 18 | 18 | if (self) { |
| 19 | 19 | [self.contentView addSubview:self.logoView]; |
| 20 | 20 | [self.contentView addSubview:self.titleLabel]; |
| 21 | + [self makeSubViewsLayout]; | |
| 21 | 22 | } |
| 22 | 23 | return self; |
| 23 | 24 | } |
| 24 | --(void)layoutSubviews | |
| 25 | +- (void)makeSubViewsLayout | |
| 25 | 26 | { |
| 26 | - [super layoutSubviews]; | |
| 27 | 27 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 28 | 28 | make.top.equalTo(self.contentView).offset(0); |
| 29 | 29 | make.centerX.equalTo(self.contentView); |
| ... | ... | @@ -42,7 +42,6 @@ |
| 42 | 42 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 43 | 43 | self.titleLabel.text = model.title; |
| 44 | 44 | [self.titleLabel sizeToFit]; |
| 45 | - [self layoutSubviews]; | |
| 46 | 45 | } |
| 47 | 46 | - (UIImageView *)logoView{ |
| 48 | 47 | if (!_logoView) { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchHotsFooterView.m
| ... | ... | @@ -20,12 +20,12 @@ |
| 20 | 20 | self.backgroundColor = kWhiteColor; |
| 21 | 21 | [self addSubview:self.line]; |
| 22 | 22 | [self addSubview:self.clearBtn]; |
| 23 | + [self makeSubViewsLayout]; | |
| 23 | 24 | } |
| 24 | 25 | return self; |
| 25 | 26 | } |
| 26 | -- (void)layoutSubviews | |
| 27 | +- (void)makeSubViewsLayout | |
| 27 | 28 | { |
| 28 | - [super layoutSubviews]; | |
| 29 | 29 | [self.line mas_makeConstraints:^(MASConstraintMaker *make) { |
| 30 | 30 | make.top.equalTo(self); |
| 31 | 31 | make.left.equalTo(self).offset(15); | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchListCell.m
| ... | ... | @@ -23,10 +23,11 @@ |
| 23 | 23 | [self.contentView addSubview:self.logoView]; |
| 24 | 24 | [self.contentView addSubview:self.titleLabel]; |
| 25 | 25 | [self.contentView addSubview:self.line]; |
| 26 | + [self makeSubViewsLayout]; | |
| 26 | 27 | } |
| 27 | 28 | return self; |
| 28 | 29 | } |
| 29 | -- (void)layoutSubviews | |
| 30 | +- (void)makeSubViewsLayout | |
| 30 | 31 | { |
| 31 | 32 | [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 32 | 33 | make.top.left.equalTo(self.contentView).offset(15); |
| ... | ... | @@ -56,7 +57,6 @@ |
| 56 | 57 | [attrString addAttribute:NSForegroundColorAttributeName value:color range:range]; |
| 57 | 58 | self.titleLabel.attributedText = attrString; |
| 58 | 59 | [self.titleLabel sizeToFit]; |
| 59 | - [self setNeedsLayout]; | |
| 60 | 60 | } |
| 61 | 61 | - (UIImageView *)logoView{ |
| 62 | 62 | if (!_logoView) { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveServiceChinasCell.m
| ... | ... | @@ -18,12 +18,12 @@ |
| 18 | 18 | self = [super initWithFrame:frame]; |
| 19 | 19 | if (self) { |
| 20 | 20 | [self.contentView addSubview:self.cycleView]; |
| 21 | + [self makeSubViewsLayout]; | |
| 21 | 22 | } |
| 22 | 23 | return self; |
| 23 | 24 | } |
| 24 | --(void)layoutSubviews | |
| 25 | +- (void)makeSubViewsLayout | |
| 25 | 26 | { |
| 26 | - [super layoutSubviews]; | |
| 27 | 27 | [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 28 | 28 | make.top.bottom.equalTo(self.contentView); |
| 29 | 29 | make.left.equalTo(self.contentView).offset(15); | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveServiceEpiCell.m
| ... | ... | @@ -29,13 +29,13 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; |
| 29 | 29 | [self.contentView addSubview:self.travelBtn]; |
| 30 | 30 | [self.leftImageView addSubview:self.titleLabel]; |
| 31 | 31 | [self.leftImageView addSubview:self.listCollectionView]; |
| 32 | + [self makeSubViewsLayout]; | |
| 32 | 33 | } |
| 33 | 34 | return self; |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | -- (void)layoutSubviews | |
| 37 | +- (void)makeSubViewsLayout | |
| 37 | 38 | { |
| 38 | - [super layoutSubviews]; | |
| 39 | 39 | [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 40 | 40 | make.top.equalTo(self.contentView); |
| 41 | 41 | make.left.equalTo(self.contentView).offset(10); |
| ... | ... | @@ -89,7 +89,7 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; |
| 89 | 89 | } |
| 90 | 90 | #pragma mark - UICollectionViewDelegateFlowLayout |
| 91 | 91 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ |
| 92 | - return CGSizeMake(collectionView.width, (collectionView.height -10)/3); | |
| 92 | + return CGSizeMake(collectionView.width, (collectionView.height -20)/3); | |
| 93 | 93 | } |
| 94 | 94 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ |
| 95 | 95 | return UIEdgeInsetsMake(0, 0, 0, 0); |
| ... | ... | @@ -105,7 +105,6 @@ static NSString *CNServiceOrLookID = @"CNLiveServiceOrLookCell"; |
| 105 | 105 | [self.travelBtn sd_setImageWithURL:[NSURL URLWithString:pageModel1.poster] forState:UIControlStateNormal]; |
| 106 | 106 | self.titleLabel.text = model.blockName; |
| 107 | 107 | [_titleLabel sizeToFit]; |
| 108 | - [self setNeedsLayout]; | |
| 109 | 108 | [self.listCollectionView reloadData]; |
| 110 | 109 | } |
| 111 | 110 | - (UIImageView *)leftImageView | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveServiceLookCell.m
| ... | ... | @@ -24,13 +24,13 @@ |
| 24 | 24 | [self.backImage addSubview:self.titleLabel]; |
| 25 | 25 | [self.backImage addSubview:self.subTitlelabel]; |
| 26 | 26 | [self.backImage addSubview:self.cycleView]; |
| 27 | + [self makeSubViewsLayout]; | |
| 27 | 28 | |
| 28 | 29 | } |
| 29 | 30 | return self; |
| 30 | 31 | } |
| 31 | -- (void)layoutSubviews | |
| 32 | +- (void)makeSubViewsLayout | |
| 32 | 33 | { |
| 33 | - [super layoutSubviews]; | |
| 34 | 34 | [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 35 | 35 | make.top.bottom.equalTo(self.contentView); |
| 36 | 36 | make.left.equalTo(self.contentView).offset(10); |
| ... | ... | @@ -59,7 +59,7 @@ |
| 59 | 59 | NSDictionary *dic = array[i]; |
| 60 | 60 | CnLivePageContentModel *model = [CnLivePageContentModel mj_objectWithKeyValues:dic]; |
| 61 | 61 | [sqArr addObject:model]; |
| 62 | - if ((i != 0 || array.count == 1) && (i%2 == 0 || i == array.count - 1)) { | |
| 62 | + if ((i != 0 || array.count == 1) && ((i + 1)%3 == 0 || i == array.count - 1)) { | |
| 63 | 63 | NSDictionary *category = @{ |
| 64 | 64 | @"title":@"大家都在用", |
| 65 | 65 | @"lists":sqArr.copy, |
| ... | ... | @@ -87,7 +87,6 @@ |
| 87 | 87 | [self.titleLabel sizeToFit]; |
| 88 | 88 | self.subTitlelabel.text = model.blockSubTitle; |
| 89 | 89 | [self.subTitlelabel sizeToFit]; |
| 90 | - [self setNeedsLayout]; | |
| 91 | 90 | } |
| 92 | 91 | - (UIImageView *)backImage |
| 93 | 92 | { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveServiceOrLookCell.m
| ... | ... | @@ -21,11 +21,11 @@ |
| 21 | 21 | [self.contentView addSubview:self.titleLabel]; |
| 22 | 22 | [self.contentView addSubview:self.describe]; |
| 23 | 23 | [self.contentView addSubview:self.rightBtn]; |
| 24 | + [self makeSubViewsLayout]; | |
| 24 | 25 | } |
| 25 | 26 | return self; |
| 26 | 27 | } |
| 27 | -- (void)layoutSubviews{ | |
| 28 | - [super layoutSubviews]; | |
| 28 | +- (void)makeSubViewsLayout{ | |
| 29 | 29 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 30 | 30 | make.left.equalTo(self.contentView).offset(10); |
| 31 | 31 | make.centerY.equalTo(self.contentView); |
| ... | ... | @@ -56,7 +56,6 @@ |
| 56 | 56 | [self.titleLabel sizeToFit]; |
| 57 | 57 | self.describe.text = model.subTitle; |
| 58 | 58 | [self.describe sizeToFit]; |
| 59 | - [self setNeedsLayout]; | |
| 60 | 59 | } |
| 61 | 60 | - (void)setType:(CNLiveCellShowType)type |
| 62 | 61 | { | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveVideoRecommendCell.m
| ... | ... | @@ -25,15 +25,15 @@ |
| 25 | 25 | [self.contentView addSubview:self.price]; |
| 26 | 26 | [self.contentView addSubview:self.oldPrice]; |
| 27 | 27 | [self.contentView addSubview:self.lookNum]; |
| 28 | + [self makeSubViewsLayout]; | |
| 28 | 29 | } |
| 29 | 30 | return self; |
| 30 | 31 | } |
| 31 | -- (void)layoutSubviews{ | |
| 32 | - [super layoutSubviews]; | |
| 32 | +- (void)makeSubViewsLayout{ | |
| 33 | 33 | [self.logoImage mas_makeConstraints:^(MASConstraintMaker *make) { |
| 34 | 34 | make.top.equalTo(self.contentView); |
| 35 | 35 | make.centerX.equalTo(self.contentView); |
| 36 | - make.height.width.offset(_type == CNLiveCellShowTypeHot?65:96); | |
| 36 | + make.height.width.offset(65); | |
| 37 | 37 | }]; |
| 38 | 38 | |
| 39 | 39 | [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| ... | ... | @@ -41,14 +41,8 @@ |
| 41 | 41 | make.left.right.equalTo(self.logoImage); |
| 42 | 42 | }]; |
| 43 | 43 | [self.price mas_makeConstraints:^(MASConstraintMaker *make) { |
| 44 | - make.top.equalTo(_type == CNLiveCellShowTypeHot?self.logoImage.mas_bottom:self.titleLabel.mas_bottom).offset(5); | |
| 45 | - if (_type == CNLiveCellShowTypeHot) { | |
| 46 | - make.centerX.equalTo(self.contentView); | |
| 47 | - }else{ | |
| 44 | + make.top.equalTo(self.titleLabel.mas_bottom).offset(5); | |
| 48 | 45 | make.left.equalTo(self.logoImage); |
| 49 | - } | |
| 50 | - | |
| 51 | - | |
| 52 | 46 | }]; |
| 53 | 47 | [self.oldPrice mas_makeConstraints:^(MASConstraintMaker *make) { |
| 54 | 48 | make.left.equalTo(self.price.mas_right).offset(7); |
| ... | ... | @@ -75,6 +69,13 @@ |
| 75 | 69 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; |
| 76 | 70 | self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]]; |
| 77 | 71 | [self.price sizeToFit]; |
| 72 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 73 | + make.height.width.offset(65); | |
| 74 | + }]; | |
| 75 | + [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 76 | + make.top.equalTo(self.logoImage.mas_bottom).offset(5); | |
| 77 | + make.centerX.equalTo(self); | |
| 78 | + }]; | |
| 78 | 79 | }else if (_type == CNLiveCellShowTypeVideo){ |
| 79 | 80 | self.titleLabel.hidden = NO; |
| 80 | 81 | self.titleLabel.numberOfLines = 2; |
| ... | ... | @@ -82,9 +83,12 @@ |
| 82 | 83 | self.titleLabel.text = model.title; |
| 83 | 84 | NSString *num = model.spectators; |
| 84 | 85 | if (num.floatValue > 10000) { |
| 85 | - num = [NSString stringWithFormat:@"%.1f",num.floatValue/10000]; | |
| 86 | + num = [NSString stringWithFormat:@"%.1f万",num.floatValue/10000]; | |
| 86 | 87 | } |
| 87 | 88 | [self.lookNum setTitle:[NSString stringWithFormat:@"%@浏览",num] forState:UIControlStateNormal]; |
| 89 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 90 | + make.height.width.offset(96); | |
| 91 | + }]; | |
| 88 | 92 | }else{ |
| 89 | 93 | self.titleLabel.hidden = NO; |
| 90 | 94 | self.price.hidden = NO; |
| ... | ... | @@ -107,9 +111,14 @@ |
| 107 | 111 | self.oldPrice.attributedText = string; |
| 108 | 112 | [self.oldPrice sizeToFit]; |
| 109 | 113 | } |
| 110 | - | |
| 114 | + [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 115 | + make.height.width.offset(96); | |
| 116 | + }]; | |
| 117 | + [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 118 | + make.top.equalTo(self.titleLabel.mas_bottom).offset(5); | |
| 119 | + make.left.equalTo(self.logoImage); | |
| 120 | + }]; | |
| 111 | 121 | } |
| 112 | - [self setNeedsLayout]; | |
| 113 | 122 | } |
| 114 | 123 | - (UIImageView *)logoImage{ |
| 115 | 124 | if (!_logoImage) { | ... | ... |
CNLiveCServiceModule/Classes/ViewController/CNLiveAllServiceVC.m
| ... | ... | @@ -174,6 +174,9 @@ static NSString *HistoryFootID = @"UICollectionFooterView"; |
| 174 | 174 | #pragma mark - UICollectionViewDelegateFlowLayout |
| 175 | 175 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ |
| 176 | 176 | CNLiveSearchHotsModel *model = self.dataSource[indexPath.section]; |
| 177 | + if (_serviceId &&![_serviceId isEqualToString:@""]&&indexPath.section != 0){ | |
| 178 | + return CGSizeMake(collectionView.width, model.layout.height); | |
| 179 | + } | |
| 177 | 180 | return CGSizeMake(model.layout.width, model.layout.height); |
| 178 | 181 | } |
| 179 | 182 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ | ... | ... |
CNLiveCServiceModule/Classes/ViewController/CNLiveMyServicesVC.m
| ... | ... | @@ -169,14 +169,20 @@ static NSString *HotListCellID = @"HotListCellID"; |
| 169 | 169 | strongself |
| 170 | 170 | [self.navigationController popViewControllerAnimated:YES]; |
| 171 | 171 | }; |
| 172 | -// [_navigationBar.right setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateNormal]; | |
| 172 | + [_navigationBar.right setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateNormal]; | |
| 173 | 173 | _navigationBar.rightTitle = @"清空"; |
| 174 | 174 | _navigationBar.onClickRightButton = ^{ |
| 175 | - | |
| 176 | - [CNLiveServicePresent removeMyServiceResult:^{ | |
| 177 | - strongself | |
| 178 | - [self myServiceData]; | |
| 175 | + UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"确认清空所有服务吗?" message:nil preferredStyle:UIAlertControllerStyleAlert]; | |
| 176 | + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]; | |
| 177 | + UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
| 178 | + [CNLiveServicePresent removeMyServiceResult:^{ | |
| 179 | + strongself | |
| 180 | + [self myServiceData]; | |
| 181 | + }]; | |
| 179 | 182 | }]; |
| 183 | + [alertVC addAction:cancel]; | |
| 184 | + [alertVC addAction:sure]; | |
| 185 | + [weakSelf presentViewController:alertVC animated:YES completion:NULL]; | |
| 180 | 186 | }; |
| 181 | 187 | |
| 182 | 188 | } | ... | ... |
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceSearchVC.m
| ... | ... | @@ -50,13 +50,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; |
| 50 | 50 | [self.listTableView reloadData]; |
| 51 | 51 | } |
| 52 | 52 | if (![CNLiveNetworking isNetworking]) { |
| 53 | - if (self.dataListArr.count > 0) { | |
| 54 | - return; | |
| 55 | - } | |
| 56 | - self.listCollectionView.mj_footer.hidden = YES; | |
| 57 | - [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(searchRequese)]; | |
| 58 | - self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | |
| 59 | - [self setCNAPIErrorEmptyView]; | |
| 53 | + [QMUITips showError:@"网络未连接" inView:self.view hideAfterDelay:2]; | |
| 60 | 54 | return; |
| 61 | 55 | } |
| 62 | 56 | [QMUITips showLoadingInView:self.view]; |
| ... | ... | @@ -90,11 +84,7 @@ static NSString *HistoryFootID = @"HistoryFootID"; |
| 90 | 84 | [self.listTableView reloadData]; |
| 91 | 85 | } |
| 92 | 86 | } error:^{ |
| 93 | - weakSelf.listCollectionView.hidden = YES; | |
| 94 | - strongself | |
| 95 | - [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(searchRequese)]; | |
| 96 | - self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); | |
| 97 | - [self setCNAPIErrorEmptyView]; | |
| 87 | + [QMUITips hideAllTipsInView:self.view]; | |
| 98 | 88 | |
| 99 | 89 | }]; |
| 100 | 90 | } |
| ... | ... | @@ -160,11 +150,17 @@ static NSString *HistoryFootID = @"HistoryFootID"; |
| 160 | 150 | { |
| 161 | 151 | [super viewWillAppear:animated]; |
| 162 | 152 | self.navigationController.navigationBarHidden = YES; |
| 153 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActive) name:UIApplicationDidEnterBackgroundNotification object:nil]; | |
| 163 | 154 | } |
| 164 | 155 | - (void)viewWillDisappear:(BOOL)animated |
| 165 | 156 | { |
| 166 | 157 | [super viewWillDisappear:animated]; |
| 167 | 158 | self.navigationController.navigationBarHidden = NO; |
| 159 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; | |
| 160 | + [CNLiveServiceHistorySearch saveHistorySearch:self.histories.mutableCopy]; | |
| 161 | +} | |
| 162 | +#pragma mark - Notification | |
| 163 | +- (void)resignActive{ | |
| 168 | 164 | [CNLiveServiceHistorySearch saveHistorySearch:self.histories.mutableCopy]; |
| 169 | 165 | } |
| 170 | 166 | #pragma mark - Action |
| ... | ... | @@ -208,6 +204,14 @@ static NSString *HistoryFootID = @"HistoryFootID"; |
| 208 | 204 | { |
| 209 | 205 | CNLiveHistoryModel *model1 = model.lists[indexPath.row]; |
| 210 | 206 | self.searchStr = model1.title; |
| 207 | + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.histories]; | |
| 208 | + [array removeObjectAtIndex:indexPath.row]; | |
| 209 | + NSDictionary *dic = @{ | |
| 210 | + @"title":_searchStr, | |
| 211 | + }; | |
| 212 | + [array insertObject:dic atIndex:0]; | |
| 213 | + self.histories = array.copy; | |
| 214 | + [self dealHotsAndHistories]; | |
| 211 | 215 | self.searchView.searchField.text = self.searchStr; |
| 212 | 216 | [self searchRequese]; |
| 213 | 217 | } |
| ... | ... | @@ -263,7 +267,8 @@ static NSString *HistoryFootID = @"HistoryFootID"; |
| 263 | 267 | return CGSizeMake(collectionView.width, 40); |
| 264 | 268 | } |
| 265 | 269 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{ |
| 266 | - if (section == 0) { | |
| 270 | + CNLiveSearchHotsModel *model = self.hDataSources[section]; | |
| 271 | + if ([model.title isEqualToString:@"热度推荐"]) { | |
| 267 | 272 | return CGSizeMake(0, 0); |
| 268 | 273 | } |
| 269 | 274 | return CGSizeMake(self.view.width, 40); | ... | ... |
CNLiveCServiceModule/Classes/ViewController/CNLiveServiceVC.m
| ... | ... | @@ -41,6 +41,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; |
| 41 | 41 | @implementation CNLiveServiceVC |
| 42 | 42 | - (void)requestService{ |
| 43 | 43 | if (![CNLiveNetworking isNetworking]) { |
| 44 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | |
| 45 | + return; | |
| 46 | + } | |
| 44 | 47 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_noNet"] text:@"网络开小差了,刷新试试" detailText:nil buttonTitle:@" 刷新 " buttonAction:@selector(requestService)]; |
| 45 | 48 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 46 | 49 | [self setCNAPIErrorEmptyView]; |
| ... | ... | @@ -56,7 +59,11 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; |
| 56 | 59 | self.hots = hots; |
| 57 | 60 | dispatch_group_leave(requestGroup); |
| 58 | 61 | } error:^{ |
| 62 | + | |
| 59 | 63 | strongself |
| 64 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | |
| 65 | + return; | |
| 66 | + } | |
| 60 | 67 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; |
| 61 | 68 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 62 | 69 | [self setCNAPIErrorEmptyView]; |
| ... | ... | @@ -69,6 +76,9 @@ static NSString *CNGoodsOrVideoheaderID = @"CNLiveGoodsOrVideoHeaderView"; |
| 69 | 76 | } error:^{ |
| 70 | 77 | |
| 71 | 78 | strongself |
| 79 | + if (self.dataSource.count>0 && self.pageListSource.count>0) { | |
| 80 | + return; | |
| 81 | + } | |
| 72 | 82 | [self showEmptyViewWithImage:[UIImage loadCServiceBundle:@"service_failure"] text:@"加载失败,请点击重试" detailText:nil buttonTitle:@" 重试 " buttonAction:@selector(requestService)]; |
| 73 | 83 | self.emptyView.frame = CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop); |
| 74 | 84 | [self setCNAPIErrorEmptyView]; | ... | ... |