Commit 02236c18c465316a2a674dd750788208d7bf1706
1 parent
968eeddb
修复数据布局bug
Showing
5 changed files
with
46 additions
and
26 deletions
CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.m
| ... | ... | @@ -25,8 +25,8 @@ static const CGFloat margin = 15; |
| 25 | 25 | [CNLiveNetworking setupShowResult:YES]; |
| 26 | 26 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/search") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 27 | 27 | if (responseObject&&[responseObject isKindOfClass:[NSDictionary class]]) { |
| 28 | - NSString *lastPageStr = responseObject[@"data"][@"isLastPage"]; | |
| 29 | - BOOL isLastPage = lastPageStr.boolValue; | |
| 28 | + NSString *lastPageStr = responseObject[@"data"][@"hasNextPage"]; | |
| 29 | + BOOL isLastPage = !lastPageStr.boolValue; | |
| 30 | 30 | NSArray *listArr = responseObject[@"data"][@"list"]; |
| 31 | 31 | if (listArr&&[listArr isKindOfClass:[NSArray class]]) { |
| 32 | 32 | if (listArr.count == 0) { |
| ... | ... | @@ -260,7 +260,7 @@ static const CGFloat margin = 15; |
| 260 | 260 | |
| 261 | 261 | + (void)loadMyServicepage:(NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(nonnull void (^)(void))failure{ |
| 262 | 262 | NSDictionary * params = @{@"sid": CNUserShareModelUid ? CNUserShareModelUid : @"", |
| 263 | - @"pageSize":@"10", | |
| 263 | + @"pageSize":@"100", | |
| 264 | 264 | @"type":@"2", |
| 265 | 265 | @"page":page?page:@"" |
| 266 | 266 | |
| ... | ... | @@ -281,8 +281,8 @@ static const CGFloat margin = 15; |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | if (dic) { |
| 284 | - NSString *lastPage = dic[@"isLastPage"]; | |
| 285 | - !succeed?:succeed(array.copy,lastPage); | |
| 284 | + NSString *lastPage = dic[@"hasNextPage"]; | |
| 285 | + !succeed?:succeed(array.copy,!lastPage.boolValue); | |
| 286 | 286 | }else{ |
| 287 | 287 | [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; |
| 288 | 288 | !failure?:failure(); |
| ... | ... | @@ -352,8 +352,8 @@ static const CGFloat margin = 15; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | if (dic) { |
| 355 | - NSString *lastPage = dic[@"isLastPage"]; | |
| 356 | - !succeed?:succeed(array.copy,lastPage.boolValue); | |
| 355 | + NSString *lastPage = dic[@"hasNextPage"]; | |
| 356 | + !succeed?:succeed(array.copy,!lastPage.boolValue); | |
| 357 | 357 | }else{ |
| 358 | 358 | [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; |
| 359 | 359 | !failure?:failure(); | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveCycleActiveCell.m
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | _cycleView.infiniteLoop = YES; |
| 62 | 62 | _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated; |
| 63 | 63 | _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter; |
| 64 | - _cycleView.contentMode = UIViewContentModeScaleAspectFit; | |
| 64 | + _cycleView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill; | |
| 65 | 65 | _cycleView.hidesForSinglePage = YES; |
| 66 | 66 | _cycleView.pageControlDotSize = CGSizeMake(4, 4); |
| 67 | 67 | } | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveGoodsOrVideoHeaderView.m
| ... | ... | @@ -68,6 +68,7 @@ |
| 68 | 68 | if ([pageModel.blockName isEqualToString:@"热销排行"]) { |
| 69 | 69 | self.LogoImage.hidden = NO; |
| 70 | 70 | self.subTitle.hidden = NO; |
| 71 | + self.moreBtn.hidden = NO; | |
| 71 | 72 | UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1"); |
| 72 | 73 | self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; |
| 73 | 74 | self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256"); | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveSearchListCell.m
| ... | ... | @@ -49,13 +49,10 @@ |
| 49 | 49 | { |
| 50 | 50 | _model = model; |
| 51 | 51 | [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; |
| 52 | - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:model.title]; | |
| 53 | - NSRange range = [model.title rangeOfString:model.searchStr]; | |
| 54 | - UIColor *color = CNLiveColorWithHexString(@"#00CD1E"); | |
| 55 | - [attrString addAttribute:NSFontAttributeName value:UIFontMake(14) range:NSMakeRange(0, model.title.length)]; | |
| 56 | - [attrString addAttribute:NSForegroundColorAttributeName value:CNLiveColorWithHexString(@"#333333") range:NSMakeRange(0, model.title.length)]; | |
| 57 | - [attrString addAttribute:NSForegroundColorAttributeName value:color range:range]; | |
| 58 | - self.titleLabel.attributedText = attrString; | |
| 52 | + NSMutableAttributedString * titleString = [[NSMutableAttributedString alloc] initWithString: model.title]; | |
| 53 | + [titleString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#00CD1E) range:[model.title rangeOfString:model.searchStr]]; | |
| 54 | + | |
| 55 | + self.titleLabel.attributedText = titleString; | |
| 59 | 56 | [self.titleLabel sizeToFit]; |
| 60 | 57 | } |
| 61 | 58 | - (UIImageView *)logoView{ |
| ... | ... | @@ -70,6 +67,8 @@ |
| 70 | 67 | { |
| 71 | 68 | if (!_titleLabel) { |
| 72 | 69 | _titleLabel = [[UILabel alloc] init]; |
| 70 | + _titleLabel.font = UIFontMake(14); | |
| 71 | + _titleLabel.textColor = CNLiveColorWithHexString(@"#333333"); | |
| 73 | 72 | } |
| 74 | 73 | return _titleLabel; |
| 75 | 74 | } | ... | ... |
CNLiveCServiceModule/Classes/View/CNLiveVideoRecommendCell.m
| ... | ... | @@ -57,26 +57,28 @@ |
| 57 | 57 | #pragma mark - Setting&&getting |
| 58 | 58 | - (void)setModel:(CnLivePageContentModel *)model |
| 59 | 59 | { |
| 60 | - self.titleLabel.hidden = YES; | |
| 61 | - self.price.hidden = YES; | |
| 62 | - self.titleLabel.numberOfLines = 1; | |
| 63 | - self.oldPrice.hidden = YES; | |
| 64 | - self.lookNum.hidden = YES; | |
| 65 | 60 | [_logoImage sd_setImageWithURL:[NSURL URLWithString:model.poster]]; |
| 66 | 61 | if (_type == CNLiveCellShowTypeHot) { |
| 62 | + self.titleLabel.hidden = YES; | |
| 67 | 63 | self.price.hidden = NO; |
| 64 | + self.oldPrice.hidden = YES; | |
| 65 | + self.lookNum.hidden = YES; | |
| 68 | 66 | NSError *error; |
| 69 | 67 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; |
| 70 | 68 | self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]]; |
| 71 | 69 | [self.price sizeToFit]; |
| 72 | - [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 70 | + [self.logoImage mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 71 | + make.top.equalTo(self.contentView); | |
| 72 | + make.centerX.equalTo(self.contentView); | |
| 73 | 73 | make.height.width.offset(65); |
| 74 | 74 | }]; |
| 75 | - [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 75 | + [self.price mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 76 | 76 | make.top.equalTo(self.logoImage.mas_bottom).offset(5); |
| 77 | 77 | make.centerX.equalTo(self); |
| 78 | 78 | }]; |
| 79 | 79 | }else if (_type == CNLiveCellShowTypeVideo){ |
| 80 | + self.price.hidden = YES; | |
| 81 | + self.oldPrice.hidden = YES; | |
| 80 | 82 | self.titleLabel.hidden = NO; |
| 81 | 83 | self.titleLabel.numberOfLines = 2; |
| 82 | 84 | self.lookNum.hidden = NO; |
| ... | ... | @@ -86,13 +88,21 @@ |
| 86 | 88 | num = [NSString stringWithFormat:@"%.1f万",num.floatValue/10000]; |
| 87 | 89 | } |
| 88 | 90 | [self.lookNum setTitle:[NSString stringWithFormat:@"%@浏览",num] forState:UIControlStateNormal]; |
| 89 | - [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 91 | + [self.logoImage mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 92 | + make.top.equalTo(self.contentView); | |
| 93 | + make.centerX.equalTo(self.contentView); | |
| 90 | 94 | make.height.width.offset(96); |
| 91 | 95 | }]; |
| 96 | + [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 97 | + make.left.right.equalTo(self.logoImage); | |
| 98 | + make.top.equalTo(self.logoImage.mas_bottom).offset(10); | |
| 99 | + }]; | |
| 92 | 100 | }else{ |
| 101 | + self.titleLabel.numberOfLines = 1; | |
| 93 | 102 | self.titleLabel.hidden = NO; |
| 94 | 103 | self.price.hidden = NO; |
| 95 | 104 | self.titleLabel.text = model.title; |
| 105 | + self.lookNum.hidden = YES; | |
| 96 | 106 | NSError *error; |
| 97 | 107 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; |
| 98 | 108 | NSString *nowStr = dic[@"price"]; |
| ... | ... | @@ -100,7 +110,6 @@ |
| 100 | 110 | [price addAttribute:NSFontAttributeName value:UIFontMake(15) range:NSMakeRange(0, price.length)]; |
| 101 | 111 | [price addAttribute:NSFontAttributeName value:UIFontMake(10) range:NSMakeRange(0, 1)]; |
| 102 | 112 | self.price.attributedText = price; |
| 103 | - | |
| 104 | 113 | [self.price sizeToFit]; |
| 105 | 114 | NSString *oldStr = dic[@"prices"]; |
| 106 | 115 | |
| ... | ... | @@ -110,13 +119,24 @@ |
| 110 | 119 | [string addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)]; |
| 111 | 120 | self.oldPrice.attributedText = string; |
| 112 | 121 | [self.oldPrice sizeToFit]; |
| 122 | + }else{ | |
| 123 | + self.oldPrice.hidden = YES; | |
| 113 | 124 | } |
| 114 | - [self.logoImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 125 | + [self.logoImage mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 126 | + make.top.equalTo(self.contentView); | |
| 127 | + make.centerX.equalTo(self.contentView); | |
| 115 | 128 | make.height.width.offset(96); |
| 116 | 129 | }]; |
| 117 | - [self.price mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 130 | + [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 131 | + make.left.right.equalTo(self.logoImage); | |
| 132 | + make.top.equalTo(self.logoImage.mas_bottom).offset(10); | |
| 133 | + }]; | |
| 134 | + [self.price mas_remakeConstraints:^(MASConstraintMaker *make) { | |
| 118 | 135 | make.top.equalTo(self.titleLabel.mas_bottom).offset(5); |
| 119 | 136 | make.left.equalTo(self.logoImage); |
| 137 | + if (self.price.width > self.contentView.width) { | |
| 138 | + make.right.equalTo(self.logoImage); | |
| 139 | + } | |
| 120 | 140 | }]; |
| 121 | 141 | } |
| 122 | 142 | } | ... | ... |