Commit 02236c18c465316a2a674dd750788208d7bf1706

Authored by yanglingyu
1 parent 968eeddb

修复数据布局bug

CNLiveCServiceModule/Classes/Present/CNLiveServicePresent.m
@@ -25,8 +25,8 @@ static const CGFloat margin = 15; @@ -25,8 +25,8 @@ static const CGFloat margin = 15;
25 [CNLiveNetworking setupShowResult:YES]; 25 [CNLiveNetworking setupShowResult:YES];
26 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/search") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { 26 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/servingApi/search") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
27 if (responseObject&&[responseObject isKindOfClass:[NSDictionary class]]) { 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 NSArray *listArr = responseObject[@"data"][@"list"]; 30 NSArray *listArr = responseObject[@"data"][@"list"];
31 if (listArr&&[listArr isKindOfClass:[NSArray class]]) { 31 if (listArr&&[listArr isKindOfClass:[NSArray class]]) {
32 if (listArr.count == 0) { 32 if (listArr.count == 0) {
@@ -260,7 +260,7 @@ static const CGFloat margin = 15; @@ -260,7 +260,7 @@ static const CGFloat margin = 15;
260 260
261 + (void)loadMyServicepage:(NSString *)page result:(nonnull void (^)(NSArray * _Nonnull, BOOL))succeed error:(nonnull 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":@"100",
264 @"type":@"2", 264 @"type":@"2",
265 @"page":page?page:@"" 265 @"page":page?page:@""
266 266
@@ -281,8 +281,8 @@ static const CGFloat margin = 15; @@ -281,8 +281,8 @@ static const CGFloat margin = 15;
281 } 281 }
282 } 282 }
283 if (dic) { 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 }else{ 286 }else{
287 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; 287 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3];
288 !failure?:failure(); 288 !failure?:failure();
@@ -352,8 +352,8 @@ static const CGFloat margin = 15; @@ -352,8 +352,8 @@ static const CGFloat margin = 15;
352 } 352 }
353 353
354 if (dic) { 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 }else{ 357 }else{
358 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3]; 358 [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:3];
359 !failure?:failure(); 359 !failure?:failure();
CNLiveCServiceModule/Classes/View/CNLiveCycleActiveCell.m
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 _cycleView.infiniteLoop = YES; 61 _cycleView.infiniteLoop = YES;
62 _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated; 62 _cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
63 _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter; 63 _cycleView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
64 - _cycleView.contentMode = UIViewContentModeScaleAspectFit; 64 + _cycleView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
65 _cycleView.hidesForSinglePage = YES; 65 _cycleView.hidesForSinglePage = YES;
66 _cycleView.pageControlDotSize = CGSizeMake(4, 4); 66 _cycleView.pageControlDotSize = CGSizeMake(4, 4);
67 } 67 }
CNLiveCServiceModule/Classes/View/CNLiveGoodsOrVideoHeaderView.m
@@ -68,6 +68,7 @@ @@ -68,6 +68,7 @@
68 if ([pageModel.blockName isEqualToString:@"热销排行"]) { 68 if ([pageModel.blockName isEqualToString:@"热销排行"]) {
69 self.LogoImage.hidden = NO; 69 self.LogoImage.hidden = NO;
70 self.subTitle.hidden = NO; 70 self.subTitle.hidden = NO;
  71 + self.moreBtn.hidden = NO;
71 UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1"); 72 UIColor *begin = CNLiveColorWithHexString(@"#FFF4F1");
72 self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[begin,kWhiteColor] rect:self.bounds]]; 73 self.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientVerticalImageWithColors:@[begin,kWhiteColor] rect:self.bounds]];
73 self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256"); 74 self.titlelabel.textColor = CNLiveColorWithHexString(@"#FA7256");
CNLiveCServiceModule/Classes/View/CNLiveSearchListCell.m
@@ -49,13 +49,10 @@ @@ -49,13 +49,10 @@
49 { 49 {
50 _model = model; 50 _model = model;
51 [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.icon]]; 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 [self.titleLabel sizeToFit]; 56 [self.titleLabel sizeToFit];
60 } 57 }
61 - (UIImageView *)logoView{ 58 - (UIImageView *)logoView{
@@ -70,6 +67,8 @@ @@ -70,6 +67,8 @@
70 { 67 {
71 if (!_titleLabel) { 68 if (!_titleLabel) {
72 _titleLabel = [[UILabel alloc] init]; 69 _titleLabel = [[UILabel alloc] init];
  70 + _titleLabel.font = UIFontMake(14);
  71 + _titleLabel.textColor = CNLiveColorWithHexString(@"#333333");
73 } 72 }
74 return _titleLabel; 73 return _titleLabel;
75 } 74 }
CNLiveCServiceModule/Classes/View/CNLiveVideoRecommendCell.m
@@ -57,26 +57,28 @@ @@ -57,26 +57,28 @@
57 #pragma mark - Setting&&getting 57 #pragma mark - Setting&&getting
58 - (void)setModel:(CnLivePageContentModel *)model 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 [_logoImage sd_setImageWithURL:[NSURL URLWithString:model.poster]]; 60 [_logoImage sd_setImageWithURL:[NSURL URLWithString:model.poster]];
66 if (_type == CNLiveCellShowTypeHot) { 61 if (_type == CNLiveCellShowTypeHot) {
  62 + self.titleLabel.hidden = YES;
67 self.price.hidden = NO; 63 self.price.hidden = NO;
  64 + self.oldPrice.hidden = YES;
  65 + self.lookNum.hidden = YES;
68 NSError *error; 66 NSError *error;
69 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; 67 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error];
70 self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]]; 68 self.price.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]];
71 [self.price sizeToFit]; 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 make.height.width.offset(65); 73 make.height.width.offset(65);
74 }]; 74 }];
75 - [self.price mas_updateConstraints:^(MASConstraintMaker *make) { 75 + [self.price mas_remakeConstraints:^(MASConstraintMaker *make) {
76 make.top.equalTo(self.logoImage.mas_bottom).offset(5); 76 make.top.equalTo(self.logoImage.mas_bottom).offset(5);
77 make.centerX.equalTo(self); 77 make.centerX.equalTo(self);
78 }]; 78 }];
79 }else if (_type == CNLiveCellShowTypeVideo){ 79 }else if (_type == CNLiveCellShowTypeVideo){
  80 + self.price.hidden = YES;
  81 + self.oldPrice.hidden = YES;
80 self.titleLabel.hidden = NO; 82 self.titleLabel.hidden = NO;
81 self.titleLabel.numberOfLines = 2; 83 self.titleLabel.numberOfLines = 2;
82 self.lookNum.hidden = NO; 84 self.lookNum.hidden = NO;
@@ -86,13 +88,21 @@ @@ -86,13 +88,21 @@
86 num = [NSString stringWithFormat:@"%.1f万",num.floatValue/10000]; 88 num = [NSString stringWithFormat:@"%.1f万",num.floatValue/10000];
87 } 89 }
88 [self.lookNum setTitle:[NSString stringWithFormat:@"%@浏览",num] forState:UIControlStateNormal]; 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 make.height.width.offset(96); 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 }else{ 100 }else{
  101 + self.titleLabel.numberOfLines = 1;
93 self.titleLabel.hidden = NO; 102 self.titleLabel.hidden = NO;
94 self.price.hidden = NO; 103 self.price.hidden = NO;
95 self.titleLabel.text = model.title; 104 self.titleLabel.text = model.title;
  105 + self.lookNum.hidden = YES;
96 NSError *error; 106 NSError *error;
97 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error]; 107 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:[model.desc dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error];
98 NSString *nowStr = dic[@"price"]; 108 NSString *nowStr = dic[@"price"];
@@ -100,7 +110,6 @@ @@ -100,7 +110,6 @@
100 [price addAttribute:NSFontAttributeName value:UIFontMake(15) range:NSMakeRange(0, price.length)]; 110 [price addAttribute:NSFontAttributeName value:UIFontMake(15) range:NSMakeRange(0, price.length)];
101 [price addAttribute:NSFontAttributeName value:UIFontMake(10) range:NSMakeRange(0, 1)]; 111 [price addAttribute:NSFontAttributeName value:UIFontMake(10) range:NSMakeRange(0, 1)];
102 self.price.attributedText = price; 112 self.price.attributedText = price;
103 -  
104 [self.price sizeToFit]; 113 [self.price sizeToFit];
105 NSString *oldStr = dic[@"prices"]; 114 NSString *oldStr = dic[@"prices"];
106 115
@@ -110,13 +119,24 @@ @@ -110,13 +119,24 @@
110 [string addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)]; 119 [string addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
111 self.oldPrice.attributedText = string; 120 self.oldPrice.attributedText = string;
112 [self.oldPrice sizeToFit]; 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 make.height.width.offset(96); 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 make.top.equalTo(self.titleLabel.mas_bottom).offset(5); 135 make.top.equalTo(self.titleLabel.mas_bottom).offset(5);
119 make.left.equalTo(self.logoImage); 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 }