BHomeResumeDetailIntentionCell.m 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. //
  2. // BHomeResumeDetailIntentionCell.m
  3. // HappyJob
  4. //
  5. // Created by 张晓光 on 2019/7/3.
  6. // Copyright © 2019 Bob. All rights reserved.
  7. //
  8. #import "BHomeResumeDetailIntentionCell.h"
  9. #import "BHomeResumeDetailModel.h"
  10. @interface BHomeResumeDetailIntentionCell ()
  11. @property (nonatomic, strong) UIView *bgView;
  12. @property (nonatomic, strong) UIButton *blueView;
  13. @property (nonatomic, strong) UIButton *iconBtn;
  14. @property (nonatomic, strong) UILabel *positionTitleLabel;
  15. @property (nonatomic, strong) UILabel *positionLabel;
  16. @property (nonatomic, strong) UILabel *addressTitleLabel;
  17. @property (nonatomic, strong) UILabel *addressLabel;
  18. @property (nonatomic, strong) UILabel *salaryTitleLabel;
  19. @property (nonatomic, strong) UILabel *salaryLabel;
  20. @property (nonatomic, strong) UIView *lineView;
  21. @end
  22. @implementation BHomeResumeDetailIntentionCell
  23. - (void)awakeFromNib {
  24. [super awakeFromNib];
  25. // Initialization code
  26. }
  27. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  28. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  29. {
  30. self.selectionStyle = UITableViewCellSelectionStyleNone;
  31. self.backgroundColor = COLOR_GRAYFA;
  32. [self initViews];
  33. [self autoLayOutViews];
  34. }
  35. return self;
  36. }
  37. - (void)initViews {
  38. [self.contentView addSubview:self.bgView];
  39. [self.bgView addSubview:self.blueView];
  40. [self.blueView addSubview:self.iconBtn];
  41. [self.bgView addSubview:self.positionTitleLabel];
  42. [self.bgView addSubview:self.positionLabel];
  43. [self.bgView addSubview:self.addressTitleLabel];
  44. [self.bgView addSubview:self.addressLabel];
  45. [self.bgView addSubview:self.salaryTitleLabel];
  46. [self.bgView addSubview:self.salaryLabel];
  47. [self.bgView addSubview:self.lineView];
  48. }
  49. - (void)bHomeResumeDetailIntentionCellDict:(NSDictionary *)dict {
  50. if (dict)
  51. {
  52. BHomeResumeDetailModel *model = [BHomeResumeDetailModel yy_modelWithJSON:dict];
  53. NSArray *positionArray = @[@"普工", @"客服", @"销售", @"服务员", @"物流仓储", @"司机", @"才艺技能", @"文员助理", @"快递配送", @"促销导购", @"展会演出", @"家教培训", @"模特", @"贸易采购", @"厨师", @"编辑", @"线上推广", @"设计", @"技工", @"保洁", @"其它"];
  54. NSString *positionStr;
  55. if (model.expectationPosition.length > 0)
  56. {
  57. NSArray *expectationPositionArray = [model.expectationPosition componentsSeparatedByString:@","];
  58. for (int i = 0; i <expectationPositionArray.count ; i ++ )
  59. {
  60. if (positionStr.length > 0)
  61. {
  62. positionStr = [NSString stringWithFormat:@"%@,%@",positionStr,positionArray[[expectationPositionArray[i] integerValue]]];
  63. }
  64. else
  65. {
  66. positionStr = [NSString stringWithFormat:@"%@",positionArray[[expectationPositionArray[i] integerValue]]];
  67. }
  68. }
  69. }
  70. self.positionLabel.text = positionStr ? positionStr :@"无";
  71. self.addressLabel.text = model.expectationAddress ? model.expectationAddress :@"无";
  72. NSArray *moneyArray = @[@"1000~2000元/月", @"2001~3000元/月", @"3001~4000元/月", @"4001~5000元/月", @"5001~6000元/月", @"6001~7000元/月", @"7001~8000元/月", @"8001~9000元/月", @"9001~10000元/月", @"10000以上元/月"];
  73. if (model.expectationSalary.length > 0 && [model.expectationSalary integerValue] >= 0)
  74. {
  75. self.salaryLabel.text = moneyArray[[model.expectationSalary integerValue]];
  76. }
  77. else
  78. {
  79. self.salaryLabel.text = @"不限";
  80. }
  81. }
  82. }
  83. #pragma mark - 布局
  84. - (void)autoLayOutViews {
  85. __weak typeof(self) weakSelf = self;
  86. [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.leading.equalTo(weakSelf.contentView.mas_leading).offset(15);
  88. make.trailing.equalTo(weakSelf.contentView.mas_trailing).offset(-15);
  89. make.top.equalTo(weakSelf.contentView.mas_top).offset(20);
  90. make.bottom.equalTo(weakSelf.contentView.mas_bottom).offset(0);
  91. }];
  92. [_blueView mas_makeConstraints:^(MASConstraintMaker *make) {
  93. make.leading.equalTo(weakSelf.bgView.mas_leading).offset(0);
  94. make.trailing.equalTo(weakSelf.bgView.mas_trailing).offset(0);
  95. make.top.equalTo(weakSelf.bgView.mas_top).offset(0);
  96. }];
  97. [_iconBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.leading.equalTo(weakSelf.blueView.mas_leading).offset(20);
  99. make.top.equalTo(weakSelf.blueView.mas_top).offset(10);
  100. make.bottom.equalTo(weakSelf.blueView.mas_bottom).offset(-10);
  101. }];
  102. [_positionTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.leading.equalTo(weakSelf.bgView.mas_leading).offset(50);
  104. make.top.equalTo(weakSelf.blueView.mas_bottom).offset(17);
  105. make.width.mas_equalTo(65);
  106. }];
  107. [_positionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  108. make.leading.equalTo(weakSelf.positionTitleLabel.mas_trailing).offset(30);
  109. make.top.equalTo(weakSelf.blueView.mas_bottom).offset(17);
  110. make.trailing.equalTo(weakSelf.bgView.mas_trailing).offset(-30);
  111. }];
  112. [_addressTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  113. make.leading.equalTo(weakSelf.bgView.mas_leading).offset(50);
  114. make.top.equalTo(weakSelf.positionLabel.mas_bottom).offset(10);
  115. make.width.mas_equalTo(65);
  116. }];
  117. [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.leading.equalTo(weakSelf.addressTitleLabel.mas_trailing).offset(30);
  119. make.top.equalTo(weakSelf.positionLabel.mas_bottom).offset(10);
  120. make.trailing.equalTo(weakSelf.bgView.mas_trailing).offset(-30);
  121. }];
  122. [_salaryTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  123. make.leading.equalTo(weakSelf.bgView.mas_leading).offset(50);
  124. make.top.equalTo(weakSelf.addressLabel.mas_bottom).offset(12);
  125. make.width.mas_equalTo(65);
  126. }];
  127. [_salaryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.leading.equalTo(weakSelf.addressTitleLabel.mas_trailing).offset(30);
  129. make.top.equalTo(weakSelf.addressLabel.mas_bottom).offset(10);
  130. make.trailing.equalTo(weakSelf.bgView.mas_trailing).offset(-30);
  131. make.bottom.equalTo(weakSelf.bgView.mas_bottom).offset(-24);
  132. }];
  133. [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.leading.equalTo(weakSelf.bgView.mas_leading).offset(0);
  135. make.trailing.equalTo(weakSelf.bgView.mas_trailing).offset(0);
  136. make.bottom.equalTo(weakSelf.bgView.mas_bottom).offset(0);
  137. make.height.mas_equalTo(1);
  138. }];
  139. }
  140. #pragma mark - setter&getter
  141. - (UIView *)bgView {
  142. if (_bgView == nil)
  143. {
  144. _bgView = [[UIView alloc]init];
  145. _bgView.backgroundColor = [UIColor whiteColor];
  146. _bgView.layer.cornerRadius = 5;
  147. _bgView.layer.masksToBounds = YES;
  148. _bgView.clipsToBounds = YES;
  149. }
  150. return _bgView;
  151. }
  152. - (UIButton *)blueView {
  153. if (_blueView == nil)
  154. {
  155. _blueView = [[UIButton alloc]init];
  156. [_blueView az_setGradientBackgroundWithColors:@[[UIColor colorFromHexString:@"219BEE"],[UIColor colorFromHexString:@"2BB0F5"]] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  157. }
  158. return _blueView;
  159. }
  160. - (UIButton *)iconBtn {
  161. if (_iconBtn == nil)
  162. {
  163. _iconBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  164. [_iconBtn setTitle:@"求职意向" forState:UIControlStateNormal];
  165. [_iconBtn setImage:[UIImage imageNamed:@"b_message_white"] forState:UIControlStateNormal];
  166. [_iconBtn layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:5];
  167. _iconBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  168. }
  169. return _iconBtn;
  170. }
  171. - (UILabel *)positionTitleLabel {
  172. if (_positionTitleLabel == nil)
  173. {
  174. _positionTitleLabel = [[UILabel alloc]init];
  175. _positionTitleLabel.text = @"期望岗位:";
  176. _positionTitleLabel.font = [UIFont systemFontOfSize:12];
  177. _positionTitleLabel.textColor = COLOR_BACK6;
  178. }
  179. return _positionTitleLabel;
  180. }
  181. - (UILabel *)positionLabel {
  182. if (_positionLabel == nil)
  183. {
  184. _positionLabel = [[UILabel alloc]init];
  185. _positionLabel.font = [UIFont systemFontOfSize:12];
  186. _positionLabel.textColor = COLOR_BACK6;
  187. _positionLabel.numberOfLines = 0;
  188. }
  189. return _positionLabel;
  190. }
  191. - (UILabel *)addressTitleLabel {
  192. if (_addressTitleLabel == nil)
  193. {
  194. _addressTitleLabel = [[UILabel alloc]init];
  195. _addressTitleLabel.text = @"期望地点:";
  196. _addressTitleLabel.font = [UIFont systemFontOfSize:12];
  197. _addressTitleLabel.textColor = COLOR_BACK6;
  198. }
  199. return _addressTitleLabel;
  200. }
  201. - (UILabel *)addressLabel {
  202. if (_addressLabel == nil)
  203. {
  204. _addressLabel = [[UILabel alloc]init];
  205. _addressLabel.font = [UIFont systemFontOfSize:12];
  206. _addressLabel.textColor = COLOR_BACK6;
  207. _addressLabel.numberOfLines = 0;
  208. }
  209. return _addressLabel;
  210. }
  211. - (UILabel *)salaryTitleLabel {
  212. if (_salaryTitleLabel == nil)
  213. {
  214. _salaryTitleLabel = [[UILabel alloc]init];
  215. _salaryTitleLabel.text = @"期望薪资:";
  216. _salaryTitleLabel.font = [UIFont systemFontOfSize:12];
  217. _salaryTitleLabel.textColor = COLOR_BACK6;
  218. }
  219. return _salaryTitleLabel;
  220. }
  221. - (UILabel *)salaryLabel {
  222. if (_salaryLabel == nil)
  223. {
  224. _salaryLabel = [[UILabel alloc]init];
  225. _salaryLabel.font = [UIFont systemFontOfSize:12];
  226. _salaryLabel.textColor = COLOR_BACK6;
  227. _salaryLabel.numberOfLines = 0;
  228. }
  229. return _salaryLabel;
  230. }
  231. - (UIView *)lineView {
  232. if (_lineView== nil)
  233. {
  234. _lineView = [[UIView alloc]init];
  235. _lineView.backgroundColor = COLOR_BACKE;
  236. }
  237. return _lineView;
  238. }
  239. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  240. [super setSelected:selected animated:animated];
  241. // Configure the view for the selected state
  242. }
  243. @end