// // YOUPAIZYUserZiLiaoDTCell.m // VQU // // Created by 肖浩然的mac on 2021/7/10. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAIZYUserZiLiaoPJCell.h" #import "YOUPAILZLabelCollectionCell.h" @interface YOUPAIZYUserZiLiaoPJCell() @property (nonatomic, strong) UICollectionView *youpaipcollectionView; /* countLabel */ @property (strong, nonatomic) UILabel *youpaipcountLabel; @property (strong, nonatomic) UILabel *youpaipcountLabel1; /* arrowBtn */ @property (strong, nonatomic) UIButton *youpaiparrowBtn; /* titleView */ @property (strong, nonatomic) UIView *youpaiptitleView; /* goodPJLabel */ @property (strong, nonatomic) UILabel *youpaipgoodPJLabel; @end @implementation YOUPAIZYUserZiLiaoPJCell -(instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self youpaifsetSubView]; } return self; } -(void)youpaifsetSubView{ UIView *titleView = [UIView new]; self.youpaiptitleView = titleView; [self.contentView addSubview:titleView]; [titleView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.top.mas_equalTo(0); make.height.mas_equalTo(20); }]; titleView.backgroundColor = LCWhiteColor; self.youpaiptitleLabel = [[UILabel alloc] init]; self.youpaiptitleLabel.font = LCBoldFont(14); [titleView addSubview:self.youpaiptitleLabel]; [self.youpaiptitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(0); make.left.mas_equalTo(14); }]; self.youpaiptitleLabel.textColor = LZ273145Color; // //视频接通率 // UILabel *countLabel = [UILabel new]; // self.youpaipcountLabel = countLabel; // [self.contentView addSubview:countLabel]; // [countLabel mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(titleView.mas_bottom).offset(5); // make.left.mas_equalTo(14); // make.height.mas_equalTo(12); // }]; // // //// countLabel.text = @"视频接通率:98%(接通365次)"; // // countLabel.font = [UIFont systemFontOfSize:12]; // //接通次数 // UILabel *countLabel1 = [UILabel new]; // self.youpaipcountLabel1 = countLabel1; // [self.contentView addSubview:countLabel1]; // [countLabel1 mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(titleView.mas_bottom).offset(5); // make.left.mas_equalTo(countLabel.mas_right); // make.height.mas_equalTo(12); // }]; // // countLabel1.font = [UIFont systemFontOfSize:12]; // countLabel1.textColor = HexColorFromRGB(0xFFB800); // //好评率 // // // UILabel *goodPJLabel = [UILabel new]; // self.youpaipgoodPJLabel = goodPJLabel; // [self.contentView addSubview:goodPJLabel]; // [goodPJLabel mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.mas_equalTo(countLabel); // make.top.mas_equalTo(countLabel.mas_bottom).offset(5);; // }]; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; self.youpaipcollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout]; [self.contentView addSubview:self.youpaipcollectionView]; [self.youpaipcollectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(titleView.mas_bottom).offset(0); make.left.mas_offset(12.f); make.right.mas_offset(-12.f); make.bottom.mas_offset(0.f); }]; // self.collectionView.userInteractionEnabled = NO; self.youpaipcollectionView.backgroundColor = LCWhiteColor; self.youpaipcollectionView.showsVerticalScrollIndicator = NO; self.youpaipcollectionView.showsHorizontalScrollIndicator = NO; self.youpaipcollectionView.bounces = NO; self.youpaipcollectionView.scrollEnabled = NO; self.youpaipcollectionView.delegate = self; self.youpaipcollectionView.dataSource = self; [self.youpaipcollectionView registerClass:[YOUPAILZLabelCollectionCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAILZLabelCollectionCell class])]; } -(void)setYoupaipmodel:(YOUPAILCUserShowModel *)model{ _youpaipmodel = model; // if (model.youpaipskill_list.count>0) { // YOUPAILCSkillModel *skillModel = model.youpaipskill_list.firstObject; // // if (model.youpaiporder_switch == 2) { // self.youpaipcountLabel.attributedText = [LCTools setRichTextWithTitle:@"视频接通率:" subTitle:[NSString stringWithFormat:@"%@",skillModel.youpaiprate] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12]; // self.youpaipcountLabel1.text = [NSString stringWithFormat:@"(接通%ld次)",(long)skillModel.youpaipservice_count]; // }else{ // self.youpaipcountLabel.attributedText = [LCTools setRichTextWithTitle:@"视频接通率:" subTitle:@"" titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12]; // self.youpaipcountLabel1.text = @""; // self.youpaipcountLabel.hidden = YES; // self.youpaipcountLabel1.hidden = YES; // // // // } // // // } // if (model.youpaipevaluate&&model.youpaiporder_switch == 2) { // self.youpaipgoodPJLabel.attributedText = [LCTools setRichTextWithTitle:@"好评率:" subTitle:model.youpaipevaluate titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12]; // // [self.youpaipcollectionView mas_remakeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(self.youpaipgoodPJLabel.mas_bottom).offset(5); // make.left.mas_offset(14.f); // make.right.mas_offset(-14.f); // make.bottom.mas_offset(0.f); // }]; // }else if(model.youpaipevaluate &&model.youpaiporder_switch != 2){ // self.youpaipcountLabel.hidden = YES; // self.youpaipcountLabel1.hidden = YES; // [self.youpaipgoodPJLabel mas_remakeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(self.youpaiptitleView.mas_bottom).offset(5); // make.left.mas_equalTo(14); // make.height.mas_equalTo(12); // }]; // [self.youpaipcollectionView mas_remakeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(self.youpaipgoodPJLabel.mas_bottom).offset(5); // make.left.mas_offset(14.f); // make.right.mas_offset(-14.f); // make.bottom.mas_offset(0.f); // }]; // self.youpaipgoodPJLabel.attributedText = [LCTools setRichTextWithTitle:@"好评率:" subTitle:model.youpaipevaluate titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12]; // // }else if (!model.youpaipevaluate &&model.youpaiporder_switch == 2){ // self.youpaipgoodPJLabel.hidden = YES; // }else{ // self.youpaipgoodPJLabel.hidden = YES; // } } -(void)setYoupaiplabelArray:(NSArray *)labelArray{ _youpaiplabelArray = labelArray; } #pragma mark /** 返回区数 @param collectionView 集合视图 @return 返回区数 */ - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } /** 返回项目数 @param collectionView 集合视图 @param section 区 @return 项目数 */ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return self.youpaiplabelArray.count; } -(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ YOUPAILZLabelCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAILZLabelCollectionCell class]) forIndexPath:indexPath]; YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row]; model.youpaipisSelect = YES; [cell youpaifreloadWithModel:model]; return cell; } #pragma mark UICollectionViewDelegateFlowLayout /** 项目大小 @param collectionView 集合视图 @param collectionViewLayout 布局 @param indexPath 布局 @return 大小 */ #pragma mark - item宽高 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row]; NSString *str = [NSString stringWithFormat:@"%@",model.youpaipname]; CGRect rect = [str boundingRectWithSize:CGSizeMake(KScreenWidth,20) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName :LCFont(12)} context:nil]; return CGSizeMake(rect.size.width + 24 ,24.5); } #pragma mark - X间距 - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 9.0; } #pragma mark - Y间距 - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 9.0; } //设置段落的内边距 - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { return UIEdgeInsetsMake(0,0,0,0);//UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row]; [self.youpaipdelegate youpaifclickLabel:model]; } @end