Commit 46987641fbc9902b0ae2d30212acc643cda06e2a
1 parent
da606275
0.1.6
Showing
6 changed files
with
43 additions
and
2 deletions
CNLiveCommuntyModule.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 = 'CNLiveCommuntyModule' | 10 | s.name = 'CNLiveCommuntyModule' |
| 11 | - s.version = '0.1.5' | 11 | + s.version = '0.1.6' |
| 12 | s.summary = 'A short description of CNLiveCommuntyModule.' | 12 | s.summary = 'A short description of CNLiveCommuntyModule.' |
| 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. |
CNLiveCommuntyModule/Classes/Model/CNLiveCommuntyHomeModel.h
| @@ -117,6 +117,8 @@ NS_ASSUME_NONNULL_BEGIN | @@ -117,6 +117,8 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 117 | @property (nonatomic, copy) NSString *totalFee; | 117 | @property (nonatomic, copy) NSString *totalFee; |
| 118 | @property (nonatomic, copy) NSString *intentBeginTime; | 118 | @property (nonatomic, copy) NSString *intentBeginTime; |
| 119 | @property (nonatomic, copy) NSString *remark; | 119 | @property (nonatomic, copy) NSString *remark; |
| 120 | +@property (nonatomic, copy) NSString *img; | ||
| 121 | +@property (nonatomic, strong) NSMutableArray *imgs; | ||
| 120 | @property (nonatomic, strong) NSNumber *createTime; | 122 | @property (nonatomic, strong) NSNumber *createTime; |
| 121 | @property (nonatomic, copy) NSString *createTimeString; | 123 | @property (nonatomic, copy) NSString *createTimeString; |
| 122 | @property (nonatomic, copy) NSString *repairName; | 124 | @property (nonatomic, copy) NSString *repairName; |
CNLiveCommuntyModule/Classes/Model/CNLiveCommuntyHomeModel.m
| @@ -162,6 +162,11 @@ MJCodingImplementation | @@ -162,6 +162,11 @@ MJCodingImplementation | ||
| 162 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; | 162 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; |
| 163 | self.createTimeString = [dateFormatter stringFromDate:detaildate]; | 163 | self.createTimeString = [dateFormatter stringFromDate:detaildate]; |
| 164 | } | 164 | } |
| 165 | + if ([property.name isEqualToString:@"img"] && ![oldValue isKindOfClass:NSNull.class] && [oldValue isNotBlank]) { | ||
| 166 | + NSString * img_str = (NSString *)oldValue; | ||
| 167 | + self.imgs = [img_str componentsSeparatedByString:@","].mutableCopy; | ||
| 168 | + [self.imgs removeObject:@""]; | ||
| 169 | + } | ||
| 165 | return oldValue; | 170 | return oldValue; |
| 166 | } | 171 | } |
| 167 | 172 |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.h
| @@ -56,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN | @@ -56,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 56 | @property (nonatomic, strong) QMUIButton * statueButton; | 56 | @property (nonatomic, strong) QMUIButton * statueButton; |
| 57 | @property (nonatomic, strong) UILabel * lineLabel; | 57 | @property (nonatomic, strong) UILabel * lineLabel; |
| 58 | @property (nonatomic, strong) UILabel * priceLabel; | 58 | @property (nonatomic, strong) UILabel * priceLabel; |
| 59 | +@property (nonatomic, strong) NSMutableArray * tempArray; | ||
| 59 | 60 | ||
| 60 | @property (nonatomic, strong) CNLiveCommuntyActivityRepairListModel * repairModel; | 61 | @property (nonatomic, strong) CNLiveCommuntyActivityRepairListModel * repairModel; |
| 61 | 62 |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.m
| @@ -450,6 +450,25 @@ | @@ -450,6 +450,25 @@ | ||
| 450 | [self.mainView addSubview:self.statueButton]; | 450 | [self.mainView addSubview:self.statueButton]; |
| 451 | [self.mainView addSubview:self.lineLabel]; | 451 | [self.mainView addSubview:self.lineLabel]; |
| 452 | [self.mainView addSubview:self.priceLabel]; | 452 | [self.mainView addSubview:self.priceLabel]; |
| 453 | + | ||
| 454 | + self.tempArray = [[NSMutableArray alloc] init]; | ||
| 455 | + for (int i = 0; i < 3; i++) { | ||
| 456 | + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; | ||
| 457 | + imageView.backgroundColor = UIColorHex(#f9f9f9); | ||
| 458 | + imageView.tag = 1000 + i; | ||
| 459 | + imageView.hidden = YES; | ||
| 460 | + imageView.layer.cornerRadius = 7; | ||
| 461 | + imageView.layer.masksToBounds = YES; | ||
| 462 | + imageView.contentMode = UIViewContentModeScaleAspectFill; | ||
| 463 | + [imageView setUserInteractionEnabled:YES]; | ||
| 464 | + __weak typeof(self) weakSelf = self; | ||
| 465 | + [imageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithActionBlock:^(UITapGestureRecognizer * _Nonnull sender) { | ||
| 466 | + UIImageView * imageView = (UIImageView *)sender.view; | ||
| 467 | + [CNLivePhotoBrowser photoBrowserForDefultWithSourceViews:weakSelf.tempArray MediaURLArray:weakSelf.repairModel.imgs CurrentIndex:imageView.tag - 1000 ShowType:CNLivePhotoBrowserShowTypeImage Sheet:nil CompleterBlock:NULL]; | ||
| 468 | + }]]; | ||
| 469 | + [self.mainView addSubview:imageView]; | ||
| 470 | + [self.tempArray addObject:imageView]; | ||
| 471 | + } | ||
| 453 | } | 472 | } |
| 454 | return self; | 473 | return self; |
| 455 | } | 474 | } |
| @@ -488,6 +507,12 @@ | @@ -488,6 +507,12 @@ | ||
| 488 | make.left.mas_equalTo(weakSelf.mainView.mas_left).offset(10); | 507 | make.left.mas_equalTo(weakSelf.mainView.mas_left).offset(10); |
| 489 | make.right.mas_equalTo(weakSelf.mainView.mas_right).offset(-10); | 508 | make.right.mas_equalTo(weakSelf.mainView.mas_right).offset(-10); |
| 490 | }]; | 509 | }]; |
| 510 | + | ||
| 511 | + [self.tempArray mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:10 leadSpacing:10 tailSpacing:10]; | ||
| 512 | + [self.tempArray mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 513 | + make.bottom.mas_equalTo(weakSelf.mainView.mas_bottom).offset(-10); | ||
| 514 | + make.height.mas_equalTo((kScreenWidth - 60)/3); | ||
| 515 | + }]; | ||
| 491 | } | 516 | } |
| 492 | -(void)setRepairModel:(CNLiveCommuntyActivityRepairListModel *)repairModel | 517 | -(void)setRepairModel:(CNLiveCommuntyActivityRepairListModel *)repairModel |
| 493 | { | 518 | { |
| @@ -499,6 +524,13 @@ | @@ -499,6 +524,13 @@ | ||
| 499 | self.dateLabel.text = [NSString stringWithFormat:@"下单时间:%@",repairModel.createTimeString]; | 524 | self.dateLabel.text = [NSString stringWithFormat:@"下单时间:%@",repairModel.createTimeString]; |
| 500 | [_statueButton setTitle:repairModel.statusString forState:UIControlStateNormal]; | 525 | [_statueButton setTitle:repairModel.statusString forState:UIControlStateNormal]; |
| 501 | [_statueButton setTitleColor:![repairModel.status isEqualToString:@"3"]?UIColorHex(#FD862E):UIColorHex(#797979) forState:UIControlStateNormal]; | 526 | [_statueButton setTitleColor:![repairModel.status isEqualToString:@"3"]?UIColorHex(#FD862E):UIColorHex(#797979) forState:UIControlStateNormal]; |
| 527 | + | ||
| 528 | + for (int i = 0; i < self.repairModel.imgs.count; i++) { | ||
| 529 | + NSString * imageUrl = self.repairModel.imgs[i]; | ||
| 530 | + UIImageView * imageView = self.tempArray[i]; | ||
| 531 | + imageView.hidden = NO; | ||
| 532 | + [imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageWithColor:UIColorHex(#f9f9f9)]]; | ||
| 533 | + } | ||
| 502 | } | 534 | } |
| 503 | 535 | ||
| 504 | #pragma mark - | 536 | #pragma mark - |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntListViewController.m
| @@ -211,7 +211,8 @@ | @@ -211,7 +211,8 @@ | ||
| 211 | } | 211 | } |
| 212 | if (self.showType == CNLiveCommuntListShowTypeRepair) { | 212 | if (self.showType == CNLiveCommuntListShowTypeRepair) { |
| 213 | CNLiveCommuntyActivityRepairListModel * repairModel = self.dataArray[indexPath.row]; | 213 | CNLiveCommuntyActivityRepairListModel * repairModel = self.dataArray[indexPath.row]; |
| 214 | - return [repairModel.status isEqualToString:@"3"] && [repairModel.totalFee integerValue] > 0?110.0:70.0; | 214 | + CGFloat itemW = repairModel.imgs.count > 0 ? (kScreenWidth - 60)/3 + 20 : 0; |
| 215 | + return ([repairModel.status isEqualToString:@"3"] && [repairModel.totalFee integerValue] > 0?110.0:70.0) + itemW; | ||
| 215 | } | 216 | } |
| 216 | return 0.001; | 217 | return 0.001; |
| 217 | } | 218 | } |