123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- //
- // AllCoachCell.m
- // jiaPei
- //
- // Created by apple on 16/8/18.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "AllCoachCell.h"
- #import "CoachOrderCommentVC.h"
- #import "CDPStarEvaluation.h"
- #import "UIImageView+WebCache.h"
- @interface AllCoachCell()
- {
- //NSMutableArray *starArray;
- UIImageView *VImg;
- CDPStarEvaluation *starImageView;//星形评价
- }
- @end
- @implementation AllCoachCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
- self.backgroundColor = KBackGroundColor;
-
- CGFloat wid = kSize.width;
-
- CGFloat x,y,w,h;
-
- x = 10;
- y = 10;
- w = 80;
- h = 90;
- _headImg = [[UIImageView alloc] KSetxywh];
- [_headImg borderColor:kLineColor width:2 cornorRadios:5];
- [self.contentView addSubview:_headImg];
-
- x += w + 10;
- w = wid - x - 10;
- h = 30;
-
- UILabel *label;
- NSMutableArray *labelArray = [NSMutableArray array];
- for (int i = 0; i < 3; i ++) {
- label = [[UILabel alloc] initWithFrame:CGRectMake(x, y + i*h, w, h)];
- [self.contentView addSubview:label];
- [labelArray addObject:label];
- }
-
- _nameLabel = labelArray[0];
- _nameLabel.width -= 40;
- _carTypeLabel = [[UILabel alloc] initWithFrame:_nameLabel.frame];
- [self.contentView addSubview:_carTypeLabel];
- _scoreLabel = labelArray[1];
- _countLabel = labelArray[2];
-
- VImg = [[UIImageView alloc] initWithFrame:CGRectMake(kSize.width - 40, _nameLabel.y + 5, 20, 20)];
- //VImg.backgroundColor = [UIColor redColor];
- [self.contentView addSubview:VImg];
-
- //星级
- y += h + 7;
- h = 16;
- w = h*4.98;
- starImageView = [[CDPStarEvaluation alloc] initWithFrame:CGRectMake(x, y, w, h) onTheView:self.contentView];
-
-
- NSString *titString = @"0条学员点评";
- w = [titString sizeForFont:Font16].width + 3;
- x = wid - w - 10;
- y = _countLabel.y;
- h = 30;
- _commentBtn = [[UIButton alloc] KSetxywh];
- [_commentBtn setTitle:@"" textColor:[UIColor colorWithRed:54/255.0 green:123/255.0 blue:193/255.0 alpha:1] font:Font16 fotState:UIControlStateNormal];
- [_commentBtn target:self];
- [self.contentView addSubview:_commentBtn];
-
- y += h/2.0 + [titString sizeForFont:Font16].height/2.0 + 1;
- [_commentBtn addViewWithRect:CGRectMake(x, y, w, 1.5) Color:[UIColor colorWithRed:54/255.0 green:123/255.0 blue:193/255.0 alpha:1]];
- }
- return self;
- }
- -(void)setDataDic:(NSDictionary *)dataDic
- {
- _dataDic = dataDic;
-
- NSString *headString = dataDic[@"PHOTO"];
- if (!headString) {
- headString = dataDic[@"HEADIMG"];
- }
- if (!headString) {
- headString = @"";
- }
- _headImg.contentMode = UIViewContentModeScaleAspectFit;
- [_headImg sd_setImageWithURL:[NSURL URLWithString:headString] placeholderImage:[UIImage imageNamed:@"NOIMG"]];
-
-
- if ([dataDic[@"VIP"] integerValue] == 0) {
- VImg.image = [UIImage imageNamed:@"vipIcon.png"];
- }else{
- VImg.image = [UIImage imageNamed:@"school_name_icon.png"];
- }
-
- //星级
- [starImageView setStarWithFloat:[dataDic[@"STAR"] floatValue]/5.0];
-
-
- NSString *driveAge = [NSString stringWithFormat:@"%@",dataDic[@"DRIVEAGE"]];
- if (!driveAge || driveAge.length < 1 || [driveAge isEqualToString:@"0"]) {
- driveAge = @"1";
- }
- [_nameLabel setText:dataDic[@"NAME"] Font:Font17 TextColor:KContentTextColor Alignment:NSTextAlignmentLeft];
- NSMutableAttributedString *abs = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ 驾龄%@年",dataDic[@"NAME"],driveAge]];
- [abs beginEditing];//FontTitle titleColor
- //字体大小
- [abs addAttribute:NSFontAttributeName
- value:[UIFont scaleSize:20.0]
- range:NSMakeRange(0, [dataDic[@"NAME"] length])];
- //字体颜色
- [abs addAttribute:NSForegroundColorAttributeName
- value:KTitleColor
- range:NSMakeRange(0, [dataDic[@"NAME"] length])];
- _nameLabel.attributedText = abs;
-
-
- [_carTypeLabel setText:[NSString stringWithFormat:@"%@ %@",[dataDic[@"SEX"] integerValue] == 1?@"男":@"女",dataDic[@"CARTYPE"]] Font:Font17 TextColor:[UIColor orangeColor] Alignment:NSTextAlignmentRight];
- [_scoreLabel setText:[NSString stringWithFormat:@"综合评分:%@分",dataDic[@"SCORE"]] Font:Font17 TextColor:[UIColor orangeColor] Alignment:NSTextAlignmentRight];
- [_countLabel setText:[NSString stringWithFormat:@"交易成功:%@笔",dataDic[@"ORDERNUM"]] Font:Font17 TextColor:[UIColor orangeColor] Alignment:NSTextAlignmentLeft];
-
- [_commentBtn setTitle:[NSString stringWithFormat:@"%@条学员评价",dataDic[@"COUNT"]] forState:UIControlStateNormal];
- }
- -(void)btnClick:(UIButton *)sender
- {
- //跳转到评论页面
- CoachOrderCommentVC *vc = [[CoachOrderCommentVC alloc] init];
- vc.coachID = _dataDic[@"CI_OUT_ID"];
- [_superVC navPushHideTabbarToVC:vc];
- }
- @end
|